diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index d67aa5722..a89298790 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -533,4 +533,9 @@ export default { confirmOrder: 'vn-order-line > vn-vertical > vn-button-bar > vn-button > button', confirmButton: 'vn-order-line > vn-confirm button[response="ACCEPT"]', }, + workerPbx: { + extensionInput: 'vn-worker-pbx vn-textfield[model="$ctrl.worker.sip.extension"] input', + passwordInput: 'vn-worker-pbx vn-textfield[model="$ctrl.worker.sip.secret"] input', + saveButton: 'vn-worker-pbx vn-submit[label="Save"] input' + } }; diff --git a/e2e/paths/worker-module/01_pbx.spec.js b/e2e/paths/worker-module/01_pbx.spec.js new file mode 100644 index 000000000..e7e97f9b1 --- /dev/null +++ b/e2e/paths/worker-module/01_pbx.spec.js @@ -0,0 +1,35 @@ +import selectors from '../../helpers/selectors.js'; +import createNightmare from '../../helpers/nightmare'; + +describe('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!'); + }); +}); diff --git a/modules/worker/front/index/index.html b/modules/worker/front/index/index.html index 7debfc728..0da3d89c9 100644 --- a/modules/worker/front/index/index.html +++ b/modules/worker/front/index/index.html @@ -16,10 +16,11 @@ - + class="vn-list-item searchResult">
{{::worker.user.nickname}}