From 728e6a0c6d0f9cd2aa2097b995f6ac726955dfd0 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Sun, 25 Sep 2022 10:52:07 +0530 Subject: [PATCH] test: comments clean up Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- .../common/00_pre_configurations.js | 4 - .../integration/common/1a_table_operations.js | 1 - .../common/2b_table_with_m2m_column.js | 2 - .../3a_filter_sort_fields_operations.js | 3 - .../integration/common/3c_lookup_column.js | 3 - .../integration/common/3d_rollup_column.js | 4 - .../integration/common/3e_duration_column.js | 3 - .../common/4a_table_view_grid_gallery_form.js | 1 - .../common/4c_form_view_detailed.js | 3 - .../integration/common/4e_form_view_share.js | 3 - .../common/4f_pg_grid_view_share.js | 8 - .../integration/common/5a_user_role.js | 10 +- .../integration/common/5b_preview_role.js | 2 - .../integration/common/6f_attachments.js | 6 - .../integration/common/6g_base_share.js | 1 - .../common/7a_create_project_from_excel.js | 2 - .../cypress/integration/common/8a_webhook.js | 3 - .../integration/spec/roleValidation.spec.js | 274 +++++++++--------- .../cypress/integration/test/explicitLogin.js | 1 - scripts/cypress/support/commands.js | 8 - .../cypress/support/page_objects/mainPage.js | 6 - .../support/page_objects/navigation.js | 7 - 22 files changed, 138 insertions(+), 217 deletions(-) diff --git a/scripts/cypress/integration/common/00_pre_configurations.js b/scripts/cypress/integration/common/00_pre_configurations.js index 48b8682f16..a44270d816 100644 --- a/scripts/cypress/integration/common/00_pre_configurations.js +++ b/scripts/cypress/integration/common/00_pre_configurations.js @@ -187,7 +187,6 @@ export const genTest = (apiType, dbType) => { } } else { projectsPage.createProject(proj.basic, proj.config); - // cy.wait(5000); if (dbType === "xcdb") { // store base URL- to re-visit and delete form view later let projId; @@ -240,12 +239,9 @@ export const genTest = (apiType, dbType) => { cy_createProjectBlock(proj, apiType, dbType); } - // 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.get("button.ant-tabs-tab-remove").should("not.exist"); - // cy.wait(1000); // first instance of updating local storage information cy.saveLocalStorage(); diff --git a/scripts/cypress/integration/common/1a_table_operations.js b/scripts/cypress/integration/common/1a_table_operations.js index fd2c1d5136..26a504cd8d 100644 --- a/scripts/cypress/integration/common/1a_table_operations.js +++ b/scripts/cypress/integration/common/1a_table_operations.js @@ -53,7 +53,6 @@ export const genTest = (apiType, dbType) => { // cy.get("thead > tr > th.ant-table-cell").should("have.length", 5); - // cy.wait(1000); cy.wait("@waitForPageLoad"); // Audit table entries diff --git a/scripts/cypress/integration/common/2b_table_with_m2m_column.js b/scripts/cypress/integration/common/2b_table_with_m2m_column.js index edd4350ba9..bfc7735b92 100644 --- a/scripts/cypress/integration/common/2b_table_with_m2m_column.js +++ b/scripts/cypress/integration/common/2b_table_with_m2m_column.js @@ -107,8 +107,6 @@ export const genTest = (apiType, dbType) => { .contains("ACADEMY DINOSAUR", { timeout: 2000 }) .click() .then(() => { - // wait to ensure pop up appears before we proceed further - // cy.wait(1000); // Link card validation cy.getActiveDrawer(".nc-drawer-expanded-form") .find(".text-lg") diff --git a/scripts/cypress/integration/common/3a_filter_sort_fields_operations.js b/scripts/cypress/integration/common/3a_filter_sort_fields_operations.js index be31c6c23c..67c42329bb 100644 --- a/scripts/cypress/integration/common/3a_filter_sort_fields_operations.js +++ b/scripts/cypress/integration/common/3a_filter_sort_fields_operations.js @@ -53,7 +53,6 @@ export const genTest = (apiType, dbType) => { // add a row to end of Country table cy.get(".nc-add-new-row-btn").click(); - // cy.wait(1000); cy.get(".nc-expand-col-Country") .find(".nc-cell > input") .first() @@ -78,8 +77,6 @@ export const genTest = (apiType, dbType) => { // verify mainPage.getPagination(5).click(); - // kludge: flicker on load - // cy.wait(3000); cy.wait("@waitForPageLoad"); mainPage.getCell("Country", 10).contains("Test Country").should("exist"); diff --git a/scripts/cypress/integration/common/3c_lookup_column.js b/scripts/cypress/integration/common/3c_lookup_column.js index 0970c61ffe..7980380009 100644 --- a/scripts/cypress/integration/common/3c_lookup_column.js +++ b/scripts/cypress/integration/common/3c_lookup_column.js @@ -19,11 +19,8 @@ export const genTest = (apiType, dbType) => { // // 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/integration/common/3d_rollup_column.js b/scripts/cypress/integration/common/3d_rollup_column.js index e94f666706..30d35e5ce9 100644 --- a/scripts/cypress/integration/common/3d_rollup_column.js +++ b/scripts/cypress/integration/common/3d_rollup_column.js @@ -17,12 +17,8 @@ export const genTest = (apiType, dbType) => { // 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); diff --git a/scripts/cypress/integration/common/3e_duration_column.js b/scripts/cypress/integration/common/3e_duration_column.js index 94924fa495..3d6f6a3cf4 100644 --- a/scripts/cypress/integration/common/3e_duration_column.js +++ b/scripts/cypress/integration/common/3e_duration_column.js @@ -18,11 +18,8 @@ export const genTest = (apiType, dbType) => { before(() => { 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); }); diff --git a/scripts/cypress/integration/common/4a_table_view_grid_gallery_form.js b/scripts/cypress/integration/common/4a_table_view_grid_gallery_form.js index 14da568ed7..a2368dd7d8 100644 --- a/scripts/cypress/integration/common/4a_table_view_grid_gallery_form.js +++ b/scripts/cypress/integration/common/4a_table_view_grid_gallery_form.js @@ -77,7 +77,6 @@ export const genTest = (apiType, dbType) => { // click on delete icon (becomes visible on hovering mouse) cy.get(".nc-view-delete-icon").click({ force: true }); - // cy.wait(300); cy.getActiveModal(".nc-modal-view-delete") .find(".ant-btn-dangerous") .click(); diff --git a/scripts/cypress/integration/common/4c_form_view_detailed.js b/scripts/cypress/integration/common/4c_form_view_detailed.js index a5cbab992d..b47217e90f 100644 --- a/scripts/cypress/integration/common/4c_form_view_detailed.js +++ b/scripts/cypress/integration/common/4c_form_view_detailed.js @@ -324,7 +324,6 @@ export const genTest = (apiType, dbType) => { // open form view & enable "email me" option cy.openTableTab("Country", 25); - // cy.wait(1000); cy.get(`.nc-view-item.nc-${viewType}-view-item`) .contains("Form-1") @@ -338,7 +337,6 @@ export const genTest = (apiType, dbType) => { settingsPage.openMenu(settingsPage.APPSTORE); mainPage.resetSMTP(); - // cy.wait(300); cy.openTableTab("Country", 25); }); @@ -383,7 +381,6 @@ export const genTest = (apiType, dbType) => { // click on delete icon (becomes visible on hovering mouse) cy.get(".nc-view-delete-icon").click({ force: true }); - // cy.wait(1000); cy.getActiveModal(".nc-modal-view-delete") .find(".ant-btn-dangerous") .click(); diff --git a/scripts/cypress/integration/common/4e_form_view_share.js b/scripts/cypress/integration/common/4e_form_view_share.js index ba8bbf6219..d976cee30b 100644 --- a/scripts/cypress/integration/common/4e_form_view_share.js +++ b/scripts/cypress/integration/common/4e_form_view_share.js @@ -112,7 +112,6 @@ export const genTest = (apiType, dbType) => { cy.visit(linkText, { baseUrl: null, }); - // cy.wait(5000); cy.wait(["@waitForPageLoad"], { times: 2 }); // wait for share view page to load! @@ -208,8 +207,6 @@ export const genTest = (apiType, dbType) => { // // clean up newly added rows into Country table operations // // this auto verifies successfull addition of rows to table as well // mainPage.getPagination(25).click(); - // // kludge: flicker on load - // cy.wait(3000) // // cy.get(".nc-grid-row").should("have.length", 1); // cy.get(".ant-checkbox").should('exist').eq(1).click({ force: true }); diff --git a/scripts/cypress/integration/common/4f_pg_grid_view_share.js b/scripts/cypress/integration/common/4f_pg_grid_view_share.js index 1b9f52e768..58ac85b625 100644 --- a/scripts/cypress/integration/common/4f_pg_grid_view_share.js +++ b/scripts/cypress/integration/common/4f_pg_grid_view_share.js @@ -22,8 +22,6 @@ export const genTest = (apiType, dbType) => { // .click(); mainPage.shareView().click({ force: true }); - cy.wait(5000); - // wait, as URL initially will be /undefined cy.getActiveModal(".nc-modal-share-view") .find(".share-link-box") @@ -136,7 +134,6 @@ export const genTest = (apiType, dbType) => { cy.visit(viewURL["combined"], { baseUrl: null, }); - cy.wait(5000); // wait for page rendering to complete cy.get(".nc-grid-row").should("have.length", 18); @@ -353,7 +350,6 @@ export const genTest = (apiType, dbType) => { cy.visit(storedURL, { baseUrl: null, }); - cy.wait(5000); // number of view entries should be 2 before we delete cy.get(".nc-view-item").its("length").should("eq", 2); @@ -390,12 +386,9 @@ export const genTest = (apiType, dbType) => { cy.visit(storedURL, { baseUrl: null, }); - cy.wait(5000); // delete row mainPage.getPagination(5).click(); - // kludge: flicker on load - cy.wait(3000); // wait for page rendering to complete cy.get(".nc-grid-row").should("have.length", 10); @@ -439,7 +432,6 @@ export const genTest = (apiType, dbType) => { cy.visit(viewURL["rowColUpdate"], { baseUrl: null, }); - cy.wait(5000); //5 // wait for public view page to load! diff --git a/scripts/cypress/integration/common/5a_user_role.js b/scripts/cypress/integration/common/5a_user_role.js index 14938cc4ba..8ccba12e06 100644 --- a/scripts/cypress/integration/common/5a_user_role.js +++ b/scripts/cypress/integration/common/5a_user_role.js @@ -116,7 +116,6 @@ export const genTest = (apiType, dbType) => { before(() => { cy.restoreLocalStorage(); cy.visit(mainPage.roleURL[roleType]); - // cy.wait(5000); cy.get('button:contains("SIGN UP"):visible').should("exist"); cy.get('input[type="text"]', { timeout: 20000 }).type( @@ -126,9 +125,6 @@ export const genTest = (apiType, dbType) => { roles[roleType].credentials.password ); cy.get('button:contains("SIGN UP")').click(); - - // cy.wait(3000); - cy.get(`.nc-project-page-title:contains("My Projects"):visible`).should( "exist" ); @@ -277,9 +273,9 @@ export const genTest = (apiType, dbType) => { }); it(`[${roles[roleType].name}] App store accessibility`, () => { - cy.visit("/#/apps").then(r =>{ - cy.toastWait('You don\'t have enough permission to access the page.') - }) + cy.visit("/#/apps").then((r) => { + cy.toastWait("You don't have enough permission to access the page."); + }); }); }); }; diff --git a/scripts/cypress/integration/common/5b_preview_role.js b/scripts/cypress/integration/common/5b_preview_role.js index d695b2a89f..df14c0aefe 100644 --- a/scripts/cypress/integration/common/5b_preview_role.js +++ b/scripts/cypress/integration/common/5b_preview_role.js @@ -59,8 +59,6 @@ export const genTest = (apiType, dbType, roleType) => { after(() => { // cy.get(".nc-preview-reset").click({ force: true }); cy.get(".mdi-exit-to-app").click(); - // cy.wait(20000) - // wait for page rendering to complete cy.get(".nc-grid-row", { timeout: 25000 }).should("have.length", 25); diff --git a/scripts/cypress/integration/common/6f_attachments.js b/scripts/cypress/integration/common/6f_attachments.js index df01d44c66..a05dcffe32 100644 --- a/scripts/cypress/integration/common/6f_attachments.js +++ b/scripts/cypress/integration/common/6f_attachments.js @@ -31,9 +31,6 @@ export const genTest = (apiType, dbType) => { // wait for page rendering to complete cy.get(".nc-grid-row").should("have.length", 10); - // kludge: flicker on load - // cy.wait(3000); - mainPage.getCell("Country", 10).rightclick(); cy.getActiveMenu(".nc-dropdown-grid-context-menu") .contains("Delete Row") @@ -74,8 +71,6 @@ export const genTest = (apiType, dbType) => { mainPage.shareView().click(); - // cy.wait(5000); - // copy link text, visit URL cy.getActiveModal(".nc-modal-share-view") .find(".share-link-box") @@ -94,7 +89,6 @@ export const genTest = (apiType, dbType) => { cy.visit(linkText, { baseUrl: null, }); - // cy.wait(5000); cy.wait(["@waitForSharedViewLoad"]); // wait for share view page to load! diff --git a/scripts/cypress/integration/common/6g_base_share.js b/scripts/cypress/integration/common/6g_base_share.js index 2f07b0c9ce..e47c5faeb7 100644 --- a/scripts/cypress/integration/common/6g_base_share.js +++ b/scripts/cypress/integration/common/6g_base_share.js @@ -29,7 +29,6 @@ export const genTest = (apiType, dbType) => { baseUrl: null, }); cy.wait(["@waitForPageLoad"]); - // cy.wait(5000); }); it(`${roleType}: Validate access permissions: advance menu`, () => { diff --git a/scripts/cypress/integration/common/7a_create_project_from_excel.js b/scripts/cypress/integration/common/7a_create_project_from_excel.js index 21092a3182..b17a8035d6 100644 --- a/scripts/cypress/integration/common/7a_create_project_from_excel.js +++ b/scripts/cypress/integration/common/7a_create_project_from_excel.js @@ -92,7 +92,6 @@ export const genTest = (apiType, dbType) => { { dbType: "none", apiType: "REST", name: "importSample" }, {} ); - // cy.wait(4000); cy.saveLocalStorage(); }); @@ -176,7 +175,6 @@ export const genTest = (apiType, dbType) => { cy.getActiveModal().find(".ant-btn-primary").click(); // wait for page to get loaded (issue observed in CI-CD) - // cy.wait(5000); cy.wait("@waitForPageLoad"); }); diff --git a/scripts/cypress/integration/common/8a_webhook.js b/scripts/cypress/integration/common/8a_webhook.js index 7d45f05c1b..f39b8a6935 100644 --- a/scripts/cypress/integration/common/8a_webhook.js +++ b/scripts/cypress/integration/common/8a_webhook.js @@ -116,7 +116,6 @@ function configureWebhook(hook, test) { .contains(new RegExp("^" + hook.condition.column + "$", "g")) .should("exist") .click(); - // cy.wait(1000); cy.get(".nc-filter-operation-select").should("exist").last().click(); cy.get(".ant-select-dropdown:visible") @@ -163,8 +162,6 @@ function addNewRow(index, cellValue) { cy.get(".nc-add-new-row-btn:visible").should("exist"); cy.get(".nc-add-new-row-btn").click(); - // cy.wait(1000); - cy.get(".nc-expand-col-Title") .should("exist") .find(".nc-cell > input") diff --git a/scripts/cypress/integration/spec/roleValidation.spec.js b/scripts/cypress/integration/spec/roleValidation.spec.js index 72acb68583..6d08ac9273 100644 --- a/scripts/cypress/integration/spec/roleValidation.spec.js +++ b/scripts/cypress/integration/spec/roleValidation.spec.js @@ -1,5 +1,5 @@ -import { mainPage, settingsPage } from '../../support/page_objects/mainPage'; -import { roles } from '../../support/page_objects/projectConstants'; +import { mainPage, settingsPage } from "../../support/page_objects/mainPage"; +import { roles } from "../../support/page_objects/projectConstants"; // Left hand navigation bar, validation for // 1. Audit menu @@ -9,62 +9,62 @@ import { roles } from '../../support/page_objects/projectConstants'; export function _advSettings(roleType, mode) { cy.log(roleType, mode); - if (mode === 'baseShare') { + if (mode === "baseShare") { // open modal - cy.get('.nc-project-menu').should('exist').click(); - cy.getActiveMenu('.nc-dropdown-project-menu') + cy.get(".nc-project-menu").should("exist").click(); + cy.getActiveMenu(".nc-dropdown-project-menu") .find(`[data-menu-id="language"]`) - .should('exist'); + .should("exist"); // click again to close modal - cy.get('.nc-project-menu').should('exist').click(); + cy.get(".nc-project-menu").should("exist").click(); return; } let validationString = - true == roles[roleType].validations.advSettings ? 'exist' : 'not.exist'; + true == roles[roleType].validations.advSettings ? "exist" : "not.exist"; // cy.get(".nc-team-settings").should(validationString); - cy.get('.nc-project-menu').should('exist').click(); - cy.getActiveMenu('.nc-dropdown-project-menu') + cy.get(".nc-project-menu").should("exist").click(); + cy.getActiveMenu(".nc-dropdown-project-menu") .find(`[data-menu-id="preview-as"]`) .should(validationString); - cy.getActiveMenu('.nc-dropdown-project-menu') + cy.getActiveMenu(".nc-dropdown-project-menu") .find(`[data-menu-id="teamAndSettings"]:visible`) .should(validationString); if (true === roles[roleType].validations.advSettings) { - cy.getActiveMenu('.nc-dropdown-project-menu') + cy.getActiveMenu(".nc-dropdown-project-menu") .find(`[data-menu-id="teamAndSettings"]:visible`) .should(validationString) .click(); - cy.get(`[data-menu-id="teamAndAuth"]`).should('exist'); - if (roleType === 'owner') - cy.get(`[data-menu-id="appStore"]`).should('exist'); - cy.get(`[data-menu-id="projMetaData"]`).should('exist'); - cy.get(`[data-menu-id="audit"]`).should('exist'); + cy.get(`[data-menu-id="teamAndAuth"]`).should("exist"); + if (roleType === "owner") + cy.get(`[data-menu-id="appStore"]`).should("exist"); + cy.get(`[data-menu-id="projMetaData"]`).should("exist"); + cy.get(`[data-menu-id="audit"]`).should("exist"); settingsPage.closeMenu(); } else { - cy.get('.nc-project-menu').should('exist').click(); + cy.get(".nc-project-menu").should("exist").click(); } // float menu in preview mode - if ('preview' === mode) { - cy.get('.nc-floating-preview-btn').should('exist'); - cy.get('.nc-floating-preview-btn') + if ("preview" === mode) { + cy.get(".nc-floating-preview-btn").should("exist"); + cy.get(".nc-floating-preview-btn") .find(`[type="radio"][value="${roles[roleType].name}"]`) - .should('be.checked'); + .should("be.checked"); } // cy.get("body").click("bottomRight"); } export function _editSchema(roleType, mode) { - let columnName = 'City'; + let columnName = "City"; let validationString = - true === roles[roleType].validations.editSchema ? 'exist' : 'not.exist'; + true === roles[roleType].validations.editSchema ? "exist" : "not.exist"; cy.openTableTab(columnName, 25); @@ -72,18 +72,18 @@ export function _editSchema(roleType, mode) { cy.get(`.nc-add-new-table`).should(validationString); // delete table option - cy.get(`.nc-project-tree-tbl-City`).should('exist').rightclick(); - cy.get('.ant-dropdown-content:visible').should(validationString); + cy.get(`.nc-project-tree-tbl-City`).should("exist").rightclick(); + cy.get(".ant-dropdown-content:visible").should(validationString); - if (validationString === 'exist') { - cy.getActiveMenu('.nc-dropdown-tree-view-context-menu') + if (validationString === "exist") { + cy.getActiveMenu(".nc-dropdown-tree-view-context-menu") .find('[role="menuitem"]') - .contains('Delete') - .should('exist'); - cy.getActiveMenu('.nc-dropdown-tree-view-context-menu') + .contains("Delete") + .should("exist"); + cy.getActiveMenu(".nc-dropdown-tree-view-context-menu") .find('[role="menuitem"]') - .contains('Rename') - .should('exist'); + .contains("Rename") + .should("exist"); // click on a cell to close table context menu mainPage.getCell(columnName, 3).click(); @@ -91,104 +91,104 @@ export function _editSchema(roleType, mode) { // add new column option // - cy.get('.nc-column-add').should(validationString); + cy.get(".nc-column-add").should(validationString); // update column (edit/ delete menu) - cy.get('.nc-ui-dt-dropdown').should(validationString); - - if (validationString === 'exist') { - cy.get('.nc-import-menu').should('exist').click(); - cy.getActiveMenu('.nc-dropdown-import-menu').should('exist'); - cy.getActiveMenu('.nc-dropdown-import-menu') - .find('.ant-dropdown-menu-item') - .contains('Airtable'); - cy.getActiveMenu('.nc-dropdown-import-menu') - .find('.ant-dropdown-menu-item') - .contains('CSV file'); - cy.getActiveMenu('.nc-dropdown-import-menu') - .find('.ant-dropdown-menu-item') - .contains('JSON file'); - cy.getActiveMenu('.nc-dropdown-import-menu') - .find('.ant-dropdown-menu-item') - .contains('Microsoft Excel'); + cy.get(".nc-ui-dt-dropdown").should(validationString); + + if (validationString === "exist") { + cy.get(".nc-import-menu").should("exist").click(); + cy.getActiveMenu(".nc-dropdown-import-menu").should("exist"); + cy.getActiveMenu(".nc-dropdown-import-menu") + .find(".ant-dropdown-menu-item") + .contains("Airtable"); + cy.getActiveMenu(".nc-dropdown-import-menu") + .find(".ant-dropdown-menu-item") + .contains("CSV file"); + cy.getActiveMenu(".nc-dropdown-import-menu") + .find(".ant-dropdown-menu-item") + .contains("JSON file"); + cy.getActiveMenu(".nc-dropdown-import-menu") + .find(".ant-dropdown-menu-item") + .contains("Microsoft Excel"); } } export function _editData(roleType, mode) { - let columnName = 'City'; + let columnName = "City"; let validationString = - true === roles[roleType].validations.editData ? 'exist' : 'not.exist'; + true === roles[roleType].validations.editData ? "exist" : "not.exist"; cy.openTableTab(columnName, 25); // add row button - cy.get('.nc-add-new-row-btn:visible').should(validationString); + cy.get(".nc-add-new-row-btn:visible").should(validationString); // add button at bottom of page mainPage.getCell(columnName, 25).scrollIntoView(); - cy.get('.nc-grid-add-new-cell:visible').should(validationString); + cy.get(".nc-grid-add-new-cell:visible").should(validationString); // update row option (right click) // - mainPage.getCell('City', 5).rightclick(); + mainPage.getCell("City", 5).rightclick(); cy.wait(100); - cy.get('.ant-dropdown-content:visible').should(validationString); + cy.get(".ant-dropdown-content:visible").should(validationString); - if (validationString === 'exist') { + if (validationString === "exist") { // right click options will exist (only for 'exist' case) // - cy.getActiveMenu('.nc-dropdown-grid-context-menu') - .contains('Insert New Row') + cy.getActiveMenu(".nc-dropdown-grid-context-menu") + .contains("Insert New Row") .should(validationString); - cy.getActiveMenu('.nc-dropdown-grid-context-menu') - .contains('Clear cell') + cy.getActiveMenu(".nc-dropdown-grid-context-menu") + .contains("Clear cell") .should(validationString); - cy.getActiveMenu('.nc-dropdown-grid-context-menu') - .contains('Delete Row') + cy.getActiveMenu(".nc-dropdown-grid-context-menu") + .contains("Delete Row") .should(validationString); - cy.getActiveMenu('.nc-dropdown-grid-context-menu') - .contains('Delete Selected Rows') + cy.getActiveMenu(".nc-dropdown-grid-context-menu") + .contains("Delete Selected Rows") .should(validationString); // cy.get("body").type("{esc}"); - mainPage.getCell('City', 13).click(); + mainPage.getCell("City", 13).click(); // update cell contents option using row expander should be enabled // mainPage .getRow(1) - .find('.nc-row-no') - .should('exist') + .find(".nc-row-no") + .should("exist") .eq(0) - .trigger('mouseover', { force: true }); - cy.get('.nc-row-expand').should('exist').eq(10).click({ force: true }); - cy.getActiveDrawer('.nc-drawer-expanded-form') - .find('button') - .contains('Save row') - .should('exist'); - cy.getActiveDrawer('.nc-drawer-expanded-form') - .find('button') - .contains('Cancel') - .should('exist') + .trigger("mouseover", { force: true }); + cy.get(".nc-row-expand").should("exist").eq(10).click({ force: true }); + cy.getActiveDrawer(".nc-drawer-expanded-form") + .find("button") + .contains("Save row") + .should("exist"); + cy.getActiveDrawer(".nc-drawer-expanded-form") + .find("button") + .contains("Cancel") + .should("exist") .click(); } else { // update cell contents option using row expander should be disabled // - cy.get('.nc-row-expand').should('exist').eq(10).click({ force: true }); - cy.getActiveDrawer('.nc-drawer-expanded-form') - .find('button:disabled') - .contains('Save row') - .should('exist'); - cy.getActiveDrawer('.nc-drawer-expanded-form') - .find('button') - .contains('Cancel') - .should('exist') + cy.get(".nc-row-expand").should("exist").eq(10).click({ force: true }); + cy.getActiveDrawer(".nc-drawer-expanded-form") + .find("button:disabled") + .contains("Save row") + .should("exist"); + cy.getActiveDrawer(".nc-drawer-expanded-form") + .find("button") + .contains("Cancel") + .should("exist") .click(); } // double click cell entries to edit // - mainPage.getCell('City', 5).dblclick().find('input').should(validationString); + mainPage.getCell("City", 5).dblclick().find("input").should(validationString); } // read &/ update comment @@ -196,53 +196,49 @@ export function _editData(roleType, mode) { // Everyone else: read &/ update // export function _editComment(roleType, mode) { - let columnName = 'City'; + let columnName = "City"; let validationString = true === roles[roleType].validations.editComment - ? 'Comment added successfully' - : 'Not allowed'; + ? "Comment added successfully" + : "Not allowed"; cy.openTableTab(columnName, 25); - // cy.wait(1000); - // click on comment icon & type comment // - cy.get('.nc-row-expand').should('exist').eq(10).click({ force: true }); + cy.get(".nc-row-expand").should("exist").eq(10).click({ force: true }); // Expected response: // Viewer: Not able to see comment option // Everyone else: Comment added/read successfully // - // cy.wait(3000); - - if ('viewer' === roleType) { - cy.getActiveDrawer('.nc-drawer-expanded-form') - .should('exist') - .find('.nc-toggle-comments') - .should('not.exist'); + if ("viewer" === roleType) { + cy.getActiveDrawer(".nc-drawer-expanded-form") + .should("exist") + .find(".nc-toggle-comments") + .should("not.exist"); } else { - cy.getActiveDrawer('.nc-drawer-expanded-form') - .should('exist') - .find('.nc-toggle-comments') - .should('exist') + cy.getActiveDrawer(".nc-drawer-expanded-form") + .should("exist") + .find(".nc-toggle-comments") + .should("exist") .click(); - cy.getActiveDrawer('.nc-drawer-expanded-form') - .find('.nc-comment-box') - .should('exist') - .type('Comment-1{enter}'); + cy.getActiveDrawer(".nc-drawer-expanded-form") + .find(".nc-comment-box") + .should("exist") + .type("Comment-1{enter}"); // cy.toastWait('Comment added successfully') - cy.getActiveDrawer('.nc-drawer-expanded-form') - .find('.nc-toggle-comments') + cy.getActiveDrawer(".nc-drawer-expanded-form") + .find(".nc-toggle-comments") .click(); } - cy.getActiveDrawer('.nc-drawer-expanded-form') - .find('button') - .contains('Cancel') - .should('exist') + cy.getActiveDrawer(".nc-drawer-expanded-form") + .find("button") + .contains("Cancel") + .should("exist") .click(); } @@ -250,7 +246,7 @@ export function _editComment(roleType, mode) { // Editor/Viewer/Commenter : can only view 'existing' views // Rest: can create/edit export function _viewMenu(roleType, mode) { - let columnName = 'City'; + let columnName = "City"; // Lock, Download, Upload let menuWithSubmenuCount = 3; @@ -261,16 +257,16 @@ export function _viewMenu(roleType, mode) { cy.openTableTab(columnName, 25); let validationString = - true === roles[roleType].validations.shareView ? 'exist' : 'not.exist'; + true === roles[roleType].validations.shareView ? "exist" : "not.exist"; - if (roleType === 'editor') { + if (roleType === "editor") { // Download / Upload CSV menuWithSubmenuCount = 2; // Get API Snippet and ERD menuWithoutSubmenuCount = 2; // ERD - if (mode === 'baseShare') menuWithoutSubmenuCount = 1; - } else if (roleType === 'commenter' || roleType === 'viewer') { + if (mode === "baseShare") menuWithoutSubmenuCount = 1; + } else if (roleType === "commenter" || roleType === "viewer") { // Download CSV & Download excel menuWithSubmenuCount = 0; // Get API Snippet and ERD @@ -278,7 +274,7 @@ export function _viewMenu(roleType, mode) { } // view list field (default GRID view) - cy.get(`.nc-view-item`).should('exist'); + cy.get(`.nc-view-item`).should("exist"); // view create option, exists only for owner/ creator cy.get(`.nc-create-grid-view`).should(validationString); @@ -288,47 +284,47 @@ export function _viewMenu(roleType, mode) { // share view permissions are role specific // actions menu (more), only download csv should be visible for non-previlaged users - cy.get('.nc-actions-menu-btn').click(); - cy.getActiveMenu('.nc-dropdown-actions-menu') - .find('.ant-dropdown-menu-submenu:visible') - .should('have.length', menuWithSubmenuCount); - cy.getActiveMenu('.nc-dropdown-actions-menu') - .find('.ant-dropdown-menu-item:visible') - .should('have.length', menuWithoutSubmenuCount); + cy.get(".nc-actions-menu-btn").click(); + cy.getActiveMenu(".nc-dropdown-actions-menu") + .find(".ant-dropdown-menu-submenu:visible") + .should("have.length", menuWithSubmenuCount); + cy.getActiveMenu(".nc-dropdown-actions-menu") + .find(".ant-dropdown-menu-item:visible") + .should("have.length", menuWithoutSubmenuCount); // click again to close menu - cy.get('.nc-actions-menu-btn').click(); + cy.get(".nc-actions-menu-btn").click(); } export function _topRightMenu(roleType, mode) { // kludge; download csv menu persists until clicked - let columnName = 'City'; + let columnName = "City"; // cy.closeTableTab(columnName); // cy.openTableTab(columnName, 25); let validationString = - true == roles[roleType].validations.shareView ? 'exist' : 'not.exist'; + true == roles[roleType].validations.shareView ? "exist" : "not.exist"; cy.get(`.nc-share-base`).should(validationString); - cy.get('.nc-menu-translate').should('exist'); - cy.get('.nc-menu-accounts').should('exist'); + cy.get(".nc-menu-translate").should("exist"); + cy.get(".nc-menu-accounts").should("exist"); } // Access control list // export function disableTableAccess(tbl, role) { const cls = `.nc-acl-${tbl}-${role}-chkbox`; - cy.get(cls).find('input').should('be.checked').click({ force: true }); - cy.get(cls).find('input').should('not.be.checked'); + cy.get(cls).find("input").should("be.checked").click({ force: true }); + cy.get(cls).find("input").should("not.be.checked"); } export function enableTableAccess(tbl, role) { const cls = `.nc-acl-${tbl}-${role}-chkbox`; - cy.get(cls).find('input').should('not.be.checked').click({ force: true }); - cy.get(cls).find('input').should('be.checked'); + cy.get(cls).find("input").should("not.be.checked").click({ force: true }); + cy.get(cls).find("input").should("be.checked"); } export function _accessControl(roleType, previewMode) { - let validationString = roleType === 'creator' ? 'exist' : 'not.exist'; + let validationString = roleType === "creator" ? "exist" : "not.exist"; cy.get(`.nc-project-tree-tbl-Language`).should(validationString); cy.get(`.nc-project-tree-tbl-CustomerList`).should(validationString); diff --git a/scripts/cypress/integration/test/explicitLogin.js b/scripts/cypress/integration/test/explicitLogin.js index 77c471c0f9..6b6c1476c6 100644 --- a/scripts/cypress/integration/test/explicitLogin.js +++ b/scripts/cypress/integration/test/explicitLogin.js @@ -27,7 +27,6 @@ export const genTest = (apiType, dbType) => { .then(() => { let query = `ALTER TABLE "actor" RENAME TO "${projId}actor"`; cy.task("sqliteExec", query); - cy.wait(1000); }); }); }); diff --git a/scripts/cypress/support/commands.js b/scripts/cypress/support/commands.js index 15f4678aa0..26a50b58d0 100644 --- a/scripts/cypress/support/commands.js +++ b/scripts/cypress/support/commands.js @@ -47,16 +47,12 @@ Cypress.Commands.add("signinOrSignup", (_args) => { _args ); - cy.wait(1000); - // signin/signup cy.get("body").then(($body) => { - // cy.wait(1000) cy.url().then((url) => { if (!url.includes("/projects")) { // handle initial load if ($body.find(".welcome-page").length > 0) { - cy.wait(8000); cy.get("body").trigger("mousemove"); cy.snip("LetsBegin"); cy.contains("Let's Begin").click(); @@ -421,7 +417,6 @@ Cypress.Commands.add("snip", (filename) => { ) { let storeName = `${screenShotDb.length}_${filename}`; screenShotDb.push(filename); - // cy.wait(1000); cy.screenshot(storeName, { overwrite: true }); } }); @@ -434,7 +429,6 @@ Cypress.Commands.add("snipActiveModal", (filename) => { ) { let storeName = `${screenShotDb.length}_${filename}`; screenShotDb.push(filename); - // cy.wait(1000); // cy.getActiveModal().screenshot(filename, { // padding: 0, // overwrite: true, @@ -451,7 +445,6 @@ Cypress.Commands.add("snipActiveMenu", (filename) => { ) { let storeName = `${screenShotDb.length}_${filename}`; screenShotDb.push(filename); - // cy.wait(1000); // cy.getActiveMenu().screenshot(filename, { // padding: 0, // overwrite: true, @@ -477,7 +470,6 @@ Cypress.Commands.add("signOut", () => { .last() .click(); - // cy.wait(5000); cy.get('button:contains("SIGN IN")').should("exist"); }); diff --git a/scripts/cypress/support/page_objects/mainPage.js b/scripts/cypress/support/page_objects/mainPage.js index 743a5898f5..3d2c2b9e58 100644 --- a/scripts/cypress/support/page_objects/mainPage.js +++ b/scripts/cypress/support/page_objects/mainPage.js @@ -128,7 +128,6 @@ export class _mainPage { cy.getActiveModal(".nc-modal-invite-user-and-share-base") .find('input[placeholder="E-mail"]') .should("exist"); - // cy.wait(1000); cy.getActiveModal(".nc-modal-invite-user-and-share-base") .find('input[placeholder="E-mail"]') @@ -261,16 +260,13 @@ export class _mainPage { .trigger("mouseover", { force: true }) .click({ force: true }); - // cy.wait(500); // cy.get(".nc-column-delete").click(); cy.getActiveMenu(".nc-dropdown-column-operations") .find(".nc-column-delete") .click(); - // cy.wait(500); // cy.get(".nc-column-delete").should("not.be.visible"); // cy.get(".ant-btn-dangerous:visible").contains("Delete").click(); - // cy.wait(500); cy.getActiveModal(".nc-modal-column-delete") .find(".ant-btn-dangerous:visible") @@ -523,7 +519,6 @@ export class _mainPage { .find(".nc-project-menu-item") .contains("Download") .click(); - // cy.wait(1000); cy.get(".nc-project-menu-item:contains('Download as CSV')") .should("exist") .click(); @@ -601,7 +596,6 @@ export class _mainPage { cy.intercept("GET", "/api/v1/db/meta/projects/**").as("metaSync"); cy.get(".nc-btn-metasync-reload").should("exist").click(); - // cy.wait(2000); cy.wait("@metaSync"); cy.get(`.nc-metasync-row-${tbl}:contains(${msg})`).should("exist"); diff --git a/scripts/cypress/support/page_objects/navigation.js b/scripts/cypress/support/page_objects/navigation.js index cc8a1b1b7c..050c7aaef8 100644 --- a/scripts/cypress/support/page_objects/navigation.js +++ b/scripts/cypress/support/page_objects/navigation.js @@ -78,11 +78,8 @@ export class _loginPage { // projectsPage.openProject(staticProjects.pgExternalREST.basic.name); // } // - // // 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); } } @@ -108,14 +105,11 @@ export class _projectsPage { projectsPage.openProject(staticProjects.pgExternalREST.basic.name); } - // kludge: wait for page load to finish - // cy.wait(4000); cy.wait("@waitForPageLoad"); // close team & auth tab cy.get("button.ant-tabs-tab-remove").should("exist").click(); cy.get("button.ant-tabs-tab-remove").should("not.exist"); - // cy.wait(1000); } // Open existing project @@ -212,7 +206,6 @@ export class _projectsPage { // Create project cy.contains("Ok & Save Project", { timeout: 20000 }).click(); - // cy.wait(5000); // takes a while to load project this.waitHomePageLoad();