#1255 e2e route.basicData

This commit is contained in:
Carlos Jimenez Ruiz 2019-03-25 10:07:10 +01:00
parent f4ddf3544d
commit f7e6fbb648
3 changed files with 76 additions and 2 deletions

View File

@ -412,11 +412,11 @@ let actions = {
.mousedown(datePickerSelector)
.wait('div.flatpickr-calendar.open');
if (changeMonth > 0)
this.mousedown('body > div > div.flatpickr-months > span.flatpickr-next-month > svg');
this.mousedown('body > div.flatpickr-calendar.open > div.flatpickr-months > span.flatpickr-next-month > svg');
if (changeMonth < 0)
this.mousedown('body > div > div.flatpickr-months > span.flatpickr-prev-month > svg');
this.mousedown('body > div.flatpickr-calendar.open > div.flatpickr-months > span.flatpickr-prev-month > svg');
const daySelector = 'div.flatpickr-calendar.open span.flatpickr-day:nth-child(16)';

View File

@ -551,5 +551,16 @@ export default {
extensionInput: 'vn-worker-pbx vn-textfield[model="$ctrl.worker.sip.extension"] input',
passwordInput: 'vn-worker-pbx vn-textfield[model="$ctrl.worker.sip.secret"] input',
saveButton: 'vn-worker-pbx vn-submit[label="Save"] input'
},
routeBasicData: {
workerAutoComplete: 'vn-route-basic-data vn-autocomplete[field="$ctrl.route.workerFk"]',
vehicleAutoComplete: 'vn-route-basic-data vn-autocomplete[field="$ctrl.route.vehicleFk"]',
agencyAutoComplete: 'vn-route-basic-data vn-autocomplete[field="$ctrl.route.agencyModeFk"]',
kmStartInput: 'vn-route-basic-data vn-textfield[field="$ctrl.route.kmStart"] input',
kmEndInput: 'vn-route-basic-data vn-textfield[model="$ctrl.route.kmEnd"] input',
createdDateInput: 'vn-route-basic-data vn-date-picker[model="$ctrl.route.created"] > div > input',
startedDateInput: 'vn-route-basic-data vn-date-picker[model="$ctrl.route.started"] > div > input',
finishedDateInput: 'vn-route-basic-data vn-date-picker[model="$ctrl.route.finished"] > div > input',
saveButton: 'vn-route-basic-data vn-submit[label="Save"] input'
}
};

View File

@ -0,0 +1,63 @@
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');
});
});