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

43 lines
1.6 KiB
JavaScript

import selectors from '../../helpers/selectors.js';
import openPage from '../../helpers/puppeteer';
describe('Client Edit web access path', () => {
const nightmare = createNightmare();
beforeAll(() => {
nightmare
.loginAndModule('employee', 'client')
.accessToSearchResult('Bruce Banner')
.accessToSection('client.card.webAccess');
});
it(`should uncheck the Enable web access checkbox and update the name`, async() => {
const result = await nightmare
.waitToClick(selectors.clientWebAccess.enableWebAccessCheckbox)
.clearInput(selectors.clientWebAccess.userNameInput)
.write(selectors.clientWebAccess.userNameInput, 'Hulk')
.waitToClick(selectors.clientWebAccess.saveButton)
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should confirm web access is now unchecked', async() => {
const result = await nightmare
.waitToClick(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
.waitToClick(selectors.clientsIndex.othersButton)
.waitToClick(selectors.clientWebAccess.webAccessButton)
.checkboxState(selectors.clientWebAccess.enableWebAccessCheckbox);
expect(result).toBe('unchecked');
});
it('should confirm web access name have been updated', async() => {
const result = await nightmare
.waitToGetProperty(selectors.clientWebAccess.userNameInput, 'value');
expect(result).toEqual('Hulk');
});
});