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

64 lines
2.2 KiB
JavaScript
Raw Normal View History

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')
.datePicker(selectors.routeBasicData.createdDateInput, 1)
.clearInput(selectors.routeBasicData.kmStartInput)
.write(selectors.routeBasicData.kmStartInput, 1)
.clearInput(selectors.routeBasicData.kmEndInput)
.write(selectors.routeBasicData.kmEndInput, 2)
.datePicker(selectors.routeBasicData.startedDateInput, 1)
.datePicker(selectors.routeBasicData.finishedDateInput, 1)
.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');
});
});