Test #1221 e2e worker.pbx

This commit is contained in:
Carlos Jimenez Ruiz 2019-03-08 14:46:01 +01:00
parent 99ef9d71fe
commit 78103137bb
3 changed files with 43 additions and 2 deletions

View File

@ -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'
}
};

View File

@ -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!');
});
});

View File

@ -16,10 +16,11 @@
</vn-searchbar>
</vn-card>
<vn-card margin-medium-v>
<a ng-repeat="worker in workers track by worker.id"
<a
ng-repeat="worker in workers track by worker.id"
ui-sref="worker.card.summary({id: worker.id})"
translate-attr="{title: 'View worker'}"
class="vn-list-item">
class="vn-list-item searchResult">
<vn-horizontal>
<vn-one>
<h6>{{::worker.user.nickname}}</h6>