From 7cd643c8c7e02a1c021c01490d4fa6900541e12e Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 31 Mar 2020 15:30:57 +0200 Subject: [PATCH] E2E fixes: waitForContentLoaded() extension --- e2e/helpers/extensions.js | 2 +- e2e/paths/02-client/15_user_config.spec.js | 5 ----- e2e/paths/04-item/09_regularize.spec.js | 2 +- e2e/paths/05-ticket/12_descriptor.spec.js | 4 ++-- e2e/paths/06-claim/04_claim_action.spec.js | 5 ++++- e2e/paths/08-route/03_create.spec.js | 1 - e2e/paths/09-invoice-out/02_descriptor.spec.js | 1 - 7 files changed, 8 insertions(+), 12 deletions(-) diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index 93914d2ff..1d0073999 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -551,7 +551,7 @@ let actions = { }, waitForContentLoaded: async function() { - // await this.waitFor(250); + await this.waitForSpinnerLoad(); } }; diff --git a/e2e/paths/02-client/15_user_config.spec.js b/e2e/paths/02-client/15_user_config.spec.js index 89d4e004a..2d412377a 100644 --- a/e2e/paths/02-client/15_user_config.spec.js +++ b/e2e/paths/02-client/15_user_config.spec.js @@ -16,7 +16,6 @@ describe('User config', () => { describe('as salesPerson', () => { it('should login', async() => { await page.login('salesPerson'); - await page.waitForContentLoaded(); }); it('should now open the user config form to check the settings', async() => { @@ -26,7 +25,6 @@ describe('User config', () => { let expectedLocalWarehouse = await page .expectPropertyValue(selectors.globalItems.userLocalWarehouse, 'value', ''); - let expectedLocalBank = await page .expectPropertyValue(selectors.globalItems.userLocalBank, 'value', ''); @@ -50,7 +48,6 @@ describe('User config', () => { describe('as employee', () => { it('should log in', async() => { await page.login('employee'); - await page.waitForContentLoaded(); }); it('should open the user config form to check the settings', async() => { @@ -59,7 +56,6 @@ describe('User config', () => { let expectedLocalWarehouse = await page .expectPropertyValue(selectors.globalItems.userLocalWarehouse, 'value', ''); - let expectedLocalBank = await page .expectPropertyValue(selectors.globalItems.userLocalBank, 'value', ''); @@ -92,7 +88,6 @@ describe('User config', () => { describe('as salesPerson 2nd run', () => { it('should log in once more', async() => { await page.login('salesPerson'); - await page.waitForContentLoaded(); }); it('should again open the user config form to check the local settings', async() => { diff --git a/e2e/paths/04-item/09_regularize.spec.js b/e2e/paths/04-item/09_regularize.spec.js index a37d97fa3..9c07d5916 100644 --- a/e2e/paths/04-item/09_regularize.spec.js +++ b/e2e/paths/04-item/09_regularize.spec.js @@ -65,8 +65,8 @@ describe('Item regularize path', () => { }); it('should clear the user local settings now', async() => { - await page.waitForContentLoaded(); await page.waitToClick(selectors.globalItems.userMenuButton); + await page.waitForContentLoaded(); await page.clearInput(selectors.globalItems.userConfigFirstAutocomplete); const result = await page.waitForLastSnackbar(); diff --git a/e2e/paths/05-ticket/12_descriptor.spec.js b/e2e/paths/05-ticket/12_descriptor.spec.js index ce9f064dd..4e2fce19e 100644 --- a/e2e/paths/05-ticket/12_descriptor.spec.js +++ b/e2e/paths/05-ticket/12_descriptor.spec.js @@ -99,8 +99,8 @@ describe('Ticket descriptor path', () => { }); it('should delete the stowaway', async() => { - await page.waitForContentLoaded(); await page.waitToClick(selectors.ticketDescriptor.moreMenu); + await page.waitForContentLoaded(); await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteStowawayButton); await page.waitToClick(selectors.ticketDescriptor.acceptDeleteStowawayButton); const result = await page.waitForLastSnackbar(); @@ -130,8 +130,8 @@ describe('Ticket descriptor path', () => { }); it('should invoice the ticket using the descriptor more menu', async() => { - await page.waitForContentLoaded(); await page.waitToClick(selectors.ticketDescriptor.moreMenu); + await page.waitForContentLoaded(); await page.waitToClick(selectors.ticketDescriptor.moreMenuMakeInvoice); await page.waitToClick(selectors.ticketDescriptor.acceptInvoiceOutButton); const result = await page.waitForLastSnackbar(); diff --git a/e2e/paths/06-claim/04_claim_action.spec.js b/e2e/paths/06-claim/04_claim_action.spec.js index a482e21c3..fedb5e0cb 100644 --- a/e2e/paths/06-claim/04_claim_action.spec.js +++ b/e2e/paths/06-claim/04_claim_action.spec.js @@ -25,7 +25,10 @@ describe('Claim action path', () => { }); it('should import the second importable ticket', async() => { - await page.waitFor(3000); // the animation adding the header element for the claimed total obscures somehow other elements for about 2 seconds + // the animation adding the header element for the claimed total + // obscures somehow other elements for about 2 seconds + await page.waitFor(3000); + await page.waitToClick(selectors.claimAction.importTicketButton); await page.waitToClick(selectors.claimAction.secondImportableTicket); const result = await page.waitForLastSnackbar(); diff --git a/e2e/paths/08-route/03_create.spec.js b/e2e/paths/08-route/03_create.spec.js index dafccff7f..88d7c8d28 100644 --- a/e2e/paths/08-route/03_create.spec.js +++ b/e2e/paths/08-route/03_create.spec.js @@ -17,7 +17,6 @@ describe('Route create path', () => { describe('as employee', () => { it('should click on the add new route button and open the creation form', async() => { - await page.waitForContentLoaded(); await page.waitToClick(selectors.routeIndex.addNewRouteButton); await page.waitForState('route.create'); }); diff --git a/e2e/paths/09-invoice-out/02_descriptor.spec.js b/e2e/paths/09-invoice-out/02_descriptor.spec.js index 535e37bdd..605106abf 100644 --- a/e2e/paths/09-invoice-out/02_descriptor.spec.js +++ b/e2e/paths/09-invoice-out/02_descriptor.spec.js @@ -78,7 +78,6 @@ describe('InvoiceOut descriptor path', () => { }); it('should now navigate to the invoiceOut index', async() => { - await page.waitForContentLoaded(); await page.waitToClick(selectors.globalItems.applicationsMenuButton); await page.wait(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.invoiceOutButton);