From 2d54ae6730f2c9c0e2bcc0bf0e0a86573aa3125a Mon Sep 17 00:00:00 2001 From: Pranav C Date: Sat, 24 Sep 2022 17:44:20 +0530 Subject: [PATCH] test(cypress): test to verify super admin access to appstore Signed-off-by: Pranav C --- packages/nc-gui/pages/index/apps.vue | 2 +- .../integration/common/5c_super_user_role.js | 84 +++++++++++++++++++ .../cypress/integration/test/pg-restRoles.js | 2 + scripts/cypress/integration/test/restRoles.js | 3 + .../integration/test/xcdb-restRoles.js | 2 + 5 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 scripts/cypress/integration/common/5c_super_user_role.js diff --git a/packages/nc-gui/pages/index/apps.vue b/packages/nc-gui/pages/index/apps.vue index 03cb132bd6..5b3d81bf2c 100644 --- a/packages/nc-gui/pages/index/apps.vue +++ b/packages/nc-gui/pages/index/apps.vue @@ -11,7 +11,7 @@ definePageMeta({ diff --git a/scripts/cypress/integration/common/5c_super_user_role.js b/scripts/cypress/integration/common/5c_super_user_role.js new file mode 100644 index 0000000000..afe8f503ec --- /dev/null +++ b/scripts/cypress/integration/common/5c_super_user_role.js @@ -0,0 +1,84 @@ +import { loginPage } from '../../support/page_objects/navigation'; +import { roles } from '../../support/page_objects/projectConstants'; + +export const genTest = (apiType, dbType) => { + describe(`${apiType.toUpperCase()} api - Table views: Create/Edit/Delete`, () => { + before(() => { + loginPage.signIn(roles.owner.credentials); + }); + + beforeEach(() => { + cy.restoreLocalStorage(); + }); + + afterEach(() => { + cy.saveLocalStorage(); + }); + + 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'); + + // 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 .nc-app-store-card-install') + .click(); + + cy.getActiveModal('.nc-modal-plugin-install') + .find('[placeholder="Channel Name"]') + .type('Test channel') + + cy.getActiveModal('.nc-modal-plugin-install') + .find('[placeholder="Webhook URL"]') + .type('http://test.com') + + + cy.getActiveModal('.nc-modal-plugin-install') + .find('button:contains("Save")') + .click() + + 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') + .find('[placeholder="Channel Name"]') + .should('have.value', 'Test channel') + .clear() + .type('Test channel 2') + + cy.getActiveModal('.nc-modal-plugin-install') + .get('button:contains("Save")') + .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.getActiveModal('.nc-modal-plugin-uninstall') + .should('exist') + .find('button:contains("Confirm")') + .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 194d22e051..fa868a3df1 100644 --- a/scripts/cypress/integration/test/pg-restRoles.js +++ b/scripts/cypress/integration/test/pg-restRoles.js @@ -2,6 +2,7 @@ let t0 = require("./explicitLogin"); let t01 = require("../common/00_pre_configurations"); let t5a = require("../common/5a_user_role"); let t5b = require("../common/5b_preview_role"); +let t5c = require("../common/5c_super_user_role"); const { setCurrentMode, } = require("../../support/page_objects/projectConstants"); @@ -12,6 +13,7 @@ const nocoTestSuite = (apiType, dbType) => { t5a.genTest(apiType, dbType); // t5b.genTest(apiType, dbType); + t5c.genTest(apiType, dbType); }; nocoTestSuite("rest", "postgres"); diff --git a/scripts/cypress/integration/test/restRoles.js b/scripts/cypress/integration/test/restRoles.js index 69a80b009a..b636dff4ec 100644 --- a/scripts/cypress/integration/test/restRoles.js +++ b/scripts/cypress/integration/test/restRoles.js @@ -2,6 +2,7 @@ let t0 = require("./explicitLogin"); let t01 = require("../common/00_pre_configurations"); let t5a = require("../common/5a_user_role"); let t5b = require("../common/5b_preview_role"); +let t5c = require("../common/5c_super_user_role"); const { setCurrentMode, } = require("../../support/page_objects/projectConstants"); @@ -12,6 +13,8 @@ const nocoTestSuite = (apiType, dbType) => { t5a.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 985978fc6d..fd6edd531d 100644 --- a/scripts/cypress/integration/test/xcdb-restRoles.js +++ b/scripts/cypress/integration/test/xcdb-restRoles.js @@ -2,6 +2,7 @@ let t0 = require("./explicitLogin"); let t01 = require("../common/00_pre_configurations"); let t5a = require("../common/5a_user_role"); let t5b = require("../common/5b_preview_role"); +let t5c = require("../common/5c_super_user_role"); const { setCurrentMode, } = require("../../support/page_objects/projectConstants"); @@ -12,6 +13,7 @@ const nocoTestSuite = (apiType, dbType) => { t5a.genTest(apiType, dbType); // t5b.genTest(apiType, dbType); + t5c.genTest(apiType, dbType); }; nocoTestSuite("rest", "xcdb");