2019-09-06 09:43:15 +00:00
|
|
|
import selectors from '../../../helpers/selectors.js';
|
2020-01-26 23:48:00 +00:00
|
|
|
import getBrowser from '../../../helpers/puppeteer';
|
2018-09-10 11:38:14 +00:00
|
|
|
|
2020-07-02 07:35:52 +00:00
|
|
|
describe('Ticket Edit sale path', () => {
|
2020-01-23 15:01:29 +00:00
|
|
|
let browser;
|
|
|
|
let page;
|
2018-09-10 11:38:14 +00:00
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
beforeAll(async() => {
|
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
2020-01-26 23:48:00 +00:00
|
|
|
await page.loginAndModule('salesPerson', 'ticket');
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.accessToSearchResult('16');
|
2020-01-26 23:48:00 +00:00
|
|
|
await page.accessToSection('ticket.card.sale');
|
2018-11-07 07:38:09 +00:00
|
|
|
});
|
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
afterAll(async() => {
|
|
|
|
await browser.close();
|
|
|
|
});
|
|
|
|
|
2019-06-27 06:41:07 +00:00
|
|
|
it(`should click on the first sale claim icon to navigate over there`, async() => {
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.firstSaleClaimIcon);
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.waitForState('claim.card.basicData');
|
2018-11-07 07:38:09 +00:00
|
|
|
});
|
|
|
|
|
2019-06-27 06:41:07 +00:00
|
|
|
it('should navigate to the tickets index', async() => {
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
2020-11-23 17:28:39 +00:00
|
|
|
await page.waitForSelector(selectors.globalItems.applicationsMenuVisible);
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.ticketsButton);
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.waitForState('ticket.index');
|
2018-09-10 11:38:14 +00:00
|
|
|
});
|
|
|
|
|
2019-06-27 06:41:07 +00:00
|
|
|
it(`should search for a ticket and then navigate to it's sales`, async() => {
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.accessToSearchResult('16');
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.accessToSection('ticket.card.sale');
|
2020-07-02 07:35:52 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should set the ticket as libre`, async() => {
|
2020-11-13 16:37:02 +00:00
|
|
|
const searchValue = 'libre';
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.stateMenuButton);
|
2020-11-13 16:37:02 +00:00
|
|
|
await page.write(selectors.ticketSales.moreMenuState, searchValue);
|
|
|
|
try {
|
|
|
|
await page.waitForFunction(searchValue => {
|
|
|
|
const element = document.querySelector('li.active');
|
|
|
|
if (element)
|
|
|
|
return element.innerText.toLowerCase().includes(searchValue.toLowerCase());
|
|
|
|
}, {}, searchValue);
|
|
|
|
} catch (error) {
|
|
|
|
const builtSelector = await page.selectorFormater(selectors.ticketSales.moreMenuState);
|
|
|
|
const inputValue = await page.evaluate(() => {
|
|
|
|
return document.querySelector('.vn-drop-down.shown vn-textfield input').value;
|
|
|
|
});
|
|
|
|
throw new Error(`${builtSelector} value is ${inputValue}! ${error}`);
|
|
|
|
}
|
|
|
|
await page.waitForState('ticket.card.sale');
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.keyboard.press('Enter');
|
|
|
|
const message = await page.waitForSnackbar();
|
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2020-07-02 07:35:52 +00:00
|
|
|
});
|
2018-11-07 07:38:09 +00:00
|
|
|
|
2020-07-02 07:35:52 +00:00
|
|
|
it(`should check it's state is libre now`, async() => {
|
|
|
|
await page.waitForTextInElement(selectors.ticketDescriptor.stateLabelValue, 'Libre');
|
|
|
|
const result = await page.waitToGetProperty(selectors.ticketDescriptor.stateLabelValue, 'innerText');
|
|
|
|
|
|
|
|
expect(result).toEqual('State Libre');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should set the ticket as OK`, async() => {
|
|
|
|
await page.waitToClick(selectors.ticketSales.setOk);
|
|
|
|
const message = await page.waitForSnackbar();
|
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2020-07-02 07:35:52 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should check it's state is OK now`, async() => {
|
|
|
|
await page.waitForTextInElement(selectors.ticketDescriptor.stateLabelValue, 'OK');
|
|
|
|
const result = await page.waitToGetProperty(selectors.ticketDescriptor.stateLabelValue, 'innerText');
|
|
|
|
|
|
|
|
expect(result).toEqual('State OK');
|
2018-10-25 14:44:03 +00:00
|
|
|
});
|
|
|
|
|
2019-06-27 06:41:07 +00:00
|
|
|
it(`should check the zoomed image isn't present`, async() => {
|
2020-04-08 09:24:40 +00:00
|
|
|
const result = await page.countElement(selectors.ticketSales.firstSaleZoomedImage);
|
2018-11-07 07:38:09 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(0);
|
2018-10-25 14:44:03 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should click on the thumbnail image of the 1st sale and see the zoomed image`, async() => {
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.firstSaleThumbnailImage);
|
2020-04-08 09:24:40 +00:00
|
|
|
const result = await page.countElement(selectors.ticketSales.firstSaleZoomedImage);
|
2018-11-07 07:38:09 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(1);
|
2018-09-10 11:38:14 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should click on the zoomed image to close it`, async() => {
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.firstSaleZoomedImage);
|
2020-04-08 09:24:40 +00:00
|
|
|
const result = await page.countElement(selectors.ticketSales.firstSaleZoomedImage);
|
2018-11-07 07:38:09 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(0);
|
2018-09-10 11:38:14 +00:00
|
|
|
});
|
|
|
|
|
2020-07-02 07:35:52 +00:00
|
|
|
it(`should click on the first sale ID making now the item descriptor visible`, async() => {
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.firstSaleId);
|
|
|
|
await page.waitImgLoad(selectors.ticketSales.firstSaleDescriptorImage);
|
|
|
|
const visible = await page.isVisible(selectors.ticketSales.saleDescriptorPopover);
|
2018-11-07 07:38:09 +00:00
|
|
|
|
|
|
|
expect(visible).toBeTruthy();
|
2018-09-10 11:38:14 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should click on the descriptor image of the 1st sale and see the zoomed image`, async() => {
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.waitToClick('vn-item-descriptor img');
|
2020-04-08 09:24:40 +00:00
|
|
|
const result = await page.countElement(selectors.ticketSales.firstSaleZoomedImage);
|
2018-11-07 07:38:09 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(1);
|
2018-09-10 11:38:14 +00:00
|
|
|
});
|
|
|
|
|
2019-02-04 14:40:57 +00:00
|
|
|
it(`should now click on the zoomed image to close it`, async() => {
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.firstSaleZoomedImage);
|
2020-04-08 09:24:40 +00:00
|
|
|
const result = await page.countElement(selectors.ticketSales.firstSaleZoomedImage);
|
2018-11-07 07:38:09 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(0);
|
2018-09-10 11:38:14 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should click on the summary icon of the item-descriptor to access to the item summary`, async() => {
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.saleDescriptorPopoverSummaryButton);
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.waitForState('item.card.summary');
|
2018-09-10 11:38:14 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should return to ticket sales section', async() => {
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
2020-11-23 17:28:39 +00:00
|
|
|
await page.waitForSelector(selectors.globalItems.applicationsMenuVisible);
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.ticketsButton);
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.accessToSearchResult('16');
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.accessToSection('ticket.card.sale');
|
2018-09-10 11:38:14 +00:00
|
|
|
});
|
|
|
|
|
2019-06-27 06:41:07 +00:00
|
|
|
it('should remove 1 from the first sale quantity', async() => {
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.firstSaleQuantityCell);
|
2020-11-23 17:28:39 +00:00
|
|
|
await page.waitForSelector(selectors.ticketSales.firstSaleQuantity);
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.type(selectors.ticketSales.firstSaleQuantity, '9\u000d');
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2018-11-07 07:38:09 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2018-09-10 11:38:14 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should update the price', async() => {
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.firstSalePrice);
|
2020-11-23 17:28:39 +00:00
|
|
|
await page.waitForSelector(selectors.ticketSales.firstSalePriceInput);
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.type(selectors.ticketSales.firstSalePriceInput, '5\u000d');
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2018-11-07 07:38:09 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2018-09-10 11:38:14 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should confirm the price have been updated', async() => {
|
2020-07-02 07:35:52 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.ticketSales.firstSalePrice, 'innerText');
|
2018-11-07 07:38:09 +00:00
|
|
|
|
|
|
|
expect(result).toContain('5.00');
|
2018-09-10 11:38:14 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should confirm the total price for that item have been updated', async() => {
|
2020-04-08 09:24:40 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText');
|
2018-11-07 07:38:09 +00:00
|
|
|
|
2019-06-27 06:41:07 +00:00
|
|
|
expect(result).toContain('45.00');
|
2018-09-10 11:38:14 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should update the discount', async() => {
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.firstSaleDiscount);
|
2020-11-23 17:28:39 +00:00
|
|
|
await page.waitForSelector(selectors.ticketSales.firstSaleDiscountInput);
|
2022-04-11 07:04:05 +00:00
|
|
|
await page.type(selectors.ticketSales.firstSaleDiscountInput, '50');
|
2022-03-29 12:33:22 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.saveSaleDiscountButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2018-11-07 07:38:09 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2018-09-10 11:38:14 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should confirm the discount have been updated', async() => {
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.waitForTextInElement(selectors.ticketSales.firstSaleDiscount, '50.00%');
|
|
|
|
const result = await page.waitToGetProperty(selectors.ticketSales.firstSaleDiscount, 'innerText');
|
2018-11-07 07:38:09 +00:00
|
|
|
|
2020-01-16 12:39:32 +00:00
|
|
|
expect(result).toContain('50.00%');
|
2018-10-25 14:44:03 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should confirm the total import for that item have been updated', async() => {
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.waitForTextInElement(selectors.ticketSales.firstSaleImport, '22.50');
|
|
|
|
const result = await page.waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText');
|
2018-11-07 07:38:09 +00:00
|
|
|
|
2019-06-27 06:41:07 +00:00
|
|
|
expect(result).toContain('22.50');
|
2018-10-25 14:44:03 +00:00
|
|
|
});
|
|
|
|
|
2022-12-07 12:53:59 +00:00
|
|
|
it('should check in the history that logs has been added', async() => {
|
2023-03-23 09:05:02 +00:00
|
|
|
pending('https://redmine.verdnatura.es/issues/5455');
|
2023-02-22 11:52:54 +00:00
|
|
|
await page.reload({waitUntil: ['networkidle0', 'domcontentloaded']});
|
2022-12-07 12:53:59 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.firstSaleHistoryButton);
|
|
|
|
await page.waitForSelector(selectors.ticketSales.firstSaleHistory);
|
|
|
|
const result = await page.countElement(selectors.ticketSales.firstSaleHistory);
|
|
|
|
|
|
|
|
expect(result).toBeGreaterThan(0);
|
|
|
|
await page.waitToClick(selectors.ticketSales.closeHistory);
|
|
|
|
});
|
|
|
|
|
2021-11-29 07:30:36 +00:00
|
|
|
it('should recalculate price of sales', async() => {
|
|
|
|
await page.waitToClick(selectors.ticketSales.firstSaleCheckbox);
|
|
|
|
await page.waitToClick(selectors.ticketSales.secondSaleCheckbox);
|
|
|
|
|
|
|
|
await page.waitToClick(selectors.ticketSales.moreMenu);
|
|
|
|
await page.waitToClick(selectors.ticketSales.moreMenuRecalculatePrice);
|
|
|
|
const message = await page.waitForSnackbar();
|
|
|
|
|
|
|
|
expect(message.text).toContain('Data saved!');
|
|
|
|
});
|
|
|
|
|
2022-01-25 14:09:29 +00:00
|
|
|
it('should log in as salesAssistant and navigate to ticket sales', async() => {
|
2022-01-21 10:40:48 +00:00
|
|
|
await page.loginAndModule('salesAssistant', 'ticket');
|
2023-09-25 08:49:47 +00:00
|
|
|
await page.accessToSearchResult('15');
|
2022-01-21 10:40:48 +00:00
|
|
|
await page.accessToSection('ticket.card.sale');
|
2022-01-25 14:09:29 +00:00
|
|
|
});
|
2022-01-21 10:40:48 +00:00
|
|
|
|
2023-05-25 13:03:22 +00:00
|
|
|
it('should select the first sale and create a refund with warehouse', async() => {
|
2021-12-21 13:43:53 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.firstSaleCheckbox);
|
|
|
|
await page.waitToClick(selectors.ticketSales.moreMenu);
|
2022-04-04 11:26:53 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.moreMenuRefund);
|
2023-05-25 13:03:22 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.refundWithWarehouse);
|
2023-03-01 07:15:58 +00:00
|
|
|
await page.waitForSnackbar();
|
2021-12-21 13:43:53 +00:00
|
|
|
await page.waitForState('ticket.card.sale');
|
|
|
|
});
|
|
|
|
|
2023-05-26 10:20:02 +00:00
|
|
|
it('should select the first sale and create a refund without warehouse', async() => {
|
|
|
|
await page.accessToSearchResult('18');
|
|
|
|
await page.waitToClick(selectors.ticketSales.firstSaleCheckbox);
|
|
|
|
await page.waitToClick(selectors.ticketSales.moreMenu);
|
|
|
|
await page.waitToClick(selectors.ticketSales.moreMenuRefund);
|
|
|
|
await page.waitToClick(selectors.ticketSales.refundWithoutWarehouse);
|
|
|
|
await page.waitForSnackbar();
|
|
|
|
await page.waitForState('ticket.card.sale');
|
|
|
|
});
|
2023-05-25 13:03:22 +00:00
|
|
|
|
2023-03-01 07:15:58 +00:00
|
|
|
it('should show error trying to delete a ticket with a refund', async() => {
|
|
|
|
await page.accessToSearchResult('16');
|
|
|
|
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
|
|
|
await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteTicket);
|
|
|
|
await page.waitToClick(selectors.globalItems.acceptButton);
|
|
|
|
const message = await page.waitForSnackbar();
|
|
|
|
|
|
|
|
expect(message.text).toContain('Tickets with associated refunds can\'t be deleted');
|
|
|
|
await page.waitToClick(selectors.globalItems.cancelButton);
|
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should select the third sale and create a claim of it', async() => {
|
2021-12-21 13:43:53 +00:00
|
|
|
await page.accessToSearchResult('16');
|
|
|
|
await page.accessToSection('ticket.card.sale');
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.thirdSaleCheckbox);
|
|
|
|
await page.waitToClick(selectors.ticketSales.moreMenu);
|
|
|
|
await page.waitToClick(selectors.ticketSales.moreMenuCreateClaim);
|
2023-04-17 10:44:58 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.acceptButton);
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.waitForState('claim.card.basicData');
|
2018-09-12 13:38:08 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should click on the Claims button of the top bar menu', async() => {
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
2020-11-23 17:28:39 +00:00
|
|
|
await page.waitForSelector(selectors.globalItems.applicationsMenuVisible);
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.claimsButton);
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.waitForState('claim.index');
|
2018-10-25 14:44:03 +00:00
|
|
|
});
|
2018-09-12 13:38:08 +00:00
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should search for the claim with id 4', async() => {
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.accessToSearchResult('4');
|
|
|
|
await page.waitForState('claim.card.summary');
|
2018-09-12 13:38:08 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should click the Tickets button of the top bar menu', async() => {
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
2020-11-23 17:28:39 +00:00
|
|
|
await page.waitForSelector(selectors.globalItems.applicationsMenuVisible);
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.ticketsButton);
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.waitForState('ticket.index');
|
2018-10-25 14:44:03 +00:00
|
|
|
});
|
|
|
|
|
2019-06-27 06:41:07 +00:00
|
|
|
it('should search for a ticket then access to the sales section', async() => {
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.accessToSearchResult('16');
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.accessToSection('ticket.card.sale');
|
2018-10-22 15:12:41 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should select the third sale and delete it', async() => {
|
2020-04-08 09:24:40 +00:00
|
|
|
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
|
|
|
await page.waitForSpinnerLoad();
|
|
|
|
const message = await page.waitForSnackbar();
|
2018-11-07 07:38:09 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2018-10-25 14:44:03 +00:00
|
|
|
});
|
2018-10-22 15:12:41 +00:00
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should confirm the third sale was deleted`, async() => {
|
2020-04-08 09:24:40 +00:00
|
|
|
const result = await page.countElement(selectors.ticketSales.saleLine);
|
2018-11-07 07:38:09 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(3);
|
2018-09-10 11:38:14 +00:00
|
|
|
});
|
|
|
|
|
2019-08-13 09:48:00 +00:00
|
|
|
it('should select the second sale and transfer it to a valid ticket', async() => {
|
2020-07-02 07:35:52 +00:00
|
|
|
const targetTicketId = '12';
|
2019-06-27 06:41:07 +00:00
|
|
|
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.secondSaleCheckbox);
|
|
|
|
await page.waitToClick(selectors.ticketSales.transferSaleButton);
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.transferQuantityCell);
|
|
|
|
await page.type(selectors.ticketSales.transferQuantityInput, '10\u000d');
|
|
|
|
await page.type(selectors.ticketSales.moveToTicketInput, targetTicketId);
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.moveToTicketButton);
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.expectURL(`ticket/${targetTicketId}/sale`);
|
2018-10-25 14:44:03 +00:00
|
|
|
});
|
2018-09-10 11:38:14 +00:00
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should confirm the transfered line is the correct one', async() => {
|
2020-11-23 17:28:39 +00:00
|
|
|
await page.waitForSelector(selectors.ticketSales.secondSaleText);
|
2020-04-08 09:24:40 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.ticketSales.secondSaleText, 'innerText');
|
2018-11-07 07:38:09 +00:00
|
|
|
|
2019-08-13 09:48:00 +00:00
|
|
|
expect(result).toContain(`Melee weapon heavy shield`);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should confirm the transfered quantity is the correct one', async() => {
|
2023-09-25 08:49:47 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.ticketSales.firstSaleQuantityCell, 'innerText');
|
2019-08-13 09:48:00 +00:00
|
|
|
|
2023-05-16 11:31:22 +00:00
|
|
|
expect(result).toContain('20');
|
2018-10-25 14:44:03 +00:00
|
|
|
});
|
2018-09-10 11:38:14 +00:00
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should go back to the original ticket sales section', async() => {
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton);
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.accessToSearchResult('16');
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.accessToSection('ticket.card.sale');
|
2018-10-25 14:44:03 +00:00
|
|
|
});
|
|
|
|
|
2019-08-13 09:48:00 +00:00
|
|
|
it(`should confirm the original ticket has still three lines`, async() => {
|
2020-11-23 17:28:39 +00:00
|
|
|
await page.waitForSelector(selectors.ticketSales.saleLine);
|
2020-04-08 09:24:40 +00:00
|
|
|
const result = await page.countElement(selectors.ticketSales.saleLine);
|
2018-11-07 07:38:09 +00:00
|
|
|
|
2019-08-13 09:48:00 +00:00
|
|
|
expect(result).toEqual(3);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should confirm the second sale quantity is now half of it's original value after the transfer`, async() => {
|
2020-04-08 09:24:40 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.ticketSales.secondSaleQuantityCell, 'innerText');
|
2019-08-13 09:48:00 +00:00
|
|
|
|
|
|
|
expect(result).toContain('10');
|
2018-10-25 14:44:03 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should go back to the receiver ticket sales section', async() => {
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton);
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.accessToSearchResult('12');
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.accessToSection('ticket.card.sale');
|
2018-10-25 14:44:03 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should transfer the sale back to the original ticket', async() => {
|
2020-07-02 07:35:52 +00:00
|
|
|
const targetTicketId = '16';
|
2019-06-27 06:41:07 +00:00
|
|
|
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.secondSaleCheckbox);
|
|
|
|
await page.waitToClick(selectors.ticketSales.transferSaleButton);
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.type(selectors.ticketSales.moveToTicketInput, targetTicketId);
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.moveToTicketButton);
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.expectURL(`ticket/${targetTicketId}/sale`);
|
2018-10-25 14:44:03 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should confirm the original ticket received the line', async() => {
|
2019-08-13 09:48:00 +00:00
|
|
|
const expectedLines = 4;
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.waitForNumberOfElements(selectors.ticketSales.saleLine, expectedLines);
|
|
|
|
const result = await page.countElement(selectors.ticketSales.saleLine);
|
2018-11-07 07:38:09 +00:00
|
|
|
|
2019-08-13 09:48:00 +00:00
|
|
|
expect(result).toEqual(expectedLines);
|
2018-10-25 14:44:03 +00:00
|
|
|
});
|
|
|
|
|
2019-06-27 06:41:07 +00:00
|
|
|
it(`should throw an error when attempting to create a ticket for an inactive client`, async() => {
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.firstSaleCheckbox);
|
|
|
|
await page.waitToClick(selectors.ticketSales.transferSaleButton);
|
|
|
|
await page.waitToClick(selectors.ticketSales.moveToNewTicketButton);
|
|
|
|
const message = await page.waitForSnackbar();
|
2019-06-27 06:41:07 +00:00
|
|
|
|
2023-09-25 08:49:47 +00:00
|
|
|
expect(message.text).toContain(`You can't create a ticket for an inactive client`);
|
2020-07-02 07:35:52 +00:00
|
|
|
|
|
|
|
await page.closePopup();
|
2019-06-27 06:41:07 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should go now to the ticket sales section of an active, not frozen client', async() => {
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton);
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.accessToSearchResult('13');
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.accessToSection('ticket.card.sale');
|
2018-11-29 13:24:57 +00:00
|
|
|
});
|
|
|
|
|
2019-06-27 06:41:07 +00:00
|
|
|
it(`should select all sales, tranfer them to a new ticket and delete the sender ticket as it would've been left empty`, async() => {
|
2020-07-02 07:35:52 +00:00
|
|
|
const senderTicketId = '13';
|
2019-06-27 06:41:07 +00:00
|
|
|
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.selectAllSalesCheckbox);
|
|
|
|
await page.waitToClick(selectors.ticketSales.transferSaleButton);
|
|
|
|
await page.waitToClick(selectors.ticketSales.moveToNewTicketButton);
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.evaluate((selector, ticketId) => {
|
|
|
|
return document.querySelector(selector).innerText.toLowerCase().indexOf(`#${ticketId}`) == -1;
|
|
|
|
}, selectors.ticketDescriptor.id, senderTicketId);
|
|
|
|
await page.waitForState('ticket.card.sale');
|
2018-09-10 11:38:14 +00:00
|
|
|
});
|
|
|
|
|
2019-06-27 06:41:07 +00:00
|
|
|
it('should confirm the new ticket received the line', async() => {
|
2021-10-15 12:42:27 +00:00
|
|
|
const expectedLines = 1;
|
2020-04-08 09:24:40 +00:00
|
|
|
const result = await page.countElement(selectors.ticketSales.saleLine);
|
2018-11-07 07:38:09 +00:00
|
|
|
|
2021-10-15 12:42:27 +00:00
|
|
|
expect(result).toEqual(expectedLines);
|
2018-10-25 14:44:03 +00:00
|
|
|
});
|
2018-09-10 11:38:14 +00:00
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should check the first sale reserved icon isnt visible', async() => {
|
2020-04-08 09:24:40 +00:00
|
|
|
const result = await page.isVisible(selectors.ticketSales.firstSaleReservedIcon);
|
2018-11-07 07:38:09 +00:00
|
|
|
|
|
|
|
expect(result).toBeFalsy();
|
2018-10-25 14:44:03 +00:00
|
|
|
});
|
2018-09-10 11:38:14 +00:00
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should mark the first sale as reserved', async() => {
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.firstSaleCheckbox);
|
2021-10-19 11:11:31 +00:00
|
|
|
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.moreMenu);
|
|
|
|
await page.waitToClick(selectors.ticketSales.moreMenuReserve);
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.closePopup();
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.waitForClassNotPresent(selectors.ticketSales.firstSaleReservedIcon, 'ng-hide');
|
|
|
|
const result = await page.isVisible(selectors.ticketSales.firstSaleReservedIcon);
|
2018-11-07 07:38:09 +00:00
|
|
|
|
|
|
|
expect(result).toBeTruthy();
|
2018-10-25 14:44:03 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should unmark the first sale as reserved', async() => {
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.waitToClick(selectors.ticketSales.moreMenu);
|
|
|
|
await page.waitToClick(selectors.ticketSales.moreMenuUnmarkReseved);
|
|
|
|
await page.waitForClassPresent(selectors.ticketSales.firstSaleReservedIcon, 'ng-hide');
|
|
|
|
const result = await page.isVisible(selectors.ticketSales.firstSaleReservedIcon);
|
2018-11-07 07:38:09 +00:00
|
|
|
|
|
|
|
expect(result).toBeFalsy();
|
|
|
|
});
|
|
|
|
|
2019-06-27 06:41:07 +00:00
|
|
|
it('should log in as Production role and go to a target ticket summary', async() => {
|
2020-04-08 09:24:40 +00:00
|
|
|
await page.loginAndModule('production', 'ticket');
|
2020-07-02 07:35:52 +00:00
|
|
|
await page.accessToSearchResult('13');
|
|
|
|
await page.waitForState('ticket.card.summary');
|
2018-10-25 14:44:03 +00:00
|
|
|
});
|
|
|
|
|
2020-07-02 07:35:52 +00:00
|
|
|
it(`should check the ticket is deleted`, async() => {
|
|
|
|
await page.waitForSelector(selectors.ticketDescriptor.isDeletedIcon);
|
2018-11-08 14:20:42 +00:00
|
|
|
});
|
|
|
|
});
|