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-11-20 13:22:00 +00:00
|
|
|
describe('Client Add 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('Bruce Banner');
|
|
|
|
await page.accessToSection('client.card.note.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-11-20 13:22:00 +00:00
|
|
|
});
|
2017-12-15 09:07:52 +00:00
|
|
|
|
2020-02-28 15:49:39 +00:00
|
|
|
it(`should reach the notes index`, async() => {
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('client.card.note.index');
|
2020-02-28 15:49:39 +00:00
|
|
|
});
|
|
|
|
|
2019-01-16 14:02:50 +00:00
|
|
|
it(`should click on the add note button`, async() => {
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.waitToClick(selectors.clientNotes.addNoteFloatButton);
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('client.card.note.create');
|
2018-11-20 13:22:00 +00:00
|
|
|
});
|
2017-12-15 09:07:52 +00:00
|
|
|
|
2019-01-16 14:02:50 +00:00
|
|
|
it(`should create a note`, async() => {
|
2020-11-23 17:28:39 +00:00
|
|
|
await page.waitForSelector(selectors.clientNotes.note);
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.type(`${selectors.clientNotes.note} textarea`, 'Meeting with Black Widow 21st 9am');
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.waitToClick(selectors.clientNotes.saveButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2018-10-30 07:51:18 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2018-11-20 13:22:00 +00:00
|
|
|
});
|
2017-12-15 09:07:52 +00:00
|
|
|
|
2019-01-16 14:02:50 +00:00
|
|
|
it('should confirm the note was created', async() => {
|
2019-12-31 11:00:16 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.clientNotes.firstNoteText, 'innerText');
|
2018-10-30 07:51:18 +00:00
|
|
|
|
2018-11-20 13:22:00 +00:00
|
|
|
expect(result).toEqual('Meeting with Black Widow 21st 9am');
|
2017-12-15 09:07:52 +00:00
|
|
|
});
|
|
|
|
});
|