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;
|
|
|
|
await page.loginAndModule('employee', 'ticket');
|
|
|
|
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-01-23 15:01:29 +00:00
|
|
|
await page.waitForSelector(selectors.ticketBasicData.zoneAutocomplete, {});
|
|
|
|
const disabled = await page.evaluate(selector => {
|
|
|
|
return document.querySelector(selector).disabled;
|
|
|
|
}, `${selectors.ticketBasicData.zoneAutocomplete} 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();
|
|
|
|
await page.wait(selectors.ticketBasicData.zoneAutocomplete);
|
|
|
|
const disabled = await page.evaluate(selector => {
|
|
|
|
return document.querySelector(selector).disabled;
|
|
|
|
}, `${selectors.ticketBasicData.zoneAutocomplete} 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-01-29 13:54:07 +00:00
|
|
|
.waitToGetProperty(selectors.ticketBasicData.zoneAutocomplete, '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-01-23 15:01:29 +00:00
|
|
|
await page.autocompleteSearch(selectors.ticketBasicData.agencyAutocomplete, 'Entanglement');
|
|
|
|
let zone = await page
|
2020-01-29 13:54:07 +00:00
|
|
|
.waitToGetProperty(selectors.ticketBasicData.zoneAutocomplete, 'value');
|
2019-08-20 12:18:32 +00:00
|
|
|
|
|
|
|
expect(zone.length).toEqual(0);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should edit the ticket zone then check the agency is for the new zone`, async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.autocompleteSearch(selectors.ticketBasicData.zoneAutocomplete, 'Zone expensive A');
|
|
|
|
let zone = await page
|
2020-01-29 13:54:07 +00:00
|
|
|
.waitToGetProperty(selectors.ticketBasicData.agencyAutocomplete, '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);
|
|
|
|
await page.waitForURL('data/step-two');
|
|
|
|
let url = await page.parsedUrl();
|
2018-11-22 14:44:33 +00:00
|
|
|
|
|
|
|
expect(url.hash).toContain('data/step-two');
|
|
|
|
});
|
|
|
|
|
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');
|
|
|
|
|
2019-09-17 12:17:15 +00:00
|
|
|
expect(result).toContain('-€248.00');
|
2018-11-22 14:44:33 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 09:55:23 +00:00
|
|
|
it(`should then click next to move on to step three`, async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.ticketBasicData.nextStepButton);
|
|
|
|
await page.waitForURL('data/step-three');
|
|
|
|
let url = await page.parsedUrl();
|
2018-11-22 14:44:33 +00:00
|
|
|
|
|
|
|
expect(url.hash).toContain('data/step-three');
|
|
|
|
});
|
|
|
|
|
2019-01-07 09:55:23 +00:00
|
|
|
it(`should select a new reason for the changes made then click on finalize`, async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.autocompleteSearch(selectors.ticketBasicData.chargesReasonAutocomplete, 'Cambiar los precios en el ticket');
|
|
|
|
await page.waitToClick(selectors.ticketBasicData.finalizeButton);
|
|
|
|
await page.waitForURL('summary');
|
|
|
|
let url = await page.parsedUrl();
|
2018-11-22 14:44:33 +00:00
|
|
|
|
|
|
|
expect(url.hash).toContain('summary');
|
2018-09-03 11:54:35 +00:00
|
|
|
});
|
|
|
|
});
|