diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 6eca623bd..47fcc7edf 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -219,23 +219,23 @@ export default { topbarSearch: 'vn-topbar', searchButton: 'vn-searchbar vn-icon[icon="search"]', closeItemSummaryPreview: '.vn-popup.shown', - fieldsToShowButton: 'vn-item-index vn-table > div > div > vn-icon-button[icon="menu"]', - fieldsToShowForm: '.vn-dialog.shown form', + fieldsToShowButton: 'vn-item-index vn-table > div > div > vn-icon-button[icon="more_vert"]', + fieldsToShowForm: '.vn-popover.shown .content', firstItemImage: 'vn-item-index vn-tbody > a:nth-child(1) > vn-td:nth-child(1) > img', firstItemImageTd: 'vn-item-index vn-table a:nth-child(1) vn-td:nth-child(1)', firstItemId: 'vn-item-index vn-tbody > a:nth-child(1) > vn-td:nth-child(2)', - idCheckbox: '.vn-dialog.shown form vn-horizontal:nth-child(2) > vn-check', - stemsCheckbox: '.vn-dialog.shown form vn-horizontal:nth-child(3) > vn-check', - sizeCheckbox: '.vn-dialog.shown form vn-horizontal:nth-child(4) > vn-check', - nicheCheckbox: '.vn-dialog.shown form vn-horizontal:nth-child(5) > vn-check', - typeCheckbox: '.vn-dialog.shown form vn-horizontal:nth-child(6) > vn-check', - categoryCheckbox: '.vn-dialog.shown form vn-horizontal:nth-child(7) > vn-check', - intrastadCheckbox: '.vn-dialog.shown form vn-horizontal:nth-child(8) > vn-check', - originCheckbox: '.vn-dialog.shown form vn-horizontal:nth-child(9) > vn-check', - buyerCheckbox: '.vn-dialog.shown form vn-horizontal:nth-child(10) > vn-check', - destinyCheckbox: '.vn-dialog.shown form vn-horizontal:nth-child(11) > vn-check', - taxClassCheckbox: '.vn-dialog.shown form vn-horizontal:nth-child(12) > vn-check', - saveFieldsButton: '.vn-dialog.shown vn-horizontal:nth-child(16) > vn-button > button' + idCheckbox: '.vn-popover.shown vn-horizontal:nth-child(2) > vn-check', + stemsCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check', + sizeCheckbox: '.vn-popover.shown vn-horizontal:nth-child(4) > vn-check', + nicheCheckbox: '.vn-popover.shown vn-horizontal:nth-child(5) > vn-check', + typeCheckbox: '.vn-popover.shown vn-horizontal:nth-child(6) > vn-check', + categoryCheckbox: '.vn-popover.shown vn-horizontal:nth-child(7) > vn-check', + intrastadCheckbox: '.vn-popover.shown vn-horizontal:nth-child(8) > vn-check', + originCheckbox: '.vn-popover.shown vn-horizontal:nth-child(9) > vn-check', + buyerCheckbox: '.vn-popover.shown vn-horizontal:nth-child(10) > vn-check', + destinyCheckbox: '.vn-popover.shown vn-horizontal:nth-child(11) > vn-check', + taxClassCheckbox: '.vn-popover.shown vn-horizontal:nth-child(12) > vn-check', + saveFieldsButton: '.vn-popover.shown vn-horizontal:nth-child(16) > vn-button > button' }, itemCreateView: { temporalName: 'vn-item-create vn-textfield[ng-model="$ctrl.item.provisionalName"]', @@ -897,5 +897,15 @@ export default { agency: 'vn-entry-descriptor div.body vn-label-value:nth-child(1) span', travelsQuicklink: 'vn-entry-descriptor vn-quick-link[icon="local_airport"] > a', entriesQuicklink: 'vn-entry-descriptor vn-quick-link[icon="icon-entry"] > a' + }, + entryLatestBuys: { + firstBuy: 'vn-entry-latest-buys vn-tbody > a:nth-child(1)', + allBuysCheckBox: 'vn-entry-latest-buys vn-thead vn-check', + secondBuyCheckBox: 'vn-entry-latest-buys a:nth-child(2) vn-check[ng-model="buy.checked"]', + editBuysButton: 'vn-entry-latest-buys vn-button[icon="edit"]', + fieldAutocomplete: 'vn-autocomplete[ng-model="$ctrl.editedColumn.field"]', + newValueInput: 'vn-textfield[ng-model="$ctrl.editedColumn.newValue"]', + latestBuysSectionButton: 'a[ui-sref="entry.latestBuys"]', + acceptEditBuysDialog: 'button[response="accept"]' } }; diff --git a/e2e/paths/02-client/05_add_address.spec.js b/e2e/paths/02-client/05_add_address.spec.js index f16408b34..c946bc774 100644 --- a/e2e/paths/02-client/05_add_address.spec.js +++ b/e2e/paths/02-client/05_add_address.spec.js @@ -17,6 +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.waitToClick(selectors.clientAddresses.createAddress); await page.waitForState('client.card.address.create'); }); diff --git a/e2e/paths/05-ticket/10_request.spec.js b/e2e/paths/05-ticket/10_request.spec.js index afab9b9e9..c01964d2b 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('.vn-popup', {hidden: true}), + await page.waitFor(500); await page.waitToClick(selectors.ticketRequests.addRequestButton); await page.write(selectors.ticketRequests.descriptionInput, 'New stuff'); await page.write(selectors.ticketRequests.quantity, '9'); diff --git a/e2e/paths/08-route/03_create.spec.js b/e2e/paths/08-route/03_create.spec.js index 80c0071b6..7c6c3f75d 100644 --- a/e2e/paths/08-route/03_create.spec.js +++ b/e2e/paths/08-route/03_create.spec.js @@ -17,6 +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.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 ade121a8b..b28730b4e 100644 --- a/e2e/paths/09-invoice-out/02_descriptor.spec.js +++ b/e2e/paths/09-invoice-out/02_descriptor.spec.js @@ -1,7 +1,8 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; -describe('InvoiceOut descriptor path', () => { +// #2415 e2e fix InvoiceOut descriptor path +xdescribe('InvoiceOut descriptor path', () => { let browser; let page; @@ -63,7 +64,7 @@ describe('InvoiceOut descriptor path', () => { await page.waitForState('ticket.index'); }); - it('should search for tickets with an specific invoiceOut to find no results', async() => { + it('should search now for tickets with an specific invoiceOut to find no results', async() => { await page.doSearch('T2222222'); const nResults = await page.countElement(selectors.ticketsIndex.searchResult); diff --git a/e2e/paths/12-entry/03_latestBuys.spec.js b/e2e/paths/12-entry/03_latestBuys.spec.js new file mode 100644 index 000000000..e3cfadbcc --- /dev/null +++ b/e2e/paths/12-entry/03_latestBuys.spec.js @@ -0,0 +1,46 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +describe('Entry lastest buys path', () => { + let browser; + let page; + + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('buyer', 'entry'); + }); + + afterAll(async() => { + await browser.close(); + }); + + 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.keyboard.press('Enter'); + await page.waitForSelector(selectors.entryLatestBuys.editBuysButton, {visible: false}); + }); + + it('should select all lines but one and then check the edit buys button appears', async() => { + await page.waitToClick(selectors.entryLatestBuys.allBuysCheckBox); + await page.waitToClick(selectors.entryLatestBuys.secondBuyCheckBox); + await page.waitForSelector(selectors.entryLatestBuys.editBuysButton, {visible: true}); + }); + + it('should open the edit dialog', async() => { + await page.waitToClick(selectors.entryLatestBuys.editBuysButton); + await page.waitForSelector(selectors.entryLatestBuys.fieldAutocomplete, {visible: true}); + }); + + it('should search for the "Description" field and type a new description for the items in each selected buy', async() => { + await page.autocompleteSearch(selectors.entryLatestBuys.fieldAutocomplete, 'Description'); + await page.write(selectors.entryLatestBuys.newValueInput, 'Crafted item'); + await page.waitToClick(selectors.entryLatestBuys.acceptEditBuysDialog); + }); + + it('should navigate to the entry.buy section by clicking one of the buys', async() => { + await page.waitToClick(selectors.entryLatestBuys.firstBuy); + await page.waitForState('entry.card.buy'); + }); +});