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); let url = await page.expectURL('/note/create'); expect(url).toBe(true); }); 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 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'); }); });