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; await page.loginAndModule('employee', 'worker'); 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'); }); });