2023-03-22 09:21:15 +00:00
|
|
|
import selectors from '../../helpers/selectors';
|
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
|
|
|
|
|
|
|
describe('Worker Add notes path', () => {
|
|
|
|
let browser;
|
|
|
|
let page;
|
|
|
|
beforeAll(async() => {
|
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
2023-04-17 09:52:31 +00:00
|
|
|
await page.loginAndModule('hr', 'worker');
|
2023-03-22 09:21:15 +00:00
|
|
|
await page.accessToSearchResult('Bruce Banner');
|
|
|
|
await page.accessToSection('worker.card.note.index');
|
|
|
|
});
|
|
|
|
|
|
|
|
afterAll(async() => {
|
|
|
|
await browser.close();
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should reach the notes index`, async() => {
|
|
|
|
await page.waitForState('worker.card.note.index');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should click on the add note button`, async() => {
|
|
|
|
await page.waitToClick(selectors.workerNotes.addNoteFloatButton);
|
|
|
|
await page.waitForState('worker.card.note.create');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should create a note`, async() => {
|
|
|
|
await page.waitForSelector(selectors.workerNotes.note);
|
|
|
|
await page.type(`${selectors.workerNotes.note} textarea`, 'Meeting with Black Widow 21st 9am');
|
|
|
|
await page.waitToClick(selectors.workerNotes.saveButton);
|
|
|
|
const message = await page.waitForSnackbar();
|
|
|
|
|
|
|
|
expect(message.text).toContain('Data saved!');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should confirm the note was created', async() => {
|
|
|
|
const result = await page.waitToGetProperty(selectors.workerNotes.firstNoteText, 'innerText');
|
|
|
|
|
|
|
|
expect(result).toEqual('Meeting with Black Widow 21st 9am');
|
|
|
|
});
|
|
|
|
});
|