Browse Source

test(cypress): test to verify super admin access to appstore

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3796/head
Pranav C 2 years ago
parent
commit
2d54ae6730
  1. 2
      packages/nc-gui/pages/index/apps.vue
  2. 84
      scripts/cypress/integration/common/5c_super_user_role.js
  3. 2
      scripts/cypress/integration/test/pg-restRoles.js
  4. 3
      scripts/cypress/integration/test/restRoles.js
  5. 2
      scripts/cypress/integration/test/xcdb-restRoles.js

2
packages/nc-gui/pages/index/apps.vue

@ -11,7 +11,7 @@ definePageMeta({
<template>
<div class="p-10 h-full overflow-auto">
<h1 class="text-3xl text-center mb-11">{{ $t('title.appStore') }}</h1>
<h1 class="text-3xl text-center mb-11 nc-app-store-title">{{ $t('title.appStore') }}</h1>
<AppStore />
</div>
</template>

84
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')
});
});
});
}

2
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");

3
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");

2
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");

Loading…
Cancel
Save