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-11 07:14:26 +00:00
|
|
|
.waitForLogin('employee');
|
2018-09-11 13:09:15 +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-11 13:09:15 +00:00
|
|
|
return nightmare
|
|
|
|
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
|
|
|
.wait(selectors.globalItems.applicationsMenuVisible)
|
|
|
|
.waitToClick(selectors.globalItems.ticketsButton)
|
2018-10-20 10:07:48 +00:00
|
|
|
.wait(selectors.ticketsIndex.searchResult)
|
2018-09-11 13:09:15 +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-11 13:09:15 +00:00
|
|
|
});
|
2018-04-04 09:56:07 +00:00
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should search for the ticket 1', done => {
|
2018-09-11 13:09:15 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.ticketsIndex.searchResult)
|
|
|
|
.type(selectors.ticketsIndex.searchTicketInput, 'id:1')
|
|
|
|
.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-11 13:09:15 +00:00
|
|
|
});
|
2018-04-04 09:56:07 +00:00
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should click on the search result to access to the ticket's sale`, done => {
|
2018-09-11 13:09:15 +00:00
|
|
|
return nightmare
|
|
|
|
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
|
|
|
|
.waitToClick(selectors.ticketsIndex.searchResult)
|
|
|
|
.waitToClick(selectors.ticketSales.saleButton)
|
|
|
|
.waitForURL('sale')
|
|
|
|
.url()
|
|
|
|
.then(url => {
|
|
|
|
expect(url).toContain('sale');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-11 13:09:15 +00:00
|
|
|
});
|
2018-04-04 09:56:07 +00:00
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should confirm the first ticket sale contains the colour', done => {
|
2018-09-11 13:09:15 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.ticketSales.firstSaleText)
|
|
|
|
.getInnerText(selectors.ticketSales.firstSaleColour)
|
|
|
|
.then(value => {
|
|
|
|
expect(value).toContain('Yellow');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-11 13:09:15 +00:00
|
|
|
});
|
2018-04-04 09:56:07 +00:00
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should confirm the first ticket sale contains the lenght', done => {
|
2018-09-11 13:09:15 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.ticketSales.firstSaleText)
|
|
|
|
.getInnerText(selectors.ticketSales.firstSaleText)
|
|
|
|
.then(value => {
|
|
|
|
expect(value).toContain('5');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-11 13:09:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should confirm the first ticket sale contains the price', done => {
|
2018-09-11 13:09:15 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.ticketSales.firstSaleText)
|
|
|
|
.getInnerText(selectors.ticketSales.firstSalePrice)
|
|
|
|
.then(value => {
|
2018-10-16 14:23:33 +00:00
|
|
|
expect(value).toContain('9.10');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-11 13:09:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should confirm the first ticket sale contains the discount', done => {
|
2018-09-11 13:09:15 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.ticketSales.firstSaleText)
|
|
|
|
.getInnerText(selectors.ticketSales.firstSaleDiscount)
|
|
|
|
.then(value => {
|
|
|
|
expect(value).toContain('0 %');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-11 13:09:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should confirm the first ticket sale contains the total import', done => {
|
2018-09-11 13:09:15 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.ticketSales.firstSaleText)
|
|
|
|
.getInnerText(selectors.ticketSales.firstSaleImport)
|
|
|
|
.then(value => {
|
2018-09-21 13:01:51 +00:00
|
|
|
expect(value).toContain('45.50');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-11 13:09:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should confirm the second ticket sale contains the colour', done => {
|
2018-09-11 13:09:15 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.ticketSales.secondSaleText)
|
|
|
|
.getInnerText(selectors.ticketSales.secondSaleColour)
|
|
|
|
.then(value => {
|
|
|
|
expect(value).toContain('Red');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-11 13:09:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should confirm the second ticket sale contains the price', done => {
|
2018-09-11 13:09:15 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.ticketSales.secondSaleText)
|
|
|
|
.getInnerText(selectors.ticketSales.secondSalePrice)
|
|
|
|
.then(value => {
|
2018-10-16 14:23:33 +00:00
|
|
|
expect(value).toContain('1.07');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-11 13:09:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should confirm the second ticket sale contains the discount', done => {
|
2018-09-11 13:09:15 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.ticketSales.secondSaleText)
|
|
|
|
.getInnerText(selectors.ticketSales.secondSaleDiscount)
|
|
|
|
.then(value => {
|
|
|
|
expect(value).toContain('0 %');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-11 13:09:15 +00:00
|
|
|
});
|
2018-04-04 09:56:07 +00:00
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should confirm the second ticket sale contains the total import', done => {
|
2018-09-11 13:09:15 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.ticketSales.secondSaleText)
|
|
|
|
.getInnerText(selectors.ticketSales.secondSaleImport)
|
|
|
|
.then(value => {
|
2018-09-21 13:01:51 +00:00
|
|
|
expect(value).toContain('10.70');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-04-04 09:56:07 +00:00
|
|
|
});
|
|
|
|
});
|