import selectors from '../../helpers/selectors'; import getBrowser from '../../helpers/puppeteer'; describe('Client log path', () => { let browser; let page; beforeAll(async() => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('employee', 'client'); await page.accessToSearchResult('DavidCharlesHaller'); await page.accessToSection('client.card.basicData'); }); afterAll(async() => { await browser.close(); }); it('should update the clients name', async() => { await page.clearInput(selectors.clientBasicData.name); await page.write(selectors.clientBasicData.name, 'this is a test'); await page.waitToClick(selectors.clientBasicData.saveButton); let result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should navigate to the log section', async() => { await page.waitToClick(selectors.clientLog.logButton); await page.waitForState('client.card.log'); }); it('should check the previous value of the last logged change', async() => { let lastModificationPreviousValue = await page .waitToGetProperty(selectors.clientLog.lastModificationPreviousValue, 'innerText'); expect(lastModificationPreviousValue).toContain('DavidCharlesHaller'); }); it('should check the current value of the last logged change', async() => { let lastModificationPreviousValue = await page .waitToGetProperty(selectors.clientLog.lastModificationPreviousValue, 'innerText'); let lastModificationCurrentValue = await page. waitToGetProperty(selectors.clientLog.lastModificationCurrentValue, 'innerText'); expect(lastModificationPreviousValue).toEqual('name: DavidCharlesHaller'); expect(lastModificationCurrentValue).toEqual('name: this is a test'); }); });