salix/e2e/paths/03-worker/02_basicData.spec.js

43 lines
1.8 KiB
JavaScript
Raw Normal View History

2020-02-07 09:34:24 +00:00
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Worker basic data path', () => {
2022-12-28 12:06:00 +00:00
const workerId = 1106;
2020-02-07 09:34:24 +00:00
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('hr', 'worker');
2022-12-28 12:06:00 +00:00
const httpDataResponse = page.waitForResponse(response => {
return response.status() === 200 && response.url().includes(`Workers/${workerId}`);
});
2020-02-07 09:34:24 +00:00
await page.accessToSearchResult('David Charles Haller');
2022-12-28 12:06:00 +00:00
await httpDataResponse;
2020-02-07 09:34:24 +00:00
await page.accessToSection('worker.card.basicData');
});
afterAll(async() => {
await browser.close();
});
2022-12-28 12:06:00 +00:00
it('should edit the form and then reload the section and check the data was edited', async() => {
await page.overwrite(selectors.workerBasicData.name, 'David C.');
await page.overwrite(selectors.workerBasicData.surname, 'H.');
await page.overwrite(selectors.workerBasicData.phone, '444332211');
2023-02-27 07:39:46 +00:00
await page.overwrite(selectors.workerBasicData.locker, '1');
2022-12-28 12:06:00 +00:00
await page.click(selectors.workerBasicData.saveButton);
2020-04-08 09:24:40 +00:00
const message = await page.waitForSnackbar();
2020-02-07 09:34:24 +00:00
2020-11-10 11:06:21 +00:00
expect(message.text).toContain('Data saved!');
2020-02-07 09:34:24 +00:00
await page.reloadSection('worker.card.basicData');
2022-12-28 12:06:00 +00:00
expect(await page.waitToGetProperty(selectors.workerBasicData.name, 'value')).toEqual('David C.');
expect(await page.waitToGetProperty(selectors.workerBasicData.surname, 'value')).toEqual('H.');
expect(await page.waitToGetProperty(selectors.workerBasicData.phone, 'value')).toEqual('444332211');
2023-02-27 07:39:46 +00:00
expect(await page.waitToGetProperty(selectors.workerBasicData.locker, 'value')).toEqual('1');
2020-02-07 09:34:24 +00:00
});
});