2019-03-25 09:07:10 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2020-01-23 15:01:29 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2019-03-25 09:07:10 +00:00
|
|
|
|
|
|
|
describe('Route basic Data path', () => {
|
2020-01-23 15:01:29 +00:00
|
|
|
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
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
afterAll(async() => {
|
|
|
|
await browser.close();
|
2019-03-25 09:07:10 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should edit the route basic data', async() => {
|
2020-03-23 22:57:11 +00:00
|
|
|
const nextMonth = new Date();
|
|
|
|
nextMonth.setMonth(nextMonth.getMonth() + 1);
|
|
|
|
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.autocompleteSearch(selectors.routeBasicData.worker, 'adminBossNick');
|
|
|
|
await page.autocompleteSearch(selectors.routeBasicData.vehicle, '1111-IMK');
|
2020-03-23 22:57:11 +00:00
|
|
|
await page.pickDate(selectors.routeBasicData.createdDate, nextMonth);
|
2020-02-03 14:55:11 +00:00
|
|
|
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');
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.routeBasicData.saveButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-03-25 09:07:10 +00:00
|
|
|
|
2020-04-08 09:24:40 +00:00
|
|
|
expect(message.type).toBe('success');
|
2020-02-12 06:21:53 +00:00
|
|
|
});
|
2019-03-25 09:07:10 +00:00
|
|
|
|
|
|
|
it('should confirm the worker was edited', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.reloadSection('route.card.basicData');
|
2020-02-03 14:55:11 +00:00
|
|
|
const worker = await page.waitToGetProperty(selectors.routeBasicData.worker, '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() => {
|
2020-02-03 14:55:11 +00:00
|
|
|
const vehicle = await page.waitToGetProperty(selectors.routeBasicData.vehicle, 'value');
|
2019-03-25 09:07:10 +00:00
|
|
|
|
|
|
|
expect(vehicle).toEqual('1111-IMK');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should confirm the km start was edited', async() => {
|
2020-02-03 14:55:11 +00:00
|
|
|
const kmStart = await page.waitToGetProperty(selectors.routeBasicData.kmStart, 'value');
|
2019-03-25 09:07:10 +00:00
|
|
|
|
|
|
|
expect(kmStart).toEqual('1');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should confirm the km end was edited', async() => {
|
2020-02-03 14:55:11 +00:00
|
|
|
const kmEnd = await page.waitToGetProperty(selectors.routeBasicData.kmEnd, 'value');
|
2019-03-25 09:07:10 +00:00
|
|
|
|
|
|
|
expect(kmEnd).toEqual('2');
|
|
|
|
});
|
|
|
|
});
|