parent
33e6467c44
commit
d5eec3721f
|
@ -576,5 +576,16 @@ export default {
|
||||||
startedDateInput: 'vn-route-basic-data vn-date-picker[model="$ctrl.route.started"] > 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',
|
finishedDateInput: 'vn-route-basic-data vn-date-picker[model="$ctrl.route.finished"] > div > input',
|
||||||
saveButton: 'vn-route-basic-data vn-submit[label="Save"] input'
|
saveButton: 'vn-route-basic-data vn-submit[label="Save"] input'
|
||||||
|
},
|
||||||
|
routeTickets: {
|
||||||
|
firstTicketPriority: 'vn-route-tickets vn-tr:nth-child(1) vn-textfield[model="ticket.priority"] input',
|
||||||
|
secondTicketPriority: 'vn-route-tickets vn-tr:nth-child(2) vn-textfield[model="ticket.priority"] input',
|
||||||
|
thirdTicketPriority: 'vn-route-tickets vn-tr:nth-child(3) vn-textfield[model="ticket.priority"] input',
|
||||||
|
fourthTicketPriority: 'vn-route-tickets vn-tr:nth-child(4) vn-textfield[model="ticket.priority"] input',
|
||||||
|
fifthTicketPriority: 'vn-route-tickets vn-tr:nth-child(5) vn-textfield[model="ticket.priority"] input',
|
||||||
|
firstTicketCheckbox: 'vn-route-tickets vn-tr:nth-child(1) vn-check md-checkbox',
|
||||||
|
buscamanButton: 'vn-route-tickets vn-button[icon="icon-buscaman"]',
|
||||||
|
firstTicketDeleteButton: 'vn-route-tickets vn-tr:nth-child(1) vn-icon[icon="delete"]',
|
||||||
|
confirmButton: 'vn-route-tickets > vn-confirm button[response="ACCEPT"]'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -23,6 +23,14 @@ describe('Claim edit basic data path', () => {
|
||||||
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
|
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it(`should have been redirected to the next section of claims as the role is salesAssistant`, async() => {
|
||||||
|
const url = await nightmare
|
||||||
|
.waitForURL('/detail')
|
||||||
|
.parsedUrl();
|
||||||
|
|
||||||
|
expect(url.hash).toContain('/detail');
|
||||||
|
});
|
||||||
|
|
||||||
it('should confirm the claim state was edited', async() => {
|
it('should confirm the claim state was edited', async() => {
|
||||||
const result = await nightmare
|
const result = await nightmare
|
||||||
.reloadSection('claim.card.basicData')
|
.reloadSection('claim.card.basicData')
|
||||||
|
|
|
@ -62,4 +62,24 @@ describe('Claim detail', () => {
|
||||||
|
|
||||||
expect(result).toEqual(1);
|
expect(result).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should login as salesAssistant to be redirected to the next claim section', async() => {
|
||||||
|
const result = await nightmare
|
||||||
|
.loginAndModule('salesAssistant', 'claim')
|
||||||
|
.accessToSearchResult('2')
|
||||||
|
.accessToSection('claim.card.detail')
|
||||||
|
.waitToClick(selectors.claimDetail.addItemButton)
|
||||||
|
.waitToClick(selectors.claimDetail.firstClaimableSaleFromTicket)
|
||||||
|
.waitForLastSnackbar();
|
||||||
|
|
||||||
|
expect(result).toEqual('Data saved!');
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should have been redirected to the next section in claims`, async() => {
|
||||||
|
const url = await nightmare
|
||||||
|
.waitForURL('/development')
|
||||||
|
.parsedUrl();
|
||||||
|
|
||||||
|
expect(url.hash).toContain('development');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,136 @@
|
||||||
|
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.tickets');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should modify the first ticket priority', async() => {
|
||||||
|
const result = await nightmare
|
||||||
|
.write(selectors.routeTickets.firstTicketPriority, 5)
|
||||||
|
.write('body', '\u000d') // simulates enter
|
||||||
|
.waitForLastSnackbar();
|
||||||
|
|
||||||
|
expect(result).toEqual('Data saved!');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should now modify the first ticket priority', async() => {
|
||||||
|
const result = await nightmare
|
||||||
|
.write(selectors.routeTickets.firstTicketPriority, 4)
|
||||||
|
.write('body', '\u000d') // simulates enter
|
||||||
|
.waitForLastSnackbar();
|
||||||
|
|
||||||
|
expect(result).toEqual('Data saved!');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should next modify the first ticket priority', async() => {
|
||||||
|
const result = await nightmare
|
||||||
|
.write(selectors.routeTickets.firstTicketPriority, 3)
|
||||||
|
.write('body', '\u000d') // simulates enter
|
||||||
|
.waitForLastSnackbar();
|
||||||
|
|
||||||
|
expect(result).toEqual('Data saved!');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should once more modify the first ticket priority', async() => {
|
||||||
|
const result = await nightmare
|
||||||
|
.write(selectors.routeTickets.firstTicketPriority, 2)
|
||||||
|
.write('body', '\u000d') // simulates enter
|
||||||
|
.waitForLastSnackbar();
|
||||||
|
|
||||||
|
expect(result).toEqual('Data saved!');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should finally modify the first ticket priority', async() => {
|
||||||
|
const result = await nightmare
|
||||||
|
.write(selectors.routeTickets.firstTicketPriority, 1)
|
||||||
|
.write('body', '\u000d') // simulates enter
|
||||||
|
.waitForLastSnackbar();
|
||||||
|
|
||||||
|
expect(result).toEqual('Data saved!');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should reload the section as a pre-step to check the first ticket priority', async() => {
|
||||||
|
const result = await nightmare
|
||||||
|
.reloadSection('route.card.tickets')
|
||||||
|
.waitToGetProperty(selectors.routeTickets.firstTicketPriority, 'value');
|
||||||
|
|
||||||
|
expect(result).toEqual('1');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should confirm the second ticket priority', async() => {
|
||||||
|
const result = await nightmare
|
||||||
|
.waitToGetProperty(selectors.routeTickets.secondTicketPriority, 'value');
|
||||||
|
|
||||||
|
expect(result).toEqual('2');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should confirm the third ticket priority', async() => {
|
||||||
|
const result = await nightmare
|
||||||
|
.waitToGetProperty(selectors.routeTickets.thirdTicketPriority, 'value');
|
||||||
|
|
||||||
|
expect(result).toEqual('3');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should confirm the fourth ticket priority', async() => {
|
||||||
|
const result = await nightmare
|
||||||
|
.waitToGetProperty(selectors.routeTickets.fourthTicketPriority, 'value');
|
||||||
|
|
||||||
|
expect(result).toEqual('4');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should confirm the fifth ticket priority', async() => {
|
||||||
|
const result = await nightmare
|
||||||
|
.waitToGetProperty(selectors.routeTickets.fifthTicketPriority, 'value');
|
||||||
|
|
||||||
|
expect(result).toEqual('5');
|
||||||
|
});
|
||||||
|
|
||||||
|
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();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should check the first ticket checkbox and confirm the buscamanButton button isnt disabled anymore', async() => {
|
||||||
|
const result = await nightmare
|
||||||
|
.waitToClick(selectors.routeTickets.firstTicketCheckbox)
|
||||||
|
.evaluate(selector => {
|
||||||
|
return document.querySelector(selector);
|
||||||
|
}, `${selectors.routeTickets.buscamanButton} :disabled`);
|
||||||
|
|
||||||
|
expect(result).toBeFalsy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should count how many tickets are in route', async() => {
|
||||||
|
const result = await nightmare
|
||||||
|
.countElement('vn-route-tickets vn-textfield[model="ticket.priority"]');
|
||||||
|
|
||||||
|
expect(result).toEqual(5);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should delete the first ticket in route', async() => {
|
||||||
|
const result = await nightmare
|
||||||
|
.waitToClick(selectors.routeTickets.firstTicketDeleteButton)
|
||||||
|
.waitToClick(selectors.routeTickets.confirmButton)
|
||||||
|
.waitForLastSnackbar();
|
||||||
|
|
||||||
|
expect(result).toEqual('Ticket deleted from route');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should now count how many tickets are in route to find one less', async() => {
|
||||||
|
const result = await nightmare
|
||||||
|
.countElement('vn-route-tickets vn-textfield[model="ticket.priority"]');
|
||||||
|
|
||||||
|
expect(result).toEqual(4);
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue