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

69 lines
2.7 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)
.clearTextarea(selectors.claimBasicData.observationInput)
.write(selectors.claimBasicData.observationInput, 'edited observation')
.waitToClick(selectors.claimBasicData.saveButton)
.waitForSnackbar();
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
});
it(`should have been redirected to the next section of claims as the role is salesAssistant`, async() => {
const url = await nightmare
.waitForURL('/detail')
.parsedUrl();
expect(url.hash).toContain('/detail');
});
it('should confirm the claim state was edited', async() => {
const result = await nightmare
.reloadSection('claim.card.basicData')
.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 result = await nightmare
.checkboxState(selectors.claimBasicData.isPaidWithManaCheckbox);
expect(result).toBe('checked');
});
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)
.clearTextarea(selectors.claimBasicData.observationInput)
.write(selectors.claimBasicData.observationInput, 'Observation one')
.waitToClick(selectors.claimBasicData.saveButton)
.waitForSnackbar();
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
});
});