From cafd0dd6b1611c4f7511481930992ce57220fedf Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Thu, 25 Aug 2022 11:49:19 +0530 Subject: [PATCH] test: CY formula, lookup, rollup, duration Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- .../integration/common/3b_formula_column.js | 11 +++++++-- .../integration/common/3c_lookup_column.js | 7 ++++++ .../integration/common/3d_rollup_column.js | 24 ++++++++++++------- .../integration/common/3e_duration_column.js | 24 +++++++++++++++---- 4 files changed, 51 insertions(+), 15 deletions(-) diff --git a/scripts/cypress-v2/integration/common/3b_formula_column.js b/scripts/cypress-v2/integration/common/3b_formula_column.js index bcd1e566a1..9074eaf8cd 100644 --- a/scripts/cypress-v2/integration/common/3b_formula_column.js +++ b/scripts/cypress-v2/integration/common/3b_formula_column.js @@ -15,6 +15,13 @@ export const genTest = (apiType, dbType) => { 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); }); @@ -88,9 +95,9 @@ export const genTest = (apiType, dbType) => { .clear() .type(newName); - cy.get('textarea.nc-formula-input').click().clear().type(newFormula); + cy.get('textarea.nc-formula-input').click().clear().type(newFormula, { parseSpecialCharSequences: false }); cy.get(".ant-btn-primary").contains("Save").should('exist').click(); - cy.toastWait(`Column created`); + // cy.toastWait(`Column created`); cy.get(`th[data-title="${oldName}"]`).should("not.exist"); cy.get(`th[data-title="${newName}"]`).should("exist"); }; diff --git a/scripts/cypress-v2/integration/common/3c_lookup_column.js b/scripts/cypress-v2/integration/common/3c_lookup_column.js index 746c612217..f46d7e25a5 100644 --- a/scripts/cypress-v2/integration/common/3c_lookup_column.js +++ b/scripts/cypress-v2/integration/common/3c_lookup_column.js @@ -18,6 +18,13 @@ export const genTest = (apiType, dbType) => { 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); }); diff --git a/scripts/cypress-v2/integration/common/3d_rollup_column.js b/scripts/cypress-v2/integration/common/3d_rollup_column.js index 6c20142888..39824601f7 100644 --- a/scripts/cypress-v2/integration/common/3d_rollup_column.js +++ b/scripts/cypress-v2/integration/common/3d_rollup_column.js @@ -9,6 +9,7 @@ export const genTest = (apiType, dbType) => { // const fetchParentFromLabel = (label) => { cy.get("label").contains(label).parents(".ant-row").click(); + cy.wait(500); }; // Run once before test- create project (rest/graphql) @@ -16,6 +17,13 @@ export const genTest = (apiType, dbType) => { 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); @@ -31,7 +39,7 @@ export const genTest = (apiType, dbType) => { // Routine to create a new look up column // - const addLookUpColumn = ( + const addRollUpColumn = ( columnName, childTable, childCol, @@ -45,8 +53,8 @@ export const genTest = (apiType, dbType) => { cy.getActiveMenu().find('input.nc-column-name-input', { timeout: 3000 }) .should('exist') .clear() - .type(childCol); - cy.get(".nc-column-type-input").last().click().type("Rollup"); + .type(columnName); + cy.get(".nc-column-type-input").last().click().type("RollUp"); cy.getActiveSelection().find('.ant-select-item-option').contains("Rollup").click(); // Configure Child table & column names @@ -62,7 +70,7 @@ export const genTest = (apiType, dbType) => { cy.get(".ant-btn-primary").contains("Save").should('exist').click(); cy.toastWait(`Column created`); - cy.get(`th[data-title="${childCol}"]`).should("exist"); + cy.get(`th[data-title="${columnName}"]`).should("exist"); }; // routine to delete column @@ -98,20 +106,20 @@ export const genTest = (apiType, dbType) => { // Test case it("Add Rollup column (City, City, count) & Delete", () => { - addLookUpColumn("RollUpCol_2", "City", "City", "count"); + 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_2", 4) + mainPage.getCell("RollUpCol", 4) .contains("2") .should("exist"); // editColumnByName("RollUpCol_2", "RollUpCol_New"); - deleteColumnByName("RollUpCol_2"); + deleteColumnByName("RollUpCol"); }); it.skip("Add Rollup column (City, CountryId, count) & Delete", () => { - addLookUpColumn("RollUpCol_1", "City", "CountryId", "count"); + 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"]`) diff --git a/scripts/cypress-v2/integration/common/3e_duration_column.js b/scripts/cypress-v2/integration/common/3e_duration_column.js index d0921b5396..2d244ac8ac 100644 --- a/scripts/cypress-v2/integration/common/3e_duration_column.js +++ b/scripts/cypress-v2/integration/common/3e_duration_column.js @@ -20,6 +20,13 @@ export const genTest = (apiType, dbType) => { 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); + cy.createTable(tableName); }); @@ -97,14 +104,21 @@ export const genTest = (apiType, dbType) => { cy.wait(500) cy.get(".nc-add-new-row-btn").click(); } else { - mainPage.getRow(index).find(".nc-row-expand-icon").click({ force: true }); + // mainPage.getRow(index).find(".nc-row-expand-icon").click({ force: true }); + cy.get(".nc-row-expand") + .eq(index-1) + .click({ force: true }); } cy.get(".duration-cell-wrapper > input").first().should('exist').type(cellValue); - cy.getActiveModal().find("button").contains("Save row").click({ force: true }); + cy.getActiveDrawer().find("button").contains("Save row").click({ force: true }); cy.toastWait("Row updated successfully"); - mainPage.getCell(colName, index).find('input').then(($e) => { - expect($e[0].value).to.equal(expectedValue) - }) + cy.getActiveDrawer().find("button").contains("Cancel").click({ force: true }); + // mainPage.getCell(colName, index).find('input').then(($e) => { + // expect($e[0].value).to.equal(expectedValue) + // }) + mainPage.getCell(colName, index) + .contains(expectedValue) + .should("exist"); } ///////////////////////////////////////////////////