2020-02-07 09:34:24 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
|
|
|
|
|
|
|
describe('Worker basic data path', () => {
|
|
|
|
let browser;
|
|
|
|
let page;
|
|
|
|
beforeAll(async() => {
|
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
|
|
|
await page.loginAndModule('hr', 'worker');
|
|
|
|
await page.accessToSearchResult('David Charles Haller');
|
|
|
|
await page.accessToSection('worker.card.basicData');
|
|
|
|
});
|
|
|
|
|
|
|
|
afterAll(async() => {
|
|
|
|
await browser.close();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should edit the form', async() => {
|
|
|
|
await page.clearInput(selectors.workerBasicData.name);
|
|
|
|
await page.write(selectors.workerBasicData.name, 'David C.');
|
|
|
|
await page.clearInput(selectors.workerBasicData.surname);
|
|
|
|
await page.write(selectors.workerBasicData.surname, 'H.');
|
|
|
|
await page.clearInput(selectors.workerBasicData.phone);
|
|
|
|
await page.write(selectors.workerBasicData.phone, '444332211');
|
|
|
|
await page.waitToClick(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
|
|
|
});
|
|
|
|
|
|
|
|
it('should reload the section then check the name was edited', async() => {
|
|
|
|
await page.reloadSection('worker.card.basicData');
|
|
|
|
const result = await page.waitToGetProperty(selectors.workerBasicData.name, 'value');
|
|
|
|
|
|
|
|
expect(result).toEqual('David C.');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should the surname was edited', async() => {
|
|
|
|
const result = await page.waitToGetProperty(selectors.workerBasicData.surname, 'value');
|
|
|
|
|
|
|
|
expect(result).toEqual('H.');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should the phone was edited', async() => {
|
|
|
|
const result = await page.waitToGetProperty(selectors.workerBasicData.phone, 'value');
|
|
|
|
|
|
|
|
expect(result).toEqual('444332211');
|
|
|
|
});
|
|
|
|
});
|