2021-03-05 10:33:55 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
|
|
|
|
2021-03-05 16:06:06 +00:00
|
|
|
// #2833 Refactor account.basicData
|
|
|
|
xdescribe('Account 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;
|
|
|
|
await page.loginAndModule('developer', 'account');
|
|
|
|
});
|
|
|
|
|
|
|
|
afterAll(async() => {
|
|
|
|
await browser.close();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should open the new account form by clicking the add button', async() => {
|
|
|
|
await page.waitToClick(selectors.accountIndex.addAccount);
|
|
|
|
await page.waitForState('account.create');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should fill the form and then save it by clicking the create button', async() => {
|
|
|
|
await page.write(selectors.accountIndex.newName, 'Remy');
|
|
|
|
await page.write(selectors.accountIndex.newNickname, 'Gambit');
|
|
|
|
await page.write(selectors.accountIndex.newEmail, 'RemyEtienneLeBeau@verdnatura.es');
|
|
|
|
await page.autocompleteSearch(selectors.accountIndex.newRole, 'Trainee');
|
|
|
|
await page.write(selectors.accountIndex.newPassword, 'cestlavie');
|
|
|
|
await page.waitToClick(selectors.accountIndex.createAccountButton);
|
|
|
|
const message = await page.waitForSnackbar();
|
|
|
|
|
|
|
|
expect(message.text).toContain('Data saved!');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should redirect the user to the created account basic data section', async() => {
|
|
|
|
await page.waitForState('account.card.basicData');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should edit the basic data', async() => {
|
|
|
|
await page.overwrite(selectors.accountBasicData.name, 'Anna');
|
|
|
|
await page.overwrite(selectors.accountBasicData.nickname, 'Rogue');
|
|
|
|
await page.overwrite(selectors.accountBasicData.email, 'AnnaMarieLeBeau@verdnatura.es');
|
|
|
|
await page.autocompleteSearch(selectors.accountBasicData.language, 'english');
|
|
|
|
await page.waitToClick(selectors.accountBasicData.save);
|
|
|
|
const message = await page.waitForSnackbar();
|
|
|
|
|
|
|
|
expect(message.text).toContain('Data saved!');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should reload the section and check the name was edited successfully', async() => {
|
|
|
|
await page.reloadSection('account.card.basicData');
|
|
|
|
const result = await page.waitToGetProperty(selectors.accountBasicData.name, 'value');
|
|
|
|
|
|
|
|
expect(result).toEqual('Anna');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should check the nickname was edited successfully', async() => {
|
|
|
|
const result = await page.waitToGetProperty(selectors.accountBasicData.nickname, 'value');
|
|
|
|
|
|
|
|
expect(result).toEqual('Rogue');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should check the email was edited successfully', async() => {
|
|
|
|
const result = await page.waitToGetProperty(selectors.accountBasicData.email, 'value');
|
|
|
|
|
|
|
|
expect(result).toEqual('AnnaMarieLeBeau@verdnatura.es');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should check the language was edited successfully', async() => {
|
|
|
|
const result = await page.waitToGetProperty(selectors.accountBasicData.language, 'value');
|
|
|
|
|
|
|
|
expect(result).toEqual('English');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should navigate to the roles section to check the roles are correct', async() => {
|
|
|
|
await page.accessToSection('account.card.roles');
|
|
|
|
const rolesCount = await page.countElement(selectors.accountRoles.anyResult);
|
|
|
|
|
|
|
|
expect(rolesCount).toEqual(3);
|
|
|
|
});
|
|
|
|
});
|