57 lines
2.1 KiB
JavaScript
57 lines
2.1 KiB
JavaScript
import getBrowser from '../../helpers/puppeteer';
|
|
|
|
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]',
|
|
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'
|
|
};
|
|
|
|
describe('Client web access path', () => {
|
|
let browser;
|
|
let page;
|
|
|
|
beforeAll(async() => {
|
|
browser = await getBrowser();
|
|
page = browser.page;
|
|
await page.loginAndModule('salesPerson', 'client');
|
|
await page.accessToSearchResult('max');
|
|
});
|
|
|
|
afterAll(async() => {
|
|
await browser.close();
|
|
});
|
|
|
|
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();
|
|
|
|
await page.reloadSection('client.card.webAccess');
|
|
const hasAccess = await page.checkboxState($.enableWebAccess);
|
|
const userName = await page.getValue($.userName);
|
|
const email = await page.getValue($.email);
|
|
|
|
// await page.accessToSection('client.card.log');
|
|
// const logName = await page.innerText($.nameValue);
|
|
// const logActive = await page.innerText($.activeValue);
|
|
|
|
expect(enableMessage.type).toBe('success');
|
|
expect(modifyMessage.type).toBe('success');
|
|
|
|
expect(hasAccess).toBe('unchecked');
|
|
expect(userName).toEqual('legion');
|
|
expect(email).toEqual('legion@marvel.com');
|
|
|
|
// expect(logName).toEqual('Legion');
|
|
// expect(logActive).toEqual('✗');
|
|
});
|
|
});
|