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

65 lines
2.5 KiB
JavaScript

import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Claim edit basic data path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
});
afterAll(async() => {
await browser.close();
});
it(`should log in as salesAssistant then reach basic data of the target claim`, async() => {
await page.loginAndModule('salesAssistant', 'claim');
await page.accessToSearchResult('1');
await page.accessToSection('claim.card.basicData');
});
it(`should edit claim state and observation fields`, async() => {
await page.autocompleteSearch(selectors.claimBasicData.claimStateAutocomplete, 'Gestionado');
await page.clearTextarea(selectors.claimBasicData.observationInput);
await page.write(selectors.claimBasicData.observationInput, 'edited observation');
await page.waitToClick(selectors.claimBasicData.saveButton);
const result = await page.waitForLastSnackbar();
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
});
it(`should have been redirected to the next section of claims as the role is salesAssistant`, async() => {
await page.waitForURL('/detail');
const url = await page.parsedUrl();
expect(url.hash).toContain('/detail');
});
it('should confirm the claim state was edited', async() => {
await page.reloadSection('claim.card.basicData');
await page.wait(selectors.claimBasicData.claimStateAutocomplete);
const result = await page.waitToGetProperty(selectors.claimBasicData.claimStateAutocomplete, 'value');
expect(result).toEqual('Gestionado');
});
it('should confirm the claim observation was edited', async() => {
const result = await page
.waitToGetProperty(selectors.claimBasicData.observationInput, 'value');
expect(result).toEqual('edited observation');
});
it(`should edit the claim to leave it untainted`, async() => {
await page.autocompleteSearch(selectors.claimBasicData.claimStateAutocomplete, 'Pendiente');
await page.clearTextarea(selectors.claimBasicData.observationInput);
await page.write(selectors.claimBasicData.observationInput, 'Observation one');
await page.waitToClick(selectors.claimBasicData.saveButton);
const result = await page.waitForLastSnackbar();
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
});
});