From 4f7e56788e81fee14f48aad47de48e15590e5c65 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Tue, 24 Mar 2020 16:49:36 +0100 Subject: [PATCH 1/3] replaced expectURL for waitForState in most cases --- e2e/helpers/extensions.js | 6 ---- e2e/paths/02-client/01_create_client.spec.js | 8 ++--- .../02-client/03_edit_fiscal_data.spec.js | 12 ++------ e2e/paths/02-client/05_add_address.spec.js | 16 +++------- .../02-client/06_add_address_notes.spec.js | 4 +-- e2e/paths/02-client/08_add_notes.spec.js | 8 ++--- e2e/paths/02-client/09_add_credit.spec.js | 4 +-- e2e/paths/02-client/10_add_greuge.spec.js | 4 +-- e2e/paths/02-client/13_log.spec.js | 5 +--- e2e/paths/02-client/14_balance.spec.js | 12 ++------ e2e/paths/02-client/19_summary.spec.js | 4 +-- e2e/paths/03-worker/01_summary.spec.js | 4 +-- e2e/paths/03-worker/04_time_control.spec.js | 8 ++--- e2e/paths/04-item/01_summary.spec.js | 4 +-- e2e/paths/04-item/08_create_and_clone.spec.js | 20 ++++--------- e2e/paths/04-item/09_regularize.spec.js | 28 +++++------------- e2e/paths/04-item/11_item_log.spec.js | 12 ++------ e2e/paths/04-item/13_request.spec.js | 4 +-- e2e/paths/05-ticket/05_tracking_state.spec.js | 8 ++--- .../05-ticket/06_basic_data_steps.spec.js | 8 ++--- e2e/paths/05-ticket/09_weekly.spec.js | 16 +++------- e2e/paths/05-ticket/10_request.spec.js | 5 +--- e2e/paths/05-ticket/11_diary.spec.js | 4 +-- e2e/paths/05-ticket/12_descriptor.spec.js | 20 ++++--------- e2e/paths/05-ticket/14_create_ticket.spec.js | 8 ++--- .../15_create_ticket_from_client.spec.js | 5 +--- e2e/paths/05-ticket/16_summary.spec.js | 8 ++--- e2e/paths/05-ticket/17_log.spec.js | 8 ++--- e2e/paths/06-claim/01_basic_data.spec.js | 4 +-- e2e/paths/06-claim/02_development.spec.js | 4 +-- e2e/paths/06-claim/03_detail.spec.js | 4 +-- e2e/paths/06-claim/05_summary.spec.js | 4 +-- e2e/paths/06-claim/06_descriptor.spec.js | 12 ++------ e2e/paths/07-order/01_summary.spec.js | 4 +-- e2e/paths/07-order/02_basic_data.spec.js | 16 +++------- e2e/paths/07-order/03_lines.spec.js | 7 ++--- e2e/paths/07-order/04_catalog.spec.js | 8 ++--- e2e/paths/08-route/01_summary.spec.js | 4 +-- e2e/paths/08-route/03_create.spec.js | 12 ++------ e2e/paths/09-invoice-out/01_summary.spec.js | 4 +-- .../09-invoice-out/02_descriptor.spec.js | 29 +++++-------------- e2e/paths/10-travel/01_thermograph.spec.js | 8 ++--- .../10-travel/02_basic_data_and_log.spec.js | 8 ++--- e2e/paths/11-zone/01_basic-data.spec.js | 4 +-- e2e/paths/12-entry/01_summary.spec.js | 4 +-- e2e/paths/12-entry/02_descriptor.spec.js | 28 +++++------------- 46 files changed, 105 insertions(+), 312 deletions(-) diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index 1ff0119fd..136a24905 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -416,12 +416,6 @@ let actions = { let builtSelector = await this.selectorFormater(selector); await this.waitToClick(selector); - await this.waitForSelector(selector => { - document - .querySelector(`${selector} vn-drop-down`).$ctrl.content - .querySelectorAll('li'); - }, selector); - await this.write('.vn-drop-down.shown vn-textfield', searchValue); try { diff --git a/e2e/paths/02-client/01_create_client.spec.js b/e2e/paths/02-client/01_create_client.spec.js index 2de38d421..29a27884f 100644 --- a/e2e/paths/02-client/01_create_client.spec.js +++ b/e2e/paths/02-client/01_create_client.spec.js @@ -102,15 +102,11 @@ describe('Client create path', async() => { await page.wait(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.clientsButton); await page.wait(selectors.clientsIndex.createClientButton); - let url = await page.expectURL('#!/client/index'); - - expect(url).toBe(true); + await page.waitForState('lient.index'); }); it(`should search for the user Carol Danvers to confirm it exists`, async() => { await page.accessToSearchResult('Carol Danvers'); - let url = await page.expectURL('#!/client/114/summary'); - - expect(url).toBe(true); + await page.waitForState('client.card.summary'); }); }); diff --git a/e2e/paths/02-client/03_edit_fiscal_data.spec.js b/e2e/paths/02-client/03_edit_fiscal_data.spec.js index 4cd54b87d..10a29cdfa 100644 --- a/e2e/paths/02-client/03_edit_fiscal_data.spec.js +++ b/e2e/paths/02-client/03_edit_fiscal_data.spec.js @@ -36,9 +36,7 @@ describe('Client Edit fiscalData path', () => { it(`should click on the fiscal data button`, async() => { await page.waitToClick(selectors.clientFiscalData.fiscalDataButton); - let url = await page.expectURL('fiscal-data'); - - expect(url).toBe(true); + await page.waitForState('client.card.fiscalData'); }); it('should not be able to edit the verified data checkbox', async() => { @@ -124,9 +122,7 @@ describe('Client Edit fiscalData path', () => { // confirm all addresses have now EQtax checked step 1 it(`should click on the addresses button to access to the client's addresses`, async() => { await page.waitToClick(selectors.clientAddresses.addressesButton); - let url = await page.expectURL('/address/index'); - - expect(url).toBe(true); + await page.waitForState('client.card.address.index'); }); // confirm all addresses have now EQtax checked step 2 @@ -261,9 +257,7 @@ describe('Client Edit fiscalData path', () => { // confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 1 it(`should click on the addresses button to access to the client's addresses`, async() => { await page.waitToClick(selectors.clientAddresses.addressesButton); - let url = await page.expectURL('/address/index'); - - expect(url).toBe(true); + await page.waitForState('client.card.address.index'); }); // confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 2 diff --git a/e2e/paths/02-client/05_add_address.spec.js b/e2e/paths/02-client/05_add_address.spec.js index c9228e1cf..f22798453 100644 --- a/e2e/paths/02-client/05_add_address.spec.js +++ b/e2e/paths/02-client/05_add_address.spec.js @@ -18,9 +18,7 @@ describe('Client Add address path', () => { it(`should click on the add new address button to access to the new address form`, async() => { await page.waitToClick(selectors.clientAddresses.createAddress); - let url = await page.expectURL('address/create'); - - expect(url).toBe(true); + await page.waitForState('client.card.address.create'); }); it('should receive an error after clicking save button as consignee, street and town fields are empty', async() => { @@ -72,9 +70,7 @@ describe('Client Add address path', () => { }); it(`should navigate back to the addresses index`, async() => { - let url = await page.expectURL('/address/index'); - - expect(url).toBe(true); + await page.waitForState('client.card.address.index'); }); it(`should confirm the new address exists and it's the default one`, async() => { @@ -101,9 +97,7 @@ describe('Client Add address path', () => { it(`should click on the edit icon of the default address`, async() => { await page.waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand'); await page.waitToClick(selectors.clientAddresses.firstEditAddress); - let url = await page.expectURL('/edit'); - - expect(url).toBe(true); + await page.waitForState('client.card.address.edit'); }); it(`should click on the active checkbox and receive an error to save it because it is the default address`, async() => { @@ -119,8 +113,6 @@ describe('Client Add address path', () => { await page.waitForSelector('#shapes .shown', {hidden: true}); await page.waitToClick(selectors.clientAddresses.cancelEditAddressButton); await page.waitToClick('.vn-confirm.shown button[response="accept"]'); - let url = await page.expectURL('address/index'); - - expect(url).toBe(true); + await page.waitForState('client.card.address.index'); }); }); diff --git a/e2e/paths/02-client/06_add_address_notes.spec.js b/e2e/paths/02-client/06_add_address_notes.spec.js index 58a949698..abfa1ae34 100644 --- a/e2e/paths/02-client/06_add_address_notes.spec.js +++ b/e2e/paths/02-client/06_add_address_notes.spec.js @@ -19,9 +19,7 @@ describe('Client add address notes path', () => { it(`should click on the edit icon of the default address`, async() => { await page.waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street'); await page.waitToClick(selectors.clientAddresses.firstEditAddress); - let url = await page.expectURL('/edit'); - - expect(url).toBe(true); + await page.waitForState('client.card.address.edit'); }); it('should not save a description without observation type', async() => { diff --git a/e2e/paths/02-client/08_add_notes.spec.js b/e2e/paths/02-client/08_add_notes.spec.js index b759cbd07..3d6a8a915 100644 --- a/e2e/paths/02-client/08_add_notes.spec.js +++ b/e2e/paths/02-client/08_add_notes.spec.js @@ -17,16 +17,12 @@ describe('Client Add notes path', () => { }); it(`should reach the notes index`, async() => { - let url = await page.expectURL('/note'); - - expect(url).toBe(true); + await page.waitForState('client.card.note.index'); }); it(`should click on the add note button`, async() => { await page.waitToClick(selectors.clientNotes.addNoteFloatButton); - let url = await page.expectURL('/note/create'); - - expect(url).toBe(true); + await page.waitForState('client.card.note.create'); }); it(`should create a note`, async() => { diff --git a/e2e/paths/02-client/09_add_credit.spec.js b/e2e/paths/02-client/09_add_credit.spec.js index 05c50e809..639d850f6 100644 --- a/e2e/paths/02-client/09_add_credit.spec.js +++ b/e2e/paths/02-client/09_add_credit.spec.js @@ -18,9 +18,7 @@ describe('Client Add credit path', () => { it(`should click on the add credit button`, async() => { await page.waitToClick(selectors.clientCredit.addCreditFloatButton); - let url = await page.expectURL('/credit/create'); - - expect(url).toBe(true); + await page.waitForState('client.card.credit.create'); }); it(`should edit the credit`, async() => { diff --git a/e2e/paths/02-client/10_add_greuge.spec.js b/e2e/paths/02-client/10_add_greuge.spec.js index c934a42f1..1dda319be 100644 --- a/e2e/paths/02-client/10_add_greuge.spec.js +++ b/e2e/paths/02-client/10_add_greuge.spec.js @@ -18,9 +18,7 @@ describe('Client Add greuge path', () => { it(`should click on the add greuge button`, async() => { await page.waitToClick(selectors.clientGreuge.addGreugeFloatButton); - let url = await page.expectURL('greuge/create'); - - expect(url).toBe(true); + await page.waitForState('client.card.greuge.create'); }); it(`should receive an error if all fields are empty but date and type on submit`, async() => { diff --git a/e2e/paths/02-client/13_log.spec.js b/e2e/paths/02-client/13_log.spec.js index 462d66347..fc4b98b8b 100644 --- a/e2e/paths/02-client/13_log.spec.js +++ b/e2e/paths/02-client/13_log.spec.js @@ -27,9 +27,7 @@ describe('Client log path', () => { it('should navigate to the log section', async() => { await page.waitToClick(selectors.clientLog.logButton); - let url = await page.expectURL('log'); - - expect(url).toBe(true); + await page.waitForState('client.card.log'); }); it('should check the previous value of the last logged change', async() => { @@ -46,7 +44,6 @@ describe('Client log path', () => { let lastModificationCurrentValue = await page. waitToGetProperty(selectors.clientLog.lastModificationCurrentValue, 'innerText'); - expect(lastModificationPreviousValue).toEqual('name: DavidCharlesHaller'); expect(lastModificationCurrentValue).toEqual('name: this is a test'); }); diff --git a/e2e/paths/02-client/14_balance.spec.js b/e2e/paths/02-client/14_balance.spec.js index ef7930c8d..87dc84a8e 100644 --- a/e2e/paths/02-client/14_balance.spec.js +++ b/e2e/paths/02-client/14_balance.spec.js @@ -41,9 +41,7 @@ describe('Client balance path', () => { it('should click the new payment button', async() => { await page.closePopup(); await page.reloadSection('client.card.balance.index'); - let url = await page.expectURL('/balance'); - - expect(url).toBe(true); + await page.waitForState('client.card.balance.index'); }); it('should create a new payment that clears the debt', async() => { @@ -110,17 +108,13 @@ describe('Client balance path', () => { await page.wait(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.clientsButton); await page.wait(selectors.clientsIndex.createClientButton); - let url = await page.expectURL('#!/client/index'); - - expect(url).toBe(true); + await page.waitForState('client.index'); }); it('should now search for the user Petter Parker', async() => { await page.accessToSearchResult('Petter Parker'); await page.waitToClick(selectors.clientBalance.balanceButton); - let url = await page.expectURL('/balance'); - - expect(url).toBe(true); + await page.waitForState('client.card.balance.index'); }); it('should not be able to click the new payment button as it isnt present', async() => { diff --git a/e2e/paths/02-client/19_summary.spec.js b/e2e/paths/02-client/19_summary.spec.js index 11b5a298e..ab39154cf 100644 --- a/e2e/paths/02-client/19_summary.spec.js +++ b/e2e/paths/02-client/19_summary.spec.js @@ -17,9 +17,7 @@ describe('Client summary path', () => { }); it('should reach the first route summary section', async() => { - let url = await page.expectURL('#!/client/102/summary'); - - expect(url).toBe(true); + await page.waitForState('client.card.summary'); }); it('should display details from the client on the header', async() => { diff --git a/e2e/paths/03-worker/01_summary.spec.js b/e2e/paths/03-worker/01_summary.spec.js index 86a95eee3..4ea87481a 100644 --- a/e2e/paths/03-worker/01_summary.spec.js +++ b/e2e/paths/03-worker/01_summary.spec.js @@ -16,9 +16,7 @@ describe('Worker summary path', () => { }); it('should reach the employee summary section', async() => { - const url = await page.expectURL('#!/worker/3/summary'); - - expect(url).toBe(true); + await page.waitForState('worker.card.summary'); }); it('should check the summary contains the name and userName on the header', async() => { diff --git a/e2e/paths/03-worker/04_time_control.spec.js b/e2e/paths/03-worker/04_time_control.spec.js index 36aaca61e..36340e880 100644 --- a/e2e/paths/03-worker/04_time_control.spec.js +++ b/e2e/paths/03-worker/04_time_control.spec.js @@ -316,16 +316,12 @@ describe('Worker time control path', () => { it('should search for a worker and access to its summary', async() => { await page.accessToSearchResult('HankPym'); - let url = await page.expectURL('/summary'); - - expect(url).toBe(true); + await page.waitForState('worker.card.summary'); }); it('should access to the time control section', async() => { await page.accessToSection('worker.card.timeControl'); - let url = await page.expectURL('/time-control'); - - expect(url).toBe(true); + await page.waitForState('worker.card.timeControl'); }); it('should lovingly scan in Hank Pym', async() => { diff --git a/e2e/paths/04-item/01_summary.spec.js b/e2e/paths/04-item/01_summary.spec.js index 6fd4e9c13..6f2c2c926 100644 --- a/e2e/paths/04-item/01_summary.spec.js +++ b/e2e/paths/04-item/01_summary.spec.js @@ -103,9 +103,7 @@ describe('Item summary path', () => { it(`should navigate to the one of the items detailed section`, async() => { await page.accessToSearchResult('Melee weapon combat fist 15cm'); - let url = await page.expectURL('summary'); - - expect(url).toBe(true); + await page.waitForState('item.card.summary'); }); it(`should check the descritor edit button is not visible for employee`, async() => { diff --git a/e2e/paths/04-item/08_create_and_clone.spec.js b/e2e/paths/04-item/08_create_and_clone.spec.js index d06ef4682..73249a0b9 100644 --- a/e2e/paths/04-item/08_create_and_clone.spec.js +++ b/e2e/paths/04-item/08_create_and_clone.spec.js @@ -27,23 +27,17 @@ describe('Item Create/Clone path', () => { it('should access to the create item view by clicking the create floating button', async() => { await page.waitToClick(selectors.itemsIndex.createItemButton); - let url = await page.expectURL('#!/item/create'); - - expect(url).toBe(true); + await page.waitForState('item.create'); }); it('should return to the item index by clickig the cancel button', async() => { await page.waitToClick(selectors.itemCreateView.cancelButton); - let url = await page.expectURL('#!/item/index'); - - expect(url).toBe(true); + await page.waitForState('item.index'); }); it('should now access to the create item view by clicking the create floating button', async() => { await page.waitToClick(selectors.itemsIndex.createItemButton); - let url = await page.expectURL('#!/item/create'); - - expect(url).toBe(true); + await page.waitForState('item.create'); }); it('should create the Infinity Gauntlet item', async() => { @@ -87,9 +81,7 @@ describe('Item Create/Clone path', () => { it('should return to the items index by clicking the return to items button', async() => { await page.waitToClick(selectors.itemBasicData.goToItemIndexButton); await page.wait(selectors.itemsIndex.createItemButton); - let url = await page.expectURL('#!/item/index'); - - expect(url).toBe(true); + await page.waitForState('item.index'); }); it(`should search for the item Infinity Gauntlet`, async() => { @@ -106,9 +98,7 @@ describe('Item Create/Clone path', () => { await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Infinity Gauntlet'); await page.waitToClick(selectors.itemsIndex.searchResultCloneButton); await page.waitToClick(selectors.itemsIndex.acceptClonationAlertButton); - let url = await page.expectURL('tags'); - - expect(url).toBe(true); + await page.waitForState('item.tags'); }); it('should search for the item Infinity Gauntlet and find two', async() => { diff --git a/e2e/paths/04-item/09_regularize.spec.js b/e2e/paths/04-item/09_regularize.spec.js index 18f182e74..a37d97fa3 100644 --- a/e2e/paths/04-item/09_regularize.spec.js +++ b/e2e/paths/04-item/09_regularize.spec.js @@ -34,9 +34,7 @@ describe('Item regularize path', () => { it('should search for an specific item', async() => { await page.accessToSearchResult('Ranged weapon pistol 9mm'); - let url = await page.expectURL('/summary'); - - expect(url).toBe(true); + await page.waitForState('item.card.summary'); }); it('should open the regularize dialog and check the warehouse matches the local user settings', async() => { @@ -63,9 +61,7 @@ describe('Item regularize path', () => { page.waitForNavigation({waitUntil: ['load', 'networkidle0', 'domcontentloaded']}), page.waitToClick(selectors.globalItems.ticketsButton) ]); - let url = await page.expectURL('#!/ticket/index'); - - expect(url).toBe(true); + await page.waitForState('ticket.index'); }); it('should clear the user local settings now', async() => { @@ -80,9 +76,7 @@ describe('Item regularize path', () => { it('should search for the ticket with alias missing', async() => { await page.keyboard.press('Escape'); await page.accessToSearchResult('missing'); - let url = await page.expectURL('/summary'); - - expect(url).toBe(true); + await page.waitForState('ticket.card.summary'); }); it(`should check the ticket sale quantity is showing a negative value`, async() => { @@ -104,16 +98,12 @@ describe('Item regularize path', () => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); await page.wait(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.itemsButton); - let url = await page.expectURL('#!/item/index'); - - expect(url).toBe(true); + await page.waitForState('item.index'); }); it('should search for the item once again', async() => { await page.accessToSearchResult('Ranged weapon pistol 9mm'); - let url = await page.expectURL('/summary'); - - expect(url).toBe(true); + await page.waitForState('item.card.summary'); }); it('should regularize the item once more', async() => { @@ -135,16 +125,12 @@ describe('Item regularize path', () => { page.waitToClick(selectors.globalItems.ticketsButton) ]); await page.waitForTransitionEnd('vn-searchbar'); - let url = await page.expectURL('#!/ticket/index'); - - expect(url).toBe(true); + await page.waitForState('ticket.index'); }); it('should search for the ticket with id 25 once again', async() => { await page.accessToSearchResult('25'); - let url = await page.expectURL('/summary'); - - expect(url).toBe(true); + await page.waitForState('ticket.card.summary'); }); it(`should check the ticket contains now two sales`, async() => { diff --git a/e2e/paths/04-item/11_item_log.spec.js b/e2e/paths/04-item/11_item_log.spec.js index 213365c12..82800b9b8 100644 --- a/e2e/paths/04-item/11_item_log.spec.js +++ b/e2e/paths/04-item/11_item_log.spec.js @@ -25,9 +25,7 @@ describe('Item log path', () => { it('should access to the create item view by clicking the create floating button', async() => { await page.waitToClick(selectors.itemsIndex.createItemButton); - let url = await page.expectURL('#!/item/create'); - - expect(url).toBe(true); + await page.waitForState('item.create'); }); it('should create the Knowledge artifact item', async() => { @@ -44,17 +42,13 @@ describe('Item log path', () => { it('should return to the items index by clicking the return to items button', async() => { await page.waitToClick(selectors.itemBasicData.goToItemIndexButton); await page.wait(selectors.itemsIndex.createItemButton); - let url = await page.expectURL('#!/item/index'); - - expect(url).toBe(true); + await page.waitForState('item.index'); }); it(`should search for the created item and navigate to it's log section`, async() => { await page.accessToSearchResult('Knowledge artifact'); await page.accessToSection('item.card.log'); - let url = await page.expectURL('/log'); - - expect(url).toBe(true); + await page.waitForState('item.card.log'); }); it(`should confirm the log is showing 5 entries`, async() => { diff --git a/e2e/paths/04-item/13_request.spec.js b/e2e/paths/04-item/13_request.spec.js index d6aecbb48..2deabb20b 100644 --- a/e2e/paths/04-item/13_request.spec.js +++ b/e2e/paths/04-item/13_request.spec.js @@ -16,9 +16,7 @@ describe('Item request path', () => { }); it('should reach the item request section', async() => { - const result = await page.expectURL('/item/request'); - - expect(result).toBe(true); + await page.waitForState('item.request'); }); it('should fill the id and quantity then check the concept was updated', async() => { diff --git a/e2e/paths/05-ticket/05_tracking_state.spec.js b/e2e/paths/05-ticket/05_tracking_state.spec.js index 108e8776f..2623966be 100644 --- a/e2e/paths/05-ticket/05_tracking_state.spec.js +++ b/e2e/paths/05-ticket/05_tracking_state.spec.js @@ -21,9 +21,7 @@ describe('Ticket Create new tracking state path', () => { it('should access to the create state view by clicking the create floating button', async() => { await page.waitToClick(selectors.ticketTracking.createStateButton); await page.waitForSelector(selectors.createStateView.state, {visible: true}); - let url = await page.expectURL('tracking/edit'); - - expect(url).toBe(true); + await page.waitForState('ticket.card.tracking.edit'); }); it(`should attempt create a new state but receive an error if state is empty`, async() => { @@ -51,9 +49,7 @@ describe('Ticket Create new tracking state path', () => { it('should now access to the create state view by clicking the create floating button', async() => { await page.waitToClick(selectors.ticketTracking.createStateButton); - let url = await page.expectURL('tracking/edit'); - - expect(url).toBe(true); + await page.waitForState('ticket.card.tracking.edit'); }); it(`should attemp to create an state for which salesPerson doesn't have permissions`, async() => { diff --git a/e2e/paths/05-ticket/06_basic_data_steps.spec.js b/e2e/paths/05-ticket/06_basic_data_steps.spec.js index de78b9fa7..3191673a5 100644 --- a/e2e/paths/05-ticket/06_basic_data_steps.spec.js +++ b/e2e/paths/05-ticket/06_basic_data_steps.spec.js @@ -68,9 +68,7 @@ describe('Ticket Edit basic data path', () => { it(`should click next`, async() => { await page.waitToClick(selectors.ticketBasicData.nextStepButton); - let url = await page.expectURL('data/step-two'); - - expect(url).toBe(true); + await page.waitForState('ticket.card.basicData.stepTwo'); }); it(`should have a price diference`, async() => { @@ -83,8 +81,6 @@ describe('Ticket Edit basic data path', () => { it(`should select a new reason for the changes made then click on finalize`, async() => { await page.waitToClick(selectors.ticketBasicData.chargesReason); await page.waitToClick(selectors.ticketBasicData.finalizeButton); - let url = await page.expectURL('summary'); - - expect(url).toBe(true); + await page.waitForState('ticket.card.summary'); }); }); diff --git a/e2e/paths/05-ticket/09_weekly.spec.js b/e2e/paths/05-ticket/09_weekly.spec.js index 9213afd1d..1629107fb 100644 --- a/e2e/paths/05-ticket/09_weekly.spec.js +++ b/e2e/paths/05-ticket/09_weekly.spec.js @@ -41,9 +41,7 @@ describe('Ticket descriptor path', () => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); await page.wait(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.ticketsButton); - let url = await page.expectURL('#!/ticket/index'); - - expect(url).toBe(true); + await page.waitForState('ticket.index'); }); it('should confirm the ticket 11 was added to thursday', async() => { @@ -57,16 +55,12 @@ describe('Ticket descriptor path', () => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); await page.wait(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.ticketsButton); - let url = await page.expectURL('#!/ticket/index'); - - expect(url).toBe(true); + await page.waitForState('ticket.index'); }); it('should now search for the ticket 11', async() => { await page.accessToSearchResult('11'); - let url = await page.expectURL('/summary'); - - expect(url).toBe(true); + await page.waitForState('ticket.card.summary'); }); it('should add the ticket to saturday turn using the descriptor more menu', async() => { @@ -82,9 +76,7 @@ describe('Ticket descriptor path', () => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); await page.wait(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.ticketsButton); - let url = await page.expectURL('#!/ticket/index'); - - expect(url).toBe(true); + await page.waitForState('ticket.index'); }); it('should confirm the ticket 11 was added on saturday', async() => { diff --git a/e2e/paths/05-ticket/10_request.spec.js b/e2e/paths/05-ticket/10_request.spec.js index 737d69048..2bb0cbb73 100644 --- a/e2e/paths/05-ticket/10_request.spec.js +++ b/e2e/paths/05-ticket/10_request.spec.js @@ -30,13 +30,10 @@ describe('Ticket purchase request path', () => { }); it('should have been redirected to the request index', async() => { - let url = await page.expectURL('/request'); - - expect(url).toBe(true); + await page.waitForState('ticket.card.request.index'); }); it(`should edit the third request quantity as it's state is still new`, async() => { - await page.waitFor(2000); // looks like it needs more than a single second some times to load await page.write(selectors.ticketRequests.thirdRequestQuantity, '9'); await page.keyboard.press('Enter'); const result = await page.waitForLastSnackbar(); diff --git a/e2e/paths/05-ticket/11_diary.spec.js b/e2e/paths/05-ticket/11_diary.spec.js index b529ee1ff..5e900fd25 100644 --- a/e2e/paths/05-ticket/11_diary.spec.js +++ b/e2e/paths/05-ticket/11_diary.spec.js @@ -28,7 +28,7 @@ xdescribe('Ticket diary path', () => { it(`should click on the search result to access to the ticket summary`, async() => { await page.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Bat cave'); await page.waitToClick(selectors.ticketsIndex.searchResult); - let url = await page.expectURL('/summary'); + let url = await page.expectURL('/summary'); // use waitForState instead expect(url).toBe(true); }); @@ -37,7 +37,7 @@ xdescribe('Ticket diary path', () => { await page.waitToClick(selectors.ticketSummary.firstSaleItemId); await page.waitForTransitionEnd('.vn-popover'); await page.waitToClick(selectors.ticketSummary.popoverDiaryButton); - let url = await page.expectURL('/diary'); + let url = await page.expectURL('/diary'); // use waitForState instead expect(url).toBe(true); }); diff --git a/e2e/paths/05-ticket/12_descriptor.spec.js b/e2e/paths/05-ticket/12_descriptor.spec.js index 0302b9c86..ce9f064dd 100644 --- a/e2e/paths/05-ticket/12_descriptor.spec.js +++ b/e2e/paths/05-ticket/12_descriptor.spec.js @@ -18,9 +18,7 @@ describe('Ticket descriptor path', () => { describe('Delete ticket', () => { it('should search for an specific ticket', async() => { await page.accessToSearchResult('18'); - let url = await page.expectURL('/summary'); - - expect(url).toBe(true); + await page.waitForState('ticket.card.summary'); }); it(`should update the shipped hour using the descriptor menu`, async() => { @@ -50,9 +48,7 @@ describe('Ticket descriptor path', () => { }); it('should have been relocated to the ticket index', async() => { - let url = await page.expectURL('#!/ticket/index'); - - expect(url).toBe(true); + await page.waitForState('ticket.index'); }); it(`should search for the deleted ticket and check it's date`, async() => { @@ -68,9 +64,7 @@ describe('Ticket descriptor path', () => { describe('add stowaway', () => { it('should search for a ticket', async() => { await page.accessToSearchResult('16'); - let url = await page.expectURL('/summary'); - - expect(url).toBe(true); + await page.waitForState('ticket.card.summary'); }); it('should open the add stowaway dialog', async() => { @@ -101,9 +95,7 @@ describe('Ticket descriptor path', () => { it(`should navigate back to the added ticket using the descriptors ship button`, async() => { await page.waitToClick(selectors.ticketDescriptor.shipButton); - let url = await page.expectURL('#!/ticket/17/summary'); - - expect(url).toBe(true); + await page.waitForState('ticket.card.summary'); }); it('should delete the stowaway', async() => { @@ -127,9 +119,7 @@ describe('Ticket descriptor path', () => { await page.loginAndModule('adminBoss', 'ticket'); await page.accessToSearchResult(invoiceableTicketId); - let url = await page.expectURL(`ticket/${invoiceableTicketId}/summary`); - - expect(url).toBe(true); + await page.waitForState('ticket.card.summary'); }); it(`should make sure the ticket doesn't have an invoiceOutFk yet`, async() => { diff --git a/e2e/paths/05-ticket/14_create_ticket.spec.js b/e2e/paths/05-ticket/14_create_ticket.spec.js index c44125120..176e89930 100644 --- a/e2e/paths/05-ticket/14_create_ticket.spec.js +++ b/e2e/paths/05-ticket/14_create_ticket.spec.js @@ -17,9 +17,7 @@ describe('Ticket create path', () => { 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); + await page.waitForState('ticket.create'); }); it('should succeed to create a ticket', async() => { @@ -38,8 +36,6 @@ describe('Ticket create path', () => { }); it('should check the url is now the summary of the ticket', async() => { - let url = await page.expectURL('/summary'); - - expect(url).toBe(true); + await page.waitForState('ticket.card.summary'); }); }); diff --git a/e2e/paths/05-ticket/15_create_ticket_from_client.spec.js b/e2e/paths/05-ticket/15_create_ticket_from_client.spec.js index 28c11de3a..a68ce894e 100644 --- a/e2e/paths/05-ticket/15_create_ticket_from_client.spec.js +++ b/e2e/paths/05-ticket/15_create_ticket_from_client.spec.js @@ -19,9 +19,7 @@ describe('Ticket create from client path', () => { it('should click the create simple ticket on the descriptor menu', async() => { await page.waitToClick(selectors.clientDescriptor.moreMenu); await page.waitToClick(selectors.clientDescriptor.simpleTicketButton); - let url = await page.expectURL('clientFk=102'); - - expect(url).toBe(true); + await page.waitForState('ticket.create'); }); it('should check if the client details are the expected ones', async() => { @@ -31,7 +29,6 @@ describe('Ticket create from client path', () => { const address = await page .waitToGetProperty(selectors.createTicketView.address, 'value'); - expect(client).toContain('Petter Parker'); expect(address).toContain('20 Ingram Street'); }); diff --git a/e2e/paths/05-ticket/16_summary.spec.js b/e2e/paths/05-ticket/16_summary.spec.js index e7c6507d7..7ead648a2 100644 --- a/e2e/paths/05-ticket/16_summary.spec.js +++ b/e2e/paths/05-ticket/16_summary.spec.js @@ -18,9 +18,7 @@ describe('Ticket Summary path', () => { it('should navigate to the target ticket summary section', async() => { await page.loginAndModule('employee', 'ticket'); await page.accessToSearchResult(ticketId); - let url = await page.expectURL('/summary'); - - expect(url).toBe(true); + await page.waitForState('ticket.card.summary'); }); it(`should display details from the ticket and it's client on the top of the header`, async() => { @@ -75,9 +73,7 @@ describe('Ticket Summary path', () => { it('should log in as production then navigate to the summary of the same ticket', async() => { await page.loginAndModule('production', 'ticket'); await page.accessToSearchResult(ticketId); - let url = await page.expectURL('/summary'); - - expect(url).toBe(true); + await page.waitForState('ticket.card.summary'); }); it('should click on the SET OK button', async() => { diff --git a/e2e/paths/05-ticket/17_log.spec.js b/e2e/paths/05-ticket/17_log.spec.js index 2008d022e..c677d2e62 100644 --- a/e2e/paths/05-ticket/17_log.spec.js +++ b/e2e/paths/05-ticket/17_log.spec.js @@ -19,9 +19,7 @@ describe('Ticket log path', () => { await page.loginAndModule('employee', 'ticket'); await page.accessToSearchResult(ticketId); await page.accessToSection('ticket.card.observation'); - let url = await page.expectURL('/observation'); - - expect(url).toBe(true); + await page.waitForState('ticket.card.observation'); }); it('should create a new note for the test', async() => { @@ -36,9 +34,7 @@ describe('Ticket log path', () => { it('should navigate to the log section', async() => { await page.accessToSection('ticket.card.log'); - let url = await page.expectURL('/log'); - - expect(url).toBe(true); + await page.waitForState('ticket.card.log'); }); it('should set the viewport width to 1920 to see the table full width', async() => { diff --git a/e2e/paths/06-claim/01_basic_data.spec.js b/e2e/paths/06-claim/01_basic_data.spec.js index 2eb35b078..222cb558b 100644 --- a/e2e/paths/06-claim/01_basic_data.spec.js +++ b/e2e/paths/06-claim/01_basic_data.spec.js @@ -31,9 +31,7 @@ describe('Claim edit basic data path', () => { }); it(`should have been redirected to the next section of claims as the role is salesAssistant`, async() => { - let url = await page.expectURL('/detail'); - - expect(url).toBe(true); + await page.waitForState('claim.card.detail'); }); it('should confirm the claim state was edited', async() => { diff --git a/e2e/paths/06-claim/02_development.spec.js b/e2e/paths/06-claim/02_development.spec.js index 346f88581..970a801ee 100644 --- a/e2e/paths/06-claim/02_development.spec.js +++ b/e2e/paths/06-claim/02_development.spec.js @@ -32,9 +32,7 @@ describe('Claim development', () => { }); it(`should redirect to the next section of claims as the role is salesAssistant`, async() => { - let url = await page.expectURL('/action'); - - expect(url).toBe(true); + await page.waitForState('claim.card.action'); }); it('should edit a development', async() => { diff --git a/e2e/paths/06-claim/03_detail.spec.js b/e2e/paths/06-claim/03_detail.spec.js index cf758919e..93d2cba4c 100644 --- a/e2e/paths/06-claim/03_detail.spec.js +++ b/e2e/paths/06-claim/03_detail.spec.js @@ -56,7 +56,7 @@ xdescribe('Claim detail', () => { await page.loginAndModule('salesAssistant', 'claim'); await page.accessToSearchResult('1'); await page.accessToSection('claim.card.detail'); - let url = await page.expectURL('/detail'); + let url = await page.expectURL('/detail'); // replace with waitForState expect(url).toBe(true); }); @@ -99,7 +99,7 @@ xdescribe('Claim detail', () => { }); it(`should have been redirected to the next section in claims`, async() => { - let url = await page.expectURL('development'); + let url = await page.expectURL('development'); // replace with waitForState expect(url).toBe(true); }); diff --git a/e2e/paths/06-claim/05_summary.spec.js b/e2e/paths/06-claim/05_summary.spec.js index 9dab65954..c63e686cb 100644 --- a/e2e/paths/06-claim/05_summary.spec.js +++ b/e2e/paths/06-claim/05_summary.spec.js @@ -18,9 +18,7 @@ describe('claim Summary path', () => { it('should navigate to the target claim summary section', async() => { await page.loginAndModule('employee', 'claim'); await page.accessToSearchResult(claimId); - let url = await page.expectURL('/summary'); - - expect(url).toBe(true); + await page.waitForState('claim.card.summary'); }); it(`should display details from the claim and it's client on the top of the header`, async() => { diff --git a/e2e/paths/06-claim/06_descriptor.spec.js b/e2e/paths/06-claim/06_descriptor.spec.js index 104f63945..ee49fe245 100644 --- a/e2e/paths/06-claim/06_descriptor.spec.js +++ b/e2e/paths/06-claim/06_descriptor.spec.js @@ -18,9 +18,7 @@ describe('claim Descriptor path', () => { it('should now navigate to the target claim summary section', async() => { await page.loginAndModule('employee', 'claim'); await page.accessToSearchResult(claimId); - let url = await page.expectURL('/summary'); - - expect(url).toBe(true); + await page.waitForState('claim.card.summary'); }); it(`should not be able to see the delete claim button of the descriptor more menu`, async() => { @@ -31,9 +29,7 @@ describe('claim Descriptor path', () => { it(`should log in as salesAssistant and navigate to the target claim`, async() => { await page.loginAndModule('salesAssistant', 'claim'); await page.accessToSearchResult(claimId); - let url = await page.expectURL('/summary'); - - expect(url).toBe(true); + await page.waitForState('claim.card.summary'); }); it(`should be able to see the delete claim button of the descriptor more menu`, async() => { @@ -50,9 +46,7 @@ describe('claim Descriptor path', () => { }); it(`should have been relocated to the claim index`, async() => { - let url = await page.expectURL('/claim/index'); - - expect(url).toBe(true); + await page.waitForState('claim.index'); }); it(`should search for the deleted claim to find no results`, async() => { diff --git a/e2e/paths/07-order/01_summary.spec.js b/e2e/paths/07-order/01_summary.spec.js index cba56bf70..f4bc44827 100644 --- a/e2e/paths/07-order/01_summary.spec.js +++ b/e2e/paths/07-order/01_summary.spec.js @@ -16,9 +16,7 @@ describe('Order summary path', () => { }); it('should reach the order summary section', async() => { - const url = await page.expectURL('#!/order/16/summary'); - - expect(url).toBe(true); + await page.waitForState('order.card.summary'); }); it('should check the summary contains the order id', async() => { diff --git a/e2e/paths/07-order/02_basic_data.spec.js b/e2e/paths/07-order/02_basic_data.spec.js index 733ccaa1a..d7bd01208 100644 --- a/e2e/paths/07-order/02_basic_data.spec.js +++ b/e2e/paths/07-order/02_basic_data.spec.js @@ -39,9 +39,7 @@ describe('Order edit basic data path', () => { await page.accessToSearchResult(orderId); await page.accessToSection('order.card.basicData'); await page.waitForSelector(selectors.orderBasicData.observation, {visible: true}); - let url = await page.expectURL(`#!/order/${orderId}/basic-data`); - - expect(url).toBe(true); + await page.waitForState('order.card.basicData'); }); it('should not be able to change anything', async() => { @@ -59,9 +57,7 @@ describe('Order edit basic data path', () => { await page.waitToClick(selectors.orderBasicData.acceptButton); await page.waitForContentLoaded(); await page.waitToClick(selectors.ordersIndex.createOrderButton); - let url = await page.expectURL('#!/order/create'); - - expect(url).toBe(true); + await page.waitForState('order.create'); }); it('should now create a new one', async() => { @@ -69,16 +65,12 @@ describe('Order edit basic data path', () => { await page.pickDate(selectors.createOrderView.landedDatePicker); await page.autocompleteSearch(selectors.createOrderView.agency, 'Other agency'); await page.waitToClick(selectors.createOrderView.createButton); - let url = await page.expectURL('/catalog'); - - expect(url).toBe(true); + await page.waitForState('order.card.catalog'); }); it('should navigate to the basic data section of the new order', async() => { await page.accessToSection('order.card.basicData'); - let url = await page.expectURL('/basic-data'); - - expect(url).toBe(true); + await page.waitForState('order.card.basicData'); }); it('should be able to modify all the properties', async() => { diff --git a/e2e/paths/07-order/03_lines.spec.js b/e2e/paths/07-order/03_lines.spec.js index 21fceac44..450e1b9c9 100644 --- a/e2e/paths/07-order/03_lines.spec.js +++ b/e2e/paths/07-order/03_lines.spec.js @@ -41,10 +41,7 @@ describe('Order lines', () => { it('should confirm the whole order and redirect to ticket index filtered by clientFk', async() => { await page.waitToClick(selectors.orderLine.confirmOrder); - let hashPartOne = await page.expectURL('ticket/index'); - let hashPartTwo = await page.expectURL('clientFk'); - - expect(hashPartOne).toBe(true); - expect(hashPartTwo).toBe(true); + await page.expectURL('ticket/index'); + await page.expectURL('clientFk'); }); }); diff --git a/e2e/paths/07-order/04_catalog.spec.js b/e2e/paths/07-order/04_catalog.spec.js index 8c3106f6c..0db313088 100644 --- a/e2e/paths/07-order/04_catalog.spec.js +++ b/e2e/paths/07-order/04_catalog.spec.js @@ -17,9 +17,7 @@ describe('Order catalog', () => { it('should open the create new order form', async() => { await page.waitToClick(selectors.ordersIndex.createOrderButton); - let url = await page.expectURL('order/create'); - - expect(url).toBe(true); + await page.waitForState('order.create'); }); it('should create a new order', async() => { @@ -27,9 +25,7 @@ describe('Order catalog', () => { await page.pickDate(selectors.createOrderView.landedDatePicker); await page.autocompleteSearch(selectors.createOrderView.agency, 'Other agency'); await page.waitToClick(selectors.createOrderView.createButton); - let url = await page.expectURL('/catalog'); - - expect(url).toBe(true); + await page.waitForState('order.card.catalog'); }); it('should add the realm and type filters and obtain results', async() => { diff --git a/e2e/paths/08-route/01_summary.spec.js b/e2e/paths/08-route/01_summary.spec.js index c062b9b08..02cc71f2f 100644 --- a/e2e/paths/08-route/01_summary.spec.js +++ b/e2e/paths/08-route/01_summary.spec.js @@ -17,9 +17,7 @@ describe('Route summary path', () => { }); it('should reach the first route summary section', async() => { - let url = await page.expectURL('#!/route/1/summary'); - - expect(url).toBe(true); + await page.waitForState('route.card.summary'); }); it(`should display details from the route on the header`, async() => { diff --git a/e2e/paths/08-route/03_create.spec.js b/e2e/paths/08-route/03_create.spec.js index c929e647f..dafccff7f 100644 --- a/e2e/paths/08-route/03_create.spec.js +++ b/e2e/paths/08-route/03_create.spec.js @@ -19,9 +19,7 @@ describe('Route create path', () => { it('should click on the add new route button and open the creation form', async() => { await page.waitForContentLoaded(); await page.waitToClick(selectors.routeIndex.addNewRouteButton); - let url = await page.expectURL('#!/route/create'); - - expect(url).toBe(true); + await page.waitForState('route.create'); }); it(`should attempt to create a new route but fail since employee has no access rights`, async() => { @@ -41,9 +39,7 @@ describe('Route create path', () => { it('should again click on the add new route button and open the creation form', async() => { await page.waitToClick(selectors.routeIndex.addNewRouteButton); - let url = await page.expectURL('#!/route/create'); - - expect(url).toBe(true); + await page.waitForState('route.create'); }); it(`should create a new route`, async() => { @@ -59,9 +55,7 @@ describe('Route create path', () => { }); it(`should confirm the redirection to the created route summary`, async() => { - let url = await page.expectURL('/summary'); - - expect(url).toBe(true); + await page.waitForState('route.card.summary'); }); }); }); diff --git a/e2e/paths/09-invoice-out/01_summary.spec.js b/e2e/paths/09-invoice-out/01_summary.spec.js index 126c745d3..728f0130a 100644 --- a/e2e/paths/09-invoice-out/01_summary.spec.js +++ b/e2e/paths/09-invoice-out/01_summary.spec.js @@ -17,9 +17,7 @@ describe('InvoiceOut summary path', () => { }); it('should reach the summary section', async() => { - const result = await page.expectURL('/summary'); - - expect(result).toBe(true); + await page.waitForState('invoiceOut.card.summary'); }); it('should contain the company from which the invoice is emited', async() => { diff --git a/e2e/paths/09-invoice-out/02_descriptor.spec.js b/e2e/paths/09-invoice-out/02_descriptor.spec.js index 1290b9a88..ceb2175e2 100644 --- a/e2e/paths/09-invoice-out/02_descriptor.spec.js +++ b/e2e/paths/09-invoice-out/02_descriptor.spec.js @@ -20,9 +20,7 @@ describe('InvoiceOut descriptor path', () => { await page.waitToClick(selectors.ticketsIndex.openAdvancedSearchButton); await page.write(selectors.ticketsIndex.advancedSearchInvoiceOut, 'T2222222'); await page.waitToClick(selectors.ticketsIndex.advancedSearchButton); - let url = await page.expectURL('#!/ticket/3/summary'); - - expect(url).toEqual(true); + await page.waitForState('ticket.card.summary'); }); it('should navigate to the invoiceOut index', async() => { @@ -30,16 +28,12 @@ describe('InvoiceOut descriptor path', () => { await page.wait(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.invoiceOutButton); await page.wait(selectors.invoiceOutIndex.topbarSearch); - let url = await page.expectURL('#!/invoice-out/index'); - - expect(url).toBe(true); + await page.waitForState('invoiceOut.index'); }); it(`should click on the search result to access to the invoiceOut summary`, async() => { await page.accessToSearchResult('T2222222'); - let url = await page.expectURL('/summary'); - - expect(url).toBe(true); + await page.waitForState('invoiceOut.card.summary'); }); it('should delete the invoiceOut using the descriptor more menu', async() => { @@ -52,9 +46,7 @@ describe('InvoiceOut descriptor path', () => { }); it('should have been relocated to the invoiceOut index', async() => { - let url = await page.expectURL('#!/invoice-out/index'); - - expect(url).toBe(true); + await page.waitForState('invoiceOut.index'); }); it(`should search for the deleted invouceOut to find no results`, async() => { @@ -70,13 +62,10 @@ describe('InvoiceOut descriptor path', () => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); await page.wait(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.ticketsButton); - let url = await page.expectURL('#!/ticket/index'); - - expect(url).toBe(true); + await page.waitForState('ticket.index'); }); it('should search for tickets with an specific invoiceOut to find no results', async() => { - await page.waitFor(2000); await page.waitToClick(selectors.ticketsIndex.openAdvancedSearchButton); await page.write(selectors.ticketsIndex.advancedSearchInvoiceOut, 'T2222222'); await page.waitToClick(selectors.ticketsIndex.advancedSearchButton); @@ -91,16 +80,12 @@ describe('InvoiceOut descriptor path', () => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); await page.wait(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.invoiceOutButton); - let url = await page.expectURL('#!/invoice-out/index'); - - expect(url).toBe(true); + await page.waitForState('invoiceOut.index'); }); it(`should search and access to the invoiceOut summary`, async() => { await page.accessToSearchResult('T1111111'); - let url = await page.expectURL('/summary'); - - expect(url).toBe(true); + await page.waitForState('invoiceOut.card.summary'); }); it(`should check the invoiceOut is booked in the summary data`, async() => { diff --git a/e2e/paths/10-travel/01_thermograph.spec.js b/e2e/paths/10-travel/01_thermograph.spec.js index efa2295a6..67a62381a 100644 --- a/e2e/paths/10-travel/01_thermograph.spec.js +++ b/e2e/paths/10-travel/01_thermograph.spec.js @@ -18,16 +18,12 @@ describe('Travel thermograph path', () => { }); it('should reach the thermograph section', async() => { - const result = await page.expectURL('/thermograph/index'); - - expect(result).toBe(true); + await page.waitForState('travel.card.thermograph.index'); }); it('should click the add thermograph floating button', async() => { await page.waitToClick(selectors.travelThermograph.add); - const result = await page.expectURL('/thermograph/create'); - - expect(result).toBe(true); + await page.waitForState('travel.card.thermograph.create'); }); it('should select the thermograph and then the file to upload', async() => { diff --git a/e2e/paths/10-travel/02_basic_data_and_log.spec.js b/e2e/paths/10-travel/02_basic_data_and_log.spec.js index c6287a8a0..85c7231c8 100644 --- a/e2e/paths/10-travel/02_basic_data_and_log.spec.js +++ b/e2e/paths/10-travel/02_basic_data_and_log.spec.js @@ -18,9 +18,7 @@ describe('Travel basic data path', () => { }); it('should reach the thermograph section', async() => { - const result = await page.expectURL('/basic-data'); - - expect(result).toBe(true); + await page.waitForState('travel.card.basicData'); }); it('should set a wrong delivery date then receive an error on submit', async() => { @@ -92,9 +90,7 @@ describe('Travel basic data path', () => { it('should navigate to the travel logs', async() => { await page.accessToSection('travel.card.log'); - const result = await page.expectURL('/log'); - - expect(result).toBe(true); + await page.waitForState('travel.card.log'); }); it('should check the 1st log contains details from the changes made', async() => { diff --git a/e2e/paths/11-zone/01_basic-data.spec.js b/e2e/paths/11-zone/01_basic-data.spec.js index 41b3782aa..7044ab70c 100644 --- a/e2e/paths/11-zone/01_basic-data.spec.js +++ b/e2e/paths/11-zone/01_basic-data.spec.js @@ -18,9 +18,7 @@ describe('Zone basic data path', () => { }); it('should reach the basic data section', async() => { - let url = await page.expectURL('#!/zone/10/basic-data'); - - expect(url).toBe(true); + await page.waitForState('zone.card.basicData'); }); it('should edit de form and then save', async() => { diff --git a/e2e/paths/12-entry/01_summary.spec.js b/e2e/paths/12-entry/01_summary.spec.js index 39b12b840..e57654f94 100644 --- a/e2e/paths/12-entry/01_summary.spec.js +++ b/e2e/paths/12-entry/01_summary.spec.js @@ -17,9 +17,7 @@ describe('Entry summary path', () => { }); it('should reach the second entry summary section', async() => { - let url = await page.expectURL('#!/entry/2/summary'); - - expect(url).toBe(true); + await page.waitForState('entry.card.summary'); }); it(`should display details from the entry on the header`, async() => { diff --git a/e2e/paths/12-entry/02_descriptor.spec.js b/e2e/paths/12-entry/02_descriptor.spec.js index 8fa0d2a4f..699d00517 100644 --- a/e2e/paths/12-entry/02_descriptor.spec.js +++ b/e2e/paths/12-entry/02_descriptor.spec.js @@ -17,9 +17,7 @@ describe('Entry descriptor path', () => { }); it('should reach the second entry summary section', async() => { - let url = await page.expectURL('#!/entry/2/summary'); - - expect(url).toBe(true); + await page.waitForState('entry.card.summary'); }); it('should show some entry information', async() => { @@ -30,32 +28,22 @@ describe('Entry descriptor path', () => { it('should click the travels button to be redirected to the travels index filtered by the current agency', async() => { await page.waitToClick(selectors.entryDescriptor.travelsQuicklink); - const url = await page.expectURL('/travel/index'); - const filter = await page.expectURL('agencyFk'); - - expect(url).toBe(true); - expect(filter).toBe(true); + await page.expectURL('/travel/index'); + await page.expectURL('agencyFk'); }); it('should go back to the entry summary', async() => { await page.waitToClick(selectors.globalItems.homeButton); await page.selectModule('entry'); await page.accessToSearchResult('2'); - let url = await page.expectURL('#!/entry/2/summary'); - - expect(url).toBe(true); + await page.waitForState('entry.card.summary'); }); it('should click the entries button to be redirected to the entries index filtered by the current supplier', async() => { await page.waitToClick(selectors.entryDescriptor.entriesQuicklink); - const url = await page.expectURL('/entry/index'); - const supplierFilter = await page.expectURL('supplierFk'); - const toFilter = await page.expectURL('to'); - const fromFilter = await page.expectURL('from'); - - expect(url).toBe(true); - expect(supplierFilter).toBe(true); - expect(toFilter).toBe(true); - expect(fromFilter).toBe(true); + await page.expectURL('/entry/index'); + await page.expectURL('supplierFk'); + await page.expectURL('to'); + await page.expectURL('from'); }); }); From 3283f957bac2a67a15de462f4099cfa0296f1ec9 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Tue, 24 Mar 2020 16:51:21 +0100 Subject: [PATCH 2/3] corrected a typo --- e2e/paths/02-client/01_create_client.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/paths/02-client/01_create_client.spec.js b/e2e/paths/02-client/01_create_client.spec.js index 29a27884f..0b8c96c16 100644 --- a/e2e/paths/02-client/01_create_client.spec.js +++ b/e2e/paths/02-client/01_create_client.spec.js @@ -102,7 +102,7 @@ describe('Client create path', async() => { await page.wait(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.clientsButton); await page.wait(selectors.clientsIndex.createClientButton); - await page.waitForState('lient.index'); + await page.waitForState('client.index'); }); it(`should search for the user Carol Danvers to confirm it exists`, async() => { From 12c2b577e683a6c36701f042e26d9a14cebeeaec Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Tue, 24 Mar 2020 17:01:11 +0100 Subject: [PATCH 3/3] minor refactor --- modules/order/front/card/index.js | 2 +- modules/order/front/line/index.js | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/order/front/card/index.js b/modules/order/front/card/index.js index e79167761..80fa99d1d 100644 --- a/modules/order/front/card/index.js +++ b/modules/order/front/card/index.js @@ -47,7 +47,7 @@ class Controller extends ModuleCard { ] }; - this.$q.all([ + return this.$q.all([ this.$http.get(`Orders/${this.$params.id}`, {filter}) .then(res => this.order = res.data), this.$http.get(`Orders/${this.$params.id}/getTotal`) diff --git a/modules/order/front/line/index.js b/modules/order/front/line/index.js index 149251c87..9351c5df8 100644 --- a/modules/order/front/line/index.js +++ b/modules/order/front/line/index.js @@ -43,10 +43,9 @@ class Controller extends Section { rows: [row.id], actualOrderId: this.$params.id }; - return this.$http.post(`OrderRows/removes`, params).then(() => { - this.card.reload(); - this.vnApp.showSuccess(this.$t('Data saved!')); - }); + return this.$http.post(`OrderRows/removes`, params) + .then(() => this.card.reload()) + .then(() => this.vnApp.showSuccess(this.$t('Data saved!'))); } showDescriptor(event, itemFk) {