2018-04-04 09:56:07 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2018-10-24 08:57:14 +00:00
|
|
|
import createNightmare from '../../helpers/nightmare';
|
2018-04-04 09:56:07 +00:00
|
|
|
|
2018-09-11 13:09:15 +00:00
|
|
|
describe('Ticket List sale path', () => {
|
|
|
|
const nightmare = createNightmare();
|
2018-04-04 09:56:07 +00:00
|
|
|
|
2018-09-11 13:09:15 +00:00
|
|
|
beforeAll(() => {
|
|
|
|
return nightmare
|
2018-10-25 14:44:03 +00:00
|
|
|
.waitForLogin('employee');
|
2018-09-11 13:09:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-25 14:44:03 +00:00
|
|
|
it('should click on the Tickets button of the top bar menu', async () => {
|
|
|
|
const url = await nightmare
|
|
|
|
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
|
|
|
.wait(selectors.globalItems.applicationsMenuVisible)
|
|
|
|
.waitToClick(selectors.globalItems.ticketsButton)
|
2018-11-21 13:30:32 +00:00
|
|
|
.wait(selectors.ticketsIndex.searchTicketInput)
|
2018-10-25 14:44:03 +00:00
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toEqual('#!/ticket/index');
|
2018-09-11 13:09:15 +00:00
|
|
|
});
|
2018-04-04 09:56:07 +00:00
|
|
|
|
2018-11-15 13:15:34 +00:00
|
|
|
it('should search for the ticket 8', async () => {
|
2018-10-25 14:44:03 +00:00
|
|
|
const result = await nightmare
|
2018-11-21 13:30:32 +00:00
|
|
|
.wait(selectors.ticketsIndex.searchTicketInput)
|
2018-11-15 13:15:34 +00:00
|
|
|
.type(selectors.ticketsIndex.searchTicketInput, 'id:8')
|
2018-10-25 14:44:03 +00:00
|
|
|
.click(selectors.ticketsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
|
|
|
.countElement(selectors.ticketsIndex.searchResult);
|
|
|
|
|
|
|
|
expect(result).toEqual(1);
|
2018-09-11 13:09:15 +00:00
|
|
|
});
|
2018-04-04 09:56:07 +00:00
|
|
|
|
2018-10-25 14:44:03 +00:00
|
|
|
it(`should click on the search result to access to the ticket's sale`, async () => {
|
|
|
|
const url = await nightmare
|
2018-11-15 13:15:34 +00:00
|
|
|
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 24')
|
2018-10-25 14:44:03 +00:00
|
|
|
.waitToClick(selectors.ticketsIndex.searchResult)
|
|
|
|
.waitToClick(selectors.ticketSales.saleButton)
|
2018-11-15 13:15:34 +00:00
|
|
|
.waitForURL('/sale')
|
2018-11-22 14:44:33 +00:00
|
|
|
.parsedUrl();
|
2018-10-25 14:44:03 +00:00
|
|
|
|
2018-11-22 14:44:33 +00:00
|
|
|
expect(url.hash).toContain('/sale');
|
2018-09-11 13:09:15 +00:00
|
|
|
});
|
2018-04-04 09:56:07 +00:00
|
|
|
|
2018-10-25 14:44:03 +00:00
|
|
|
it('should confirm the first ticket sale contains the colour', async () => {
|
|
|
|
const value = await nightmare
|
2018-11-22 14:44:33 +00:00
|
|
|
.waitToGetProperty(selectors.ticketSales.firstSaleColour, 'innerText');
|
2018-10-25 14:44:03 +00:00
|
|
|
|
2018-11-15 13:15:34 +00:00
|
|
|
expect(value).toContain('Red');
|
2018-09-11 13:09:15 +00:00
|
|
|
});
|
2018-04-04 09:56:07 +00:00
|
|
|
|
2018-10-25 14:44:03 +00:00
|
|
|
it('should confirm the first ticket sale contains the lenght', async () => {
|
|
|
|
const value = await nightmare
|
2018-11-22 14:44:33 +00:00
|
|
|
.waitToGetProperty(selectors.ticketSales.firstSaleText, 'innerText');
|
2018-10-25 14:44:03 +00:00
|
|
|
|
2018-11-15 13:15:34 +00:00
|
|
|
expect(value).toContain('3');
|
2018-09-11 13:09:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-25 14:44:03 +00:00
|
|
|
it('should confirm the first ticket sale contains the price', async () => {
|
|
|
|
const value = await nightmare
|
2018-11-22 14:44:33 +00:00
|
|
|
.waitToGetProperty(selectors.ticketSales.firstSalePrice, 'innerText');
|
2018-10-25 14:44:03 +00:00
|
|
|
|
2018-11-15 13:15:34 +00:00
|
|
|
expect(value).toContain('1.30');
|
2018-09-11 13:09:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-25 14:44:03 +00:00
|
|
|
it('should confirm the first ticket sale contains the discount', async () => {
|
|
|
|
const value = await nightmare
|
2018-11-22 14:44:33 +00:00
|
|
|
.waitToGetProperty(selectors.ticketSales.firstSaleDiscount, 'innerText');
|
2018-10-25 14:44:03 +00:00
|
|
|
|
|
|
|
expect(value).toContain('0 %');
|
2018-09-11 13:09:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-25 14:44:03 +00:00
|
|
|
it('should confirm the first ticket sale contains the total import', async () => {
|
|
|
|
const value = await nightmare
|
2018-11-22 14:44:33 +00:00
|
|
|
.waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText');
|
2018-10-25 14:44:03 +00:00
|
|
|
|
2018-11-15 13:15:34 +00:00
|
|
|
expect(value).toContain('19.50');
|
2018-09-11 13:09:15 +00:00
|
|
|
});
|
|
|
|
|
2018-11-15 13:15:34 +00:00
|
|
|
it('should navigate to the catalog by pressing the new item button', async () => {
|
|
|
|
const url = await nightmare
|
|
|
|
.waitToClick(selectors.ticketSales.newItemButton)
|
|
|
|
.waitForURL('/catalog')
|
2018-11-22 14:44:33 +00:00
|
|
|
.parsedUrl();
|
2018-10-25 14:44:03 +00:00
|
|
|
|
2018-11-22 14:44:33 +00:00
|
|
|
expect(url.hash).toContain('/catalog');
|
2018-04-04 09:56:07 +00:00
|
|
|
});
|
|
|
|
});
|