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