salix/e2e/paths/02-client-module/08_add_notes.spec.js

42 lines
1.4 KiB
JavaScript

import selectors from '../../helpers/selectors';
import getBrowser from '../../helpers/puppeteer';
describe('Client Add notes path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('employee', 'client');
await page.accessToSearchResult('Bruce Banner');
await page.accessToSection('client.card.note.index');
});
afterAll(async() => {
await browser.close();
});
it(`should click on the add note button`, async() => {
await page.waitToClick(selectors.clientNotes.addNoteFloatButton);
await page.waitForURL('/note/create');
const url = await page.parsedUrl();
expect(url.hash).toContain('/note/create');
});
it(`should create a note`, async() => {
await page.waitFor(selectors.clientNotes.noteInput);
await page.type(`${selectors.clientNotes.noteInput} textarea`, 'Meeting with Black Widow 21st 9am');
await page.waitToClick(selectors.clientNotes.saveButton);
const result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should confirm the note was created', async() => {
const result = await page.waitToGetProperty(selectors.clientNotes.firstNoteText, 'innerText');
expect(result).toEqual('Meeting with Black Widow 21st 9am');
});
});