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

64 lines
2.4 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.claimState, 'Gestionado');
await page.clearTextarea(selectors.claimBasicData.observation);
await page.write(selectors.claimBasicData.observation, '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() => {
let url = await page.expectURL('/detail');
expect(url).toBe(true);
});
it('should confirm the claim state was edited', async() => {
await page.reloadSection('claim.card.basicData');
await page.wait(selectors.claimBasicData.claimState);
const result = await page.waitToGetProperty(selectors.claimBasicData.claimState, 'value');
expect(result).toEqual('Gestionado');
});
it('should confirm the claim observation was edited', async() => {
const result = await page
.waitToGetProperty(selectors.claimBasicData.observation, 'value');
expect(result).toEqual('edited observation');
});
it(`should edit the claim to leave it untainted`, async() => {
await page.autocompleteSearch(selectors.claimBasicData.claimState, 'Pendiente');
await page.clearTextarea(selectors.claimBasicData.observation);
await page.write(selectors.claimBasicData.observation, 'Observation one');
await page.waitToClick(selectors.claimBasicData.saveButton);
const result = await page.waitForLastSnackbar();
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
});
});