2020-01-14 08:20:14 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2017-12-15 09:07:52 +00:00
|
|
|
|
2023-04-24 10:59:56 +00:00
|
|
|
const $ = {
|
|
|
|
enableWebAccess: 'vn-client-web-access vn-check[label="Enable web access"]',
|
|
|
|
userName: 'vn-client-web-access vn-textfield[ng-model="$ctrl.account.name"]',
|
|
|
|
email: 'vn-client-web-access vn-textfield[ng-model="$ctrl.account.email"]',
|
|
|
|
saveButton: 'vn-client-web-access button[type=submit]',
|
2023-06-25 15:06:38 +00:00
|
|
|
nameValue: 'vn-client-log .changes-log:nth-child(2) .basic-json:nth-child(2) vn-json-value',
|
|
|
|
activeValue: 'vn-client-log .changes-log:nth-child(3) .basic-json:nth-child(1) vn-json-value'
|
2023-04-24 10:59:56 +00:00
|
|
|
};
|
|
|
|
|
2023-06-29 13:50:33 +00:00
|
|
|
fdescribe('Client web access path', () => {
|
2020-01-14 08:20:14 +00:00
|
|
|
let browser;
|
2019-12-31 11:00:16 +00:00
|
|
|
let page;
|
2023-04-24 10:59:56 +00:00
|
|
|
|
2019-12-31 11:00:16 +00:00
|
|
|
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
|
|
|
});
|
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
|
|
|
|
2023-04-24 10:59:56 +00:00
|
|
|
it('should modify and save web access attributes', async() => {
|
|
|
|
await page.accessToSection('client.card.webAccess');
|
|
|
|
await page.click($.enableWebAccess);
|
|
|
|
await page.click($.saveButton);
|
|
|
|
const enableMessage = await page.waitForSnackbar();
|
|
|
|
await page.overwrite($.userName, 'Legion');
|
|
|
|
await page.overwrite($.email, 'legion@marvel.com');
|
|
|
|
await page.click($.saveButton);
|
|
|
|
const modifyMessage = await page.waitForSnackbar();
|
2017-12-15 09:07:52 +00:00
|
|
|
|
2021-07-21 08:07:12 +00:00
|
|
|
await page.reloadSection('client.card.webAccess');
|
2023-04-24 10:59:56 +00:00
|
|
|
const hasAccess = await page.checkboxState($.enableWebAccess);
|
|
|
|
const userName = await page.getValue($.userName);
|
|
|
|
const email = await page.getValue($.email);
|
2018-10-30 07:51:18 +00:00
|
|
|
|
2023-06-29 13:50:33 +00:00
|
|
|
// await page.accessToSection('client.card.log');
|
|
|
|
// const logName = await page.innerText($.nameValue);
|
|
|
|
// const logActive = await page.innerText($.activeValue);
|
2020-06-16 08:32:32 +00:00
|
|
|
|
2023-04-24 10:59:56 +00:00
|
|
|
expect(enableMessage.type).toBe('success');
|
|
|
|
expect(modifyMessage.type).toBe('success');
|
2021-07-21 08:07:12 +00:00
|
|
|
|
2023-04-24 10:59:56 +00:00
|
|
|
expect(hasAccess).toBe('unchecked');
|
|
|
|
expect(userName).toEqual('Legion');
|
|
|
|
expect(email).toEqual('legion@marvel.com');
|
2021-07-21 08:07:12 +00:00
|
|
|
|
2023-06-29 13:50:33 +00:00
|
|
|
// expect(logName).toEqual('Legion');
|
|
|
|
// expect(logActive).toEqual('✗');
|
2021-07-21 08:07:12 +00:00
|
|
|
});
|
2017-12-15 09:07:52 +00:00
|
|
|
});
|