2018-09-03 11:54:35 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2018-10-24 08:57:14 +00:00
|
|
|
import createNightmare from '../../helpers/nightmare';
|
2018-09-03 11:54:35 +00:00
|
|
|
|
2018-11-22 14:44:33 +00:00
|
|
|
describe('Ticket Edit basic data path', () => {
|
|
|
|
const nightmare = createNightmare();
|
|
|
|
|
|
|
|
beforeAll(() => {
|
|
|
|
return nightmare
|
2018-12-02 23:45:34 +00:00
|
|
|
.loginAndModule('employee', 'ticket')
|
|
|
|
.accessToSearchResult('id:11')
|
|
|
|
.accessToSection('ticket.card.data.stepOne');
|
2018-11-22 14:44:33 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 09:55:23 +00:00
|
|
|
it(`should edit the client and address of the ticket then click next`, async() => {
|
2018-11-22 14:44:33 +00:00
|
|
|
let url = await nightmare
|
2019-01-07 09:55:23 +00:00
|
|
|
.autocompleteSearch(selectors.ticketBasicData.clientAutocomplete, 'Charles Xavier')
|
2018-11-22 14:44:33 +00:00
|
|
|
.wait(500)
|
2019-01-07 09:55:23 +00:00
|
|
|
.autocompleteSearch(selectors.ticketBasicData.addressAutocomplete, 'Charles Xavier')
|
2018-11-22 14:44:33 +00:00
|
|
|
.click(selectors.ticketBasicData.nextStepButton)
|
|
|
|
.waitForURL('data/step-two')
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toContain('data/step-two');
|
|
|
|
});
|
|
|
|
|
2019-01-07 09:55:23 +00:00
|
|
|
it(`should have no price diference`, async() => {
|
2018-11-22 14:44:33 +00:00
|
|
|
const result = await nightmare
|
|
|
|
.waitToGetProperty(selectors.ticketBasicData.stepTwoTotalPriceDif, 'innerText');
|
|
|
|
|
|
|
|
expect(result).toContain('0');
|
|
|
|
});
|
|
|
|
|
2019-01-07 09:55:23 +00:00
|
|
|
it(`should click next to move on to step three`, async() => {
|
2018-11-22 14:44:33 +00:00
|
|
|
let url = await nightmare
|
|
|
|
.click(selectors.ticketBasicData.nextStepButton)
|
|
|
|
.waitForURL('data/step-three')
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toContain('data/step-three');
|
|
|
|
});
|
|
|
|
|
2019-01-07 09:55:23 +00:00
|
|
|
it(`should select a reason for the changes made then click on finalize`, async() => {
|
2018-11-22 14:44:33 +00:00
|
|
|
let url = await nightmare
|
2019-01-07 09:55:23 +00:00
|
|
|
.autocompleteSearch(selectors.ticketBasicData.chargesReasonAutocomplete, 'No realizar modificaciones en precios')
|
2018-12-14 12:47:32 +00:00
|
|
|
.waitToClick(selectors.ticketBasicData.finalizeButton)
|
2018-11-22 14:44:33 +00:00
|
|
|
.waitForURL('summary')
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toContain('summary');
|
|
|
|
});
|
|
|
|
|
2019-01-07 09:55:23 +00:00
|
|
|
it(`should go back to ticket.basicData section`, async() => {
|
2018-11-22 14:44:33 +00:00
|
|
|
let url = await nightmare
|
|
|
|
.waitToClick(selectors.ticketBasicData.basicDataButton)
|
|
|
|
.waitForURL('data/step-one')
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toContain('data/step-one');
|
|
|
|
});
|
|
|
|
|
2019-01-07 09:55:23 +00:00
|
|
|
it(`should edit the ticket agency then click next`, async() => {
|
2018-11-22 14:44:33 +00:00
|
|
|
let url = await nightmare
|
2019-01-07 09:55:23 +00:00
|
|
|
.autocompleteSearch(selectors.ticketBasicData.agencyAutocomplete, 'Silla247Expensive')
|
2018-11-22 14:44:33 +00:00
|
|
|
.click(selectors.ticketBasicData.nextStepButton)
|
|
|
|
.waitForURL('data/step-two')
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toContain('data/step-two');
|
|
|
|
});
|
|
|
|
|
2019-01-07 09:55:23 +00:00
|
|
|
it(`should have a price diference`, async() => {
|
2018-11-22 14:44:33 +00:00
|
|
|
const result = await nightmare
|
|
|
|
.waitToGetProperty(selectors.ticketBasicData.stepTwoTotalPriceDif, 'innerText');
|
|
|
|
|
2019-01-11 11:25:53 +00:00
|
|
|
expect(result).toContain('-12.25 €');
|
2018-11-22 14:44:33 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 09:55:23 +00:00
|
|
|
it(`should then click next to move on to step three`, async() => {
|
2018-11-22 14:44:33 +00:00
|
|
|
let url = await nightmare
|
|
|
|
.click(selectors.ticketBasicData.nextStepButton)
|
|
|
|
.waitForURL('data/step-three')
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toContain('data/step-three');
|
|
|
|
});
|
|
|
|
|
2019-01-07 09:55:23 +00:00
|
|
|
it(`should select a new reason for the changes made then click on finalize`, async() => {
|
2018-11-22 14:44:33 +00:00
|
|
|
let url = await nightmare
|
2019-01-07 09:55:23 +00:00
|
|
|
.autocompleteSearch(selectors.ticketBasicData.chargesReasonAutocomplete, 'Cambiar los precios en el ticket')
|
2018-11-22 14:44:33 +00:00
|
|
|
.click(selectors.ticketBasicData.finalizeButton)
|
|
|
|
.waitForURL('summary')
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toContain('summary');
|
2018-09-03 11:54:35 +00:00
|
|
|
});
|
|
|
|
});
|