import selectors from '../../helpers/selectors'; import getBrowser from '../../helpers/puppeteer'; describe('Client contacts', () => { let browser; let page; beforeAll(async() => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('employee', 'client'); await page.accessToSearchResult('Clark Kent'); await page.accessToSection('client.card.contact'); }); afterAll(async() => { await browser.close(); }); it('should add a contact', async() => { await page.waitToClick(selectors.clientContacts.addContactButton); await page.clearInput(selectors.clientContacts.name); await page.write(selectors.clientContacts.name, 'Ansible'); await page.write(selectors.clientContacts.phone, 'FTL comms'); await page.waitToClick(selectors.clientContacts.saveButton); let result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should delete de contact', async() => { await page.waitFor(3000); await page.waitToClick(selectors.clientContacts.deleteFirstPhone); await page.waitToClick(selectors.clientContacts.saveButton); let result = await page.waitForLastSnackbar(); expect(result).toContain('Data saved!'); }); });