salix/e2e/paths/14-account/02_alias_create_and_basic_d...

67 lines
2.6 KiB
JavaScript
Raw Normal View History

2021-03-05 10:33:55 +00:00
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
2024-04-05 08:05:51 +00:00
describe('Account Alias create and basic data path', () => {
2021-03-05 10:33:55 +00:00
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
2024-04-04 13:02:41 +00:00
await page.loginAndModule('itManagement', 'account');
2021-03-05 10:33:55 +00:00
await page.accessToSection('account.alias');
});
afterAll(async() => {
await browser.close();
});
it('should open the new account alias form by clicking the add button', async() => {
await page.waitToClick(selectors.accountAliasIndex.addAlias);
await page.waitForState('account.alias.create');
});
it('should fill the form and then save it by clicking the create alias button', async() => {
await page.write(selectors.accountAliasIndex.newName, 'Boring alias');
await page.write(selectors.accountAliasIndex.newDescription, 'Boring description');
await page.waitToClick(selectors.accountAliasIndex.createAliasButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should redirect the user to the created account alias basic data section', async() => {
await page.waitForState('account.alias.card.basicData');
});
2021-03-05 15:25:09 +00:00
it('should edit the alias basic data', async() => {
2021-03-05 10:33:55 +00:00
await page.overwrite(selectors.accountAliasBasicData.name, 'Psykers');
await page.overwrite(selectors.accountAliasBasicData.description, 'Email group for psykers');
await page.waitToClick(selectors.accountAliasBasicData.save);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should reload the basicData section and check the name was edited successfully', async() => {
await page.reloadSection('account.alias.card.basicData');
const result = await page.waitToGetProperty(selectors.accountAliasBasicData.name, 'value');
expect(result).toEqual('Psykers');
});
it('should check the alias description was edited successfully', async() => {
const result = await page.waitToGetProperty(selectors.accountAliasBasicData.description, 'value');
expect(result).toContain('psykers');
});
it('should search IT alias then access the user section to check the role listed is the expected one', async() => {
2021-03-05 10:33:55 +00:00
await page.accessToSearchResult('IT');
await page.accessToSection('account.alias.card.users');
const rolesCount = await page.countElement(selectors.accountAliasUsers.anyResult);
expect(rolesCount).toEqual(1);
});
});