import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; describe('Ticket create from client path', () => { let browser; let page; beforeAll(async() => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('employee', 'client'); await page.accessToSearchResult('Petter Parker'); }); afterAll(async() => { await browser.close(); }); it('should click the create simple ticket on the descriptor menu', async() => { await page.waitToClick(selectors.clientDescriptor.moreMenu); await page.waitToClick(selectors.clientDescriptor.simpleTicketButton); await page.waitForURL('#!/ticket/create?clientFk=102'); const url = await page.parsedUrl(); expect(url.hash).toContain('clientFk=102'); }); it('should check if the client details are the expected ones', async() => { const client = await page .waitToGetProperty(selectors.createTicketView.clientAutocomplete, 'value'); const address = await page .waitToGetProperty(selectors.createTicketView.addressAutocomplete, 'value'); expect(client).toContain('Petter Parker'); expect(address).toContain('20 Ingram Street'); }); });