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

163 lines
6.3 KiB
JavaScript
Raw Normal View History

2018-09-03 11:54:35 +00:00
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
describe('Ticket', () => {
describe('Edit basic data path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
2018-10-11 07:14:26 +00:00
.waitForLogin('employee');
2018-09-03 11:54:35 +00:00
});
2018-10-22 15:12:41 +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
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchResult)
2018-09-03 11:54:35 +00:00
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/ticket/index');
2018-10-22 15:12:41 +00:00
done();
}).catch(done.fail);
2018-09-03 11:54:35 +00:00
});
2018-10-22 15:12:41 +00:00
it('should search for the ticket 11', done => {
2018-09-03 11:54:35 +00:00
return nightmare
.wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:11')
.click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult)
.then(result => {
expect(result).toEqual(1);
2018-10-22 15:12:41 +00:00
done();
}).catch(done.fail);
2018-09-03 11:54:35 +00:00
});
2018-10-22 15:12:41 +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
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') // should be Bruce Wayne
2018-09-03 11:54:35 +00:00
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketBasicData.basicDataButton)
.waitForURL('data/step-one')
.url()
.then(url => {
expect(url).toContain('data/step-one');
2018-10-22 15:12:41 +00:00
done();
}).catch(done.fail);
2018-09-03 11:54:35 +00:00
});
2018-10-22 15:12:41 +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
.waitToClick(selectors.ticketBasicData.clientSelect)
.waitToClick(selectors.ticketBasicData.clientSelectThirdOption)
.wait(500)
.waitToClick(selectors.ticketBasicData.addressSelect)
.waitToClick(selectors.ticketBasicData.addressSelectSecondOption)
2018-10-22 06:59:04 +00:00
.waitForTextInInput(selectors.ticketBasicData.addressSelect, 'Charles Xavier')
2018-09-03 11:54:35 +00:00
.click(selectors.ticketBasicData.nextStepButton)
.waitForURL('data/step-two')
.url()
.then(url => {
expect(url).toContain('data/step-two');
2018-10-22 15:12:41 +00:00
done();
}).catch(done.fail);
2018-09-03 11:54:35 +00:00
});
2018-10-22 15:12:41 +00:00
it(`should have no price diference`, done => {
2018-09-03 11:54:35 +00:00
return nightmare
.getInnerText(selectors.ticketBasicData.stepTwoTotalPriceDif)
.then(result => {
expect(result).toContain('0');
2018-10-22 15:12:41 +00:00
done();
}).catch(done.fail);
2018-09-03 11:54:35 +00:00
});
2018-10-22 15:12:41 +00:00
it(`should click next to move on to step three`, done => {
2018-09-03 11:54:35 +00:00
return nightmare
.click(selectors.ticketBasicData.nextStepButton)
.waitForURL('data/step-three')
.url()
.then(url => {
expect(url).toContain('data/step-three');
2018-10-22 15:12:41 +00:00
done();
}).catch(done.fail);
2018-09-03 11:54:35 +00:00
});
2018-10-22 15:12:41 +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
.waitToClick(selectors.ticketBasicData.chargesReason)
.waitToClick(selectors.ticketBasicData.chargesReasonFourthOption)
.waitForTextInInput(selectors.ticketBasicData.chargesReason, 'No realizar modificaciones en precios')
.click(selectors.ticketBasicData.finalizeButton)
.waitForURL('summary')
.url()
.then(url => {
expect(url).toContain('summary');
2018-10-22 15:12:41 +00:00
done();
}).catch(done.fail);
2018-09-03 11:54:35 +00:00
});
2018-10-22 15:12:41 +00:00
it(`should go back to ticket.basicData section`, done => {
2018-09-03 11:54:35 +00:00
return nightmare
.waitToClick(selectors.ticketBasicData.basicDataButton)
.waitForURL('data/step-one')
.url()
.then(url => {
expect(url).toContain('data/step-one');
2018-10-22 15:12:41 +00:00
done();
}).catch(done.fail);
2018-09-03 11:54:35 +00:00
});
2018-10-22 15:12:41 +00:00
it(`should edit the ticket agency then click next`, done => {
2018-09-03 11:54:35 +00:00
return nightmare
.waitToClick(selectors.ticketBasicData.agencySelect)
.waitToClick(selectors.ticketBasicData.agencySelectOptionSix)
2018-09-03 11:54:35 +00:00
.waitForTextInInput(selectors.ticketBasicData.agencySelect, 'Expensive')
.click(selectors.ticketBasicData.nextStepButton)
.waitForURL('data/step-two')
.url()
.then(url => {
expect(url).toContain('data/step-two');
2018-10-22 15:12:41 +00:00
done();
}).catch(done.fail);
2018-09-03 11:54:35 +00:00
});
2018-10-22 15:12:41 +00:00
it(`should have a price diference`, done => {
2018-09-03 11:54:35 +00:00
return nightmare
.getInnerText(selectors.ticketBasicData.stepTwoTotalPriceDif)
.then(result => {
2018-10-16 14:23:33 +00:00
expect(result).toContain('-20.65');
2018-10-22 15:12:41 +00:00
done();
}).catch(done.fail);
2018-09-03 11:54:35 +00:00
});
2018-10-22 15:12:41 +00:00
it(`should then click next to move on to step three`, done => {
2018-09-03 11:54:35 +00:00
return nightmare
.click(selectors.ticketBasicData.nextStepButton)
.waitForURL('data/step-three')
.url()
.then(url => {
expect(url).toContain('data/step-three');
2018-10-22 15:12:41 +00:00
done();
}).catch(done.fail);
2018-09-03 11:54:35 +00:00
});
2018-10-22 15:12:41 +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
.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()
.then(url => {
expect(url).toContain('summary');
2018-10-22 15:12:41 +00:00
done();
}).catch(done.fail);
2018-09-03 11:54:35 +00:00
});
});
});