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/5a_user_role.js b/scripts/cypress/integration/common/5a_user_role.js index a1495b3353..d3fff9733a 100644 --- a/scripts/cypress/integration/common/5a_user_role.js +++ b/scripts/cypress/integration/common/5a_user_role.js @@ -102,7 +102,7 @@ export const genTest = (apiType, dbType) => { disableTableAccess("CustomerList", "commenter"); disableTableAccess("CustomerList", "viewer"); - cy.get("button.nc-acl-save").click({ force: true }); + cy.get("button.nc-acl-save").click(); cy.toastWait("Updated UI ACL for tables successfully"); mainPage.closeMetaTab(); @@ -110,13 +110,15 @@ export const genTest = (apiType, dbType) => { }); const roleValidation = (roleType) => { + let clear; + describe(`User role validation`, () => { before(() => { cy.restoreLocalStorage(); cy.visit(mainPage.roleURL[roleType]); - cy.wait(5000); + // cy.wait(5000); - cy.get('button:contains("SIGN UP")').should("exist"); + cy.get('button:contains("SIGN UP"):visible').should("exist"); cy.get('input[type="text"]', { timeout: 20000 }).type( roles[roleType].credentials.username ); @@ -125,11 +127,11 @@ export const genTest = (apiType, dbType) => { ); cy.get('button:contains("SIGN UP")').click(); - cy.wait(3000); + // cy.wait(3000); - cy.get(".nc-project-page-title") - .contains("My Projects") - .should("be.visible"); + cy.get(`.nc-project-page-title:contains("My Projects"):visible`).should( + "exist" + ); if (dbType === "xcdb") { if ("rest" == apiType) @@ -149,12 +151,15 @@ export const genTest = (apiType, dbType) => { if (roleType === "creator") { // kludge: wait for page load to finish // close team & auth tab - cy.wait(2000); + cy.wait(500); cy.get("button.ant-tabs-tab-remove").should("exist").click(); - cy.wait(1000); + cy.wait(500); } cy.saveLocalStorage(); + + clear = Cypress.LocalStorage.clear; + Cypress.LocalStorage.clear = () => {}; }); beforeEach(() => { @@ -169,6 +174,8 @@ export const genTest = (apiType, dbType) => { cy.restoreLocalStorage(); cy.signOut(); cy.saveLocalStorage(); + + Cypress.LocalStorage.clear = clear; }); /////////////////////////////////////////////////////// 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/common/9a_QuickTest.js b/scripts/cypress/integration/common/9a_QuickTest.js index 3714e4946e..24481a2604 100644 --- a/scripts/cypress/integration/common/9a_QuickTest.js +++ b/scripts/cypress/integration/common/9a_QuickTest.js @@ -89,6 +89,8 @@ function verifyWebhook(config) { } export const genTest = (apiType, dbType, testMode) => { + let clear; + if (!isTestSuiteActive(apiType, dbType)) return; describe(`Quick Tests`, () => { let cellIdx = 1; @@ -115,6 +117,9 @@ export const genTest = (apiType, dbType, testMode) => { cy.openTableTab("Film", 3); cy.saveLocalStorage(); + + clear = Cypress.LocalStorage.clear; + Cypress.LocalStorage.clear = () => {}; }); beforeEach(() => { @@ -129,6 +134,8 @@ export const genTest = (apiType, dbType, testMode) => { cy.restoreLocalStorage(); cy.signOut(); cy.saveLocalStorage(); + + Cypress.LocalStorage.clear = clear; }); it("Verify Schema", () => { 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"); };