salix/e2e/paths/08-route-module/02_basic_data.spec.js

62 lines
2.4 KiB
JavaScript
Raw Normal View History

2019-03-25 09:07:10 +00:00
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
2019-03-25 09:07:10 +00:00
describe('Route basic Data path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('delivery', 'route');
await page.accessToSearchResult('1');
await page.accessToSection('route.card.basicData');
});
2019-03-25 09:07:10 +00:00
afterAll(async() => {
await browser.close();
2019-03-25 09:07:10 +00:00
});
it('should edit the route basic data', async() => {
await page.autocompleteSearch(selectors.routeBasicData.workerAutoComplete, 'adminBossNick');
await page.autocompleteSearch(selectors.routeBasicData.vehicleAutoComplete, '1111-IMK');
await page.datePicker(selectors.routeBasicData.createdDateInput, 1, null);
await page.clearInput(selectors.routeBasicData.kmStartInput);
await page.write(selectors.routeBasicData.kmStartInput, '1');
await page.clearInput(selectors.routeBasicData.kmEndInput);
await page.write(selectors.routeBasicData.kmEndInput, '2');
await page.write(selectors.routeBasicData.startedHourInput, '0800');
await page.write(selectors.routeBasicData.finishedHourInput, '1230');
await page.waitToClick(selectors.routeBasicData.saveButton);
const result = await page.waitForLastSnackbar();
2019-03-25 09:07:10 +00:00
expect(result).toEqual('Data saved!');
}, 15000);
it('should confirm the worker was edited', async() => {
await page.reloadSection('route.card.basicData');
const worker = await page.waitToGetProperty(`${selectors.routeBasicData.workerAutoComplete} input`, 'value');
2019-03-25 09:07:10 +00:00
2020-01-03 13:31:02 +00:00
expect(worker).toEqual('adminBoss - adminBossNick');
2019-03-25 09:07:10 +00:00
});
it('should confirm the vehicle was edited', async() => {
const vehicle = await page.waitToGetProperty(`${selectors.routeBasicData.vehicleAutoComplete} input`, 'value');
2019-03-25 09:07:10 +00:00
expect(vehicle).toEqual('1111-IMK');
});
it('should confirm the km start was edited', async() => {
const kmStart = await page.waitToGetProperty(selectors.routeBasicData.kmStartInput, 'value');
2019-03-25 09:07:10 +00:00
expect(kmStart).toEqual('1');
});
it('should confirm the km end was edited', async() => {
const kmEnd = await page.waitToGetProperty(selectors.routeBasicData.kmEndInput, 'value');
2019-03-25 09:07:10 +00:00
expect(kmEnd).toEqual('2');
});
});