94 lines
3.3 KiB
JavaScript
94 lines
3.3 KiB
JavaScript
import selectors from '../../helpers/selectors.js';
|
|
import createNightmare from '../../helpers/nightmare';
|
|
|
|
describe('Ticket List sale path', () => {
|
|
const nightmare = createNightmare();
|
|
|
|
beforeAll(() => {
|
|
return nightmare
|
|
.waitForLogin('employee');
|
|
});
|
|
|
|
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)
|
|
.wait(selectors.ticketsIndex.searchTicketInput)
|
|
.parsedUrl();
|
|
|
|
expect(url.hash).toEqual('#!/ticket/index');
|
|
});
|
|
|
|
it('should search for the ticket 8', async () => {
|
|
const result = await nightmare
|
|
.wait(selectors.ticketsIndex.searchTicketInput)
|
|
.type(selectors.ticketsIndex.searchTicketInput, 'id:8')
|
|
.click(selectors.ticketsIndex.searchButton)
|
|
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
|
.countElement(selectors.ticketsIndex.searchResult);
|
|
|
|
expect(result).toEqual(1);
|
|
});
|
|
|
|
it(`should click on the search result to access to the ticket's sale`, async () => {
|
|
const url = await nightmare
|
|
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 24')
|
|
.waitToClick(selectors.ticketsIndex.searchResult)
|
|
.waitToClick(selectors.ticketSales.saleButton)
|
|
.waitForURL('/sale')
|
|
.url();
|
|
|
|
expect(url).toContain('/sale');
|
|
});
|
|
|
|
it('should confirm the first ticket sale contains the colour', async () => {
|
|
const value = await nightmare
|
|
.wait(selectors.ticketSales.firstSaleText)
|
|
.getInnerText(selectors.ticketSales.firstSaleColour);
|
|
|
|
expect(value).toContain('Red');
|
|
});
|
|
|
|
it('should confirm the first ticket sale contains the lenght', async () => {
|
|
const value = await nightmare
|
|
.wait(selectors.ticketSales.firstSaleText)
|
|
.getInnerText(selectors.ticketSales.firstSaleText);
|
|
|
|
expect(value).toContain('3');
|
|
});
|
|
|
|
it('should confirm the first ticket sale contains the price', async () => {
|
|
const value = await nightmare
|
|
.wait(selectors.ticketSales.firstSaleText)
|
|
.getInnerText(selectors.ticketSales.firstSalePrice);
|
|
|
|
expect(value).toContain('1.30');
|
|
});
|
|
|
|
it('should confirm the first ticket sale contains the discount', async () => {
|
|
const value = await nightmare
|
|
.wait(selectors.ticketSales.firstSaleText)
|
|
.getInnerText(selectors.ticketSales.firstSaleDiscount);
|
|
|
|
expect(value).toContain('0 %');
|
|
});
|
|
|
|
it('should confirm the first ticket sale contains the total import', async () => {
|
|
const value = await nightmare
|
|
.wait(selectors.ticketSales.firstSaleText)
|
|
.getInnerText(selectors.ticketSales.firstSaleImport);
|
|
|
|
expect(value).toContain('19.50');
|
|
});
|
|
|
|
it('should navigate to the catalog by pressing the new item button', async () => {
|
|
const url = await nightmare
|
|
.waitToClick(selectors.ticketSales.newItemButton)
|
|
.waitForURL('/catalog')
|
|
.url();
|
|
|
|
expect(url).toContain('/catalog');
|
|
});
|
|
});
|