salix/e2e/paths/ticket-module/06_edit_basic_data_steps.sp...

163 lines
6.7 KiB
JavaScript
Raw Normal View History

2018-09-03 11:54:35 +00:00
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
2018-09-03 11:54:35 +00:00
describe('Ticket', () => {
describe('Edit basic data path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
2018-10-25 14:44:03 +00:00
.waitForLogin('employee');
2018-09-03 11:54:35 +00:00
});
2018-11-11 16:40:02 +00:00
it('should click on the Tickets button of the top bar menu', done => {
2018-09-03 11:54:35 +00:00
return nightmare
2018-10-25 14:44:03 +00:00
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchTicketInput)
2018-10-25 14:44:03 +00:00
.parsedUrl()
2018-11-11 16:40:02 +00:00
.then(url => {
2018-10-25 14:44:03 +00:00
expect(url.hash).toEqual('#!/ticket/index');
done();
}).catch(done.fail);
2018-09-03 11:54:35 +00:00
});
2018-11-11 16:40:02 +00:00
it('should search for the ticket 11', done => {
2018-09-03 11:54:35 +00:00
return nightmare
.wait(selectors.ticketsIndex.searchTicketInput)
2018-10-25 14:44:03 +00:00
.type(selectors.ticketsIndex.searchTicketInput, 'id:11')
.click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult)
2018-11-11 16:40:02 +00:00
.then(result => {
2018-10-25 14:44:03 +00:00
expect(result).toEqual(1);
done();
}).catch(done.fail);
2018-09-03 11:54:35 +00:00
});
2018-11-11 16:40:02 +00:00
it(`should click on the search result to access to the ticket Basic Data`, done => {
2018-09-03 11:54:35 +00:00
return nightmare
2018-10-25 14:44:03 +00:00
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') // should be Bruce Wayne
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketBasicData.basicDataButton)
.waitForURL('data/step-one')
.url()
2018-11-11 16:40:02 +00:00
.then(url => {
2018-10-25 14:44:03 +00:00
expect(url).toContain('data/step-one');
done();
}).catch(done.fail);
2018-09-03 11:54:35 +00:00
});
2018-11-11 16:40:02 +00:00
it(`should edit the client and address of the ticket then click next`, done => {
2018-09-03 11:54:35 +00:00
return nightmare
2018-10-25 14:44:03 +00:00
.waitToClick(selectors.ticketBasicData.clientSelect)
.waitToClick(selectors.ticketBasicData.clientSelectThirdOption)
.wait(500)
.waitToClick(selectors.ticketBasicData.addressSelect)
.waitToClick(selectors.ticketBasicData.addressSelectSecondOption)
.waitForTextInInput(selectors.ticketBasicData.addressSelect, 'Charles Xavier')
.click(selectors.ticketBasicData.nextStepButton)
.waitForURL('data/step-two')
.url()
2018-11-11 16:40:02 +00:00
.then(url => {
2018-10-25 14:44:03 +00:00
expect(url).toContain('data/step-two');
done();
}).catch(done.fail);
2018-09-03 11:54:35 +00:00
});
2018-11-11 16:40:02 +00:00
it(`should have no price diference`, done => {
2018-09-03 11:54:35 +00:00
return nightmare
2018-10-25 14:44:03 +00:00
.getInnerText(selectors.ticketBasicData.stepTwoTotalPriceDif)
2018-11-11 16:40:02 +00:00
.then(result => {
2018-10-25 14:44:03 +00:00
expect(result).toContain('0');
done();
}).catch(done.fail);
2018-09-03 11:54:35 +00:00
});
2018-11-11 16:40:02 +00:00
it(`should click next to move on to step three`, done => {
2018-09-03 11:54:35 +00:00
return nightmare
2018-10-25 14:44:03 +00:00
.click(selectors.ticketBasicData.nextStepButton)
.waitForURL('data/step-three')
.url()
2018-11-11 16:40:02 +00:00
.then(url => {
2018-10-25 14:44:03 +00:00
expect(url).toContain('data/step-three');
done();
}).catch(done.fail);
2018-09-03 11:54:35 +00:00
});
2018-11-11 16:40:02 +00:00
it(`should select a reason for the changes made then click on finalize`, done => {
2018-09-03 11:54:35 +00:00
return nightmare
2018-10-25 14:44:03 +00:00
.waitToClick(selectors.ticketBasicData.chargesReason)
.waitToClick(selectors.ticketBasicData.chargesReasonFourthOption)
.waitForTextInInput(selectors.ticketBasicData.chargesReason, 'No realizar modificaciones en precios')
.click(selectors.ticketBasicData.finalizeButton)
.waitForURL('summary')
.url()
2018-11-11 16:40:02 +00:00
.then(url => {
2018-10-25 14:44:03 +00:00
expect(url).toContain('summary');
done();
}).catch(done.fail);
2018-09-03 11:54:35 +00:00
});
2018-11-11 16:40:02 +00:00
it(`should go back to ticket.basicData section`, done => {
2018-09-03 11:54:35 +00:00
return nightmare
2018-10-25 14:44:03 +00:00
.waitToClick(selectors.ticketBasicData.basicDataButton)
.waitForURL('data/step-one')
.url()
2018-11-11 16:40:02 +00:00
.then(url => {
2018-10-25 14:44:03 +00:00
expect(url).toContain('data/step-one');
done();
}).catch(done.fail);
2018-09-03 11:54:35 +00:00
});
2018-11-11 16:40:02 +00:00
it(`should edit the ticket agency then click next`, done => {
2018-09-03 11:54:35 +00:00
return nightmare
2018-10-25 14:44:03 +00:00
.waitToClick(selectors.ticketBasicData.agencySelect)
.waitToClick(selectors.ticketBasicData.agencySelectOptionSix)
.waitForTextInInput(selectors.ticketBasicData.agencySelect, 'Expensive')
.click(selectors.ticketBasicData.nextStepButton)
.waitForURL('data/step-two')
.url()
2018-11-11 16:40:02 +00:00
.then(url => {
2018-10-25 14:44:03 +00:00
expect(url).toContain('data/step-two');
done();
}).catch(done.fail);
2018-09-03 11:54:35 +00:00
});
2018-11-11 16:40:02 +00:00
it(`should have a price diference`, done => {
2018-09-03 11:54:35 +00:00
return nightmare
2018-10-25 14:44:03 +00:00
.getInnerText(selectors.ticketBasicData.stepTwoTotalPriceDif)
2018-11-11 16:40:02 +00:00
.then(result => {
2018-11-19 07:57:11 +00:00
expect(result).toContain('-20.65 €');
2018-10-25 14:44:03 +00:00
done();
}).catch(done.fail);
2018-09-03 11:54:35 +00:00
});
2018-11-11 16:40:02 +00:00
it(`should then click next to move on to step three`, done => {
2018-09-03 11:54:35 +00:00
return nightmare
2018-10-25 14:44:03 +00:00
.click(selectors.ticketBasicData.nextStepButton)
.waitForURL('data/step-three')
.url()
2018-11-11 16:40:02 +00:00
.then(url => {
2018-10-25 14:44:03 +00:00
expect(url).toContain('data/step-three');
done();
}).catch(done.fail);
2018-09-03 11:54:35 +00:00
});
2018-11-11 16:40:02 +00:00
it(`should select a new reason for the changes made then click on finalize`, done => {
2018-09-03 11:54:35 +00:00
return nightmare
2018-10-25 14:44:03 +00:00
.waitToClick(selectors.ticketBasicData.chargesReason)
.waitToClick(selectors.ticketBasicData.chargesReasonFirstOption)
.waitForTextInInput(selectors.ticketBasicData.chargesReason, 'Cambiar los precios en el ticket')
.click(selectors.ticketBasicData.finalizeButton)
.waitForURL('summary')
.url()
2018-11-11 16:40:02 +00:00
.then(url => {
2018-10-25 14:44:03 +00:00
expect(url).toContain('summary');
done();
}).catch(done.fail);
2018-09-03 11:54:35 +00:00
});
});
});