salix/e2e/paths/claim-module/01_edit_basic_data.spec.js

67 lines
2.7 KiB
JavaScript
Raw Normal View History

2018-09-04 09:24:39 +00:00
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
2018-09-04 09:24:39 +00:00
2018-09-12 13:20:39 +00:00
describe('Claim edit basic data path', () => {
const nightmare = createNightmare();
2018-09-04 09:24:39 +00:00
2018-09-12 13:20:39 +00:00
beforeAll(() => {
2018-10-25 07:03:43 +00:00
nightmare
.loginAndModule('salesAssistant', 'claim')
.accessToSearchResult('1')
.accessToSection('claim.card.basicData');
2018-09-12 13:20:39 +00:00
});
2018-09-04 09:24:39 +00:00
2018-10-30 07:51:18 +00:00
it(`should edit claim state, is paid with mana and observation fields`, async () => {
const result = await nightmare
.waitToClick(selectors.claimBasicData.claimStateSelect)
.waitToClick(selectors.claimBasicData.claimStateSelectThirdOption)
.waitToClick(selectors.claimBasicData.isPaidWithManaCheckbox)
.clearInput(selectors.claimBasicData.observationInput)
.type(selectors.claimBasicData.observationInput, 'edited observation')
.click(selectors.claimBasicData.saveButton)
.waitForSnackbar();
2018-10-25 07:03:43 +00:00
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
2018-09-12 13:20:39 +00:00
});
2018-09-04 09:24:39 +00:00
2018-10-30 07:51:18 +00:00
it('should confirm the claim state was edited', async () => {
const result = await nightmare
.click(selectors.claimDetails.detailsButton)
.wait(selectors.claimDetails.addItemButton)
.click(selectors.claimBasicData.basicDataButton)
.wait(selectors.claimBasicData.claimStateSelect)
.waitToGetProperty(selectors.claimBasicData.claimStateSelect, 'value');
2018-10-30 07:51:18 +00:00
2018-10-25 07:03:43 +00:00
expect(result).toEqual('Gestionado');
2018-09-12 13:20:39 +00:00
});
2018-09-04 09:24:39 +00:00
2018-10-30 07:51:18 +00:00
it('should confirm the Is paid with mana checkbox is checked', async () => {
const value = await nightmare
2018-11-15 11:02:12 +00:00
.evaluate(selector => {
2018-10-30 07:51:18 +00:00
return document.querySelector(selector).checked;
}, selectors.claimBasicData.isPaidWithManaCheckbox);
2018-10-25 07:03:43 +00:00
expect(value).toBeTruthy();
2018-09-12 13:20:39 +00:00
});
2018-09-04 09:24:39 +00:00
2018-10-30 07:51:18 +00:00
it('should confirm the claim observation was edited', async () => {
const result = await nightmare
.waitToGetProperty(selectors.claimBasicData.observationInput, 'value');
2018-10-30 07:51:18 +00:00
2018-10-25 07:03:43 +00:00
expect(result).toEqual('edited observation');
2018-09-12 13:20:39 +00:00
});
2018-09-04 09:24:39 +00:00
2018-10-30 07:51:18 +00:00
it(`should edit the claim to leave it untainted`, async () => {
const result = await nightmare
.waitToClick(selectors.claimBasicData.claimStateSelect)
.waitToClick(selectors.claimBasicData.claimStateSelectFourthOption)
.waitToClick(selectors.claimBasicData.isPaidWithManaCheckbox)
.clearInput(selectors.claimBasicData.observationInput)
.type(selectors.claimBasicData.observationInput, 'Observation one')
.click(selectors.claimBasicData.saveButton)
.waitForSnackbar();
2018-10-25 07:03:43 +00:00
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
2018-09-04 09:24:39 +00:00
});
});