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

34 lines
1.2 KiB
JavaScript

import selectors from '../../helpers/selectors.js';
import openPage from '../../helpers/puppeteer';
describe('Worker pbx path', () => {
let page;
beforeAll(async() => {
page = await openPage();
await page.loginAndModule('hr', 'worker');
await page.accessToSearchResult('employee');
await page.accessToSection('worker.card.pbx');
});
afterAll(async() => {
page.close();
});
it('should receive an error when the extension exceeds 4 characters', async() => {
await page.write(selectors.workerPbx.extensionInput, '55555');
await page.waitToClick(selectors.workerPbx.saveButton);
const result = await page.waitForLastSnackbar();
expect(result).toEqual('Extension format is invalid');
});
it('should sucessfully save the changes', async() => {
await page.clearInput(selectors.workerPbx.extensionInput);
await page.write(selectors.workerPbx.extensionInput, '4444');
await page.waitToClick(selectors.workerPbx.saveButton);
const result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved! User must access web');
});
});