2022-06-20 05:31:10 +00:00
|
|
|
/* eslint max-len: ["error", { "code": 150 }]*/
|
2020-01-14 08:20:14 +00:00
|
|
|
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', () => {
|
2020-01-14 08:20:14 +00:00
|
|
|
let browser;
|
2019-12-31 11:00:16 +00:00
|
|
|
let page;
|
|
|
|
beforeAll(async() => {
|
2020-01-14 08:20:14 +00:00
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
2022-10-05 11:09:06 +00:00
|
|
|
await page.loginAndModule('salesPerson', 'client');
|
2022-06-21 11:58:47 +00:00
|
|
|
await page.accessToSearchResult('max');
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.accessToSection('client.card.webAccess');
|
|
|
|
});
|
2017-12-15 09:07:52 +00:00
|
|
|
|
2019-12-31 11:00:16 +00:00
|
|
|
afterAll(async() => {
|
2020-01-14 08:40:50 +00:00
|
|
|
await browser.close();
|
2018-11-20 13:22:00 +00:00
|
|
|
});
|
2017-12-15 09:07:52 +00:00
|
|
|
|
2021-07-21 08:07:12 +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);
|
2021-07-21 08:07:12 +00:00
|
|
|
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);
|
2022-06-17 07:28:54 +00:00
|
|
|
await page.write(selectors.clientWebAccess.userName, 'Legion');
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.waitToClick(selectors.clientWebAccess.saveButton);
|
2022-06-20 05:31:10 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
|
|
|
|
|
|
|
expect(message.text).toContain('Data saved!');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should update the email`, async() => {
|
|
|
|
await page.clearInput(selectors.clientWebAccess.email);
|
2022-06-21 11:58:47 +00:00
|
|
|
await page.write(selectors.clientWebAccess.email, 'legion@marvel.com');
|
2022-06-20 05:31:10 +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
|
|
|
|
2021-07-21 08:07:12 +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
|
|
|
|
2019-02-14 19:17:22 +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
|
|
|
|
2022-06-17 07:28:54 +00:00
|
|
|
expect(result).toEqual('Legion');
|
2017-12-15 09:07:52 +00:00
|
|
|
});
|
2020-06-16 08:32:32 +00:00
|
|
|
|
2022-06-21 11:58:47 +00:00
|
|
|
it('should confirm web access email have been updated', async() => {
|
|
|
|
const result = await page.waitToGetProperty(selectors.clientWebAccess.email, 'value');
|
|
|
|
|
|
|
|
expect(result).toEqual('legion@marvel.com');
|
|
|
|
});
|
|
|
|
|
2020-06-16 08:32:32 +00:00
|
|
|
it(`should navigate to the log section`, async() => {
|
|
|
|
await page.accessToSection('client.card.log');
|
|
|
|
});
|
|
|
|
|
2022-06-17 07:28:54 +00:00
|
|
|
it(`should confirm the last log shows the updated client name and no modifications on active checkbox`, async() => {
|
2022-12-05 14:30:41 +00:00
|
|
|
let namePreviousValue = await page
|
|
|
|
.waitToGetProperty(selectors.clientLog.namePreviousValue, 'innerText');
|
|
|
|
let nameCurrentValue = await page
|
|
|
|
.waitToGetProperty(selectors.clientLog.nameCurrentValue, 'innerText');
|
2020-06-16 08:32:32 +00:00
|
|
|
|
2022-12-05 14:30:41 +00:00
|
|
|
expect(namePreviousValue).toEqual('MaxEisenhardt');
|
|
|
|
expect(nameCurrentValue).toEqual('Legion');
|
2020-06-16 08:32:32 +00:00
|
|
|
});
|
2021-07-21 08:07:12 +00:00
|
|
|
|
2022-06-17 07:28:54 +00:00
|
|
|
it(`should confirm the penultimate log shows the updated active and no modifications on client name`, async() => {
|
2022-12-05 14:30:41 +00:00
|
|
|
let activePreviousValue = await page
|
|
|
|
.waitToGetProperty(selectors.clientLog.activePreviousValue, 'innerText');
|
|
|
|
let activeCurrentValue = await page
|
|
|
|
.waitToGetProperty(selectors.clientLog.activeCurrentValue, 'innerText');
|
2021-07-21 08:07:12 +00:00
|
|
|
|
2022-12-05 14:30:41 +00:00
|
|
|
expect(activePreviousValue).toEqual('✓');
|
|
|
|
expect(activeCurrentValue).toEqual('✗');
|
2021-07-21 08:07:12 +00:00
|
|
|
});
|
2017-12-15 09:07:52 +00:00
|
|
|
});
|