From 96d174909ac5da8da17a4c3b42a0f8d37cc6d57e Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Wed, 21 Sep 2022 12:22:15 +0530 Subject: [PATCH] test: stability- wait for edit dialog to re-render on click Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- .../common/1b_table_column_operations.js | 2 +- .../integration/common/3c_lookup_column.js | 238 ++++++------- .../integration/common/3d_rollup_column.js | 314 +++++++++--------- 3 files changed, 277 insertions(+), 277 deletions(-) diff --git a/scripts/cypress/integration/common/1b_table_column_operations.js b/scripts/cypress/integration/common/1b_table_column_operations.js index 3bf53f7153..160f7c0d16 100644 --- a/scripts/cypress/integration/common/1b_table_column_operations.js +++ b/scripts/cypress/integration/common/1b_table_column_operations.js @@ -73,7 +73,7 @@ export const genTest = (apiType, dbType) => { .click(); // fix me! wait till the modal rendering (input highlight) is completed - cy.wait(1000); + cy.wait(500); // change column type and verify // cy.get(".nc-column-type-input").last().click(); diff --git a/scripts/cypress/integration/common/3c_lookup_column.js b/scripts/cypress/integration/common/3c_lookup_column.js index 6db00e01c4..1f79fcce79 100644 --- a/scripts/cypress/integration/common/3c_lookup_column.js +++ b/scripts/cypress/integration/common/3c_lookup_column.js @@ -2,126 +2,126 @@ import { mainPage } from "../../support/page_objects/mainPage"; import { isTestSuiteActive } from "../../support/page_objects/projectConstants"; export const genTest = (apiType, dbType) => { - if (!isTestSuiteActive(apiType, dbType)) return; - - describe(`${apiType.toUpperCase()} api - LookUp column`, () => { - // to retrieve few v-input nodes from their label - // - const fetchParentFromLabel = (label) => { - cy.get("label").contains(label).parents(".ant-row").click(); - }; - - // Run once before test- create project (rest/graphql) - // - // before(() => { - // cy.fileHook(); - // mainPage.tabReset(); - // // open a table to work on views - // // - // - // // // kludge: wait for page load to finish - // // cy.wait(1000); - // // // close team & auth tab - // // cy.get('button.ant-tabs-tab-remove').should('exist').click(); - // // cy.wait(1000); - // - // cy.openTableTab("City", 25); - // }); - - beforeEach(() => { - cy.restoreLocalStorage(); - }); - - afterEach(() => { - cy.saveLocalStorage(); - }) - - // after(() => { - // cy.closeTableTab("City"); - // }); - - // Routine to create a new look up column - // - const addLookUpColumn = (childTable, childCol) => { - - cy.get(".nc-grid tr > th:last .nc-icon").click({ - force: true, - }); - - cy.getActiveMenu(".nc-dropdown-grid-add-column") - .find('input.nc-column-name-input') - .should('exist') - .clear() - .type(childCol); - // cy.get(".nc-column-type-input").last().click().type("Lookup"); - cy.getActiveMenu('.nc-dropdown-grid-add-column') - .find(".nc-column-type-input") - .last() - .click() - .type("Lookup"); - cy.getActiveSelection('.nc-dropdown-column-type') - .find('.ant-select-item-option') - .contains("Lookup") - .click(); - - // Configure Child table & column names - fetchParentFromLabel("Child table"); - cy.getActiveSelection('.nc-dropdown-relation-table') - .find('.ant-select-item-option') - .contains(childTable) - .click(); - - fetchParentFromLabel("Child column"); - cy.getActiveSelection('.nc-dropdown-relation-column') - .find('.ant-select-item-option') - .contains(childCol) - .click(); - - // cy.get(".ant-btn-primary").contains("Save").should('exist').click(); - cy.getActiveMenu('.nc-dropdown-grid-add-column') - .find(".ant-btn-primary:visible") - .contains("Save") - .click(); - cy.toastWait(`Column created`); - - cy.get(`th[data-title="${childCol}"]`).should("exist"); - }; - - // routine to delete column - // - const deleteColumnByName = (childCol) => { - mainPage.deleteColumn(childCol); - }; - - /////////////////////////////////////////////////// - // Test case - - it("Add Lookup column (Address, PostalCode) & Delete", () => { - cy.openTableTab("City", 25); - - addLookUpColumn("Address", "PostalCode"); - - // Verify first entry, will be displayed as alias here 'childColumn (from childTable)' - mainPage.getCell("PostalCode", 1) - .contains("4166") - .should("exist"); - - deleteColumnByName("PostalCode"); - - cy.closeTableTab("City"); - }); - - it.skip("Add Lookup column (Country, CountryId) & Delete", () => { - addLookUpColumn("Country", "CountryId"); - - // Verify first entry, will be displayed as alias here 'childColumn (from childTable)' - cy.get(`tbody > :nth-child(1) > [data-col="CountryId"]`) - .contains("87") - .should("exist"); - - deleteColumnByName("CountryId"); - }); + if (!isTestSuiteActive(apiType, dbType)) return; + + describe(`${apiType.toUpperCase()} api - LookUp column`, () => { + // to retrieve few v-input nodes from their label + // + const fetchParentFromLabel = (label) => { + cy.get("label").contains(label).parents(".ant-row").click(); + }; + + // Run once before test- create project (rest/graphql) + // + // before(() => { + // cy.fileHook(); + // mainPage.tabReset(); + // // open a table to work on views + // // + // + // // // kludge: wait for page load to finish + // // cy.wait(1000); + // // // close team & auth tab + // // cy.get('button.ant-tabs-tab-remove').should('exist').click(); + // // cy.wait(1000); + // + // cy.openTableTab("City", 25); + // }); + + beforeEach(() => { + cy.restoreLocalStorage(); }); + + afterEach(() => { + cy.saveLocalStorage(); + }); + + // after(() => { + // cy.closeTableTab("City"); + // }); + + // Routine to create a new look up column + // + const addLookUpColumn = (childTable, childCol) => { + cy.get(".nc-grid tr > th:last .nc-icon").click({ + force: true, + }); + + cy.getActiveMenu(".nc-dropdown-grid-add-column") + .find("input.nc-column-name-input") + .should("exist") + .clear() + .type(childCol); + // cy.get(".nc-column-type-input").last().click().type("Lookup"); + cy.getActiveMenu(".nc-dropdown-grid-add-column") + .find(".nc-column-type-input") + .last() + .click() + .type("Lookup"); + cy.getActiveSelection(".nc-dropdown-column-type") + .find(".ant-select-item-option") + .contains("Lookup") + .click(); + + // wait for re-rendering & title selection to re-appear + cy.wait(500); + + // Configure Child table & column names + fetchParentFromLabel("Child table"); + cy.getActiveSelection(".nc-dropdown-relation-table") + .find(".ant-select-item-option") + .contains(childTable) + .click(); + + fetchParentFromLabel("Child column"); + cy.getActiveSelection(".nc-dropdown-relation-column") + .find(".ant-select-item-option") + .contains(childCol) + .click(); + + // cy.get(".ant-btn-primary").contains("Save").should('exist').click(); + cy.getActiveMenu(".nc-dropdown-grid-add-column") + .find(".ant-btn-primary:visible") + .contains("Save") + .click(); + cy.toastWait(`Column created`); + + cy.get(`th[data-title="${childCol}"]`).should("exist"); + }; + + // routine to delete column + // + const deleteColumnByName = (childCol) => { + mainPage.deleteColumn(childCol); + }; + + /////////////////////////////////////////////////// + // Test case + + it("Add Lookup column (Address, PostalCode) & Delete", () => { + cy.openTableTab("City", 25); + + addLookUpColumn("Address", "PostalCode"); + + // Verify first entry, will be displayed as alias here 'childColumn (from childTable)' + mainPage.getCell("PostalCode", 1).contains("4166").should("exist"); + + deleteColumnByName("PostalCode"); + + cy.closeTableTab("City"); + }); + + it.skip("Add Lookup column (Country, CountryId) & Delete", () => { + addLookUpColumn("Country", "CountryId"); + + // Verify first entry, will be displayed as alias here 'childColumn (from childTable)' + cy.get(`tbody > :nth-child(1) > [data-col="CountryId"]`) + .contains("87") + .should("exist"); + + deleteColumnByName("CountryId"); + }); + }); }; /** diff --git a/scripts/cypress/integration/common/3d_rollup_column.js b/scripts/cypress/integration/common/3d_rollup_column.js index 7446611c9d..4491a01553 100644 --- a/scripts/cypress/integration/common/3d_rollup_column.js +++ b/scripts/cypress/integration/common/3d_rollup_column.js @@ -2,164 +2,164 @@ import { mainPage } from "../../support/page_objects/mainPage"; import { isTestSuiteActive } from "../../support/page_objects/projectConstants"; export const genTest = (apiType, dbType) => { - if (!isTestSuiteActive(apiType, dbType)) return; - - describe(`${apiType.toUpperCase()} api - RollUp column`, () => { - // to retrieve few v-input nodes from their label - // - const fetchParentFromLabel = (label) => { - cy.get("label").contains(label).parents(".ant-row").click(); - cy.wait(500); - }; - - // Run once before test- create project (rest/graphql) - // - // before(() => { - // cy.fileHook(); - // mainPage.tabReset(); - // - // // // kludge: wait for page load to finish - // // cy.wait(1000); - // // // close team & auth tab - // // cy.get('button.ant-tabs-tab-remove').should('exist').click(); - // // cy.wait(1000); - // - // // open a table to work on views - // // - // cy.openTableTab("Country", 25); - // }); - - beforeEach(() => { - cy.restoreLocalStorage(); - }) - - afterEach(() => { - cy.saveLocalStorage(); - }) - - // after(() => { - // cy.closeTableTab("Country"); - // }); - - // Routine to create a new look up column - // - const addRollUpColumn = ( - columnName, - childTable, - childCol, - aggregateFunc - ) => { - - cy.get(".nc-grid tr > th:last .nc-icon").click({ - force: true, - }); - - cy.getActiveMenu(".nc-dropdown-grid-add-column") - .find('input.nc-column-name-input') - .should('exist') - .clear() - .type(columnName); - // cy.get(".nc-column-type-input").last().click().type("RollUp"); - cy.getActiveMenu('.nc-dropdown-grid-add-column') - .find(".nc-column-type-input") - .last() - .click() - .type("RollUp") - cy.getActiveSelection('.nc-dropdown-column-type') - .find('.ant-select-item-option') - .contains("Rollup") - .click(); - - // Configure Child table & column names - fetchParentFromLabel("Child table"); - cy.getActiveSelection('.nc-dropdown-relation-table') - .find('.ant-select-item-option') - .contains(childTable) - .click(); - - fetchParentFromLabel("Child column"); - cy.getActiveSelection('.nc-dropdown-relation-column') - .find('.ant-select-item-option') - .contains(childCol) - .click(); - - fetchParentFromLabel("Aggregate function"); - cy.getActiveSelection('.nc-dropdown-rollup-function') - .find('.ant-select-item-option') - .contains(aggregateFunc) - .click(); - - // cy.get(".ant-btn-primary").contains("Save").should('exist').click(); - cy.getActiveMenu('.nc-dropdown-grid-add-column') - .find(".ant-btn-primary:visible") - .contains("Save") - .click(); - cy.toastWait(`Column created`); - - cy.get(`th[data-title="${columnName}"]`).should("exist"); - }; - - // routine to delete column - // - const deleteColumnByName = (columnName) => { - mainPage.deleteColumn(columnName); - }; - - // routine to edit column - // - // const editColumnByName = (oldName, newName) => { - // // verify if column exists before delete - // cy.get(`th:contains(${oldName})`).should("exist"); - // - // // delete opiton visible on mouse-over - // cy.get(`th:contains(${oldName}) .mdi-menu-down`) - // .trigger("mouseover") - // .click(); - // - // // edit/ save on pop-up - // cy.get(".nc-column-edit").click(); - // cy.get(".nc-column-name-input input").clear().type(newName); - // cy.get(".nc-col-create-or-edit-card").contains("Save").click(); - // - // cy.toastWait("Successfully updated alias"); - // - // // validate if deleted (column shouldnt exist) - // cy.get(`th:contains(${oldName})`).should("not.exist"); - // cy.get(`th:contains(${newName})`).should("exist"); - // }; - - /////////////////////////////////////////////////// - // Test case - - it("Add Rollup column (City, City, count) & Delete", () => { - cy.openTableTab("Country", 25); - - addRollUpColumn("RollUpCol", "City", "City", "count"); - - // Verify first entry, will be displayed as alias here 'childColumn (from childTable)' - // intentionally verifying 4th item, as initial items are being masked out by list scroll down - mainPage.getCell("RollUpCol", 4) - .contains("2") - .should("exist"); - - // editColumnByName("RollUpCol_2", "RollUpCol_New"); - deleteColumnByName("RollUpCol"); - - cy.closeTableTab("Country"); - }); - - it.skip("Add Rollup column (City, CountryId, count) & Delete", () => { - addRollUpColumn("RollUpCol_1", "City", "CountryId", "count"); - - // Verify first entry, will be displayed as alias here 'childColumn (from childTable)' - cy.get(`tbody > :nth-child(4) > [data-col="RollUpCol_1"]`) - .contains("2") - .should("exist"); - - // editColumnByName("RollUpCol_1", "RollUpCol_New"); - deleteColumnByName("RollUpCol_New"); - }); + if (!isTestSuiteActive(apiType, dbType)) return; + + describe(`${apiType.toUpperCase()} api - RollUp column`, () => { + // to retrieve few v-input nodes from their label + // + const fetchParentFromLabel = (label) => { + cy.get("label").contains(label).parents(".ant-row").click(); + cy.wait(500); + }; + + // Run once before test- create project (rest/graphql) + // + // before(() => { + // cy.fileHook(); + // mainPage.tabReset(); + // + // // // kludge: wait for page load to finish + // // cy.wait(1000); + // // // close team & auth tab + // // cy.get('button.ant-tabs-tab-remove').should('exist').click(); + // // cy.wait(1000); + // + // // open a table to work on views + // // + // cy.openTableTab("Country", 25); + // }); + + beforeEach(() => { + cy.restoreLocalStorage(); }); + + afterEach(() => { + cy.saveLocalStorage(); + }); + + // after(() => { + // cy.closeTableTab("Country"); + // }); + + // Routine to create a new look up column + // + const addRollUpColumn = ( + columnName, + childTable, + childCol, + aggregateFunc + ) => { + cy.get(".nc-grid tr > th:last .nc-icon").click({ + force: true, + }); + + cy.getActiveMenu(".nc-dropdown-grid-add-column") + .find("input.nc-column-name-input") + .should("exist") + .clear() + .type(columnName); + // cy.get(".nc-column-type-input").last().click().type("RollUp"); + cy.getActiveMenu(".nc-dropdown-grid-add-column") + .find(".nc-column-type-input") + .last() + .click() + .type("RollUp"); + cy.getActiveSelection(".nc-dropdown-column-type") + .find(".ant-select-item-option") + .contains("Rollup") + .click(); + + // wait for re-rendering & title selection to re-appear + cy.wait(500); + + // Configure Child table & column names + fetchParentFromLabel("Child table"); + cy.getActiveSelection(".nc-dropdown-relation-table") + .find(".ant-select-item-option") + .contains(childTable) + .click(); + + fetchParentFromLabel("Child column"); + cy.getActiveSelection(".nc-dropdown-relation-column") + .find(".ant-select-item-option") + .contains(childCol) + .click(); + + fetchParentFromLabel("Aggregate function"); + cy.getActiveSelection(".nc-dropdown-rollup-function") + .find(".ant-select-item-option") + .contains(aggregateFunc) + .click(); + + // cy.get(".ant-btn-primary").contains("Save").should('exist').click(); + cy.getActiveMenu(".nc-dropdown-grid-add-column") + .find(".ant-btn-primary:visible") + .contains("Save") + .click(); + cy.toastWait(`Column created`); + + cy.get(`th[data-title="${columnName}"]`).should("exist"); + }; + + // routine to delete column + // + const deleteColumnByName = (columnName) => { + mainPage.deleteColumn(columnName); + }; + + // routine to edit column + // + // const editColumnByName = (oldName, newName) => { + // // verify if column exists before delete + // cy.get(`th:contains(${oldName})`).should("exist"); + // + // // delete opiton visible on mouse-over + // cy.get(`th:contains(${oldName}) .mdi-menu-down`) + // .trigger("mouseover") + // .click(); + // + // // edit/ save on pop-up + // cy.get(".nc-column-edit").click(); + // cy.get(".nc-column-name-input input").clear().type(newName); + // cy.get(".nc-col-create-or-edit-card").contains("Save").click(); + // + // cy.toastWait("Successfully updated alias"); + // + // // validate if deleted (column shouldnt exist) + // cy.get(`th:contains(${oldName})`).should("not.exist"); + // cy.get(`th:contains(${newName})`).should("exist"); + // }; + + /////////////////////////////////////////////////// + // Test case + + it("Add Rollup column (City, City, count) & Delete", () => { + cy.openTableTab("Country", 25); + + addRollUpColumn("RollUpCol", "City", "City", "count"); + + // Verify first entry, will be displayed as alias here 'childColumn (from childTable)' + // intentionally verifying 4th item, as initial items are being masked out by list scroll down + mainPage.getCell("RollUpCol", 4).contains("2").should("exist"); + + // editColumnByName("RollUpCol_2", "RollUpCol_New"); + deleteColumnByName("RollUpCol"); + + cy.closeTableTab("Country"); + }); + + it.skip("Add Rollup column (City, CountryId, count) & Delete", () => { + addRollUpColumn("RollUpCol_1", "City", "CountryId", "count"); + + // Verify first entry, will be displayed as alias here 'childColumn (from childTable)' + cy.get(`tbody > :nth-child(4) > [data-col="RollUpCol_1"]`) + .contains("2") + .should("exist"); + + // editColumnByName("RollUpCol_1", "RollUpCol_New"); + deleteColumnByName("RollUpCol_New"); + }); + }); }; /**