salix/e2e/paths/05-ticket-module/01-sale/01_list_sales.spec.js

96 lines
3.5 KiB
JavaScript
Raw Normal View History

2019-09-06 09:43:15 +00:00
import selectors from '../../../helpers/selectors.js';
import createNightmare from '../../../helpers/nightmare';
describe('Ticket List sale path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.loginAndModule('employee', 'ticket')
.accessToSearchResult(13)
.accessToSection('ticket.card.sale');
});
it('should confirm the first ticket sale contains the colour', async() => {
const value = await nightmare
.waitToGetProperty(selectors.ticketSales.firstSaleColour, 'innerText');
expect(value).toContain('Black');
});
it('should confirm the first sale contains the price', async() => {
const value = await nightmare
.waitToGetProperty(selectors.ticketSales.firstSalePrice, 'innerText');
expect(value).toContain('1.72');
});
it('should confirm the first sale contains the discount', async() => {
const value = await nightmare
.waitToGetProperty(selectors.ticketSales.firstSaleDiscount, 'innerText');
expect(value).toContain('0 %');
});
it('should confirm the first sale contains the total import', async() => {
const value = await nightmare
.waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText');
expect(value).toContain('34.40');
});
it('should add an empty item to the sale list', async() => {
const sales = await nightmare
.waitToClick(selectors.ticketSales.newItemButton)
.countElement(selectors.ticketSales.saleLine);
expect(sales).toEqual(2);
});
it('should select a valid item to be added as the second item in the sales list', async() => {
const result = await nightmare
.waitToClick(selectors.ticketSales.secondSaleIdInput)
.write(selectors.ticketSales.secondSaleIdAutocomplete, 'Melee weapon heavy shield 1x0.5m')
.waitToClick(selectors.ticketSales.idAutocompleteFirstResult)
.write(selectors.ticketSales.secondSaleQuantity, '1\u000d')
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
2019-11-12 07:51:50 +00:00
// #1865
xit('should update the description of the new sale', async() => {
2019-09-06 09:43:15 +00:00
const result = await nightmare
.focusElement(selectors.ticketSales.secondSaleConceptCell)
.write(selectors.ticketSales.secondSaleConceptInput, 'Aegis of Valor\u000d')
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should add a third empty item to the sale list', async() => {
const sales = await nightmare
.waitToClick(selectors.ticketSales.newItemButton)
.countElement(selectors.ticketSales.saleLine);
expect(sales).toEqual(3);
});
it('should select the 2nd and 3th item and delete both', async() => {
const result = await nightmare
.waitToClick(selectors.ticketSales.secondSaleCheckbox)
.waitToClick(selectors.ticketSales.thirdSaleCheckbox)
.waitToClick(selectors.ticketSales.deleteSaleButton)
.waitToClick(selectors.ticketSales.acceptDeleteLineButton)
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it(`should verify there's only 1 single line remaining`, async() => {
const sales = await nightmare
.countElement(selectors.ticketSales.saleLine);
expect(sales).toEqual(1);
});
});