salix/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js

99 lines
3.7 KiB
JavaScript
Raw Normal View History

2018-09-03 11:54:35 +00:00
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
2018-09-03 11:54:35 +00:00
2019-06-07 12:20:46 +00:00
describe('Ticket Edit basic data path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.loginAndModule('employee', 'ticket')
2019-05-30 12:42:54 +00:00
.accessToSearchResult(11)
.accessToSection('ticket.card.basicData.stepOne');
});
2019-08-20 12:18:32 +00:00
it(`should confirm the zone autocomplete is disabled unless your role is productionBoss`, async() => {
const disabled = await nightmare
.wait(selectors.ticketBasicData.zoneAutocomplete)
.evaluate(selector => {
return document.querySelector(selector).disabled;
}, `${selectors.ticketBasicData.zoneAutocomplete} input`);
expect(disabled).toBeTruthy();
});
it(`should now log as productionBoss to perform the rest of the tests`, async() => {
await nightmare
.loginAndModule('productionBoss', 'ticket')
.accessToSearchResult(11)
.accessToSection('ticket.card.basicData.stepOne');
});
it(`should confirm the zone autocomplete is enabled for the role productionBoss`, async() => {
const disabled = await nightmare
.wait(selectors.ticketBasicData.zoneAutocomplete)
.evaluate(selector => {
return document.querySelector(selector).disabled;
}, `${selectors.ticketBasicData.zoneAutocomplete} input`);
expect(disabled).toBeFalsy();
});
it(`should check the zone is for Silla247`, async() => {
let zone = await nightmare
.waitToGetProperty(`${selectors.ticketBasicData.zoneAutocomplete} input`, 'value');
expect(zone).toContain('Zone 247 A');
});
it(`should edit the ticket agency then check there are no zones for it`, async() => {
let zone = await nightmare
.autocompleteSearch(selectors.ticketBasicData.agencyAutocomplete, 'Entanglement')
.getProperty(`${selectors.ticketBasicData.zoneAutocomplete} input`, 'value');
expect(zone.length).toEqual(0);
});
it(`should edit the ticket zone then check the agency is for the new zone`, async() => {
let zone = await nightmare
.autocompleteSearch(selectors.ticketBasicData.zoneAutocomplete, 'Zone expensive A')
.waitToGetProperty(`${selectors.ticketBasicData.agencyAutocomplete} input`, 'value');
expect(zone).toContain('Silla247Expensive');
});
it(`should click next`, async() => {
let url = await nightmare
2019-01-23 15:00:56 +00:00
.waitToClick(selectors.ticketBasicData.nextStepButton)
.waitForURL('data/step-two')
.parsedUrl();
expect(url.hash).toContain('data/step-two');
});
2019-01-07 09:55:23 +00:00
it(`should have a price diference`, async() => {
const result = await nightmare
.waitToGetProperty(selectors.ticketBasicData.stepTwoTotalPriceDif, 'innerText');
expect(result).toContain('-€184.25');
});
2019-01-07 09:55:23 +00:00
it(`should then click next to move on to step three`, async() => {
let url = await nightmare
2019-01-23 15:00:56 +00:00
.waitToClick(selectors.ticketBasicData.nextStepButton)
.waitForURL('data/step-three')
.parsedUrl();
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() => {
let url = await nightmare
2019-01-07 09:55:23 +00:00
.autocompleteSearch(selectors.ticketBasicData.chargesReasonAutocomplete, 'Cambiar los precios en el ticket')
2019-01-23 15:00:56 +00:00
.waitToClick(selectors.ticketBasicData.finalizeButton)
.waitForURL('summary')
.parsedUrl();
expect(url.hash).toContain('summary');
2018-09-03 11:54:35 +00:00
});
});