import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; describe('Ticket Edit basic data path', () => { const nightmare = createNightmare(); beforeAll(() => { return nightmare .loginAndModule('employee', 'ticket') .accessToSearchResult(11) .accessToSection('ticket.card.basicData.stepOne'); }); it(`should edit the ticket agency then click next`, async() => { let url = await nightmare .autocompleteSearch(selectors.ticketBasicData.agencyAutocomplete, 'Silla247Expensive') .waitToGetProperty(`${selectors.ticketBasicData.zoneAutocomplete} input`, 'value') .waitToClick(selectors.ticketBasicData.nextStepButton) .waitForURL('data/step-two') .parsedUrl(); expect(url.hash).toContain('data/step-two'); }); it(`should have a price diference`, async() => { const result = await nightmare .waitToGetProperty(selectors.ticketBasicData.stepTwoTotalPriceDif, 'innerText'); expect(result).toContain('-€184.25'); }); it(`should then click next to move on to step three`, async() => { let url = await nightmare .waitToClick(selectors.ticketBasicData.nextStepButton) .waitForURL('data/step-three') .parsedUrl(); expect(url.hash).toContain('data/step-three'); }); it(`should select a new reason for the changes made then click on finalize`, async() => { let url = await nightmare .autocompleteSearch(selectors.ticketBasicData.chargesReasonAutocomplete, 'Cambiar los precios en el ticket') .waitToClick(selectors.ticketBasicData.finalizeButton) .waitForURL('summary') .parsedUrl(); expect(url.hash).toContain('summary'); }); });