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

62 lines
2.3 KiB
JavaScript

import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
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');
});
afterAll(async() => {
await browser.close();
});
it('should edit the route basic data', async() => {
await page.autocompleteSearch(selectors.routeBasicData.worker, 'adminBossNick');
await page.autocompleteSearch(selectors.routeBasicData.vehicle, '1111-IMK');
await page.datePicker(selectors.routeBasicData.createdDate, 1, null);
await page.clearInput(selectors.routeBasicData.kmStart);
await page.write(selectors.routeBasicData.kmStart, '1');
await page.clearInput(selectors.routeBasicData.kmEnd);
await page.write(selectors.routeBasicData.kmEnd, '2');
await page.type(`${selectors.routeBasicData.startedHour} input`, '0800');
await page.type(`${selectors.routeBasicData.finishedHour} input`, '1230');
await page.waitToClick(selectors.routeBasicData.saveButton);
const result = await page.waitForLastSnackbar();
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.worker, 'value');
expect(worker).toEqual('adminBoss - adminBossNick');
});
it('should confirm the vehicle was edited', async() => {
const vehicle = await page.waitToGetProperty(selectors.routeBasicData.vehicle, 'value');
expect(vehicle).toEqual('1111-IMK');
});
it('should confirm the km start was edited', async() => {
const kmStart = await page.waitToGetProperty(selectors.routeBasicData.kmStart, 'value');
expect(kmStart).toEqual('1');
});
it('should confirm the km end was edited', async() => {
const kmEnd = await page.waitToGetProperty(selectors.routeBasicData.kmEnd, 'value');
expect(kmEnd).toEqual('2');
});
});