import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; describe('Supplier summary & 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 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, {visible: false}); }); });