2020-01-14 08:20:14 +00:00
|
|
|
import selectors from '../../helpers/selectors';
|
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2017-12-15 09:07:52 +00:00
|
|
|
|
2018-09-05 06:27:50 +00:00
|
|
|
describe('Client add address notes path', () => {
|
2020-01-14 08:20:14 +00:00
|
|
|
let browser;
|
2019-12-31 11:00:16 +00:00
|
|
|
let page;
|
|
|
|
beforeAll(async() => {
|
2020-01-14 08:20:14 +00:00
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.loginAndModule('employee', 'client');
|
|
|
|
await page.accessToSearchResult('Petter Parker');
|
|
|
|
await page.accessToSection('client.card.address.index');
|
|
|
|
});
|
2017-12-15 09:07:52 +00:00
|
|
|
|
2019-12-31 11:00:16 +00:00
|
|
|
afterAll(async() => {
|
2020-01-14 08:40:50 +00:00
|
|
|
await browser.close();
|
2018-09-05 06:27:50 +00:00
|
|
|
});
|
2017-12-15 09:07:52 +00:00
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should click on the edit icon of the default address`, async() => {
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street');
|
|
|
|
await page.waitToClick(selectors.clientAddresses.firstEditAddress);
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('client.card.address.edit');
|
2018-09-05 06:27:50 +00:00
|
|
|
});
|
2017-12-15 09:07:52 +00:00
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should not save a description without observation type', async() => {
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.waitToClick(selectors.clientAddresses.addObservationButton);
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.write(selectors.clientAddresses.firstObservationDescription, 'first description');
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.waitToClick(selectors.clientAddresses.saveButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2018-10-30 07:51:18 +00:00
|
|
|
|
2020-04-08 09:24:40 +00:00
|
|
|
expect(message.text).toBe('Some fields are invalid');
|
2018-09-05 06:27:50 +00:00
|
|
|
});
|
2018-02-26 15:06:49 +00:00
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should not save an observation type without description', async() => {
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.clearInput(selectors.clientAddresses.firstObservationDescription);
|
|
|
|
await page.autocompleteSearch(selectors.clientAddresses.firstObservationType, 'comercial');
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.waitToClick(selectors.clientAddresses.saveButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2018-10-30 07:51:18 +00:00
|
|
|
|
2020-04-08 09:24:40 +00:00
|
|
|
expect(message.text).toBe('Some fields are invalid');
|
2018-09-05 06:27:50 +00:00
|
|
|
});
|
2018-02-26 15:06:49 +00:00
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should create two new observations', async() => {
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.write(selectors.clientAddresses.firstObservationDescription, 'first description');
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.waitToClick(selectors.clientAddresses.addObservationButton);
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.autocompleteSearch(selectors.clientAddresses.secondObservationType, 'observation one');
|
|
|
|
await page.write(selectors.clientAddresses.secondObservationDescription, 'second description');
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.waitToClick(selectors.clientAddresses.saveButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2018-10-30 07:51:18 +00:00
|
|
|
|
2020-10-30 16:09:11 +00:00
|
|
|
expect(message.text).toBe('Data saved!');
|
2018-04-06 16:40:24 +00:00
|
|
|
});
|
|
|
|
});
|