60 lines
2.3 KiB
JavaScript
60 lines
2.3 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 and observation fields`, async() => {
|
|
const result = await nightmare
|
|
.autocompleteSearch(selectors.claimBasicData.claimStateAutocomplete, 'Gestionado')
|
|
.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 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')
|
|
.clearTextarea(selectors.claimBasicData.observationInput)
|
|
.write(selectors.claimBasicData.observationInput, 'Observation one')
|
|
.waitToClick(selectors.claimBasicData.saveButton)
|
|
.waitForSnackbar();
|
|
|
|
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
|
|
});
|
|
});
|