2018-04-04 09:56:07 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import createNightmare from '../../helpers/helpers';
|
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
describe('Ticket', () => {
|
|
|
|
describe('List sale path', () => {
|
|
|
|
const nightmare = createNightmare();
|
2018-04-04 09:56:07 +00:00
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
beforeAll(() => {
|
|
|
|
return nightmare
|
|
|
|
.waitForLogin('developer');
|
|
|
|
});
|
2018-04-04 09:56:07 +00:00
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
it('should click on the Tickets button of the top bar menu', () => {
|
|
|
|
return nightmare
|
|
|
|
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
|
|
|
.wait(selectors.globalItems.applicationsMenuVisible)
|
|
|
|
.waitToClick(selectors.globalItems.ticketsButton)
|
|
|
|
.wait(selectors.ticketsIndex.createTicketButton)
|
|
|
|
.parsedUrl()
|
|
|
|
.then(url => {
|
2018-05-25 08:03:45 +00:00
|
|
|
expect(url.hash).toEqual('#!/ticket/index');
|
2018-04-05 06:55:47 +00:00
|
|
|
});
|
2018-04-04 09:56:07 +00:00
|
|
|
});
|
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
it('should search for the ticket 1', () => {
|
|
|
|
return nightmare
|
|
|
|
.wait(selectors.ticketsIndex.searchResult)
|
2018-06-07 21:47:19 +00:00
|
|
|
.type(selectors.ticketsIndex.searchTicketInput, 'id:1')
|
2018-04-05 06:55:47 +00:00
|
|
|
.click(selectors.ticketsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
|
|
|
.countSearchResults(selectors.ticketsIndex.searchResult)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual(1);
|
|
|
|
});
|
2018-04-04 09:56:07 +00:00
|
|
|
});
|
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
it(`should click on the search result to access to the ticket's sale`, () => {
|
|
|
|
return nightmare
|
|
|
|
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Batman')
|
|
|
|
.waitToClick(selectors.ticketsIndex.searchResult)
|
|
|
|
.waitToClick(selectors.ticketSales.saleButton)
|
|
|
|
.waitForURL('sale')
|
|
|
|
.url()
|
|
|
|
.then(url => {
|
|
|
|
expect(url).toContain('sale');
|
|
|
|
});
|
2018-04-04 09:56:07 +00:00
|
|
|
});
|
|
|
|
|
2018-07-17 06:44:31 +00:00
|
|
|
it('should confirm the first ticket sale is the expected one', () => {
|
2018-04-05 06:55:47 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.ticketSales.firstSaleText)
|
|
|
|
.getInnerText(selectors.ticketSales.firstSaleText)
|
|
|
|
.then(value => {
|
2018-05-29 11:36:41 +00:00
|
|
|
expect(value).toContain('Yellow');
|
2018-04-30 10:48:29 +00:00
|
|
|
expect(value).toContain('5');
|
2018-06-22 12:52:11 +00:00
|
|
|
expect(value).toContain('€23.50');
|
2018-04-05 06:55:47 +00:00
|
|
|
expect(value).toContain('0 %');
|
2018-06-22 12:52:11 +00:00
|
|
|
expect(value).toContain('€117.50');
|
2018-04-05 06:55:47 +00:00
|
|
|
});
|
2018-04-04 09:56:07 +00:00
|
|
|
});
|
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
it('should confirm the second ticket sale is the expected one', () => {
|
|
|
|
return nightmare
|
|
|
|
.wait(selectors.ticketSales.secondSaleText)
|
|
|
|
.getInnerText(selectors.ticketSales.secondSaleText)
|
|
|
|
.then(value => {
|
2018-07-09 07:46:49 +00:00
|
|
|
expect(value).toContain('Red');
|
|
|
|
expect(value).toContain('€4.50');
|
2018-04-05 06:55:47 +00:00
|
|
|
expect(value).toContain('0 %');
|
2018-07-09 07:46:49 +00:00
|
|
|
expect(value).toContain('€45.00');
|
2018-04-05 06:55:47 +00:00
|
|
|
});
|
2018-04-04 09:56:07 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|