From 22ee9a51d7d92da636bc4cbad6fd03cd44bbd863 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Sun, 28 Aug 2022 19:31:19 +0530 Subject: [PATCH] test: CY quick-test suite phase-1: schema, data types, form verification Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- .../integration/common/9a_QuickTest.js | 176 +++++++++++------- 1 file changed, 112 insertions(+), 64 deletions(-) diff --git a/scripts/cypress-v2/integration/common/9a_QuickTest.js b/scripts/cypress-v2/integration/common/9a_QuickTest.js index fd0aee71be..d574447009 100644 --- a/scripts/cypress-v2/integration/common/9a_QuickTest.js +++ b/scripts/cypress-v2/integration/common/9a_QuickTest.js @@ -86,20 +86,35 @@ export const genTest = (apiType, dbType, testMode) => { loginPage.signIn(roles.owner.credentials); projectsPage.openProject("sample"); } + + // kludge: wait for page load to finish + cy.wait(2000); + // close team & auth tab + cy.get('button.ant-tabs-tab-remove').should('exist').click(); + cy.wait(1000); + + cy.saveLocalStorage(); + }); + beforeEach(() => { + cy.restoreLocalStorage(); + }) + after(() => {}); it("Verify Schema", () => { cy.openTableTab("Film", 3) // verify if all tables exist - for(let i=0; i { // checkbox mainPage .getCell("Done", cellIdx) - .find(".mdi-check-circle-outline") - .should(records2.Done ? "exist" : "not.exist"); + .find(".nc-cell-hover-show") + .should(records2.Done ? "not.exist" : "exist"); // date // duration - mainPage.getCell("Duration", cellIdx).find('input').then(($e) => { - expect($e[0].value).to.equal(records2.Duration) - }) + // mainPage.getCell("Duration", cellIdx).find('input').then(($e) => { + // expect($e[0].value).to.equal(records2.Duration) + // }) + + mainPage.getCell("Duration", cellIdx).contains(records2.Duration).should("exist"); // rating mainPage .getCell("Rating", cellIdx) - .find("button.mdi-star") + .find(".ant-rate-star-full") .should("have.length", records2.Rating); // verifying only one instance as its different for PG & SQLite @@ -136,10 +153,11 @@ export const genTest = (apiType, dbType, testMode) => { // LinkToAnotherRecord mainPage.getCell("Actor", cellIdx).scrollIntoView(); cy.get( - `:nth-child(${cellIdx}) > [data-col="Actor"] > .nc-virtual-cell > .v-lazy > .d-100 > .chips > :nth-child(1) > .v-chip__content > .name` + `[data-title="Actor"] > :nth-child(${cellIdx}) > .nc-virtual-cell > .w-full > .chips > :nth-child(1) > .name` ) .contains(records2.Actor[0]) .should("exist"); + // cy.get( // `:nth-child(${cellIdx}) > [data-col="Actor"] > .nc-virtual-cell > .v-lazy > .d-100 > .chips > :nth-child(2) > .v-chip__content > .name` // ) @@ -148,9 +166,12 @@ export const genTest = (apiType, dbType, testMode) => { // lookup mainPage.getCell("Status (from Actor)", cellIdx).scrollIntoView(); - cy.get( - `:nth-child(${cellIdx}) > [data-col="Status (from Actor)"] > .nc-virtual-cell > .v-lazy > .d-flex > :nth-child(1) > .v-chip__content > div > .set-item` - ) + // cy.get( + // `:nth-child(${cellIdx}) > [data-col="Status (from Actor)"] > .nc-virtual-cell > .v-lazy > .d-flex > :nth-child(1) > .v-chip__content > div > .set-item` + // ) + // .contains(records2["Status (from Actor)"][0]) + // .should("exist"); + cy.get(`[data-title="Status (from Actor)"] > :nth-child(${cellIdx}) > .nc-virtual-cell > .flex > :nth-child(1) > .nc-cell > .ant-select > .ant-select-selector > .ant-select-selection-item > .ant-tag`) .contains(records2["Status (from Actor)"][0]) .should("exist"); // cy.get( @@ -163,30 +184,34 @@ export const genTest = (apiType, dbType, testMode) => { if( testMode === 'CY_QUICK') { mainPage.getCell("RollUp", cellIdx).scrollIntoView(); - cy.get(`:nth-child(${cellIdx}) > [data-col="RollUp"] > .nc-virtual-cell`) - .contains(records2.RollUp) - .should("exist"); + mainPage.getCell("RollUp", cellIdx).contains(records2.RollUp).should("exist"); + // cy.get(`:nth-child(${cellIdx}) > [data-title="RollUp"] > .nc-virtual-cell`) + // .contains(records2.RollUp) + // .should("exist"); // formula mainPage.getCell("Computation", cellIdx).scrollIntoView(); - cy.get( - `:nth-child(${cellIdx}) > [data-col="Computation"] > .nc-virtual-cell` - ) - .contains(records2.Computation) - .should("exist"); + mainPage.getCell("Computation", cellIdx).contains(records2.Computation).should("exist"); + // cy.get( + // `:nth-child(${cellIdx}) > [data-title="Computation"] > .nc-virtual-cell` + // ) + // .contains(records2.Computation) + // .should("exist"); // ltar hm relation mainPage.getCell("Producer", cellIdx).scrollIntoView(); - cy.get( - `:nth-child(${cellIdx}) > [data-col="Producer"] > .nc-virtual-cell > .v-lazy > .d-100 > .chips > :nth-child(1) > .v-chip__content > .name` - ) - .contains(records2.Producer[0]) - .should("exist"); - cy.get( - `:nth-child(${cellIdx}) > [data-col="Producer"] > .nc-virtual-cell > .v-lazy > .d-100 > .chips > :nth-child(2) > .v-chip__content > .name` - ) - .contains(records2.Producer[1]) - .should("exist"); + mainPage.getCell("Producer", cellIdx).find('.chip').eq(0).contains(records2.Producer[0]).should('exist') + mainPage.getCell("Producer", cellIdx).find('.chip').eq(1).contains(records2.Producer[1]).should('exist') + // cy.get( + // `:nth-child(${cellIdx}) > [data-title="Producer"] > .nc-virtual-cell > .v-lazy > .d-100 > .chips > :nth-child(1) > .v-chip__content > .name` + // ) + // .contains(records2.Producer[0]) + // .should("exist"); + // cy.get( + // `:nth-child(${cellIdx}) > [data-title="Producer"] > .nc-virtual-cell > .v-lazy > .d-100 > .chips > :nth-child(2) > .v-chip__content > .name` + // ) + // .contains(records2.Producer[1]) + // .should("exist"); } cy.closeTableTab("Film"); @@ -194,55 +219,78 @@ export const genTest = (apiType, dbType, testMode) => { it("Verify Views & Shared base", () => { cy.openTableTab("Film", 3); + mainPage.toggleRightSidebar(); cy.get('.nc-form-view-item').eq(0) .click({ force: true }) // Header & description should exist + // cy.get(".nc-form") + // .find('[placeholder="Form Title"]') + // .contains("FormTitle") + // .should("exist"); + // cy.get(".nc-form") + // .find('[placeholder="Add form description"]') + // .contains("FormDescription") + // .should("exist"); + + cy.get(".nc-form").should("exist"); + cy.get(".nc-form") - .find('[placeholder="Form Title"]') - .contains("FormTitle") - .should("exist"); + .find('[placeholder="Form Title"]') + .should("exist").then(($el) => { + cy.log($el) + expect($el.val()).to.equal("FormTitle"); + }) cy.get(".nc-form") - .find('[placeholder="Add form description"]') - .contains("FormDescription") - .should("exist"); + .find('[placeholder="Add form description"]') + .should("exist").then(($el) => { + cy.log($el) + expect($el.val()).to.equal("FormDescription"); + }) // modified column name & help text - cy.get(".nc-field-wrapper").eq(0) - .find('.nc-field-labels') + cy.get(".nc-editable").eq(0) + .find('.name') .contains("DisplayName") .should('exist') - cy.get(".nc-field-wrapper").eq(0) - .find('.nc-hint') + cy.get(".nc-editable").eq(0) + .find('.text-gray-500') .contains('HelpText') .should('exist') - cy.get(".nc-field-wrapper").eq(1) - .find('.nc-field-labels') + cy.get(".nc-editable").eq(1) + .find('.name') .contains("Email") .should('exist') // add message - cy.get(".nc-form > .mx-auto") - .find("textarea").then(($element) => { - expect($element[0].value).to.have.string("Thank you for submitting the form!") - }) - - // submit another form button - cy.get(".nc-form > .mx-auto") - .find('[type="checkbox"]') - .eq(0) - .should('be.checked') - // "New form after 5 seconds" button - cy.get(".nc-form > .mx-auto") - .find('[type="checkbox"]') - .eq(1) - .should('be.checked') - // email me - cy.get(".nc-form > .mx-auto") - .find('[type="checkbox"]') - .eq(2) - .should('not.be.checked') + cy.get("textarea.nc-form-after-submit-msg").then(($element) => { + expect($element[0].value).to.have.string("Thank you for submitting the form!") + }) + // cy.get(".nc-form > .mx-auto") + // .find("textarea").then(($element) => { + // expect($element[0].value).to.have.string("Thank you for submitting the form!") + // }) + + cy.get("button.nc-form-checkbox-submit-another-form.ant-switch-checked").should('exist') + cy.get("button.nc-form-checkbox-show-blank-form.ant-switch-checked").should('exist') + cy.get("button.nc-form-checkbox-send-email.ant-switch-checked").should('not.exist') + + // // submit another form button + // cy.get(".nc-form > .mx-auto") + // .find('[type="checkbox"]') + // .eq(0) + // .should('be.checked') + // // "New form after 5 seconds" button + // cy.get(".nc-form > .mx-auto") + // .find('[type="checkbox"]') + // .eq(1) + // .should('be.checked') + // // email me + // cy.get(".nc-form > .mx-auto") + // .find('[type="checkbox"]') + // .eq(2) + // .should('not.be.checked') cy.closeTableTab("Film"); });