From b01f18187d69d32757e35ca6290d896880bf8604 Mon Sep 17 00:00:00 2001 From: "LaptopVerdnatura\\Javi" Date: Fri, 13 Nov 2020 17:37:02 +0100 Subject: [PATCH] e2e fix ticket sale --- e2e/helpers/selectors.js | 3 ++- .../05-ticket/01-sale/02_edit_sale.spec.js | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index ffcff8734..95ffca91e 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -496,7 +496,8 @@ export default { moveToTicketInput: 'form vn-input-number[ng-model="$ctrl.transfer.ticketId"] input', moveToTicketButton: '.vn-popover.shown vn-icon[icon="arrow_forward_ios"]', moveToNewTicketButton: '.vn-popover.shown vn-button[label="New ticket"]', - stateMenuButton: 'vn-ticket-sale vn-tool-bar > vn-button-menu[label="State"]' + stateMenuButton: 'vn-ticket-sale vn-tool-bar > vn-button-menu[label="State"]', + moreMenuState: 'body > div > div > div.content > div.filter.ng-scope > vn-textfield' }, ticketTracking: { createStateButton: 'vn-float-button' 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 4bc37b8fe..c3403b371 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 @@ -35,9 +35,23 @@ describe('Ticket Edit sale path', () => { }); it(`should set the ticket as libre`, async() => { + const searchValue = 'libre'; await page.waitToClick(selectors.ticketSales.stateMenuButton); - await page.write('body > div > div > div.content > div.filter.ng-scope > vn-textfield', 'libre'); - await page.waitFor(500); + await page.write(selectors.ticketSales.moreMenuState, searchValue); + try { + await page.waitForFunction(searchValue => { + const element = document.querySelector('li.active'); + if (element) + return element.innerText.toLowerCase().includes(searchValue.toLowerCase()); + }, {}, searchValue); + } catch (error) { + const builtSelector = await page.selectorFormater(selectors.ticketSales.moreMenuState); + const inputValue = await page.evaluate(() => { + return document.querySelector('.vn-drop-down.shown vn-textfield input').value; + }); + throw new Error(`${builtSelector} value is ${inputValue}! ${error}`); + } + await page.waitForState('ticket.card.sale'); await page.keyboard.press('Enter'); const message = await page.waitForSnackbar();