141 lines
4.7 KiB
JavaScript
141 lines
4.7 KiB
JavaScript
import selectors from '../../helpers/selectors.js';
|
|
import createNightmare from '../../helpers/helpers';
|
|
|
|
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', done => {
|
|
return nightmare
|
|
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
|
.wait(selectors.globalItems.applicationsMenuVisible)
|
|
.waitToClick(selectors.globalItems.ticketsButton)
|
|
.wait(selectors.ticketsIndex.searchResult)
|
|
.parsedUrl()
|
|
.then(url => {
|
|
expect(url.hash).toEqual('#!/ticket/index');
|
|
done();
|
|
}).catch(done.fail);
|
|
});
|
|
|
|
it('should search for the ticket 1', done => {
|
|
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);
|
|
done();
|
|
}).catch(done.fail);
|
|
});
|
|
|
|
it(`should click on the search result to access to the ticket's sale`, done => {
|
|
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');
|
|
done();
|
|
}).catch(done.fail);
|
|
});
|
|
|
|
it('should confirm the first ticket sale contains the colour', done => {
|
|
return nightmare
|
|
.wait(selectors.ticketSales.firstSaleText)
|
|
.getInnerText(selectors.ticketSales.firstSaleColour)
|
|
.then(value => {
|
|
expect(value).toContain('Yellow');
|
|
done();
|
|
}).catch(done.fail);
|
|
});
|
|
|
|
it('should confirm the first ticket sale contains the lenght', done => {
|
|
return nightmare
|
|
.wait(selectors.ticketSales.firstSaleText)
|
|
.getInnerText(selectors.ticketSales.firstSaleText)
|
|
.then(value => {
|
|
expect(value).toContain('5');
|
|
done();
|
|
}).catch(done.fail);
|
|
});
|
|
|
|
it('should confirm the first ticket sale contains the price', done => {
|
|
return nightmare
|
|
.wait(selectors.ticketSales.firstSaleText)
|
|
.getInnerText(selectors.ticketSales.firstSalePrice)
|
|
.then(value => {
|
|
expect(value).toContain('9.10');
|
|
done();
|
|
}).catch(done.fail);
|
|
});
|
|
|
|
it('should confirm the first ticket sale contains the discount', done => {
|
|
return nightmare
|
|
.wait(selectors.ticketSales.firstSaleText)
|
|
.getInnerText(selectors.ticketSales.firstSaleDiscount)
|
|
.then(value => {
|
|
expect(value).toContain('0 %');
|
|
done();
|
|
}).catch(done.fail);
|
|
});
|
|
|
|
it('should confirm the first ticket sale contains the total import', done => {
|
|
return nightmare
|
|
.wait(selectors.ticketSales.firstSaleText)
|
|
.getInnerText(selectors.ticketSales.firstSaleImport)
|
|
.then(value => {
|
|
expect(value).toContain('45.50');
|
|
done();
|
|
}).catch(done.fail);
|
|
});
|
|
|
|
it('should confirm the second ticket sale contains the colour', done => {
|
|
return nightmare
|
|
.wait(selectors.ticketSales.secondSaleText)
|
|
.getInnerText(selectors.ticketSales.secondSaleColour)
|
|
.then(value => {
|
|
expect(value).toContain('Red');
|
|
done();
|
|
}).catch(done.fail);
|
|
});
|
|
|
|
it('should confirm the second ticket sale contains the price', done => {
|
|
return nightmare
|
|
.wait(selectors.ticketSales.secondSaleText)
|
|
.getInnerText(selectors.ticketSales.secondSalePrice)
|
|
.then(value => {
|
|
expect(value).toContain('1.07');
|
|
done();
|
|
}).catch(done.fail);
|
|
});
|
|
|
|
it('should confirm the second ticket sale contains the discount', done => {
|
|
return nightmare
|
|
.wait(selectors.ticketSales.secondSaleText)
|
|
.getInnerText(selectors.ticketSales.secondSaleDiscount)
|
|
.then(value => {
|
|
expect(value).toContain('0 %');
|
|
done();
|
|
}).catch(done.fail);
|
|
});
|
|
|
|
it('should confirm the second ticket sale contains the total import', done => {
|
|
return nightmare
|
|
.wait(selectors.ticketSales.secondSaleText)
|
|
.getInnerText(selectors.ticketSales.secondSaleImport)
|
|
.then(value => {
|
|
expect(value).toContain('10.70');
|
|
done();
|
|
}).catch(done.fail);
|
|
});
|
|
});
|