salix/e2e/paths/03-worker/03_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 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-02-03 14:55:11 +00:00
await page.write(selectors.workerPbx.extension, '55555');
2020-01-09 12:07:16 +00:00
await page.waitToClick(selectors.workerPbx.saveButton);
2020-04-08 09:24:40 +00:00
const message = await page.waitForSnackbar();
2019-03-08 13:46:01 +00:00
2020-11-10 11:06:21 +00:00
expect(message.text).toContain('Extension format is invalid');
2019-03-08 13:46:01 +00:00
});
it('should sucessfully save the changes', async() => {
2020-02-03 14:55:11 +00:00
await page.clearInput(selectors.workerPbx.extension);
await page.write(selectors.workerPbx.extension, '4444');
2020-01-09 12:07:16 +00:00
await page.waitToClick(selectors.workerPbx.saveButton);
2020-04-08 09:24:40 +00:00
const message = await page.waitForSnackbar();
2019-03-08 13:46:01 +00:00
2020-11-10 11:06:21 +00:00
expect(message.text).toContain('Data saved! User must access web');
2019-03-08 13:46:01 +00:00
});
});