salix/e2e/paths/02-client/07_edit_web_access.spec.js

73 lines
3.1 KiB
JavaScript
Raw Normal View History

import selectors from '../../helpers/selectors';
import getBrowser from '../../helpers/puppeteer';
2017-12-15 09:07:52 +00:00
2018-11-20 13:22:00 +00:00
describe('Client Edit web access path', () => {
let browser;
2019-12-31 11:00:16 +00:00
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
2019-12-31 11:00:16 +00:00
await page.loginAndModule('employee', 'client');
await page.accessToSearchResult('Bruce Banner');
await page.accessToSection('client.card.webAccess');
});
2017-12-15 09:07:52 +00:00
2019-12-31 11:00:16 +00:00
afterAll(async() => {
await browser.close();
2018-11-20 13:22:00 +00:00
});
2017-12-15 09:07:52 +00:00
it('should uncheck the Enable web access checkbox', async() => {
2019-12-31 11:00:16 +00:00
await page.waitToClick(selectors.clientWebAccess.enableWebAccessCheckbox);
await page.waitToClick(selectors.clientWebAccess.saveButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it(`should update the name`, async() => {
2020-02-03 14:55:11 +00:00
await page.clearInput(selectors.clientWebAccess.userName);
await page.write(selectors.clientWebAccess.userName, 'Hulk');
2019-12-31 11:00:16 +00:00
await page.waitToClick(selectors.clientWebAccess.saveButton);
2020-04-08 09:24:40 +00:00
const message = await page.waitForSnackbar();
2018-10-30 07:51:18 +00:00
2020-11-10 11:06:21 +00:00
expect(message.text).toContain('Data saved!');
2018-11-20 13:22:00 +00:00
});
2017-12-15 09:07:52 +00:00
it('should reload the section and confirm web access is now unchecked', async() => {
await page.reloadSection('client.card.webAccess');
2019-12-31 11:00:16 +00:00
const result = await page.checkboxState(selectors.clientWebAccess.enableWebAccessCheckbox);
2018-10-30 07:51:18 +00:00
expect(result).toBe('unchecked');
2018-11-20 13:22:00 +00:00
});
2018-04-05 07:43:37 +00:00
2019-01-16 14:02:50 +00:00
it('should confirm web access name have been updated', async() => {
2020-02-03 14:55:11 +00:00
const result = await page.waitToGetProperty(selectors.clientWebAccess.userName, 'value');
2018-10-30 07:51:18 +00:00
2018-11-20 13:22:00 +00:00
expect(result).toEqual('Hulk');
2017-12-15 09:07:52 +00:00
});
2020-06-16 08:32:32 +00:00
it(`should navigate to the log section`, async() => {
await page.accessToSection('client.card.log');
});
it(`should confirm the last log is showing the updated client name and no modifications on the active checkbox`, async() => {
2020-06-16 08:32:32 +00:00
let lastModificationPreviousValue = await page
.waitToGetProperty(selectors.clientLog.lastModificationPreviousValue, 'innerText');
let lastModificationCurrentValue = await page
.waitToGetProperty(selectors.clientLog.lastModificationCurrentValue, 'innerText');
expect(lastModificationPreviousValue).toEqual('name BruceBanner active false');
2021-05-19 12:14:04 +00:00
expect(lastModificationCurrentValue).toEqual('name Hulk active false');
2020-06-16 08:32:32 +00:00
});
it(`should confirm the penultimate log is showing the updated avtive field and no modifications on the client name`, async() => {
let penultimateModificationPreviousValue = await page
.waitToGetProperty(selectors.clientLog.penultimateModificationPreviousValue, 'innerText');
let penultimateModificationCurrentValue = await page
.waitToGetProperty(selectors.clientLog.penultimateModificationCurrentValue, 'innerText');
expect(penultimateModificationPreviousValue).toEqual('name BruceBanner active true');
expect(penultimateModificationCurrentValue).toEqual('name BruceBanner active false');
});
2017-12-15 09:07:52 +00:00
});