74 lines
2.6 KiB
JavaScript
74 lines
2.6 KiB
JavaScript
import selectors from '../../helpers/selectors.js';
|
|
import createNightmare from '../../helpers/helpers';
|
|
|
|
describe('list sale path', () => {
|
|
const nightmare = createNightmare();
|
|
|
|
beforeAll(() => {
|
|
return nightmare
|
|
.waitForLogin('developer');
|
|
});
|
|
|
|
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 => {
|
|
expect(url.hash).toEqual('#!/ticket/list');
|
|
});
|
|
});
|
|
|
|
it('should search for the ticket 1', () => {
|
|
return nightmare
|
|
.wait(selectors.ticketsIndex.searchResult)
|
|
.type(selectors.ticketsIndex.searchTicketInput, 1)
|
|
.click(selectors.ticketsIndex.searchButton)
|
|
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
|
.countSearchResults(selectors.ticketsIndex.searchResult)
|
|
.then(result => {
|
|
expect(result).toEqual(1);
|
|
});
|
|
});
|
|
|
|
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');
|
|
});
|
|
});
|
|
|
|
it('should confirm the fist ticket sale is the expected one', () => {
|
|
return nightmare
|
|
.wait(selectors.ticketSales.firstSaleText)
|
|
.getInnerText(selectors.ticketSales.firstSaleText)
|
|
.then(value => {
|
|
expect(value).toContain('Color Yellow');
|
|
expect(value).toContain('2');
|
|
expect(value).toContain('€1.50');
|
|
expect(value).toContain('0 %');
|
|
expect(value).toContain('€3.00');
|
|
});
|
|
});
|
|
|
|
it('should confirm the second ticket sale is the expected one', () => {
|
|
return nightmare
|
|
.wait(selectors.ticketSales.secondSaleText)
|
|
.getInnerText(selectors.ticketSales.secondSaleText)
|
|
.then(value => {
|
|
expect(value).toContain('Color Yellow');
|
|
expect(value).toContain('5');
|
|
expect(value).toContain('€1.50');
|
|
expect(value).toContain('0 %');
|
|
expect(value).toContain('€7.50');
|
|
});
|
|
});
|
|
});
|