import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; describe('Account Alias create and basic data path', () => { let browser; let page; beforeAll(async() => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('developer', 'account'); 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'); }); it('should edit the alias basic data', async() => { 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() => { await page.accessToSearchResult('IT'); await page.accessToSection('account.alias.card.users'); const rolesCount = await page.countElement(selectors.accountAliasUsers.anyResult); expect(rolesCount).toEqual(1); }); });