diff --git a/e2e/paths/ticket-module/02_delete_ticket_expeditions.spec.js b/e2e/paths/ticket-module/02_delete_ticket_expeditions.spec.js index ba2015511..409a0659c 100644 --- a/e2e/paths/ticket-module/02_delete_ticket_expeditions.spec.js +++ b/e2e/paths/ticket-module/02_delete_ticket_expeditions.spec.js @@ -10,56 +10,47 @@ describe('Ticket', () => { .waitForLogin('production'); }); - it('should access to the tickets index by clicking the tickets button', (done) => { - return nightmare + it('should access to the tickets index by clicking the tickets button', async () => { + const url = await nightmare .click(selectors.moduleAccessView.ticketsSectionButton) .wait(selectors.ticketsIndex.searchResult) - .parsedUrl() - .then((url) => { - expect(url.hash).toEqual('#!/ticket/index'); - done(); - }).catch(done.fail); + .parsedUrl(); + + expect(url.hash).toEqual('#!/ticket/index'); }); - it('should search for the ticket with id 1', (done) => { - return nightmare + it('should search for the ticket with id 1', async () => { + const result = await nightmare .wait(selectors.ticketsIndex.searchTicketInput) .type(selectors.ticketsIndex.searchTicketInput, 'id:1') .click(selectors.ticketsIndex.searchButton) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) - .countElement(selectors.ticketsIndex.searchResult) - .then((result) => { - expect(result).toEqual(1); - done(); - }).catch(done.fail); + .countElement(selectors.ticketsIndex.searchResult); + + expect(result).toEqual(1); }); - it(`should click on the search result to access to the ticket expeditions`, (done) => { - return nightmare + it(`should click on the search result to access to the ticket expeditions`, async () => { + const url = await nightmare .waitForTextInElement(selectors.ticketsIndex.searchResult, '1') .waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketExpedition.expeditionButton) .waitForURL('expedition') - .url() - .then((url) => { - expect(url).toContain('expedition'); - done(); - }).catch(done.fail); + .url(); + + expect(url).toContain('expedition'); }); - it(`should delete a former expedition and confirm the remaining expedition is the expected one`, (done) => { - return nightmare + it(`should delete a former expedition and confirm the remaining expedition are the expected one`, async () => { + const result = await nightmare .waitToClick(selectors.ticketExpedition.secondExpeditionRemoveButton) .click(selectors.ticketPackages.packagesButton) .wait(selectors.ticketPackages.firstPackageSelect) .click(selectors.ticketExpedition.expeditionButton) - .wait(selectors.ticketExpedition.secondExpeditionText) - .getInnerText(selectors.ticketExpedition.secondExpeditionText) - .then((value) => { - expect(value).toContain('Iron Patriot'); - expect(value).toContain('root'); - done(); - }).catch(done.fail); + .wait(selectors.ticketExpedition.expeditionRow) + .countElement(selectors.ticketExpedition.expeditionRow); + + expect(result).toEqual(3); }); }); });