import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; describe('Account ACL path', () => { let browser; let page; beforeAll(async() => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('developer', 'account'); 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'); 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); await page.waitForState('account.acl.edit'); }); it('should edit the third acl', async() => { 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); const message = await page.waitForSnackbar(); const newFirstResult = await page.waitToGetProperty(selectors.accountAcl.thirdAcl, 'innerText'); expect(message.text).toContain('ACL removed'); expect(firstResult).not.toEqual(newFirstResult); }); });