import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; describe('Ticket create path', () => { let browser; let page; beforeAll(async() => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('employee', 'ticket'); }); afterAll(async() => { await browser.close(); }); it('should open the new ticket form', async() => { await page.waitToClick(selectors.ticketsIndex.newTicketButton); let url = await page.expectURL('#!/ticket/create'); expect(url).toBe(true); }); it('should succeed to create a ticket', async() => { await page.autocompleteSearch(selectors.createTicketView.client, 'Tony Stark'); await page.autocompleteSearch(selectors.createTicketView.address, 'Tony Stark'); await page.datePicker(selectors.createTicketView.deliveryDate, 1, null); await page.autocompleteSearch(selectors.createTicketView.warehouse, 'Warehouse One'); await page.autocompleteSearch(selectors.createTicketView.agency, 'Silla247'); await page.waitToClick(selectors.createTicketView.createButton); const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should check the url is now the summary of the ticket', async() => { let url = await page.expectURL('/summary'); expect(url).toBe(true); }); });