2019-04-08 13:38:47 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import createNightmare from '../../helpers/nightmare';
|
|
|
|
|
2019-07-02 12:44:36 +00:00
|
|
|
// #1528 e2e claim/detail
|
|
|
|
xdescribe('Route basic Data path', () => {
|
2019-04-08 13:38:47 +00:00
|
|
|
const nightmare = createNightmare();
|
|
|
|
|
|
|
|
beforeAll(() => {
|
|
|
|
nightmare
|
|
|
|
.loginAndModule('delivery', 'route')
|
2019-07-02 12:44:36 +00:00
|
|
|
.accessToSearchResult(3)
|
2019-04-08 13:38:47 +00:00
|
|
|
.accessToSection('route.card.tickets');
|
|
|
|
});
|
|
|
|
|
2019-07-02 12:44:36 +00:00
|
|
|
it('should modify the first ticket priority', async() => {
|
2019-04-08 13:38:47 +00:00
|
|
|
const result = await nightmare
|
|
|
|
.write(selectors.routeTickets.firstTicketPriority, 2)
|
|
|
|
.write('body', '\u000d') // simulates enter
|
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should confirm the buscamanButton is disabled', async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.evaluate(selector => {
|
|
|
|
return document.querySelector(selector);
|
|
|
|
}, `${selectors.routeTickets.buscamanButton} :disabled`);
|
|
|
|
|
|
|
|
expect(result).toBeTruthy();
|
|
|
|
});
|
|
|
|
|
2019-07-02 12:44:36 +00:00
|
|
|
it('should check the first ticket checkbox and confirm the buscamanButton button is no longer disabled', async() => {
|
2019-04-08 13:38:47 +00:00
|
|
|
const result = await nightmare
|
|
|
|
.waitToClick(selectors.routeTickets.firstTicketCheckbox)
|
|
|
|
.evaluate(selector => {
|
|
|
|
return document.querySelector(selector);
|
|
|
|
}, `${selectors.routeTickets.buscamanButton} :disabled`);
|
|
|
|
|
|
|
|
expect(result).toBeFalsy();
|
|
|
|
});
|
|
|
|
|
2019-07-01 11:41:38 +00:00
|
|
|
it('should check the route volume on the descriptor', async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitToGetProperty(selectors.routeDescriptor.volume, 'innerText');
|
|
|
|
|
2019-07-02 12:44:36 +00:00
|
|
|
expect(result).toEqual('1.1 / 18 m³');
|
2019-07-01 11:41:38 +00:00
|
|
|
});
|
|
|
|
|
2019-04-08 13:38:47 +00:00
|
|
|
it('should count how many tickets are in route', async() => {
|
|
|
|
const result = await nightmare
|
2019-10-11 15:38:04 +00:00
|
|
|
.countElement('vn-route-tickets vn-textfield[ng-model="ticket.priority"]');
|
2019-04-08 13:38:47 +00:00
|
|
|
|
2019-07-02 12:44:36 +00:00
|
|
|
expect(result).toEqual(11);
|
2019-04-08 13:38:47 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should delete the first ticket in route', async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitToClick(selectors.routeTickets.firstTicketDeleteButton)
|
|
|
|
.waitToClick(selectors.routeTickets.confirmButton)
|
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
2019-06-06 11:50:12 +00:00
|
|
|
expect(result).toEqual('Ticket removed from route');
|
2019-04-08 13:38:47 +00:00
|
|
|
});
|
|
|
|
|
2019-07-02 12:44:36 +00:00
|
|
|
it('should again delete the first ticket in route', async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitToClick(selectors.routeTickets.firstTicketDeleteButton)
|
|
|
|
.waitToClick(selectors.routeTickets.confirmButton)
|
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual('Ticket removed from route');
|
|
|
|
});
|
|
|
|
|
2019-04-08 13:38:47 +00:00
|
|
|
it('should now count how many tickets are in route to find one less', async() => {
|
|
|
|
const result = await nightmare
|
2019-10-11 15:38:04 +00:00
|
|
|
.countElement('vn-route-tickets vn-textfield[ng-model="ticket.priority"]');
|
2019-04-08 13:38:47 +00:00
|
|
|
|
2019-07-02 12:44:36 +00:00
|
|
|
expect(result).toEqual(9);
|
2019-04-08 13:38:47 +00:00
|
|
|
});
|
2019-07-01 11:41:38 +00:00
|
|
|
|
|
|
|
it('should confirm the route volume on the descriptor has been updated by the changes made', async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitToGetProperty(selectors.routeDescriptor.volume, 'innerText');
|
|
|
|
|
2019-07-02 12:44:36 +00:00
|
|
|
expect(result).toEqual('0.9 / 18 m³');
|
2019-07-01 11:41:38 +00:00
|
|
|
});
|
2019-04-08 13:38:47 +00:00
|
|
|
});
|