2023-02-28 06:49:34 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
|
|
|
|
|
|
|
describe('Worker pda path', () => {
|
|
|
|
let browser;
|
|
|
|
let page;
|
|
|
|
beforeAll(async() => {
|
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
2023-02-28 11:46:48 +00:00
|
|
|
await page.loginAndModule('hr', 'worker');
|
2023-02-28 06:49:34 +00:00
|
|
|
await page.accessToSearchResult('employeeNick');
|
|
|
|
await page.accessToSection('worker.card.pda');
|
|
|
|
});
|
|
|
|
|
|
|
|
afterAll(async() => {
|
|
|
|
await browser.close();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should check if worker has already a PDA allocated', async() => {
|
|
|
|
expect(await page.waitToGetProperty(selectors.workerPda.currentPDA, 'value')).toContain('serialNumber1');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should deallocate the PDA', async() => {
|
|
|
|
await page.waitToClick(selectors.workerPda.delete);
|
|
|
|
let message = await page.waitForSnackbar();
|
|
|
|
|
|
|
|
expect(message.text).toContain('PDA deallocated');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should allocate a new PDA', async() => {
|
|
|
|
await page.autocompleteSearch(selectors.workerPda.newPDA, 'serialNumber2');
|
|
|
|
await page.waitToClick(selectors.workerPda.submit);
|
|
|
|
let message = await page.waitForSnackbar();
|
|
|
|
|
|
|
|
expect(message.text).toContain('PDA allocated');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should check if a new PDA has been allocated', async() => {
|
|
|
|
expect(await page.waitToGetProperty(selectors.workerPda.currentPDA, 'value')).toContain('serialNumber2');
|
|
|
|
});
|
|
|
|
});
|