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() => {
await page.autocompleteSearch(selectors.accountAcl.role, 'trainee');
await page.autocompleteSearch(selectors.accountAcl.model, 'Campaign');
2022-05-17 13:19:54 +00:00
await page.autocompleteSearch(selectors.accountAcl.accessType, 'WRITE');
await page.autocompleteSearch(selectors.accountAcl.permission, 'DENY');
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-17 13:19:54 +00:00
await page.autocompleteSearch(selectors.accountAcl.model, 'AccessToken');
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() => {
const firstResult = 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();
const newFirstResult = await page.waitToGetProperty(selectors.accountAcl.thirdAcl, 'innerText');
2022-05-17 13:19:54 +00:00
expect(message.text).toContain('ACL removed');
expect(firstResult).not.toEqual(newFirstResult);
2022-05-17 13:19:54 +00:00
});
});