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

37 lines
1.3 KiB
JavaScript

import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Worker pbx path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('hr', 'worker');
await page.accessToSearchResult('employee');
await page.accessToSection('worker.card.pbx');
});
afterAll(async() => {
await browser.close();
});
it('should receive an error when the extension exceeds 4 characters', async() => {
await page.waitForContentLoaded();
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');
});
});