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

37 lines
1.3 KiB
JavaScript
Raw Normal View History

2019-03-08 13:46:01 +00:00
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
2019-03-08 13:46:01 +00:00
2020-01-14 08:57:57 +00:00
describe('Worker pbx path', () => {
let browser;
2020-01-09 12:07:16 +00:00
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
2020-01-09 12:07:16 +00:00
await page.loginAndModule('hr', 'worker');
await page.accessToSearchResult('employee');
await page.accessToSection('worker.card.pbx');
});
2019-03-08 13:46:01 +00:00
2020-01-09 12:07:16 +00:00
afterAll(async() => {
await browser.close();
2019-03-08 13:46:01 +00:00
});
it('should receive an error when the extension exceeds 4 characters', async() => {
2020-01-27 17:35:39 +00:00
await page.waitForContentLoaded();
2020-01-09 12:07:16 +00:00
await page.write(selectors.workerPbx.extensionInput, '55555');
await page.waitToClick(selectors.workerPbx.saveButton);
const result = await page.waitForLastSnackbar();
2019-03-08 13:46:01 +00:00
expect(result).toEqual('Extension format is invalid');
2019-03-08 13:46:01 +00:00
});
it('should sucessfully save the changes', async() => {
2020-01-09 12:07:16 +00:00
await page.clearInput(selectors.workerPbx.extensionInput);
await page.write(selectors.workerPbx.extensionInput, '4444');
await page.waitToClick(selectors.workerPbx.saveButton);
const result = await page.waitForLastSnackbar();
2019-03-08 13:46:01 +00:00
2019-06-17 09:14:45 +00:00
expect(result).toEqual('Data saved! User must access web');
2019-03-08 13:46:01 +00:00
});
});