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 reach the notes index`, async() => { await page.waitForState('client.card.note.index'); }); it(`should click on the add note button`, async() => { await page.waitToClick(selectors.clientNotes.addNoteFloatButton); await page.waitForState('client.card.note.create'); }); it(`should create a note`, async() => { await page.waitFor(selectors.clientNotes.note); await page.type(`${selectors.clientNotes.note} textarea`, 'Meeting with Black Widow 21st 9am'); await page.waitToClick(selectors.clientNotes.saveButton); const message = await page.waitForSnackbar(); expect(message.text).toBe('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'); }); });