Browse Source

test: CY quick-test suite phase-1: schema, data types, form verification

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/3384/head
Raju Udava 2 years ago
parent
commit
22ee9a51d7
  1. 168
      scripts/cypress-v2/integration/common/9a_QuickTest.js

168
scripts/cypress-v2/integration/common/9a_QuickTest.js

@ -86,20 +86,35 @@ export const genTest = (apiType, dbType, testMode) => {
loginPage.signIn(roles.owner.credentials); loginPage.signIn(roles.owner.credentials);
projectsPage.openProject("sample"); 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(() => {}); after(() => {});
it("Verify Schema", () => { it("Verify Schema", () => {
cy.openTableTab("Film", 3) cy.openTableTab("Film", 3)
// verify if all tables exist // verify if all tables exist
for(let i=0; i<tn.length; i++) for(let i=0; i<tn.length; i++) {
cy.get(".nc-project-tree").contains(tn[i]).should('exist') cy.get(`.nc-project-tree-tbl-${tn[i]}`).should('exist')
}
// for Film table, verify columns // for Film table, verify columns
for(let i=0; i<columnCount; i++) for(let i=0; i<columnCount; i++) {
cy.get(".nc-grid-header-row").find(`[data-col="${cn[i]}"]`).should('exist') cy.get(`th[data-title="${cn[i]}"]`).should("exist");
}
}); });
@ -114,20 +129,22 @@ export const genTest = (apiType, dbType, testMode) => {
// checkbox // checkbox
mainPage mainPage
.getCell("Done", cellIdx) .getCell("Done", cellIdx)
.find(".mdi-check-circle-outline") .find(".nc-cell-hover-show")
.should(records2.Done ? "exist" : "not.exist"); .should(records2.Done ? "not.exist" : "exist");
// date // date
// duration // duration
mainPage.getCell("Duration", cellIdx).find('input').then(($e) => { // mainPage.getCell("Duration", cellIdx).find('input').then(($e) => {
expect($e[0].value).to.equal(records2.Duration) // expect($e[0].value).to.equal(records2.Duration)
}) // })
mainPage.getCell("Duration", cellIdx).contains(records2.Duration).should("exist");
// rating // rating
mainPage mainPage
.getCell("Rating", cellIdx) .getCell("Rating", cellIdx)
.find("button.mdi-star") .find(".ant-rate-star-full")
.should("have.length", records2.Rating); .should("have.length", records2.Rating);
// verifying only one instance as its different for PG & SQLite // verifying only one instance as its different for PG & SQLite
@ -136,10 +153,11 @@ export const genTest = (apiType, dbType, testMode) => {
// LinkToAnotherRecord // LinkToAnotherRecord
mainPage.getCell("Actor", cellIdx).scrollIntoView(); mainPage.getCell("Actor", cellIdx).scrollIntoView();
cy.get( 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]) .contains(records2.Actor[0])
.should("exist"); .should("exist");
// cy.get( // cy.get(
// `:nth-child(${cellIdx}) > [data-col="Actor"] > .nc-virtual-cell > .v-lazy > .d-100 > .chips > :nth-child(2) > .v-chip__content > .name` // `: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 // lookup
mainPage.getCell("Status (from Actor)", cellIdx).scrollIntoView(); mainPage.getCell("Status (from Actor)", cellIdx).scrollIntoView();
cy.get( // 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` // `: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]) .contains(records2["Status (from Actor)"][0])
.should("exist"); .should("exist");
// cy.get( // cy.get(
@ -163,30 +184,34 @@ export const genTest = (apiType, dbType, testMode) => {
if( testMode === 'CY_QUICK') { if( testMode === 'CY_QUICK') {
mainPage.getCell("RollUp", cellIdx).scrollIntoView(); mainPage.getCell("RollUp", cellIdx).scrollIntoView();
cy.get(`:nth-child(${cellIdx}) > [data-col="RollUp"] > .nc-virtual-cell`) mainPage.getCell("RollUp", cellIdx).contains(records2.RollUp).should("exist");
.contains(records2.RollUp) // cy.get(`:nth-child(${cellIdx}) > [data-title="RollUp"] > .nc-virtual-cell`)
.should("exist"); // .contains(records2.RollUp)
// .should("exist");
// formula // formula
mainPage.getCell("Computation", cellIdx).scrollIntoView(); mainPage.getCell("Computation", cellIdx).scrollIntoView();
cy.get( mainPage.getCell("Computation", cellIdx).contains(records2.Computation).should("exist");
`:nth-child(${cellIdx}) > [data-col="Computation"] > .nc-virtual-cell` // cy.get(
) // `:nth-child(${cellIdx}) > [data-title="Computation"] > .nc-virtual-cell`
.contains(records2.Computation) // )
.should("exist"); // .contains(records2.Computation)
// .should("exist");
// ltar hm relation // ltar hm relation
mainPage.getCell("Producer", cellIdx).scrollIntoView(); mainPage.getCell("Producer", cellIdx).scrollIntoView();
cy.get( mainPage.getCell("Producer", cellIdx).find('.chip').eq(0).contains(records2.Producer[0]).should('exist')
`:nth-child(${cellIdx}) > [data-col="Producer"] > .nc-virtual-cell > .v-lazy > .d-100 > .chips > :nth-child(1) > .v-chip__content > .name` mainPage.getCell("Producer", cellIdx).find('.chip').eq(1).contains(records2.Producer[1]).should('exist')
) // cy.get(
.contains(records2.Producer[0]) // `:nth-child(${cellIdx}) > [data-title="Producer"] > .nc-virtual-cell > .v-lazy > .d-100 > .chips > :nth-child(1) > .v-chip__content > .name`
.should("exist"); // )
cy.get( // .contains(records2.Producer[0])
`:nth-child(${cellIdx}) > [data-col="Producer"] > .nc-virtual-cell > .v-lazy > .d-100 > .chips > :nth-child(2) > .v-chip__content > .name` // .should("exist");
) // cy.get(
.contains(records2.Producer[1]) // `:nth-child(${cellIdx}) > [data-title="Producer"] > .nc-virtual-cell > .v-lazy > .d-100 > .chips > :nth-child(2) > .v-chip__content > .name`
.should("exist"); // )
// .contains(records2.Producer[1])
// .should("exist");
} }
cy.closeTableTab("Film"); cy.closeTableTab("Film");
@ -194,55 +219,78 @@ export const genTest = (apiType, dbType, testMode) => {
it("Verify Views & Shared base", () => { it("Verify Views & Shared base", () => {
cy.openTableTab("Film", 3); cy.openTableTab("Film", 3);
mainPage.toggleRightSidebar();
cy.get('.nc-form-view-item').eq(0) cy.get('.nc-form-view-item').eq(0)
.click({ force: true }) .click({ force: true })
// Header & description should exist // 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") cy.get(".nc-form")
.find('[placeholder="Form Title"]') .find('[placeholder="Form Title"]')
.contains("FormTitle") .should("exist").then(($el) => {
.should("exist"); cy.log($el)
expect($el.val()).to.equal("FormTitle");
})
cy.get(".nc-form") cy.get(".nc-form")
.find('[placeholder="Add form description"]') .find('[placeholder="Add form description"]')
.contains("FormDescription") .should("exist").then(($el) => {
.should("exist"); cy.log($el)
expect($el.val()).to.equal("FormDescription");
})
// modified column name & help text // modified column name & help text
cy.get(".nc-field-wrapper").eq(0) cy.get(".nc-editable").eq(0)
.find('.nc-field-labels') .find('.name')
.contains("DisplayName") .contains("DisplayName")
.should('exist') .should('exist')
cy.get(".nc-field-wrapper").eq(0) cy.get(".nc-editable").eq(0)
.find('.nc-hint') .find('.text-gray-500')
.contains('HelpText') .contains('HelpText')
.should('exist') .should('exist')
cy.get(".nc-field-wrapper").eq(1) cy.get(".nc-editable").eq(1)
.find('.nc-field-labels') .find('.name')
.contains("Email") .contains("Email")
.should('exist') .should('exist')
// add message // add message
cy.get(".nc-form > .mx-auto") cy.get("textarea.nc-form-after-submit-msg").then(($element) => {
.find("textarea").then(($element) => {
expect($element[0].value).to.have.string("Thank you for submitting the form!") expect($element[0].value).to.have.string("Thank you for submitting the form!")
}) })
// cy.get(".nc-form > .mx-auto")
// submit another form button // .find("textarea").then(($element) => {
cy.get(".nc-form > .mx-auto") // expect($element[0].value).to.have.string("Thank you for submitting the form!")
.find('[type="checkbox"]') // })
.eq(0)
.should('be.checked') cy.get("button.nc-form-checkbox-submit-another-form.ant-switch-checked").should('exist')
// "New form after 5 seconds" button cy.get("button.nc-form-checkbox-show-blank-form.ant-switch-checked").should('exist')
cy.get(".nc-form > .mx-auto") cy.get("button.nc-form-checkbox-send-email.ant-switch-checked").should('not.exist')
.find('[type="checkbox"]')
.eq(1) // // submit another form button
.should('be.checked') // cy.get(".nc-form > .mx-auto")
// email me // .find('[type="checkbox"]')
cy.get(".nc-form > .mx-auto") // .eq(0)
.find('[type="checkbox"]') // .should('be.checked')
.eq(2) // // "New form after 5 seconds" button
.should('not.be.checked') // 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"); cy.closeTableTab("Film");
}); });

Loading…
Cancel
Save