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

51 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', () => {
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);
const result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
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');
});
});