import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; describe('Worker pbx path', () => { const nightmare = createNightmare(); beforeAll(() => { nightmare .loginAndModule('hr', 'worker') .accessToSearchResult('employee') .accessToSection('worker.card.pbx'); }); it('should receive an error when the extension exceeds 4 characters', async() => { const result = await nightmare .write(selectors.workerPbx.extensionInput, 55555) .waitToClick(selectors.workerPbx.saveButton) .waitForLastSnackbar(); expect(result).toEqual('EXTENSION_INVALID_FORMAT'); }); it('should sucessfully save the changes', async() => { const result = await nightmare .clearInput(selectors.workerPbx.extensionInput) .write(selectors.workerPbx.extensionInput, 4444) .clearInput(selectors.workerPbx.passwordInput) .write(selectors.workerPbx.passwordInput, 666666) .waitToClick(selectors.workerPbx.saveButton) .waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); });