2020-01-26 23:48:00 +00:00
|
|
|
import selectors from '../../../helpers/selectors.js';
|
|
|
|
import getBrowser from '../../../helpers/puppeteer';
|
2019-09-06 09:43:15 +00:00
|
|
|
|
2020-11-09 13:52:25 +00:00
|
|
|
fdescribe('Ticket List sale path', () => {
|
2020-01-23 15:01:29 +00:00
|
|
|
let browser;
|
|
|
|
let page;
|
|
|
|
|
|
|
|
beforeAll(async() => {
|
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
|
|
|
await page.loginAndModule('employee', 'ticket');
|
|
|
|
await page.accessToSearchResult('13');
|
|
|
|
await page.accessToSection('ticket.card.sale');
|
|
|
|
});
|
2019-09-06 09:43:15 +00:00
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
afterAll(async() => {
|
|
|
|
await browser.close();
|
2019-09-06 09:43:15 +00:00
|
|
|
});
|
|
|
|
|
2020-01-27 17:35:39 +00:00
|
|
|
it('should confirm the first ticket sale contains the colour tag', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
const value = await page
|
2019-09-06 09:43:15 +00:00
|
|
|
.waitToGetProperty(selectors.ticketSales.firstSaleColour, 'innerText');
|
|
|
|
|
|
|
|
expect(value).toContain('Black');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should confirm the first sale contains the price', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
const value = await page
|
2019-09-06 09:43:15 +00:00
|
|
|
.waitToGetProperty(selectors.ticketSales.firstSalePrice, 'innerText');
|
|
|
|
|
|
|
|
expect(value).toContain('1.72');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should confirm the first sale contains the discount', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
const value = await page
|
2019-09-06 09:43:15 +00:00
|
|
|
.waitToGetProperty(selectors.ticketSales.firstSaleDiscount, 'innerText');
|
|
|
|
|
2020-01-16 12:39:32 +00:00
|
|
|
expect(value).toContain('0.00%');
|
2019-09-06 09:43:15 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should confirm the first sale contains the total import', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
const value = await page
|
2019-09-06 09:43:15 +00:00
|
|
|
.waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText');
|
|
|
|
|
|
|
|
expect(value).toContain('34.40');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should add an empty item to the sale list', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.newItemButton);
|
|
|
|
const sales = await page
|
2019-09-06 09:43:15 +00:00
|
|
|
.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() => {
|
2020-01-27 17:35:39 +00:00
|
|
|
let searchValue = 'Melee weapon heavy shield 1x0.5m';
|
|
|
|
await page.waitToClick(`${selectors.ticketSales.secondSaleIdAutocomplete} input`);
|
|
|
|
await page.waitForSelector(selector => {
|
|
|
|
document
|
|
|
|
.querySelector(`${selector} vn-drop-down`).$ctrl.content
|
|
|
|
.querySelectorAll('li');
|
|
|
|
}, selectors.ticketSales.secondSaleIdAutocomplete);
|
|
|
|
|
2020-11-09 13:52:25 +00:00
|
|
|
await page.waitFor(3000);
|
2020-01-27 17:35:39 +00:00
|
|
|
await page.write(`.vn-drop-down.shown`, searchValue);
|
|
|
|
await page.waitForFunction((selector, searchValue) => {
|
|
|
|
let element = document
|
|
|
|
.querySelector(`${selector} vn-drop-down`).$ctrl.content
|
|
|
|
.querySelector('li.active');
|
|
|
|
if (element)
|
|
|
|
return element.innerText.includes(searchValue);
|
|
|
|
}, {}, selectors.ticketSales.secondSaleIdAutocomplete, searchValue);
|
|
|
|
|
|
|
|
await page.keyboard.press('Enter');
|
2020-07-02 08:31:34 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.secondSaleQuantityCell);
|
|
|
|
await page.type(selectors.ticketSales.secondSaleQuantity, '1');
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.keyboard.press('Enter');
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-09-06 09:43:15 +00:00
|
|
|
|
2020-10-30 16:09:11 +00:00
|
|
|
expect(message.text).toBe('Data saved!');
|
2019-09-06 09:43:15 +00:00
|
|
|
});
|
2020-01-23 15:01:29 +00:00
|
|
|
|
2020-05-18 14:53:48 +00:00
|
|
|
it('should update the description of the new sale', async() => {
|
|
|
|
await page.click(selectors.ticketSales.secondSaleConceptCell);
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.write(selectors.ticketSales.secondSaleConceptInput, 'Aegis of Valor');
|
|
|
|
await page.keyboard.press('Enter');
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-09-06 09:43:15 +00:00
|
|
|
|
2020-10-30 16:09:11 +00:00
|
|
|
expect(message.text).toBe('Data saved!');
|
2019-09-06 09:43:15 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should add a third empty item to the sale list', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.newItemButton);
|
|
|
|
const sales = await page.countElement(selectors.ticketSales.saleLine);
|
2019-09-06 09:43:15 +00:00
|
|
|
|
|
|
|
expect(sales).toEqual(3);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should select the 2nd and 3th item and delete both', async() => {
|
2020-02-25 15:36:29 +00:00
|
|
|
await page.waitFor(2000);
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.secondSaleCheckbox);
|
|
|
|
await page.waitToClick(selectors.ticketSales.thirdSaleCheckbox);
|
|
|
|
await page.waitToClick(selectors.ticketSales.deleteSaleButton);
|
2020-10-01 06:53:31 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.acceptButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-09-06 09:43:15 +00:00
|
|
|
|
2020-10-30 16:09:11 +00:00
|
|
|
expect(message.text).toBe('Data saved!');
|
2019-09-06 09:43:15 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should verify there's only 1 single line remaining`, async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
const sales = await page.countElement(selectors.ticketSales.saleLine);
|
2019-09-06 09:43:15 +00:00
|
|
|
|
|
|
|
expect(sales).toEqual(1);
|
|
|
|
});
|
|
|
|
});
|