From f1611f8fe0b4607204ad98f9d7e1e8a02522a4fe Mon Sep 17 00:00:00 2001 From: carlosjr Date: Fri, 15 Oct 2021 14:42:27 +0200 Subject: [PATCH] fix(e2e): many e2e using descriptor more menu need a wait before using the options --- e2e/helpers/selectors.js | 2 +- e2e/paths/04-item/08_regularize.spec.js | 2 +- e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js | 6 +++++- e2e/paths/05-ticket/09_weekly.spec.js | 4 ++-- e2e/paths/05-ticket/12_descriptor.spec.js | 12 +++++++----- e2e/paths/05-ticket/14_create_ticket.spec.js | 3 ++- .../05-ticket/15_create_ticket_from_client.spec.js | 2 +- e2e/paths/09-invoice-in/02_descriptor.spec.js | 4 ++-- e2e/paths/09-invoice-out/02_descriptor.spec.js | 1 + e2e/paths/09-invoice-out/03_manualInvoice.spec.js | 4 ++-- e2e/paths/10-travel/03_descriptor.spec.js | 6 +++--- e2e/paths/11-zone/02_descriptor.spec.js | 2 +- .../14-account/01_create_and_basic_data.spec.js | 3 ++- 13 files changed, 30 insertions(+), 21 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index f63d67f8ba..52c89743d5 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -544,7 +544,7 @@ export default { }, ticketSales: { setOk: 'vn-ticket-sale vn-tool-bar > vn-button[label="Ok"] > button', - saleLine: 'vn-table div > vn-tbody > vn-tr', + saleLine: 'vn-table div > vn-tbody > vn-tr vn-check', saleDescriptorPopover: '.vn-popover.shown vn-item-descriptor', saleDescriptorPopoverSummaryButton: '.vn-popover.shown vn-item-descriptor a[ui-sref="item.card.summary({id: $ctrl.descriptor.id})"]', newItemButton: 'vn-ticket-sale vn-card vn-icon-button[icon="add_circle"]', diff --git a/e2e/paths/04-item/08_regularize.spec.js b/e2e/paths/04-item/08_regularize.spec.js index 6a4b85d063..d7bab3b7bb 100644 --- a/e2e/paths/04-item/08_regularize.spec.js +++ b/e2e/paths/04-item/08_regularize.spec.js @@ -107,7 +107,7 @@ describe('Item regularize path', () => { }); it('should regularize the item once more', async() => { - await page.waitForTimeout(1000); // initialization of functionality takes about 100ms to work + await page.waitForTimeout(1000); // initialization of functionality takes about 1000ms to work await page.waitToClick(selectors.itemDescriptor.moreMenu); await page.waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton); await page.write(selectors.itemDescriptor.regularizeQuantity, '100'); 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 6c82e31a70..0ce803bea5 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 @@ -196,6 +196,7 @@ describe('Ticket Edit sale path', () => { }); it('should select the third sale and create a claim of it', async() => { + await page.waitForTimeout(1000); // initialization of functionality takes about 1000ms to work await page.waitToClick(selectors.ticketSales.thirdSaleCheckbox); await page.waitToClick(selectors.ticketSales.moreMenu); await page.waitToClick(selectors.ticketSales.moreMenuCreateClaim); @@ -340,9 +341,10 @@ describe('Ticket Edit sale path', () => { }); it('should confirm the new ticket received the line', async() => { + const expectedLines = 1; const result = await page.countElement(selectors.ticketSales.saleLine); - expect(result).toEqual(1); + expect(result).toEqual(expectedLines); }); it('should check the first sale reserved icon isnt visible', async() => { @@ -353,6 +355,7 @@ describe('Ticket Edit sale path', () => { it('should mark the first sale as reserved', async() => { await page.waitToClick(selectors.ticketSales.firstSaleCheckbox); + await page.waitForTimeout(1000); // initialization of functionality takes about 1000ms to work await page.waitToClick(selectors.ticketSales.moreMenu); await page.waitToClick(selectors.ticketSales.moreMenuReserve); await page.closePopup(); @@ -363,6 +366,7 @@ describe('Ticket Edit sale path', () => { }); it('should unmark the first sale as reserved', async() => { + await page.waitForTimeout(1000); // initialization of functionality takes about 1000ms to work await page.waitToClick(selectors.ticketSales.moreMenu); await page.waitToClick(selectors.ticketSales.moreMenuUnmarkReseved); await page.waitForClassPresent(selectors.ticketSales.firstSaleReservedIcon, 'ng-hide'); diff --git a/e2e/paths/05-ticket/09_weekly.spec.js b/e2e/paths/05-ticket/09_weekly.spec.js index abee26e0a9..be5b1e153a 100644 --- a/e2e/paths/05-ticket/09_weekly.spec.js +++ b/e2e/paths/05-ticket/09_weekly.spec.js @@ -28,7 +28,7 @@ describe('Ticket descriptor path', () => { }); it('should add the ticket to thursday turn using the descriptor more menu', async() => { - await page.waitForTimeout(1000); // initialization of functionality takes about 100ms to work + await page.waitForTimeout(1000); // initialization of functionality takes about 1000ms to work await page.waitToClick(selectors.ticketDescriptor.moreMenu); await page.waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn); await page.waitToClick(selectors.ticketDescriptor.thursdayButton); @@ -64,7 +64,7 @@ describe('Ticket descriptor path', () => { }); it('should add the ticket to saturday turn using the descriptor more menu', async() => { - await page.waitForTimeout(1000); // initialization of functionality takes about 100ms to work + await page.waitForTimeout(1000); // initialization of functionality takes about 1000ms to work await page.waitToClick(selectors.ticketDescriptor.moreMenu); await page.waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn); await page.waitToClick(selectors.ticketDescriptor.saturdayButton); diff --git a/e2e/paths/05-ticket/12_descriptor.spec.js b/e2e/paths/05-ticket/12_descriptor.spec.js index 247f916996..dcca61eab5 100644 --- a/e2e/paths/05-ticket/12_descriptor.spec.js +++ b/e2e/paths/05-ticket/12_descriptor.spec.js @@ -22,7 +22,7 @@ describe('Ticket descriptor path', () => { }); it(`should update the shipped hour using the descriptor menu`, async() => { - await page.waitForTimeout(1000); // initialization of functionality takes about 100ms to work + await page.waitForTimeout(1000); // initialization of functionality takes about 1000ms to work await page.waitToClick(selectors.ticketDescriptor.moreMenu); await page.waitToClick(selectors.ticketDescriptor.moreMenuChangeShippedHour); await page.pickTime(selectors.ticketDescriptor.changeShippedHour, '08:15'); @@ -66,7 +66,7 @@ describe('Ticket descriptor path', () => { describe('Restore ticket', () => { it('should restore the ticket using the descriptor menu', async() => { - await page.waitForTimeout(1000); // initialization of functionality takes about 100ms to work + await page.waitForTimeout(1000); // initialization of functionality takes about 1000ms to work await page.waitToClick(selectors.ticketDescriptor.moreMenu); await page.waitToClick(selectors.ticketDescriptor.moreMenuRestoreTicket); await page.waitToClick(selectors.ticketDescriptor.acceptDialog); @@ -84,7 +84,7 @@ describe('Ticket descriptor path', () => { }); it('should open the add stowaway dialog', async() => { - await page.waitForTimeout(1000); // initialization of functionality takes about 100ms to work + await page.waitForTimeout(1000); // initialization of functionality takes about 1000ms to work await page.waitForFunction(() => { let element = document.querySelector('vn-ticket-descriptor-menu'); return element.$ctrl.canShowStowaway === true; @@ -117,7 +117,7 @@ describe('Ticket descriptor path', () => { }); it('should delete the stowaway', async() => { - await page.waitForTimeout(1000); // initialization of functionality takes about 100ms to work + await page.waitForTimeout(1000); // initialization of functionality takes about 1000ms to work await page.waitToClick(selectors.ticketDescriptor.moreMenu); await page.waitForContentLoaded(); await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteStowawayButton); @@ -149,6 +149,7 @@ describe('Ticket descriptor path', () => { }); it('should invoice the ticket using the descriptor menu', async() => { + await page.waitForTimeout(1000); // initialization of functionality takes about 1000ms to work await page.waitToClick(selectors.ticketDescriptor.moreMenu); await page.waitForContentLoaded(); await page.waitToClick(selectors.ticketDescriptor.moreMenuMakeInvoice); @@ -180,7 +181,7 @@ describe('Ticket descriptor path', () => { describe('SMS', () => { it('should send the payment SMS using the descriptor menu', async() => { - await page.waitForTimeout(1000); // initialization of functionality takes about 100ms to work + await page.waitForTimeout(2000); // initialization of functionality takes about 1000ms to work await page.waitToClick(selectors.ticketDescriptor.moreMenu); await page.waitForContentLoaded(); await page.waitToClick(selectors.ticketDescriptor.moreMenuPaymentSMS); @@ -193,6 +194,7 @@ describe('Ticket descriptor path', () => { }); it('should send the import SMS using the descriptor menu', async() => { + await page.waitForTimeout(1000); // initialization of functionality takes about 1000ms to work await page.waitToClick(selectors.ticketDescriptor.moreMenu); await page.waitForContentLoaded(); await page.waitToClick(selectors.ticketDescriptor.moreMenuSendImportSms); diff --git a/e2e/paths/05-ticket/14_create_ticket.spec.js b/e2e/paths/05-ticket/14_create_ticket.spec.js index bd5d864896..1c0e10e6d9 100644 --- a/e2e/paths/05-ticket/14_create_ticket.spec.js +++ b/e2e/paths/05-ticket/14_create_ticket.spec.js @@ -62,7 +62,7 @@ describe('Ticket create path', () => { }); it('should make the previously created ticket the stowaway of the current ticket', async() => { - await page.waitForTimeout(1000); // initialization of functionality takes about 100ms to work + await page.waitForTimeout(1000); // initialization of functionality takes about 1000ms to work await page.waitToClick(selectors.ticketDescriptor.moreMenu); await page.waitToClick(selectors.ticketDescriptor.moreMenuAddStowaway); await page.waitToClick(selectors.ticketDescriptor.addStowawayDialogFirstTicket); @@ -72,6 +72,7 @@ describe('Ticket create path', () => { }); it('should delete the current ticket', async() => { + await page.waitForTimeout(1000); // initialization of functionality takes about 1000ms to work await page.waitToClick(selectors.ticketDescriptor.moreMenu); await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteTicket); await page.waitToClick(selectors.ticketDescriptor.acceptDialog); 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 914e6ea20a..a27050daa7 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 @@ -17,7 +17,7 @@ describe('Ticket create from client path', () => { }); it('should click the create simple ticket on the descriptor menu', async() => { - await page.waitForTimeout(1000); // initialization of functionality takes about 100ms to work + await page.waitForTimeout(1000); // initialization of functionality takes about 1000ms to work await page.waitToClick(selectors.clientDescriptor.moreMenu); await page.waitToClick(selectors.clientDescriptor.simpleTicketButton); await page.waitForState('ticket.create'); diff --git a/e2e/paths/09-invoice-in/02_descriptor.spec.js b/e2e/paths/09-invoice-in/02_descriptor.spec.js index 20102b2106..28b8e7ae3e 100644 --- a/e2e/paths/09-invoice-in/02_descriptor.spec.js +++ b/e2e/paths/09-invoice-in/02_descriptor.spec.js @@ -18,7 +18,7 @@ describe('InvoiceIn descriptor path', () => { }); it('should clone the invoiceIn using the descriptor more menu', async() => { - await page.waitForTimeout(1000); // initialization of functionality takes about 100ms to work + await page.waitForTimeout(1000); // initialization of functionality takes about 1000ms to work await page.waitToClick(selectors.invoiceInDescriptor.moreMenu); await page.waitToClick(selectors.invoiceInDescriptor.moreMenuCloneInvoiceIn); await page.waitToClick(selectors.invoiceInDescriptor.acceptButton); @@ -32,7 +32,7 @@ describe('InvoiceIn descriptor path', () => { }); it('should delete the cloned invoiceIn using the descriptor more menu', async() => { - await page.waitForTimeout(1000); // initialization of functionality takes about 100ms to work + await page.waitForTimeout(1000); // initialization of functionality takes about 1000ms to work await page.waitToClick(selectors.invoiceInDescriptor.moreMenu); await page.waitToClick(selectors.invoiceInDescriptor.moreMenuDeleteInvoiceIn); await page.waitToClick(selectors.invoiceInDescriptor.acceptButton); diff --git a/e2e/paths/09-invoice-out/02_descriptor.spec.js b/e2e/paths/09-invoice-out/02_descriptor.spec.js index 8d403e0839..222237b4f2 100644 --- a/e2e/paths/09-invoice-out/02_descriptor.spec.js +++ b/e2e/paths/09-invoice-out/02_descriptor.spec.js @@ -38,6 +38,7 @@ describe('InvoiceOut descriptor path', () => { }); it('should delete the invoiceOut using the descriptor more menu', async() => { + await page.waitForTimeout(1000); // initialization of functionality takes about 1000ms to work await page.waitToClick(selectors.invoiceOutDescriptor.moreMenu); await page.waitToClick(selectors.invoiceOutDescriptor.moreMenuDeleteInvoiceOut); await page.waitToClick(selectors.invoiceOutDescriptor.acceptDeleteButton); diff --git a/e2e/paths/09-invoice-out/03_manualInvoice.spec.js b/e2e/paths/09-invoice-out/03_manualInvoice.spec.js index cbf9f89352..d32ab3f3cf 100644 --- a/e2e/paths/09-invoice-out/03_manualInvoice.spec.js +++ b/e2e/paths/09-invoice-out/03_manualInvoice.spec.js @@ -16,7 +16,7 @@ describe('InvoiceOut manual invoice path', () => { }); it('should open the manual invoice form', async() => { - await page.waitForTimeout(1000); // initialization of functionality takes about 100ms to work + await page.waitForTimeout(1000); // initialization of functionality takes about 1000ms to work await page.waitToClick(selectors.invoiceOutIndex.createInvoice); await page.waitToClick(selectors.invoiceOutIndex.createManualInvoice); await page.waitForSelector(selectors.invoiceOutIndex.manualInvoiceForm); @@ -45,7 +45,7 @@ describe('InvoiceOut manual invoice path', () => { }); it('should now open the manual invoice form', async() => { - await page.waitForTimeout(1000); // initialization of functionality takes about 100ms to work + await page.waitForTimeout(1000); // initialization of functionality takes about 1000ms to work await page.waitToClick(selectors.invoiceOutIndex.createInvoice); await page.waitToClick(selectors.invoiceOutIndex.createManualInvoice); await page.waitForSelector(selectors.invoiceOutIndex.manualInvoiceForm); diff --git a/e2e/paths/10-travel/03_descriptor.spec.js b/e2e/paths/10-travel/03_descriptor.spec.js index 19f62b80a6..d61818866b 100644 --- a/e2e/paths/10-travel/03_descriptor.spec.js +++ b/e2e/paths/10-travel/03_descriptor.spec.js @@ -34,7 +34,7 @@ describe('Travel descriptor path', () => { }); it('should be redirected to the create entry view', async() => { - await page.waitForTimeout(1000); // initialization of functionality takes about 100ms to work + await page.waitForTimeout(1000); // initialization of functionality takes about 1000ms to work await page.waitToClick(selectors.travelDescriptor.dotMenu); await page.waitToClick(selectors.travelDescriptor.dotMenuAddEntry); await page.waitForState('entry.create'); @@ -90,7 +90,7 @@ describe('Travel descriptor path', () => { }); it('should be redirected to the create travel when using the clone option of the dot menu', async() => { - await page.waitForTimeout(1000); // initialization of functionality takes about 100ms to work + await page.waitForTimeout(1000); // initialization of functionality takes about 1000ms to work await page.waitToClick(selectors.travelDescriptor.dotMenu); await page.waitToClick(selectors.travelDescriptor.dotMenuClone); await page.respondToDialog('accept'); @@ -116,7 +116,7 @@ describe('Travel descriptor path', () => { }); it('should atempt to clone the travel and its entries using the descriptor menu but receive an error', async() => { - await page.waitForTimeout(1000); // initialization of functionality takes about 100ms to work + await page.waitForTimeout(1000); // initialization of functionality takes about 1000ms to work await page.waitToClick(selectors.travelDescriptor.dotMenu); await page.waitToClick(selectors.travelDescriptor.dotMenuCloneWithEntries); await page.waitToClick(selectors.travelDescriptor.acceptClonation); diff --git a/e2e/paths/11-zone/02_descriptor.spec.js b/e2e/paths/11-zone/02_descriptor.spec.js index fdf33c8981..d88829907d 100644 --- a/e2e/paths/11-zone/02_descriptor.spec.js +++ b/e2e/paths/11-zone/02_descriptor.spec.js @@ -17,7 +17,7 @@ describe('Zone descriptor path', () => { }); it('should eliminate the zone using the descriptor option', async() => { - await page.waitForTimeout(1000); // initialization of functionality takes about 100ms to work + await page.waitForTimeout(1000); // initialization of functionality takes about 1000ms to work await page.waitToClick(selectors.zoneDescriptor.menu); await page.waitToClick(selectors.zoneDescriptor.deleteZone); await page.respondToDialog('accept'); diff --git a/e2e/paths/14-account/01_create_and_basic_data.spec.js b/e2e/paths/14-account/01_create_and_basic_data.spec.js index 37b7855587..204da363c3 100644 --- a/e2e/paths/14-account/01_create_and_basic_data.spec.js +++ b/e2e/paths/14-account/01_create_and_basic_data.spec.js @@ -91,7 +91,7 @@ describe('Account create and basic data path', () => { }); it('should activate the account using the descriptor menu', async() => { - await page.waitForTimeout(1000); // initialization of functionality takes about 100ms to work + await page.waitForTimeout(1000); // initialization of functionality takes about 1000ms to work await page.waitToClick(selectors.accountDescriptor.menuButton); await page.waitToClick(selectors.accountDescriptor.activateAccount); await page.waitToClick(selectors.accountDescriptor.acceptButton); @@ -139,6 +139,7 @@ describe('Account create and basic data path', () => { describe('Set password', () => { it('should set the password using the descriptor menu', async() => { + await page.waitForTimeout(1000); // initialization of functionality takes about 1000ms to work await page.waitToClick(selectors.accountDescriptor.menuButton); await page.waitToClick(selectors.accountDescriptor.setPassword); await page.write(selectors.accountDescriptor.newPassword, 'quantum.crypt0graphy');