salix/e2e/paths/14-account/04_acl.spec.js

61 lines
2.3 KiB
JavaScript
Raw Normal View History

2022-05-17 13:19:54 +00:00
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Account ACL path', () => {
2022-05-17 13:19:54 +00:00
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('developer', 'account');
2022-05-17 13:19:54 +00:00
await page.accessToSection('account.acl');
});
afterAll(async() => {
await browser.close();
});
it('should go to create new acl', async() => {
await page.waitToClick(selectors.accountAcl.addAcl);
await page.waitForState('account.acl.create');
});
it('should create new acl', async() => {
2022-05-25 06:27:26 +00:00
await page.autocompleteSearch(selectors.accountAcl.role, 'sysadmin');
2023-04-18 09:33:36 +00:00
await page.autocompleteSearch(selectors.accountAcl.model, 'Account');
2022-05-25 06:27:26 +00:00
await page.autocompleteSearch(selectors.accountAcl.accessType, '*');
await page.autocompleteSearch(selectors.accountAcl.permission, 'ALLOW');
2022-05-17 13:19:54 +00:00
await page.waitToClick(selectors.accountAcl.save);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should navigate to edit', async() => {
await page.doSearch();
await page.waitToClick(selectors.accountAcl.thirdAcl);
2022-05-17 13:19:54 +00:00
await page.waitForState('account.acl.edit');
});
it('should edit the third acl', async() => {
2022-05-25 06:27:26 +00:00
await page.autocompleteSearch(selectors.accountAcl.model, 'Supplier');
2022-05-17 13:19:54 +00:00
await page.autocompleteSearch(selectors.accountAcl.accessType, 'READ');
await page.waitToClick(selectors.accountAcl.save);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should delete the third result', async() => {
2022-05-25 06:27:26 +00:00
const result = await page.waitToGetProperty(selectors.accountAcl.thirdAcl, 'innerText');
await page.waitToClick(selectors.accountAcl.deleteThirdAcl);
await page.waitToClick(selectors.globalItems.acceptButton);
2022-05-17 13:19:54 +00:00
const message = await page.waitForSnackbar();
2022-05-25 06:27:26 +00:00
const newResult = await page.waitToGetProperty(selectors.accountAcl.thirdAcl, 'innerText');
2022-05-17 13:19:54 +00:00
expect(message.text).toContain('ACL removed');
2022-05-25 06:27:26 +00:00
expect(result).not.toEqual(newResult);
2022-05-17 13:19:54 +00:00
});
});