2018-02-15 11:28:05 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2019-12-12 07:37:35 +00:00
|
|
|
import openPage from '../../helpers/puppeteer';
|
2017-12-15 09:07:52 +00:00
|
|
|
|
2018-11-20 13:22:00 +00:00
|
|
|
describe('Client Add notes path', () => {
|
2019-12-31 11:00:16 +00:00
|
|
|
let page;
|
|
|
|
beforeAll(async() => {
|
|
|
|
page = await openPage();
|
|
|
|
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() => {
|
|
|
|
page.close();
|
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 click on the add note button`, async() => {
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.waitToClick(selectors.clientNotes.addNoteFloatButton);
|
|
|
|
await page.waitForURL('/note/create');
|
|
|
|
const url = await page.parsedUrl();
|
2018-10-30 07:51:18 +00:00
|
|
|
|
2018-11-22 14:44:33 +00:00
|
|
|
expect(url.hash).toContain('/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-01-02 10:37:25 +00:00
|
|
|
await page.waitFor(selectors.clientNotes.noteInput);
|
|
|
|
await page.type(`${selectors.clientNotes.noteInput} textarea`, 'Meeting with Black Widow 21st 9am');
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.waitToClick(selectors.clientNotes.saveButton);
|
|
|
|
const result = await page.waitForLastSnackbar();
|
2018-10-30 07:51:18 +00:00
|
|
|
|
2018-11-20 13:22:00 +00:00
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
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
|
|
|
});
|
|
|
|
});
|