diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 8cea46964..06235cbfd 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -901,5 +901,16 @@ export default { newEntryTravel: 'vn-entry-create vn-autocomplete[ng-model="$ctrl.entry.travelFk"]', newEntryCompany: 'vn-entry-create vn-autocomplete[ng-model="$ctrl.entry.companyFk"]', saveNewEntry: 'vn-entry-create button[type="submit"]' + }, + supplierSummary: { + header: 'vn-supplier-summary > vn-card > h5', + basicDataId: 'vn-supplier-summary vn-label-value[label="Id"]', + fiscalAddressTaxNumber: 'vn-supplier-summary vn-label-value[label="Tax number"]', + billingDataPayMethod: 'vn-supplier-summary vn-label-value[label="Pay method"]' + }, + supplierDescriptor: { + alias: 'vn-supplier-descriptor vn-label-value[label="Alias"]', + clientButton: 'vn-supplier-descriptor vn-icon[icon="person"]', + entriesButton: 'vn-supplier-descriptor vn-icon[icon="icon-entry"]', } }; diff --git a/e2e/paths/13-supplier/01_summary_and_descriptor.spec.js b/e2e/paths/13-supplier/01_summary_and_descriptor.spec.js new file mode 100644 index 000000000..953a9ee28 --- /dev/null +++ b/e2e/paths/13-supplier/01_summary_and_descriptor.spec.js @@ -0,0 +1,84 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +describe('Supplier descriptor path', () => { + let browser; + let page; + + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('administrative', 'supplier'); + await page.accessToSearchResult('1'); + }); + + afterAll(async() => { + await browser.close(); + }); + + // summary + it('should reach the second entry summary section', async() => { + await page.waitForState('supplier.card.summary'); + }); + + it(`should confirm there's data on the summary header`, async() => { + const result = await page.waitToGetProperty(selectors.supplierSummary.header, 'innerText'); + + expect(result).toContain('Plants SL - 1'); + }); + + it(`should confirm there's data on the summary basic data`, async() => { + const result = await page.waitToGetProperty(selectors.supplierSummary.basicDataId, 'innerText'); + + expect(result).toContain('Id 1'); + }); + + it(`should confirm there's data on the summary fiscal address`, async() => { + const result = await page.waitToGetProperty(selectors.supplierSummary.fiscalAddressTaxNumber, 'innerText'); + + expect(result).toContain('Tax number 06089160W'); + }); + + it(`should confirm there's data on the summary fiscal pay method`, async() => { + const result = await page.waitToGetProperty(selectors.supplierSummary.billingDataPayMethod, 'innerText'); + + expect(result).toContain('Pay method PayMethod one'); + }); + + // descriptor + it(`should confirm there's data on the descriptor`, async() => { + const result = await page.waitToGetProperty(selectors.supplierDescriptor.alias, 'innerText'); + + expect(result).toContain('Plants nick'); + }); + + it(`should navigate to the supplier's client summary using the icon client button`, async() => { + await page.waitToClick(selectors.supplierDescriptor.clientButton); + await page.waitForState('client.card.summary'); + }); + + it(`should navigate back to the supplier`, async() => { + await page.waitToClick(selectors.globalItems.homeButton); + await page.waitForState('home'); + await page.selectModule('supplier'); + await page.accessToSearchResult('1'); + await page.waitForState('supplier.card.summary'); + }); + + it(`should navigate to the supplier's entries`, async() => { + await page.waitToClick(selectors.supplierDescriptor.entriesButton); + await page.waitForState('entry.index'); + }); + + it(`should navigate back to suppliers but a different one this time`, async() => { + await page.waitToClick(selectors.globalItems.homeButton); + await page.waitForState('home'); + await page.selectModule('supplier'); + await page.accessToSearchResult('2'); + await page.waitForState('supplier.card.summary'); + }); + + it(`should check the client button isn't present since this supplier should not be a client`, async() => { + await page.waitForSelector(selectors.supplierDescriptor.clientButton, {hidden: true}); + }); +}); diff --git a/gulpfile.js b/gulpfile.js index 6bd2b3542..61459c3fd 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -162,6 +162,9 @@ function e2eSingleRun() { `${__dirname}/e2e/paths/08*/*[sS]pec.js`, `${__dirname}/e2e/paths/09*/*[sS]pec.js`, `${__dirname}/e2e/paths/10*/*[sS]pec.js`, + `${__dirname}/e2e/paths/11*/*[sS]pec.js`, + `${__dirname}/e2e/paths/12*/*[sS]pec.js`, + `${__dirname}/e2e/paths/13*/*[sS]pec.js`, `${__dirname}/e2e/paths/**/*[sS]pec.js` ]; diff --git a/modules/supplier/front/summary/index.html b/modules/supplier/front/summary/index.html index c22a32f91..be6a027a6 100644 --- a/modules/supplier/front/summary/index.html +++ b/modules/supplier/front/summary/index.html @@ -28,7 +28,7 @@ -