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

57 lines
2.1 KiB
JavaScript
Raw Normal View History

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', () => {
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() => {
browser = await getBrowser();
page = browser.page;
2022-10-05 11:09:06 +00:00
await page.loginAndModule('salesPerson', 'client');
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() => {
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
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');
2023-04-24 10:59:56 +00:00
expect(hasAccess).toBe('unchecked');
expect(userName).toEqual('Legion');
expect(email).toEqual('legion@marvel.com');
2023-06-29 13:50:33 +00:00
// expect(logName).toEqual('Legion');
// expect(logActive).toEqual('✗');
});
2017-12-15 09:07:52 +00:00
});