From 6b0f1544a443dcfe6b88eda3ea5c9b6827fab050 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Mon, 23 Nov 2020 18:28:39 +0100 Subject: [PATCH] wait and waitFor are now deprecated. Test refactor --- e2e/paths/01-login/01_login.spec.js | 4 +- e2e/paths/02-client/01_create_client.spec.js | 4 +- .../02-client/02_edit_basic_data.spec.js | 2 +- .../02-client/03_edit_fiscal_data.spec.js | 6 +-- e2e/paths/02-client/05_add_address.spec.js | 4 +- e2e/paths/02-client/08_add_notes.spec.js | 2 +- .../12_lock_of_verified_data.spec.js | 10 ++-- e2e/paths/02-client/14_balance.spec.js | 6 +-- e2e/paths/02-client/15_user_config.spec.js | 2 +- e2e/paths/02-client/16_web_payment.spec.js | 4 +- e2e/paths/02-client/18_contacts.spec.js | 2 +- e2e/paths/03-worker/05_calendar.spec.js | 54 +++++++++---------- e2e/paths/04-item/02_basic_data.spec.js | 2 +- e2e/paths/04-item/04_tags.spec.js | 2 +- e2e/paths/04-item/08_create_and_clone.spec.js | 2 +- e2e/paths/04-item/09_regularize.spec.js | 6 +-- e2e/paths/04-item/10_index.spec.js | 6 +-- e2e/paths/04-item/11_item_log.spec.js | 4 +- e2e/paths/04-item/12_descriptor.spec.js | 2 +- .../05-ticket/01-sale/02_edit_sale.spec.js | 28 +++++----- e2e/paths/05-ticket/05_tracking_state.spec.js | 4 +- .../05-ticket/06_basic_data_steps.spec.js | 4 +- e2e/paths/05-ticket/09_weekly.spec.js | 6 +-- e2e/paths/05-ticket/10_request.spec.js | 4 +- e2e/paths/05-ticket/12_descriptor.spec.js | 2 +- e2e/paths/05-ticket/13_services.spec.js | 4 +- e2e/paths/05-ticket/14_create_ticket.spec.js | 2 +- e2e/paths/06-claim/01_basic_data.spec.js | 2 +- e2e/paths/06-claim/03_detail.spec.js | 2 +- e2e/paths/06-claim/04_claim_action.spec.js | 2 +- e2e/paths/07-order/01_summary.spec.js | 2 +- e2e/paths/08-route/03_create.spec.js | 2 +- .../09-invoice-out/02_descriptor.spec.js | 10 ++-- .../10-travel/02_basic_data_and_log.spec.js | 2 +- e2e/paths/12-entry/03_latestBuys.spec.js | 2 +- 35 files changed, 101 insertions(+), 101 deletions(-) diff --git a/e2e/paths/01-login/01_login.spec.js b/e2e/paths/01-login/01_login.spec.js index 35bebcff1..7414856da 100644 --- a/e2e/paths/01-login/01_login.spec.js +++ b/e2e/paths/01-login/01_login.spec.js @@ -45,7 +45,7 @@ describe('Login path', async() => { describe('Successful login', async() => { it('should log in and go to home state', async() => { await page.doLogin('employee'); - await page.waitFor('vn-home'); + await page.waitForSelector('vn-home'); const state = await page.getState(); expect(state).toBe('home'); @@ -58,7 +58,7 @@ describe('Login path', async() => { await page.waitToClick(selectors.globalItems.userMenuButton); await page.waitToClick(selectors.globalItems.logoutButton); - await page.waitFor('vn-login'); + await page.waitForSelector('vn-login'); const state = await page.getState(); expect(state).toBe('login'); diff --git a/e2e/paths/02-client/01_create_client.spec.js b/e2e/paths/02-client/01_create_client.spec.js index 8bdc75556..9029910a7 100644 --- a/e2e/paths/02-client/01_create_client.spec.js +++ b/e2e/paths/02-client/01_create_client.spec.js @@ -124,9 +124,9 @@ describe('Client create path', () => { it('should click on the Clients button of the top bar menu', async() => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); - await page.wait(selectors.globalItems.applicationsMenuVisible); + await page.waitForSelector(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.clientsButton); - await page.wait(selectors.clientsIndex.createClientButton); + await page.waitForSelector(selectors.clientsIndex.createClientButton); await page.waitForState('client.index'); }); diff --git a/e2e/paths/02-client/02_edit_basic_data.spec.js b/e2e/paths/02-client/02_edit_basic_data.spec.js index 8cb39520f..6f331fb23 100644 --- a/e2e/paths/02-client/02_edit_basic_data.spec.js +++ b/e2e/paths/02-client/02_edit_basic_data.spec.js @@ -18,7 +18,7 @@ describe('Client Edit basicData path', () => { describe('as employee', () => { it('should not be able to change the salesPerson', async() => { - await page.wait(selectors.clientBasicData.name); + await page.waitForSelector(selectors.clientBasicData.name); const result = await page.evaluate(selector => { return document.querySelector(selector).disabled; }, `${selectors.clientBasicData.salesPerson} input`); 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 a7bf49eb6..da04c813a 100644 --- a/e2e/paths/02-client/03_edit_fiscal_data.spec.js +++ b/e2e/paths/02-client/03_edit_fiscal_data.spec.js @@ -40,7 +40,7 @@ describe('Client Edit fiscalData path', () => { }); it('should not be able to edit the verified data checkbox', async() => { - await page.wait(selectors.clientFiscalData.verifiedDataCheckbox); + await page.waitForSelector(selectors.clientFiscalData.verifiedDataCheckbox); const result = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox); expect(result).toBeTruthy(); @@ -55,7 +55,7 @@ describe('Client Edit fiscalData path', () => { }); it(`should edit the fiscal data but fail as the fiscal id ain't valid`, async() => { - await page.wait(selectors.clientFiscalData.socialName); + await page.waitForSelector(selectors.clientFiscalData.socialName); await page.clearInput(selectors.clientFiscalData.socialName); await page.write(selectors.clientFiscalData.socialName, 'SMASH'); await page.clearInput(selectors.clientFiscalData.fiscalId); @@ -159,7 +159,7 @@ describe('Client Edit fiscalData path', () => { }); it('should propagate the Equalization tax changes', async() => { - await page.waitFor(1000); + await page.waitForTimeout(1000); await page.waitToClick(selectors.globalItems.acceptButton); const message = await page.waitForSnackbar(); diff --git a/e2e/paths/02-client/05_add_address.spec.js b/e2e/paths/02-client/05_add_address.spec.js index f2a7050fe..90cbc15a5 100644 --- a/e2e/paths/02-client/05_add_address.spec.js +++ b/e2e/paths/02-client/05_add_address.spec.js @@ -17,7 +17,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.waitFor(500); + await page.waitForTimeout(500); await page.waitToClick(selectors.clientAddresses.createAddress); await page.waitForState('client.card.address.create'); }); @@ -81,7 +81,7 @@ describe('Client Add address path', () => { }); it(`should confirm the new address exists and it's the default one`, async() => { - await page.waitFor(2000); // needs more than a single second to load the section + await page.waitForTimeout(2000); // needs more than a single second to load the section const result = await page.waitToGetProperty(selectors.clientAddresses.defaultAddress, 'innerText'); expect(result).toContain('320 Park Avenue New York'); diff --git a/e2e/paths/02-client/08_add_notes.spec.js b/e2e/paths/02-client/08_add_notes.spec.js index 82bc14d0b..d0c483a11 100644 --- a/e2e/paths/02-client/08_add_notes.spec.js +++ b/e2e/paths/02-client/08_add_notes.spec.js @@ -26,7 +26,7 @@ describe('Client Add notes path', () => { }); it(`should create a note`, async() => { - await page.waitFor(selectors.clientNotes.note); + await page.waitForSelector(selectors.clientNotes.note); await page.type(`${selectors.clientNotes.note} textarea`, 'Meeting with Black Widow 21st 9am'); await page.waitToClick(selectors.clientNotes.saveButton); const message = await page.waitForSnackbar(); diff --git a/e2e/paths/02-client/12_lock_of_verified_data.spec.js b/e2e/paths/02-client/12_lock_of_verified_data.spec.js index 817ba7238..701531c76 100644 --- a/e2e/paths/02-client/12_lock_of_verified_data.spec.js +++ b/e2e/paths/02-client/12_lock_of_verified_data.spec.js @@ -18,15 +18,15 @@ describe('Client lock verified data path', () => { describe('as salesPerson', () => { it('should confirm verified data button is disabled for salesPerson', async() => { - await page.wait(200); - await page.wait(selectors.clientFiscalData.verifiedDataCheckbox); + await page.waitForTimeout(200); + await page.waitForSelector(selectors.clientFiscalData.verifiedDataCheckbox); const result = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox); expect(result).toBeTruthy(); }); it('should edit the social name', async() => { - await page.wait(selectors.clientFiscalData.socialName); + await page.waitForSelector(selectors.clientFiscalData.socialName); await page.clearInput(selectors.clientFiscalData.socialName); await page.write(selectors.clientFiscalData.socialName, 'Captain America Civil War'); await page.waitToClick(selectors.clientFiscalData.saveButton); @@ -75,7 +75,7 @@ describe('Client lock verified data path', () => { }); it('should again edit the social name', async() => { - await page.wait(selectors.clientFiscalData.socialName); + await page.waitForSelector(selectors.clientFiscalData.socialName); await page.clearInput(selectors.clientFiscalData.socialName); await page.write(selectors.clientFiscalData.socialName, 'Ant man and the Wasp'); await page.waitToClick(selectors.clientFiscalData.saveButton); @@ -161,7 +161,7 @@ describe('Client lock verified data path', () => { }); it('should confirm the form is enabled for salesPerson', async() => { - await page.wait(selectors.clientFiscalData.socialName); + await page.waitForSelector(selectors.clientFiscalData.socialName); const result = await page.evaluate(selector => { return document.querySelector(selector).disabled; }, 'vn-textfield[ng-model="$ctrl.client.socialName"] > div'); diff --git a/e2e/paths/02-client/14_balance.spec.js b/e2e/paths/02-client/14_balance.spec.js index bd00af58e..b069a4cfb 100644 --- a/e2e/paths/02-client/14_balance.spec.js +++ b/e2e/paths/02-client/14_balance.spec.js @@ -113,9 +113,9 @@ describe('Client balance path', () => { it('should now click on the Clients button of the top bar menu', async() => { await page.login('employee'); await page.waitToClick(selectors.globalItems.applicationsMenuButton); - await page.wait(selectors.globalItems.applicationsMenuVisible); + await page.waitForSelector(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.clientsButton); - await page.wait(selectors.clientsIndex.createClientButton); + await page.waitForSelector(selectors.clientsIndex.createClientButton); await page.waitForState('client.index'); }); @@ -125,6 +125,6 @@ describe('Client balance path', () => { }); it('should not be able to click the new payment button as it isnt present', async() => { - await page.waitFor(selectors.clientBalance.newPaymentButton, {hidden: true}); + await page.waitForSelector(selectors.clientBalance.newPaymentButton, {hidden: true}); }); }); diff --git a/e2e/paths/02-client/15_user_config.spec.js b/e2e/paths/02-client/15_user_config.spec.js index 28f2ef29e..0e18c07ad 100644 --- a/e2e/paths/02-client/15_user_config.spec.js +++ b/e2e/paths/02-client/15_user_config.spec.js @@ -52,7 +52,7 @@ describe('User config', () => { it('should open the user config form to check the settings', async() => { await page.waitToClick(selectors.globalItems.userMenuButton); - await page.waitFor(1000); + await page.waitForTimeout(1000); let expectedLocalWarehouse = await page .expectPropertyValue(selectors.globalItems.userLocalWarehouse, 'value', ''); diff --git a/e2e/paths/02-client/16_web_payment.spec.js b/e2e/paths/02-client/16_web_payment.spec.js index 3a4f50e76..24d802e3e 100644 --- a/e2e/paths/02-client/16_web_payment.spec.js +++ b/e2e/paths/02-client/16_web_payment.spec.js @@ -18,7 +18,7 @@ describe('Client web Payment', () => { describe('as employee', () => { it('should not be able to confirm payments', async() => { - await page.waitFor(selectors.webPayment.confirmFirstPaymentButton, {hidden: true}); + await page.waitForSelector(selectors.webPayment.confirmFirstPaymentButton, {hidden: true}); }); }); @@ -31,7 +31,7 @@ describe('Client web Payment', () => { it('should be able to confirm payments', async() => { await page.waitToClick(selectors.webPayment.confirmFirstPaymentButton); - await page.waitFor(selectors.webPayment.firstPaymentConfirmed, {hidden: true}); + await page.waitForSelector(selectors.webPayment.firstPaymentConfirmed, {hidden: true}); }); }); }); diff --git a/e2e/paths/02-client/18_contacts.spec.js b/e2e/paths/02-client/18_contacts.spec.js index c6dd4e406..49d930435 100644 --- a/e2e/paths/02-client/18_contacts.spec.js +++ b/e2e/paths/02-client/18_contacts.spec.js @@ -28,7 +28,7 @@ describe('Client contacts', () => { }); it('should delete de contact', async() => { - await page.waitFor(3000); + await page.waitForTimeout(3000); await page.waitToClick(selectors.clientContacts.deleteFirstPhone); await page.waitToClick(selectors.clientContacts.saveButton); const message = await page.waitForSnackbar(); diff --git a/e2e/paths/03-worker/05_calendar.spec.js b/e2e/paths/03-worker/05_calendar.spec.js index 7ebc3badb..e82006b3c 100644 --- a/e2e/paths/03-worker/05_calendar.spec.js +++ b/e2e/paths/03-worker/05_calendar.spec.js @@ -26,33 +26,33 @@ describe('Worker calendar path', () => { it('should set two days as holidays on the calendar and check the total holidays increased by 1.5', async() => { await page.waitToClick(selectors.workerCalendar.holidays); - await page.waitFor(reasonableTimeBetweenClicks); + await page.waitForTimeout(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.januaryThirtyFirst); - await page.waitFor(reasonableTimeBetweenClicks); + await page.waitForTimeout(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.absence); - await page.waitFor(reasonableTimeBetweenClicks); + await page.waitForTimeout(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.marchTwentyThird); - await page.waitFor(reasonableTimeBetweenClicks); + await page.waitForTimeout(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.halfHoliday); - await page.waitFor(reasonableTimeBetweenClicks); + await page.waitForTimeout(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.mayFourth); - await page.waitFor(reasonableTimeBetweenClicks); + await page.waitForTimeout(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.furlough); - await page.waitFor(reasonableTimeBetweenClicks); + await page.waitForTimeout(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.mayTwelfth); - await page.waitFor(reasonableTimeBetweenClicks); + await page.waitForTimeout(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.mayThirteenth); - await page.waitFor(reasonableTimeBetweenClicks); + await page.waitForTimeout(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.mayFourteenth); - await page.waitFor(reasonableTimeBetweenClicks); + await page.waitForTimeout(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.halfFurlough); - await page.waitFor(reasonableTimeBetweenClicks); + await page.waitForTimeout(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.mayEighth); - await page.waitFor(reasonableTimeBetweenClicks); + await page.waitForTimeout(reasonableTimeBetweenClicks); const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText'); @@ -68,33 +68,33 @@ describe('Worker calendar path', () => { }); it('should undo what was done here', async() => { - await page.waitFor(reasonableTimeBetweenClicks); + await page.waitForTimeout(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.holidays); - await page.waitFor(reasonableTimeBetweenClicks); + await page.waitForTimeout(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.januaryThirtyFirst); - await page.waitFor(reasonableTimeBetweenClicks); + await page.waitForTimeout(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.absence); - await page.waitFor(reasonableTimeBetweenClicks); + await page.waitForTimeout(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.marchTwentyThird); - await page.waitFor(reasonableTimeBetweenClicks); + await page.waitForTimeout(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.halfHoliday); - await page.waitFor(reasonableTimeBetweenClicks); + await page.waitForTimeout(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.mayFourth); - await page.waitFor(reasonableTimeBetweenClicks); + await page.waitForTimeout(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.furlough); - await page.waitFor(reasonableTimeBetweenClicks); + await page.waitForTimeout(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.mayTwelfth); - await page.waitFor(reasonableTimeBetweenClicks); + await page.waitForTimeout(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.mayThirteenth); - await page.waitFor(reasonableTimeBetweenClicks); + await page.waitForTimeout(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.mayFourteenth); - await page.waitFor(reasonableTimeBetweenClicks); + await page.waitForTimeout(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.halfFurlough); - await page.waitFor(reasonableTimeBetweenClicks); + await page.waitForTimeout(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.mayEighth); }); @@ -113,9 +113,9 @@ describe('Worker calendar path', () => { }); it('should make a futile attempt to add holidays', async() => { - await page.waitFor(reasonableTimeBetweenClicks); + await page.waitForTimeout(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.holidays); - await page.waitFor(reasonableTimeBetweenClicks); + await page.waitForTimeout(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.januaryThirtyFirst); }); @@ -131,7 +131,7 @@ describe('Worker calendar path', () => { await page.autocompleteSearch(selectors.workerCalendar.year, lastYear); - await page.waitFor(reasonableTimeBetweenClicks); + await page.waitForTimeout(reasonableTimeBetweenClicks); const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText'); expect(result).toContain(' 0 '); diff --git a/e2e/paths/04-item/02_basic_data.spec.js b/e2e/paths/04-item/02_basic_data.spec.js index 6f664cf9b..a728ac717 100644 --- a/e2e/paths/04-item/02_basic_data.spec.js +++ b/e2e/paths/04-item/02_basic_data.spec.js @@ -46,7 +46,7 @@ describe('Item Edit basic data path', () => { await page.write(selectors.itemBasicData.newIntrastatId, '588420239'); await page.write(selectors.itemBasicData.newIntrastatDescription, 'Tropical Flowers'); await page.waitToClick(selectors.itemBasicData.acceptIntrastatButton); // this popover obscures the rest of the form for aprox 2 seconds - await page.waitFor(2000); + await page.waitForTimeout(2000); await page.waitForTextInField(selectors.itemBasicData.intrastat, 'Tropical Flowers'); let newcode = await page.waitToGetProperty(selectors.itemBasicData.intrastat, 'value'); diff --git a/e2e/paths/04-item/04_tags.spec.js b/e2e/paths/04-item/04_tags.spec.js index 39d49cd1e..9f2a8e295 100644 --- a/e2e/paths/04-item/04_tags.spec.js +++ b/e2e/paths/04-item/04_tags.spec.js @@ -31,7 +31,7 @@ describe('Item create tags path', () => { it(`should confirm the fourth row data is the expected one`, async() => { await page.reloadSection('item.card.tags'); - await page.wait('vn-item-tags'); + await page.waitForSelector('vn-item-tags'); let result = await page.waitToGetProperty(selectors.itemTags.fourthTag, 'value'); expect(result).toEqual('Ancho de la base'); 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 ac667d123..938f15e3f 100644 --- a/e2e/paths/04-item/08_create_and_clone.spec.js +++ b/e2e/paths/04-item/08_create_and_clone.spec.js @@ -77,7 +77,7 @@ describe('Item Create/Clone path', () => { xdescribe('clone', () => { 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); + await page.waitForSelector(selectors.itemsIndex.createItemButton); await page.waitForState('item.index'); }); diff --git a/e2e/paths/04-item/09_regularize.spec.js b/e2e/paths/04-item/09_regularize.spec.js index 0bc2c3acf..97c45643f 100644 --- a/e2e/paths/04-item/09_regularize.spec.js +++ b/e2e/paths/04-item/09_regularize.spec.js @@ -56,7 +56,7 @@ describe('Item regularize path', () => { it('should click on the Tickets button of the top bar menu', async() => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); - await page.wait(selectors.globalItems.applicationsMenuVisible); + await page.waitForSelector(selectors.globalItems.applicationsMenuVisible); await Promise.all([ page.waitForNavigation({waitUntil: ['load', 'networkidle0', 'domcontentloaded']}), page.waitToClick(selectors.globalItems.ticketsButton) @@ -96,7 +96,7 @@ describe('Item regularize path', () => { it('should now click on the Items button of the top bar menu', async() => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); - await page.wait(selectors.globalItems.applicationsMenuVisible); + await page.waitForSelector(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.itemsButton); await page.waitForState('item.index'); }); @@ -119,7 +119,7 @@ describe('Item regularize path', () => { it('should again click on the Tickets button of the top bar menu', async() => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); - await page.wait(selectors.globalItems.applicationsMenuVisible); + await page.waitForSelector(selectors.globalItems.applicationsMenuVisible); await Promise.all([ page.waitForNavigation({waitUntil: ['load', 'networkidle0', 'domcontentloaded']}), page.waitToClick(selectors.globalItems.ticketsButton) diff --git a/e2e/paths/04-item/10_index.spec.js b/e2e/paths/04-item/10_index.spec.js index fb4efb5c8..40c567cac 100644 --- a/e2e/paths/04-item/10_index.spec.js +++ b/e2e/paths/04-item/10_index.spec.js @@ -43,7 +43,7 @@ describe('Item index path', () => { await page.waitToClick(selectors.itemsIndex.firstSearchResult); await page.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton); await page.waitToClick(selectors.globalItems.searchButton); - await page.wait(selectors.itemsIndex.searchResult); + await page.waitForSelector(selectors.itemsIndex.searchResult); await page.waitImgLoad(selectors.itemsIndex.firstItemImage); const imageVisible = await page.isVisible(selectors.itemsIndex.firstItemImageTd); @@ -55,7 +55,7 @@ describe('Item index path', () => { }); it('should mark all unchecked boxes to leave the index as it was', async() => { - await page.waitFor(500); // otherwise the snackbar doesnt appear some times. + await page.waitForTimeout(500); // otherwise the snackbar doesnt appear some times. await page.waitToClick(selectors.itemsIndex.fieldsToShowButton); await page.waitToClick(selectors.itemsIndex.idCheckbox); await page.waitToClick(selectors.itemsIndex.stemsCheckbox); @@ -77,7 +77,7 @@ describe('Item index path', () => { await page.waitToClick(selectors.itemsIndex.firstSearchResult); await page.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton); await page.waitToClick(selectors.globalItems.searchButton); - await page.wait(selectors.itemsIndex.searchResult); + await page.waitForSelector(selectors.itemsIndex.searchResult); const idVisible = await page.isVisible(selectors.itemsIndex.firstItemId); expect(idVisible).toBeTruthy(); diff --git a/e2e/paths/04-item/11_item_log.spec.js b/e2e/paths/04-item/11_item_log.spec.js index c0a047051..2a885fe6f 100644 --- a/e2e/paths/04-item/11_item_log.spec.js +++ b/e2e/paths/04-item/11_item_log.spec.js @@ -39,7 +39,7 @@ 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); + await page.waitForSelector(selectors.itemsIndex.createItemButton); await page.waitForState('item.index'); }); @@ -49,7 +49,7 @@ describe('Item log path', () => { }); it(`should confirm the log is showing 5 entries`, async() => { - await page.wait(selectors.itemLog.anyLineCreated); + await page.waitForSelector(selectors.itemLog.anyLineCreated); const anyLineCreatedCount = await page.countElement(selectors.itemLog.anyLineCreated); expect(anyLineCreatedCount).toEqual(5); diff --git a/e2e/paths/04-item/12_descriptor.spec.js b/e2e/paths/04-item/12_descriptor.spec.js index 9e0de8479..7c6fa074c 100644 --- a/e2e/paths/04-item/12_descriptor.spec.js +++ b/e2e/paths/04-item/12_descriptor.spec.js @@ -17,7 +17,7 @@ describe('Item descriptor path', () => { }); it('should check the descriptor inactive icon is dark as the item is active', async() => { - await page.wait(selectors.itemDescriptor.inactiveIcon); + await page.waitForSelector(selectors.itemDescriptor.inactiveIcon); await page.waitForClassNotPresent(selectors.itemDescriptor.inactiveIcon, 'bright'); const darkIcon = await page.isVisible(selectors.itemDescriptor.inactiveIcon); diff --git a/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js b/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js index c3403b371..248f38927 100644 --- a/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js +++ b/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js @@ -24,7 +24,7 @@ describe('Ticket Edit sale path', () => { it('should navigate to the tickets index', async() => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); - await page.wait(selectors.globalItems.applicationsMenuVisible); + await page.waitForSelector(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.ticketsButton); await page.waitForState('ticket.index'); }); @@ -128,7 +128,7 @@ describe('Ticket Edit sale path', () => { it('should return to ticket sales section', async() => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); - await page.wait(selectors.globalItems.applicationsMenuVisible); + await page.waitForSelector(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.ticketsButton); await page.accessToSearchResult('16'); await page.accessToSection('ticket.card.sale'); @@ -143,9 +143,9 @@ describe('Ticket Edit sale path', () => { }); it('should remove 1 from the first sale quantity', async() => { - await page.waitFor(500); + await page.waitForTimeout(500); await page.waitToClick(selectors.ticketSales.firstSaleQuantityCell); - await page.waitFor(selectors.ticketSales.firstSaleQuantity); + await page.waitForSelector(selectors.ticketSales.firstSaleQuantity); await page.type(selectors.ticketSales.firstSaleQuantity, '9\u000d'); const message = await page.waitForSnackbar(); @@ -154,7 +154,7 @@ describe('Ticket Edit sale path', () => { it('should update the price', async() => { await page.waitToClick(selectors.ticketSales.firstSalePrice); - await page.waitFor(selectors.ticketSales.firstSalePriceInput); + await page.waitForSelector(selectors.ticketSales.firstSalePriceInput); await page.type(selectors.ticketSales.firstSalePriceInput, '5\u000d'); const message = await page.waitForSnackbar(); @@ -175,7 +175,7 @@ describe('Ticket Edit sale path', () => { it('should update the discount', async() => { await page.waitToClick(selectors.ticketSales.firstSaleDiscount); - await page.waitFor(selectors.ticketSales.firstSaleDiscountInput); + await page.waitForSelector(selectors.ticketSales.firstSaleDiscountInput); await page.type(selectors.ticketSales.firstSaleDiscountInput, '50\u000d'); const message = await page.waitForSnackbar(); @@ -205,7 +205,7 @@ describe('Ticket Edit sale path', () => { it('should click on the Claims button of the top bar menu', async() => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); - await page.wait(selectors.globalItems.applicationsMenuVisible); + await page.waitForSelector(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.claimsButton); await page.waitForState('claim.index'); }); @@ -217,7 +217,7 @@ describe('Ticket Edit sale path', () => { it('should click the Tickets button of the top bar menu', async() => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); - await page.wait(selectors.globalItems.applicationsMenuVisible); + await page.waitForSelector(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.ticketsButton); await page.waitForState('ticket.index'); }); @@ -225,16 +225,16 @@ describe('Ticket Edit sale path', () => { it('should search for a ticket then access to the sales section', async() => { await page.accessToSearchResult('16'); await page.accessToSection('ticket.card.sale'); - await page.wait(2000); + await page.waitForTimeout(2000); }); it('should select the third sale and delete it', async() => { await page.waitToClick(selectors.ticketSales.thirdSaleCheckbox); - await page.wait(2000); + await page.waitForTimeout(2000); await page.waitToClick(selectors.ticketSales.deleteSaleButton); - await page.wait(2000); + await page.waitForTimeout(2000); await page.waitToClick(selectors.globalItems.acceptButton); - await page.wait(2000); + await page.waitForTimeout(2000); await page.waitForSpinnerLoad(); const message = await page.waitForSnackbar(); @@ -260,7 +260,7 @@ describe('Ticket Edit sale path', () => { }); it('should confirm the transfered line is the correct one', async() => { - await page.wait(selectors.ticketSales.secondSaleText); + await page.waitForSelector(selectors.ticketSales.secondSaleText); const result = await page.waitToGetProperty(selectors.ticketSales.secondSaleText, 'innerText'); expect(result).toContain(`Melee weapon heavy shield`); @@ -279,7 +279,7 @@ describe('Ticket Edit sale path', () => { }); it(`should confirm the original ticket has still three lines`, async() => { - await page.wait(selectors.ticketSales.saleLine); + await page.waitForSelector(selectors.ticketSales.saleLine); const result = await page.countElement(selectors.ticketSales.saleLine); expect(result).toEqual(3); diff --git a/e2e/paths/05-ticket/05_tracking_state.spec.js b/e2e/paths/05-ticket/05_tracking_state.spec.js index 1db0144e5..9c8e6d492 100644 --- a/e2e/paths/05-ticket/05_tracking_state.spec.js +++ b/e2e/paths/05-ticket/05_tracking_state.spec.js @@ -48,13 +48,13 @@ 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.waitFor('.vn-popup', {hidden: true}); + await page.waitForSelector('.vn-popup', {hidden: true}); await page.waitToClick(selectors.ticketTracking.createStateButton); await page.waitForState('ticket.card.tracking.edit'); }); it(`should attemp to create an state for which salesPerson doesn't have permissions`, async() => { - await page.waitFor(1500); + await page.waitForTimeout(1500); await page.autocompleteSearch(selectors.createStateView.state, 'Encajado'); await page.waitToClick(selectors.createStateView.saveStateButton); const message = await page.waitForSnackbar(); 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 f6660ae39..fff6c1264 100644 --- a/e2e/paths/05-ticket/06_basic_data_steps.spec.js +++ b/e2e/paths/05-ticket/06_basic_data_steps.spec.js @@ -34,7 +34,7 @@ describe('Ticket Edit basic data path', () => { it(`should confirm the zone autocomplete is enabled for the role productionBoss`, async() => { await page.waitForSpinnerLoad(); - await page.wait(selectors.ticketBasicData.zone); + await page.waitForSelector(selectors.ticketBasicData.zone); const disabled = await page.evaluate(selector => { return document.querySelector(selector).disabled; }, `${selectors.ticketBasicData.zone} input`); @@ -51,7 +51,7 @@ describe('Ticket Edit basic data path', () => { it(`should edit the ticket agency then check there are no zones for it`, async() => { await page.autocompleteSearch(selectors.ticketBasicData.agency, 'Super-Man delivery'); - await page.waitFor(1000); + await page.waitForTimeout(1000); let emptyZone = await page .expectPropertyValue(selectors.ticketBasicData.zone, 'value', ''); diff --git a/e2e/paths/05-ticket/09_weekly.spec.js b/e2e/paths/05-ticket/09_weekly.spec.js index e1d54e7a4..2392de28f 100644 --- a/e2e/paths/05-ticket/09_weekly.spec.js +++ b/e2e/paths/05-ticket/09_weekly.spec.js @@ -38,7 +38,7 @@ describe('Ticket descriptor path', () => { it('should again click on the Tickets button of the top bar menu', async() => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); - await page.wait(selectors.globalItems.applicationsMenuVisible); + await page.waitForSelector(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.ticketsButton); await page.waitForState('ticket.index'); }); @@ -52,7 +52,7 @@ describe('Ticket descriptor path', () => { it('should click on the Tickets button of the top bar menu once more', async() => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); - await page.wait(selectors.globalItems.applicationsMenuVisible); + await page.waitForSelector(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.ticketsButton); await page.waitForState('ticket.index'); }); @@ -73,7 +73,7 @@ describe('Ticket descriptor path', () => { it('should click on the Tickets button of the top bar menu once again', async() => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); - await page.wait(selectors.globalItems.applicationsMenuVisible); + await page.waitForSelector(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.ticketsButton); await page.waitForState('ticket.index'); }); diff --git a/e2e/paths/05-ticket/10_request.spec.js b/e2e/paths/05-ticket/10_request.spec.js index 8d9dc6aaa..af73d7081 100644 --- a/e2e/paths/05-ticket/10_request.spec.js +++ b/e2e/paths/05-ticket/10_request.spec.js @@ -18,7 +18,7 @@ describe('Ticket purchase request path', () => { }); it('should add a new request', async() => { - await page.waitFor(500); + await page.waitForTimeout(500); await page.waitToClick(selectors.ticketRequests.addRequestButton); await page.write(selectors.ticketRequests.descriptionInput, 'New stuff'); await page.write(selectors.ticketRequests.quantity, '9'); @@ -72,7 +72,7 @@ describe('Ticket purchase request path', () => { it('should check the request was deleted', async() => { await page.reloadSection('ticket.card.request.index'); - await page.wait(selectors.ticketRequests.addRequestButton); + await page.waitForSelector(selectors.ticketRequests.addRequestButton); await page.waitForSelector(selectors.ticketRequests.thirdDescription, {hidden: true}); }); }); diff --git a/e2e/paths/05-ticket/12_descriptor.spec.js b/e2e/paths/05-ticket/12_descriptor.spec.js index c1258f973..c426f7d7f 100644 --- a/e2e/paths/05-ticket/12_descriptor.spec.js +++ b/e2e/paths/05-ticket/12_descriptor.spec.js @@ -92,7 +92,7 @@ describe('Ticket descriptor path', () => { }); await page.waitToClick(selectors.ticketDescriptor.moreMenu); await page.waitToClick(selectors.ticketDescriptor.moreMenuAddStowaway); - await page.wait(selectors.ticketDescriptor.addStowawayDialogFirstTicket); + await page.waitForSelector(selectors.ticketDescriptor.addStowawayDialogFirstTicket); const isVisible = await page.isVisible(selectors.ticketDescriptor.addStowawayDialogFirstTicket); expect(isVisible).toBeTruthy(); diff --git a/e2e/paths/05-ticket/13_services.spec.js b/e2e/paths/05-ticket/13_services.spec.js index 9108f64e4..03e57b588 100644 --- a/e2e/paths/05-ticket/13_services.spec.js +++ b/e2e/paths/05-ticket/13_services.spec.js @@ -22,7 +22,7 @@ describe('Ticket services path', () => { it('should find the add descripton button disabled for this user role', async() => { await page.waitForClassPresent(selectors.ticketService.firstAddServiceTypeButton, 'disabled'); await page.waitToClick(selectors.ticketService.addServiceButton); - await page.wait(selectors.ticketService.firstAddServiceTypeButton); + await page.waitForSelector(selectors.ticketService.firstAddServiceTypeButton); const result = await page.isDisabled(selectors.ticketService.firstAddServiceTypeButton); expect(result).toBe(true); @@ -63,7 +63,7 @@ describe('Ticket services path', () => { it('should click on the add new service type to open the dialog', async() => { await page.waitToClick(selectors.ticketService.firstAddServiceTypeButton); - await page.wait('.vn-dialog.shown'); + await page.waitForSelector('.vn-dialog.shown'); const result = await page.isVisible(selectors.ticketService.newServiceTypeName); expect(result).toBeTruthy(); diff --git a/e2e/paths/05-ticket/14_create_ticket.spec.js b/e2e/paths/05-ticket/14_create_ticket.spec.js index 692354472..4e7d95493 100644 --- a/e2e/paths/05-ticket/14_create_ticket.spec.js +++ b/e2e/paths/05-ticket/14_create_ticket.spec.js @@ -42,7 +42,7 @@ describe('Ticket create path', () => { it('should again open the new ticket form', async() => { await page.waitToClick(selectors.globalItems.returnToModuleIndexButton); - await page.waitFor(500); + await page.waitForTimeout(500); await page.waitToClick(selectors.ticketsIndex.newTicketButton); await page.waitForState('ticket.create'); }); diff --git a/e2e/paths/06-claim/01_basic_data.spec.js b/e2e/paths/06-claim/01_basic_data.spec.js index efbfd0305..5dfd54c4e 100644 --- a/e2e/paths/06-claim/01_basic_data.spec.js +++ b/e2e/paths/06-claim/01_basic_data.spec.js @@ -45,7 +45,7 @@ describe('Claim edit basic data path', () => { it('should confirm the claim state was edited', async() => { await page.reloadSection('claim.card.basicData'); - await page.wait(selectors.claimBasicData.claimState); + await page.waitForSelector(selectors.claimBasicData.claimState); const result = await page.waitToGetProperty(selectors.claimBasicData.claimState, 'value'); expect(result).toEqual('Gestionado'); diff --git a/e2e/paths/06-claim/03_detail.spec.js b/e2e/paths/06-claim/03_detail.spec.js index 9649d1905..ddcfd9302 100644 --- a/e2e/paths/06-claim/03_detail.spec.js +++ b/e2e/paths/06-claim/03_detail.spec.js @@ -106,7 +106,7 @@ xdescribe('Claim detail', () => { it('should navigate back to claim.detail to confirm the claim contains now two items', async() => { await page.accessToSection('claim.card.detail'); - await page.wait(selectors.claimDetail.claimDetailLine); + await page.waitForSelector(selectors.claimDetail.claimDetailLine); const result = await page.countElement(selectors.claimDetail.claimDetailLine); expect(result).toEqual(2); diff --git a/e2e/paths/06-claim/04_claim_action.spec.js b/e2e/paths/06-claim/04_claim_action.spec.js index c22fe5704..b3fedc9c8 100644 --- a/e2e/paths/06-claim/04_claim_action.spec.js +++ b/e2e/paths/06-claim/04_claim_action.spec.js @@ -27,7 +27,7 @@ describe('Claim action path', () => { it('should import the second importable ticket', async() => { // the animation adding the header element for the claimed total // obscures somehow other elements for about 2 seconds - await page.waitFor(3000); + await page.waitForTimeout(3000); await page.waitToClick(selectors.claimAction.importTicketButton); await page.waitToClick(selectors.claimAction.secondImportableTicket); diff --git a/e2e/paths/07-order/01_summary.spec.js b/e2e/paths/07-order/01_summary.spec.js index f21015c52..1b4776826 100644 --- a/e2e/paths/07-order/01_summary.spec.js +++ b/e2e/paths/07-order/01_summary.spec.js @@ -8,7 +8,7 @@ describe('Order summary path', () => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('employee', 'order'); - await page.waitFor(2000); + await page.waitForTimeout(2000); await page.accessToSearchResult('16'); }); diff --git a/e2e/paths/08-route/03_create.spec.js b/e2e/paths/08-route/03_create.spec.js index ad6fb3991..670f7e17b 100644 --- a/e2e/paths/08-route/03_create.spec.js +++ b/e2e/paths/08-route/03_create.spec.js @@ -17,7 +17,7 @@ describe('Route create path', () => { describe('as employee', () => { it('should click on the add new route button and open the creation form', async() => { - await page.waitFor(500); + await page.waitForTimeout(500); 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 aff35ac33..8d403e083 100644 --- a/e2e/paths/09-invoice-out/02_descriptor.spec.js +++ b/e2e/paths/09-invoice-out/02_descriptor.spec.js @@ -26,9 +26,9 @@ describe('InvoiceOut descriptor path', () => { it('should navigate to the invoiceOut index', async() => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); - await page.wait(selectors.globalItems.applicationsMenuVisible); + await page.waitForSelector(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.invoiceOutButton); - await page.wait(selectors.invoiceOutIndex.topbarSearch); + await page.waitForSelector(selectors.invoiceOutIndex.topbarSearch); await page.waitForState('invoiceOut.index'); }); @@ -59,7 +59,7 @@ describe('InvoiceOut descriptor path', () => { it('should navigate to the ticket index', async() => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); - await page.wait(selectors.globalItems.applicationsMenuVisible); + await page.waitForSelector(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.ticketsButton); await page.waitForState('ticket.index'); }); @@ -73,7 +73,7 @@ describe('InvoiceOut descriptor path', () => { it('should now navigate to the invoiceOut index', async() => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); - await page.wait(selectors.globalItems.applicationsMenuVisible); + await page.waitForSelector(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.invoiceOutButton); await page.waitForState('invoiceOut.index'); }); @@ -126,7 +126,7 @@ describe('InvoiceOut descriptor path', () => { it(`should check the salesPerson role doens't see the book option in the more menu`, async() => { await page.waitToClick(selectors.invoiceOutDescriptor.moreMenu); - await page.wait(selectors.invoiceOutDescriptor.moreMenuShowInvoiceOutPdf); + await page.waitForSelector(selectors.invoiceOutDescriptor.moreMenuShowInvoiceOutPdf); await page.waitForSelector(selectors.invoiceOutDescriptor.moreMenuBookInvoiceOut, {hidden: true}); }); 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 f1253cdd7..9c81e6f63 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 @@ -43,7 +43,7 @@ describe('Travel basic data path', () => { it('should now edit the whole form then save', async() => { await page.clearInput(selectors.travelBasicDada.reference); await page.write(selectors.travelBasicDada.reference, 'new reference!'); - await page.waitFor(2000); + await page.waitForTimeout(2000); await page.autocompleteSearch(selectors.travelBasicDada.agency, 'Entanglement'); await page.autocompleteSearch(selectors.travelBasicDada.outputWarehouse, 'Warehouse Three'); await page.autocompleteSearch(selectors.travelBasicDada.inputWarehouse, 'Warehouse Four'); diff --git a/e2e/paths/12-entry/03_latestBuys.spec.js b/e2e/paths/12-entry/03_latestBuys.spec.js index 33acdb318..8e9de8158 100644 --- a/e2e/paths/12-entry/03_latestBuys.spec.js +++ b/e2e/paths/12-entry/03_latestBuys.spec.js @@ -17,7 +17,7 @@ describe('Entry lastest buys path', () => { it('should access the latest buys seccion and search not seeing the edit buys button yet', async() => { await page.waitToClick(selectors.entryLatestBuys.latestBuysSectionButton); - await page.waitFor(250); + await page.waitForTimeout(250); await page.waitToClick(selectors.globalItems.searchButton); await page.waitForSelector(selectors.entryLatestBuys.editBuysButton, {visible: false}); });