import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; describe('Ticket Create notes path', () => { let browser; let page; beforeAll(async() => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('employee', 'ticket'); await page.accessToSearchResult('1'); await page.accessToSection('ticket.card.observation'); }); afterAll(async() => { await browser.close(); }); it('should create a new note', async() => { await page.waitToClick(selectors.ticketNotes.addNoteButton); await page.autocompleteSearch(selectors.ticketNotes.firstNoteType, 'observation one'); await page.write(selectors.ticketNotes.firstDescription, 'description'); await page.waitToClick(selectors.ticketNotes.submitNotesButton); const message = await page.waitForSnackbar(); expect(message.type).toBe('success'); }); it('should confirm the note is the expected one', async() => { await page.reloadSection('ticket.card.observation'); const result = await page .waitToGetProperty(selectors.ticketNotes.firstNoteType, 'value'); expect(result).toEqual('observation one'); const firstDescription = await page .waitToGetProperty(selectors.ticketNotes.firstDescription, 'value'); expect(firstDescription).toEqual('description'); }); it('should delete the note', async() => { await page.waitToClick(selectors.ticketNotes.firstNoteRemoveButton); await page.waitToClick(selectors.ticketNotes.submitNotesButton); const message = await page.waitForSnackbar(); expect(message.type).toBe('success'); }); });