2020-02-10 11:12:49 +00:00
|
|
|
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);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2020-02-10 11:12:49 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2020-02-10 11:12:49 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should delete de contact', async() => {
|
2020-11-23 17:28:39 +00:00
|
|
|
await page.waitForTimeout(3000);
|
2020-02-10 11:12:49 +00:00
|
|
|
await page.waitToClick(selectors.clientContacts.deleteFirstPhone);
|
|
|
|
await page.waitToClick(selectors.clientContacts.saveButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2020-02-10 11:12:49 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2020-02-10 11:12:49 +00:00
|
|
|
});
|
|
|
|
});
|