diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index ebb9bfa89..8bd4d0ce8 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -9,6 +9,7 @@ export default { invoiceOutButton: '.modules-menu > li[ui-sref="invoiceOut.index"]', claimsButton: '.modules-menu > li[ui-sref="claim.index"]', returnToModuleIndexButton: 'a[ui-sref="order.index"]', + homeButton: 'vn-topbar > div.side.start > a', userMenuButton: '#user', userLocalWarehouse: '.user-popover vn-autocomplete[ng-model="$ctrl.localWarehouseFk"]', userLocalBank: '.user-popover vn-autocomplete[ng-model="$ctrl.localBankFk"]', @@ -832,5 +833,10 @@ export default { header: 'vn-entry-summary > vn-card > h5', reference: 'vn-entry-summary vn-label-value[label="Reference"]', confirmed: 'vn-entry-summary vn-check[label="Confirmed"]', + }, + entryDescriptor: { + agency: 'vn-entry-descriptor div.body vn-label-value:nth-child(3) span', + travelsQuicklink: 'vn-entry-descriptor vn-quick-links > a:nth-child(1)', + entriesQuicklink: 'vn-entry-descriptor vn-quick-links > a:nth-child(2)' } }; diff --git a/e2e/paths/12-entry/02_descriptor.spec.js b/e2e/paths/12-entry/02_descriptor.spec.js new file mode 100644 index 000000000..8fa0d2a4f --- /dev/null +++ b/e2e/paths/12-entry/02_descriptor.spec.js @@ -0,0 +1,61 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +describe('Entry descriptor path', () => { + let browser; + let page; + + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('buyer', 'entry'); + await page.accessToSearchResult('2'); + }); + + afterAll(async() => { + await browser.close(); + }); + + it('should reach the second entry summary section', async() => { + let url = await page.expectURL('#!/entry/2/summary'); + + expect(url).toBe(true); + }); + + it('should show some entry information', async() => { + const result = await page.waitToGetProperty(selectors.entryDescriptor.agency, 'innerText'); + + expect(result).toContain('inhouse pickup'); + }); + + it('should click the travels button to be redirected to the travels index filtered by the current agency', async() => { + await page.waitToClick(selectors.entryDescriptor.travelsQuicklink); + const url = await page.expectURL('/travel/index'); + const filter = await page.expectURL('agencyFk'); + + expect(url).toBe(true); + expect(filter).toBe(true); + }); + + it('should go back to the entry summary', async() => { + await page.waitToClick(selectors.globalItems.homeButton); + await page.selectModule('entry'); + await page.accessToSearchResult('2'); + let url = await page.expectURL('#!/entry/2/summary'); + + expect(url).toBe(true); + }); + + it('should click the entries button to be redirected to the entries index filtered by the current supplier', async() => { + await page.waitToClick(selectors.entryDescriptor.entriesQuicklink); + const url = await page.expectURL('/entry/index'); + const supplierFilter = await page.expectURL('supplierFk'); + const toFilter = await page.expectURL('to'); + const fromFilter = await page.expectURL('from'); + + expect(url).toBe(true); + expect(supplierFilter).toBe(true); + expect(toFilter).toBe(true); + expect(fromFilter).toBe(true); + }); +});