2018-09-03 11:54:35 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2020-01-23 15:01:29 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2018-09-03 11:54:35 +00:00
|
|
|
|
2019-06-07 12:20:46 +00:00
|
|
|
describe('Ticket Edit basic data path', () => {
|
2020-01-23 15:01:29 +00:00
|
|
|
let browser;
|
|
|
|
let page;
|
|
|
|
|
|
|
|
beforeAll(async() => {
|
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
2022-01-18 11:49:16 +00:00
|
|
|
await page.loginAndModule('employee', 'ticket');
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.accessToSearchResult('11');
|
|
|
|
await page.accessToSection('ticket.card.basicData.stepOne');
|
|
|
|
});
|
2018-11-22 14:44:33 +00:00
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
afterAll(async() => {
|
|
|
|
await browser.close();
|
2018-11-22 14:44:33 +00:00
|
|
|
});
|
|
|
|
|
2019-08-20 12:18:32 +00:00
|
|
|
it(`should confirm the zone autocomplete is disabled unless your role is productionBoss`, async() => {
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.waitForSelector(selectors.ticketBasicData.zone, {});
|
2020-01-23 15:01:29 +00:00
|
|
|
const disabled = await page.evaluate(selector => {
|
|
|
|
return document.querySelector(selector).disabled;
|
2020-02-03 14:55:11 +00:00
|
|
|
}, `${selectors.ticketBasicData.zone} input`);
|
2019-08-20 12:18:32 +00:00
|
|
|
|
|
|
|
expect(disabled).toBeTruthy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should now log as productionBoss to perform the rest of the tests`, async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.loginAndModule('productionBoss', 'ticket');
|
|
|
|
await page.accessToSearchResult('11');
|
|
|
|
await page.accessToSection('ticket.card.basicData.stepOne');
|
2019-08-20 12:18:32 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should confirm the zone autocomplete is enabled for the role productionBoss`, async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitForSpinnerLoad();
|
2020-11-23 17:28:39 +00:00
|
|
|
await page.waitForSelector(selectors.ticketBasicData.zone);
|
2020-01-23 15:01:29 +00:00
|
|
|
const disabled = await page.evaluate(selector => {
|
|
|
|
return document.querySelector(selector).disabled;
|
2020-02-03 14:55:11 +00:00
|
|
|
}, `${selectors.ticketBasicData.zone} input`);
|
2019-08-20 12:18:32 +00:00
|
|
|
|
|
|
|
expect(disabled).toBeFalsy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should check the zone is for Silla247`, async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
let zone = await page
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.ticketBasicData.zone, 'value');
|
2019-08-20 12:18:32 +00:00
|
|
|
|
|
|
|
expect(zone).toContain('Zone 247 A');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should edit the ticket agency then check there are no zones for it`, async() => {
|
2020-09-24 12:01:56 +00:00
|
|
|
await page.autocompleteSearch(selectors.ticketBasicData.agency, 'Super-Man delivery');
|
2020-02-03 14:55:11 +00:00
|
|
|
let emptyZone = await page
|
|
|
|
.expectPropertyValue(selectors.ticketBasicData.zone, 'value', '');
|
2019-08-20 12:18:32 +00:00
|
|
|
|
2020-02-03 14:55:11 +00:00
|
|
|
expect(emptyZone).toBeTruthy();
|
2019-08-20 12:18:32 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should edit the ticket zone then check the agency is for the new zone`, async() => {
|
2020-09-23 09:21:25 +00:00
|
|
|
await page.clearInput(selectors.ticketBasicData.agency);
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.autocompleteSearch(selectors.ticketBasicData.zone, 'Zone expensive A');
|
2020-01-23 15:01:29 +00:00
|
|
|
let zone = await page
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.ticketBasicData.agency, 'value');
|
2019-08-20 12:18:32 +00:00
|
|
|
|
|
|
|
expect(zone).toContain('Silla247Expensive');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should click next`, async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.ticketBasicData.nextStepButton);
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('ticket.card.basicData.stepTwo');
|
2018-11-22 14:44:33 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 09:55:23 +00:00
|
|
|
it(`should have a price diference`, async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
const result = await page
|
2018-11-22 14:44:33 +00:00
|
|
|
.waitToGetProperty(selectors.ticketBasicData.stepTwoTotalPriceDif, 'innerText');
|
|
|
|
|
2021-05-25 11:33:17 +00:00
|
|
|
expect(result).toContain('-€232.75');
|
2018-11-22 14:44:33 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 09:55:23 +00:00
|
|
|
it(`should select a new reason for the changes made then click on finalize`, async() => {
|
2020-02-07 12:38:32 +00:00
|
|
|
await page.waitToClick(selectors.ticketBasicData.chargesReason);
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.ticketBasicData.finalizeButton);
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('ticket.card.summary');
|
2018-09-03 11:54:35 +00:00
|
|
|
});
|
2021-12-21 19:58:58 +00:00
|
|
|
|
|
|
|
it(`should not find ticket`, async() => {
|
2022-01-18 11:49:16 +00:00
|
|
|
await page.doSearch('29');
|
2021-12-21 19:58:58 +00:00
|
|
|
const count = await page.countElement(selectors.ticketsIndex.searchResult);
|
|
|
|
|
|
|
|
expect(count).toEqual(0);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should split ticket without negatives`, async() => {
|
2022-01-28 08:15:41 +00:00
|
|
|
const newAgency = 'Silla247';
|
|
|
|
const newDate = new Date();
|
|
|
|
newDate.setDate(newDate.getDate() + 1);
|
2021-12-21 19:58:58 +00:00
|
|
|
|
2021-12-22 07:37:50 +00:00
|
|
|
await page.accessToSearchResult('14');
|
2021-12-21 19:58:58 +00:00
|
|
|
await page.accessToSection('ticket.card.basicData.stepOne');
|
|
|
|
|
2022-01-28 08:15:41 +00:00
|
|
|
await page.autocompleteSearch(selectors.ticketBasicData.agency, newAgency);
|
|
|
|
await page.pickDate(selectors.ticketBasicData.shipped, newDate);
|
2021-12-22 07:11:33 +00:00
|
|
|
|
2021-12-21 19:58:58 +00:00
|
|
|
await page.waitToClick(selectors.ticketBasicData.nextStepButton);
|
|
|
|
|
|
|
|
await page.waitToClick(selectors.ticketBasicData.withoutNegatives);
|
|
|
|
await page.waitToClick(selectors.ticketBasicData.finalizeButton);
|
|
|
|
|
2022-01-28 08:15:41 +00:00
|
|
|
await page.waitForState('ticket.card.summary');
|
|
|
|
|
|
|
|
const newTicketAgency = await page
|
2021-12-21 19:58:58 +00:00
|
|
|
.waitToGetProperty(selectors.ticketDescriptor.descriptorDeliveryAgency, 'innerText');
|
2022-01-28 08:15:41 +00:00
|
|
|
const newTicketDate = await page
|
|
|
|
.waitToGetProperty(selectors.ticketDescriptor.descriptorDeliveryDate, 'innerText');
|
2021-12-21 19:58:58 +00:00
|
|
|
|
2022-01-28 08:15:41 +00:00
|
|
|
expect(newAgency).toEqual(newTicketAgency);
|
|
|
|
expect(newTicketDate).toContain(newDate.getDate());
|
2021-12-21 19:58:58 +00:00
|
|
|
});
|
|
|
|
|
2022-01-28 08:15:41 +00:00
|
|
|
it(`should new ticket have sale of old ticket`, async() => {
|
2021-12-21 19:58:58 +00:00
|
|
|
await page.accessToSection('ticket.card.sale');
|
2022-01-28 08:15:41 +00:00
|
|
|
await page.waitForState('ticket.card.sale');
|
2021-12-21 19:58:58 +00:00
|
|
|
|
|
|
|
const item = await page.waitToGetProperty(selectors.ticketSales.firstSaleId, 'innerText');
|
2022-01-28 08:15:41 +00:00
|
|
|
|
|
|
|
expect(item).toEqual('4');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should old ticket have old date and agency`, async() => {
|
|
|
|
const oldDate = new Date();
|
|
|
|
const oldAgency = 'Super-Man delivery';
|
|
|
|
|
|
|
|
await page.accessToSearchResult('14');
|
|
|
|
|
|
|
|
const oldTicketAgency = await page
|
2021-12-21 19:58:58 +00:00
|
|
|
.waitToGetProperty(selectors.ticketDescriptor.descriptorDeliveryAgency, 'innerText');
|
2022-01-28 08:15:41 +00:00
|
|
|
const oldTicketDate = await page
|
2021-12-21 19:58:58 +00:00
|
|
|
.waitToGetProperty(selectors.ticketDescriptor.descriptorDeliveryDate, 'innerText');
|
|
|
|
|
2022-01-28 08:15:41 +00:00
|
|
|
expect(oldTicketAgency).toEqual(oldAgency);
|
|
|
|
expect(oldTicketDate).toContain(oldDate.getDate());
|
2021-12-21 19:58:58 +00:00
|
|
|
});
|
2018-09-03 11:54:35 +00:00
|
|
|
});
|