salix/e2e/paths/02-worker-module/01_pbx.spec.js

36 lines
1.2 KiB
JavaScript
Raw Normal View History

2019-03-08 13:46:01 +00:00
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
2019-03-25 07:09:43 +00:00
describe('Worker pbx path', () => {
2019-03-08 13:46:01 +00:00
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();
2019-03-29 15:57:51 +00:00
expect(result).toEqual('Invalid extension');
2019-03-08 13:46:01 +00:00
});
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!');
});
});