65 lines
2.6 KiB
JavaScript
65 lines
2.6 KiB
JavaScript
import selectors from '../../helpers/selectors.js';
|
|
import createNightmare from '../../helpers/nightmare';
|
|
|
|
describe('Claim edit basic data path', () => {
|
|
const nightmare = createNightmare();
|
|
|
|
beforeAll(() => {
|
|
nightmare
|
|
.loginAndModule('salesAssistant', 'claim')
|
|
.accessToSearchResult('1')
|
|
.accessToSection('claim.card.basicData');
|
|
});
|
|
|
|
it(`should edit claim state, is paid with mana and observation fields`, async() => {
|
|
const result = await nightmare
|
|
.autocompleteSearch(selectors.claimBasicData.claimStateAutocomplete, 'Gestionado')
|
|
.waitToClick(selectors.claimBasicData.isPaidWithManaCheckbox)
|
|
.clearInput(selectors.claimBasicData.observationInput)
|
|
.type(selectors.claimBasicData.observationInput, 'edited observation')
|
|
.click(selectors.claimBasicData.saveButton)
|
|
.waitForSnackbar();
|
|
|
|
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
|
|
});
|
|
|
|
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.claimStateAutocomplete)
|
|
.waitToGetProperty(`${selectors.claimBasicData.claimStateAutocomplete} input`, 'value');
|
|
|
|
expect(result).toEqual('Gestionado');
|
|
});
|
|
|
|
it('should confirm the Is paid with mana checkbox is checked', async() => {
|
|
const value = await nightmare
|
|
.evaluate(selector => {
|
|
return document.querySelector(selector).checked;
|
|
}, selectors.claimBasicData.isPaidWithManaCheckbox);
|
|
|
|
expect(value).toBeTruthy();
|
|
});
|
|
|
|
it('should confirm the claim observation was edited', async() => {
|
|
const result = await nightmare
|
|
.waitToGetProperty(selectors.claimBasicData.observationInput, 'value');
|
|
|
|
expect(result).toEqual('edited observation');
|
|
});
|
|
|
|
it(`should edit the claim to leave it untainted`, async() => {
|
|
const result = await nightmare
|
|
.autocompleteSearch(selectors.claimBasicData.claimStateAutocomplete, 'Pendiente')
|
|
.waitToClick(selectors.claimBasicData.isPaidWithManaCheckbox)
|
|
.clearInput(selectors.claimBasicData.observationInput)
|
|
.type(selectors.claimBasicData.observationInput, 'Observation one')
|
|
.click(selectors.claimBasicData.saveButton)
|
|
.waitForSnackbar();
|
|
|
|
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
|
|
});
|
|
});
|