From b2ac82c1274a385405ead4ac70103290463388dc Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Thu, 29 Sep 2022 12:27:23 +0530 Subject: [PATCH 1/3] test: enable preview mode tests Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- .../integration/common/5b_preview_role.js | 23 +++-- .../integration/common/5c_super_user_role.js | 88 +++++++++---------- .../cypress/integration/test/pg-restRoles.js | 2 +- scripts/cypress/integration/test/restRoles.js | 5 +- .../integration/test/xcdb-restRoles.js | 2 +- 5 files changed, 61 insertions(+), 59 deletions(-) diff --git a/scripts/cypress/integration/common/5b_preview_role.js b/scripts/cypress/integration/common/5b_preview_role.js index df14c0aefe..a90cfbf198 100644 --- a/scripts/cypress/integration/common/5b_preview_role.js +++ b/scripts/cypress/integration/common/5b_preview_role.js @@ -27,36 +27,42 @@ export const genTest = (apiType, dbType, roleType) => { /////////////////////////////////////////////////////////// //// Test Suite + let clear; + describe("Role preview validations", () => { // Sign in/ open project before(() => { loginPage.loginAndOpenProject(apiType, dbType); cy.openTableTab("City", 25); - cy.wait(3000); - settingsPage.openProjectMenu(); cy.getActiveMenu(".nc-dropdown-project-menu") .find(`[data-submenu-id="preview-as"]`) .should("exist") .click(); - cy.wait(1000); cy.get(".ant-dropdown-menu-submenu") .eq(4) .find(`[data-menu-id="editor"]`) .should("exist") .click(); - - cy.wait(10000); - cy.saveLocalStorage(); + + clear = Cypress.LocalStorage.clear; + Cypress.LocalStorage.clear = () => {}; }); beforeEach(() => { cy.restoreLocalStorage(); }); + afterEach(() => { + cy.saveLocalStorage(); + Cypress.LocalStorage.clear = clear; + }); + after(() => { + cy.restoreLocalStorage(); + // cy.get(".nc-preview-reset").click({ force: true }); cy.get(".mdi-exit-to-app").click(); // wait for page rendering to complete @@ -88,6 +94,8 @@ export const genTest = (apiType, dbType, roleType) => { enableTableAccess("customerlist", "editor"); enableTableAccess("customerlist", "commenter"); enableTableAccess("customerlist", "viewer"); + + cy.saveLocalStorage(); }); const genTestSub = (roleType) => { @@ -97,9 +105,6 @@ export const genTest = (apiType, dbType, roleType) => { .find(`[type="radio"][value="${roleType}"]`) .should("exist") .click(); - - cy.wait(5000); - cy.saveLocalStorage(); }); it(`Role preview: ${roleType}: Advance settings`, () => { diff --git a/scripts/cypress/integration/common/5c_super_user_role.js b/scripts/cypress/integration/common/5c_super_user_role.js index fe72773dc0..ed51a2171d 100644 --- a/scripts/cypress/integration/common/5c_super_user_role.js +++ b/scripts/cypress/integration/common/5c_super_user_role.js @@ -1,12 +1,9 @@ -import { loginPage } from '../../support/page_objects/navigation'; -import { roles } from '../../support/page_objects/projectConstants'; +import { loginPage } from "../../support/page_objects/navigation"; +import { roles } from "../../support/page_objects/projectConstants"; export const genTest = (apiType, dbType) => { describe(`${apiType.toUpperCase()} api - Super user test`, () => { - before(() => { - loginPage.signIn(roles.owner.credentials); - cy.saveLocalStorage(); - }); + before(() => {}); beforeEach(() => { cy.restoreLocalStorage(); @@ -16,70 +13,71 @@ export const genTest = (apiType, dbType) => { cy.saveLocalStorage(); }); - after(() => { - }); - + after(() => {}); it(`Open App store page and check slack app`, () => { - - cy.visit('/#/apps').then(win => { - cy.get('.nc-app-store-title').should('exist'); - cy.get('.nc-app-store-card-Slack').should('exist'); + cy.visit("/#/apps").then((win) => { + cy.get(".nc-app-store-title").should("exist"); + cy.get(".nc-app-store-card-Slack").should("exist"); // install slack app - cy.get('.nc-app-store-card-Slack .install-btn') - .invoke('attr', 'style', 'right: 10px') + cy.get(".nc-app-store-card-Slack .install-btn").invoke( + "attr", + "style", + "right: 10px" + ); - cy.get('.nc-app-store-card-Slack .install-btn .nc-app-store-card-install') - .click(); + cy.get( + ".nc-app-store-card-Slack .install-btn .nc-app-store-card-install" + ).click(); - cy.getActiveModal('.nc-modal-plugin-install') + cy.getActiveModal(".nc-modal-plugin-install") .find('[placeholder="Channel Name"]') - .type('Test channel') + .type("Test channel"); - cy.getActiveModal('.nc-modal-plugin-install') + cy.getActiveModal(".nc-modal-plugin-install") .find('[placeholder="Webhook URL"]') - .type('http://test.com') - + .type("http://test.com"); - cy.getActiveModal('.nc-modal-plugin-install') + cy.getActiveModal(".nc-modal-plugin-install") .find('button:contains("Save")') - .click() - - cy.toastWait('Successfully installed') + .click(); - cy.get('.nc-app-store-card-Slack .install-btn .nc-app-store-card-install').should('not.exist'); + cy.toastWait("Successfully installed"); + cy.get( + ".nc-app-store-card-Slack .install-btn .nc-app-store-card-install" + ).should("not.exist"); // update slack app config - cy.get('.nc-app-store-card-Slack .install-btn .nc-app-store-card-edit').should('exist').click() - cy.getActiveModal('.nc-modal-plugin-install') - .should('exist') + cy.get(".nc-app-store-card-Slack .install-btn .nc-app-store-card-edit") + .should("exist") + .click(); + cy.getActiveModal(".nc-modal-plugin-install") + .should("exist") .find('[placeholder="Channel Name"]') - .should('have.value', 'Test channel') + .should("have.value", "Test channel") .clear() - .type('Test channel 2') + .type("Test channel 2"); - cy.getActiveModal('.nc-modal-plugin-install') + cy.getActiveModal(".nc-modal-plugin-install") .get('button:contains("Save")') - .click() - - - cy.toastWait('Successfully installed') + .click(); + cy.toastWait("Successfully installed"); // reset slack app - cy.get('.nc-app-store-card-Slack .install-btn .nc-app-store-card-reset').should('exist').click() + cy.get(".nc-app-store-card-Slack .install-btn .nc-app-store-card-reset") + .should("exist") + .click(); - cy.getActiveModal('.nc-modal-plugin-uninstall') - .should('exist') + cy.getActiveModal(".nc-modal-plugin-uninstall") + .should("exist") .find('button:contains("Confirm")') - .click() - - cy.toastWait('Plugin uninstalled successfully') + .click(); + cy.toastWait("Plugin uninstalled successfully"); }); - }); }); -} +}; diff --git a/scripts/cypress/integration/test/pg-restRoles.js b/scripts/cypress/integration/test/pg-restRoles.js index fa868a3df1..a2300c70f5 100644 --- a/scripts/cypress/integration/test/pg-restRoles.js +++ b/scripts/cypress/integration/test/pg-restRoles.js @@ -12,7 +12,7 @@ const nocoTestSuite = (apiType, dbType) => { t01.genTest(apiType, dbType); t5a.genTest(apiType, dbType); - // t5b.genTest(apiType, dbType); + t5b.genTest(apiType, dbType); t5c.genTest(apiType, dbType); }; diff --git a/scripts/cypress/integration/test/restRoles.js b/scripts/cypress/integration/test/restRoles.js index b636dff4ec..187cbaf1ec 100644 --- a/scripts/cypress/integration/test/restRoles.js +++ b/scripts/cypress/integration/test/restRoles.js @@ -12,9 +12,8 @@ const nocoTestSuite = (apiType, dbType) => { t01.genTest(apiType, dbType); t5a.genTest(apiType, dbType); - // t5b.genTest(apiType, dbType); - t5c.genTest(apiType, dbType); - + t5b.genTest(apiType, dbType); + t5c.genTest(apiType, dbType); }; nocoTestSuite("rest", "mysql"); diff --git a/scripts/cypress/integration/test/xcdb-restRoles.js b/scripts/cypress/integration/test/xcdb-restRoles.js index fd6edd531d..b49058dee1 100644 --- a/scripts/cypress/integration/test/xcdb-restRoles.js +++ b/scripts/cypress/integration/test/xcdb-restRoles.js @@ -12,7 +12,7 @@ const nocoTestSuite = (apiType, dbType) => { t01.genTest(apiType, dbType); t5a.genTest(apiType, dbType); - // t5b.genTest(apiType, dbType); + t5b.genTest(apiType, dbType); t5c.genTest(apiType, dbType); }; From 0c542ee17a1e9edb3f357a60b7ac3cdb70f5f890 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Thu, 29 Sep 2022 13:52:28 +0530 Subject: [PATCH 2/3] test: preview-mode corrections Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- .../nc-gui/components/general/PreviewAs.vue | 4 +- .../integration/common/5b_preview_role.js | 88 ++++++++++--------- 2 files changed, 50 insertions(+), 42 deletions(-) diff --git a/packages/nc-gui/components/general/PreviewAs.vue b/packages/nc-gui/components/general/PreviewAs.vue index b99623b256..4faf78f335 100644 --- a/packages/nc-gui/components/general/PreviewAs.vue +++ b/packages/nc-gui/components/general/PreviewAs.vue @@ -82,7 +82,7 @@ watch(previewAs, (newRole) => {
-
+
{{ $t('general.close') }}
@@ -91,7 +91,7 @@ watch(previewAs, (newRole) => {