import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; 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) .wait(selectors.clientWebAccess.enableWebAccessCheckbox) .evaluate(selector => { return document.querySelector(selector).checked; }, selectors.clientWebAccess.enableWebAccessCheckbox); expect(result).toBeFalsy(); }); it('should confirm web access name have been updated', async() => { const result = await nightmare .waitToGetProperty(selectors.clientWebAccess.userNameInput, 'value'); expect(result).toEqual('Hulk'); }); });