2018-02-15 11:28:05 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2018-02-20 09:00:19 +00:00
|
|
|
import createNightmare from '../../helpers/helpers';
|
2017-12-15 09:07:52 +00:00
|
|
|
|
|
|
|
describe('Edit web access path', () => {
|
2018-02-20 09:00:19 +00:00
|
|
|
const nightmare = createNightmare();
|
2017-12-15 09:07:52 +00:00
|
|
|
|
2018-03-02 11:15:17 +00:00
|
|
|
beforeAll(() => {
|
|
|
|
return nightmare
|
|
|
|
.waitForLogin('developer');
|
|
|
|
});
|
|
|
|
|
2018-02-20 09:00:19 +00:00
|
|
|
it('should click on the Clients button of the top bar menu', () => {
|
|
|
|
return nightmare
|
2017-12-15 09:07:52 +00:00
|
|
|
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
|
|
|
.wait(selectors.globalItems.applicationsMenuVisible)
|
|
|
|
.waitToClick(selectors.globalItems.clientsButton)
|
|
|
|
.wait(selectors.clientsIndex.createClientButton)
|
2018-02-20 21:35:54 +00:00
|
|
|
.parsedUrl()
|
2017-12-15 09:07:52 +00:00
|
|
|
.then(url => {
|
2018-02-20 09:00:19 +00:00
|
|
|
expect(url.hash).toEqual('#!/clients');
|
|
|
|
});
|
2017-12-15 09:07:52 +00:00
|
|
|
});
|
|
|
|
|
2018-02-20 09:00:19 +00:00
|
|
|
it('should search for the user Bruce Banner', () => {
|
|
|
|
return nightmare
|
2017-12-15 09:07:52 +00:00
|
|
|
.wait(selectors.clientsIndex.searchResult)
|
|
|
|
.type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
|
|
|
|
.click(selectors.clientsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
|
|
|
.countSearchResults(selectors.clientsIndex.searchResult)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual(1);
|
2018-02-20 09:00:19 +00:00
|
|
|
});
|
2017-12-15 09:07:52 +00:00
|
|
|
});
|
|
|
|
|
2018-02-20 09:00:19 +00:00
|
|
|
it(`should click on the search result to access to the client's web access`, () => {
|
|
|
|
return nightmare
|
2017-12-15 09:07:52 +00:00
|
|
|
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
|
|
|
|
.waitToClick(selectors.clientsIndex.searchResult)
|
2018-02-15 11:28:05 +00:00
|
|
|
.waitToClick(selectors.clientWebAccess.webAccessButton)
|
2017-12-15 09:07:52 +00:00
|
|
|
.waitForURL('web-access')
|
|
|
|
.url()
|
|
|
|
.then(url => {
|
|
|
|
expect(url).toContain('web-access');
|
2018-02-20 09:00:19 +00:00
|
|
|
});
|
2017-12-15 09:07:52 +00:00
|
|
|
});
|
|
|
|
|
2018-02-20 09:00:19 +00:00
|
|
|
it(`should click on the Enable web access checkbox to uncheck it`, () => {
|
|
|
|
return nightmare
|
2018-02-15 11:28:05 +00:00
|
|
|
.waitToClick(selectors.clientWebAccess.enableWebAccessCheckbox)
|
|
|
|
.waitToClick(selectors.clientFiscalData.saveButton)
|
2018-02-20 09:00:19 +00:00
|
|
|
.waitForSnackbar()
|
2018-01-09 12:51:41 +00:00
|
|
|
.then(result => {
|
|
|
|
expect(result).toContain(`Data saved!`);
|
2018-02-20 09:00:19 +00:00
|
|
|
});
|
2017-12-15 09:07:52 +00:00
|
|
|
});
|
|
|
|
|
2018-02-20 09:00:19 +00:00
|
|
|
it('should confirm Enable web access checkbox is unchecked', () => {
|
|
|
|
return nightmare
|
2018-02-15 11:28:05 +00:00
|
|
|
.waitToClick(selectors.clientBasicData.basicDataButton)
|
|
|
|
.wait(selectors.clientBasicData.nameInput)
|
|
|
|
.waitToClick(selectors.clientWebAccess.webAccessButton)
|
|
|
|
.wait(selectors.clientWebAccess.enableWebAccessCheckbox)
|
2018-01-09 12:51:41 +00:00
|
|
|
.evaluate(selector => {
|
|
|
|
return document.querySelector(selector).checked;
|
2018-02-15 11:28:05 +00:00
|
|
|
}, selectors.clientWebAccess.enableWebAccessCheckbox)
|
2018-01-09 12:51:41 +00:00
|
|
|
.then(value => {
|
|
|
|
expect(value).toBeFalsy();
|
2018-02-20 09:00:19 +00:00
|
|
|
});
|
2017-12-15 09:07:52 +00:00
|
|
|
});
|
|
|
|
|
2018-02-20 09:00:19 +00:00
|
|
|
it('should edit the User name', () => {
|
|
|
|
return nightmare
|
2018-02-15 11:28:05 +00:00
|
|
|
.wait(selectors.clientWebAccess.userNameInput)
|
|
|
|
.clearInput(selectors.clientWebAccess.userNameInput)
|
|
|
|
.type(selectors.clientWebAccess.userNameInput, 'Hulk')
|
|
|
|
.click(selectors.clientWebAccess.saveButton)
|
2018-02-20 09:00:19 +00:00
|
|
|
.waitForSnackbar()
|
2017-12-15 09:07:52 +00:00
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('Data saved!');
|
2018-02-20 09:00:19 +00:00
|
|
|
});
|
2017-12-15 09:07:52 +00:00
|
|
|
});
|
|
|
|
|
2018-02-20 09:00:19 +00:00
|
|
|
it('should confirm the User name have been edited', () => {
|
|
|
|
return nightmare
|
2018-02-15 11:28:05 +00:00
|
|
|
.click(selectors.clientBasicData.basicDataButton)
|
|
|
|
.wait(selectors.clientBasicData.nameInput)
|
|
|
|
.click(selectors.clientWebAccess.webAccessButton)
|
|
|
|
.wait(selectors.clientWebAccess.userNameInput)
|
|
|
|
.waitForTextInInput(selectors.clientWebAccess.userNameInput, 'Hulk')
|
|
|
|
.getInputValue(selectors.clientWebAccess.userNameInput)
|
2017-12-15 09:07:52 +00:00
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('Hulk');
|
2018-02-20 09:00:19 +00:00
|
|
|
});
|
2017-12-15 09:07:52 +00:00
|
|
|
});
|
|
|
|
});
|