From 4bddc45421b437028a04ff6c9e89f08b4a20b8cd Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Sat, 24 Sep 2022 12:03:03 +0530 Subject: [PATCH] test(misc): wait clean up Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- .../components/smartsheet-header/Menu.vue | 1 + .../integration/common/6f_attachments.js | 14 +++---------- .../integration/common/6g_base_share.js | 5 ++++- .../common/7a_create_project_from_excel.js | 12 ++++++++--- .../cypress/integration/common/8a_webhook.js | 10 +++++++--- .../integration/spec/roleValidation.spec.js | 4 ++-- scripts/cypress/support/commands.js | 9 ++++++++- .../cypress/support/page_objects/mainPage.js | 20 +++++++++++++------ 8 files changed, 48 insertions(+), 27 deletions(-) diff --git a/packages/nc-gui/components/smartsheet-header/Menu.vue b/packages/nc-gui/components/smartsheet-header/Menu.vue index 0a263e697b..5ad1d0b143 100644 --- a/packages/nc-gui/components/smartsheet-header/Menu.vue +++ b/packages/nc-gui/components/smartsheet-header/Menu.vue @@ -23,6 +23,7 @@ const { getMeta } = useMetas() const deleteColumn = () => Modal.confirm({ title: h('div', ['Do you want to delete ', h('span', { class: 'font-weight-bold' }, [column?.value?.title]), ' column ?']), + wrapClassName: 'nc-modal-column-delete', okText: t('general.delete'), okType: 'danger', cancelText: t('general.cancel'), diff --git a/scripts/cypress/integration/common/6f_attachments.js b/scripts/cypress/integration/common/6f_attachments.js index 2a76aaf303..df01d44c66 100644 --- a/scripts/cypress/integration/common/6f_attachments.js +++ b/scripts/cypress/integration/common/6f_attachments.js @@ -27,15 +27,12 @@ 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(5).click(); - // kludge: flicker on load - cy.wait(3000); // wait for page rendering to complete cy.get(".nc-grid-row").should("have.length", 10); - // mainPage - // .getRow(10) - // .find(".mdi-checkbox-blank-outline") - // .click({ force: true }); + + // kludge: flicker on load + // cy.wait(3000); mainPage.getCell("Country", 10).rightclick(); cy.getActiveMenu(".nc-dropdown-grid-context-menu") @@ -129,12 +126,7 @@ export const genTest = (apiType, dbType) => { it(`Filter column which contain only attachments, download CSV`, () => { // come back to main window loginPage.loginAndOpenProject(apiType, dbType); - // cy.visit('/') - // cy.wait(5000) - // projectsPage.openConfiguredProject(apiType, dbType); - cy.openTableTab("Country", 25); - // cy.wait(1000); mainPage.filterField("testAttach", "is not null", null); mainPage.hideField("LastUpdate"); diff --git a/scripts/cypress/integration/common/6g_base_share.js b/scripts/cypress/integration/common/6g_base_share.js index 070fd0f1a9..2f07b0c9ce 100644 --- a/scripts/cypress/integration/common/6g_base_share.js +++ b/scripts/cypress/integration/common/6g_base_share.js @@ -21,12 +21,15 @@ export const genTest = (apiType, dbType) => { const permissionValidation = (roleType) => { it(`${roleType}: Visit base shared URL`, () => { cy.log(linkText); + // http://localhost:8080/api/v1/db/meta/projects/p_4ufoizgrorwyey/tables?includeM2M=false + cy.intercept("/api/v1/db/meta/projects/**").as("waitForPageLoad"); // visit URL & wait for page load to complete cy.visit(linkText, { baseUrl: null, }); - cy.wait(5000); + 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 a9edea748e..21092a3182 100644 --- a/scripts/cypress/integration/common/7a_create_project_from_excel.js +++ b/scripts/cypress/integration/common/7a_create_project_from_excel.js @@ -87,12 +87,12 @@ export const genTest = (apiType, dbType) => { sheetData = rows; }); - cy.visit("/"); + // cy.visit("/"); projectsPage.createProject( { dbType: "none", apiType: "REST", name: "importSample" }, {} ); - cy.wait(4000); + // cy.wait(4000); cy.saveLocalStorage(); }); @@ -122,6 +122,11 @@ export const genTest = (apiType, dbType) => { }); it("File Upload: Verify pre-load template page", () => { + // http://localhost:8080/api/v1/db/meta/audits/comments/count?ids[]=1&ids[]=2&fk_model_id=md_fq1vxy2181bzp0 + cy.intercept("/api/v1/db/meta/audits/comments/count*").as( + "waitForPageLoad" + ); + cy.getActiveModal() .find(".ant-collapse-item") .then((sheets) => { @@ -171,7 +176,8 @@ 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(5000); + cy.wait("@waitForPageLoad"); }); it("File Upload: Verify loaded data", () => { diff --git a/scripts/cypress/integration/common/8a_webhook.js b/scripts/cypress/integration/common/8a_webhook.js index fe967ed7ef..7d45f05c1b 100644 --- a/scripts/cypress/integration/common/8a_webhook.js +++ b/scripts/cypress/integration/common/8a_webhook.js @@ -116,7 +116,7 @@ function configureWebhook(hook, test) { .contains(new RegExp("^" + hook.condition.column + "$", "g")) .should("exist") .click(); - cy.wait(1000); + // cy.wait(1000); cy.get(".nc-filter-operation-select").should("exist").last().click(); cy.get(".ant-select-dropdown:visible") @@ -162,8 +162,11 @@ function clearServerData() { 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.wait(1000); + cy.get(".nc-expand-col-Title") + .should("exist") .find(".nc-cell > input") .first() .type(cellValue); @@ -185,6 +188,7 @@ function updateRow(index, cellValue) { .click({ force: true }); cy.get(".nc-expand-col-Title") + .should("exist") .find(".nc-cell > input") .should("exist") .first() @@ -207,7 +211,7 @@ function updateRow(index, cellValue) { function verifyHookTrigger(count, lastValue) { // allow message to be received - cy.wait(500); + cy.wait(100); cy.request("http://localhost:9090/hook/count").then((msg) => { cy.log(msg.body); diff --git a/scripts/cypress/integration/spec/roleValidation.spec.js b/scripts/cypress/integration/spec/roleValidation.spec.js index e245a63649..406bc2f7aa 100644 --- a/scripts/cypress/integration/spec/roleValidation.spec.js +++ b/scripts/cypress/integration/spec/roleValidation.spec.js @@ -203,7 +203,7 @@ export function _editComment(roleType, mode) { cy.openTableTab(columnName, 25); - cy.wait(1000); + // cy.wait(1000); // click on comment icon & type comment // @@ -214,7 +214,7 @@ export function _editComment(roleType, mode) { // Everyone else: Comment added/read successfully // - cy.wait(3000); + // cy.wait(3000); if ("viewer" === roleType) { cy.getActiveDrawer(".nc-drawer-expanded-form") diff --git a/scripts/cypress/support/commands.js b/scripts/cypress/support/commands.js index 64251d9554..de6139aa1d 100644 --- a/scripts/cypress/support/commands.js +++ b/scripts/cypress/support/commands.js @@ -173,7 +173,7 @@ Cypress.Commands.add("closeTableTab", (tn) => { .click(); // subsequent tab open commands will fail if tab is not closed completely - cy.wait(1000); + cy.wait(100); }); Cypress.Commands.add("openOrCreateGqlProject", (_args) => { @@ -486,6 +486,13 @@ Cypress.Commands.add("signOut", () => { cy.get('button:contains("SIGN IN")').should("exist"); }); +// Navigation +// +Cypress.Commands.add("gotoProjectsPage", () => { + cy.get(".nc-noco-brand-icon").should("exist").click(); + cy.get(`.nc-project-page-title:contains("My Projects")`).should("exist"); +}); + // Drag n Drop // refer: https://stackoverflow.com/a/55409853 /* diff --git a/scripts/cypress/support/page_objects/mainPage.js b/scripts/cypress/support/page_objects/mainPage.js index 987999a850..ee4c9b632d 100644 --- a/scripts/cypress/support/page_objects/mainPage.js +++ b/scripts/cypress/support/page_objects/mainPage.js @@ -256,13 +256,21 @@ export class _mainPage { .trigger("mouseover", { force: true }) .click({ force: true }); - cy.wait(500); + // 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.get(".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") + .contains("Delete") + .click(); cy.get(`th:contains(${colName})`).should("not.exist"); };