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