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

62 lines
2.4 KiB
JavaScript
Raw Normal View History

2018-09-04 09:24:39 +00:00
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
2018-09-04 09:24:39 +00:00
2018-09-12 13:20:39 +00:00
describe('Claim edit basic data path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('salesAssistant', 'claim');
await page.accessToSearchResult('1');
await page.accessToSection('claim.card.basicData');
});
2018-09-04 09:24:39 +00:00
afterAll(async() => {
await browser.close();
2018-09-12 13:20:39 +00:00
});
2018-09-04 09:24:39 +00:00
it(`should edit claim state and observation fields`, async() => {
await page.autocompleteSearch(selectors.claimBasicData.claimStateAutocomplete, 'Gestionado');
await page.clearTextarea(selectors.claimBasicData.observationInput);
2020-01-26 23:48:00 +00:00
await page.type(selectors.claimBasicData.observationInput, 'edited observation');
await page.waitToClick(selectors.claimBasicData.saveButton);
const result = await page.waitForLastSnackbar();
2018-10-30 07:51:18 +00:00
2018-10-25 07:03:43 +00:00
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
2018-09-12 13:20:39 +00:00
});
2018-09-04 09:24:39 +00:00
2019-04-08 13:38:47 +00:00
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();
2019-04-08 13:38:47 +00:00
expect(url.hash).toContain('/detail');
});
2019-01-07 08:33:07 +00:00
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} input`, 'value');
2018-10-30 07:51:18 +00:00
2018-10-25 07:03:43 +00:00
expect(result).toEqual('Gestionado');
2018-09-12 13:20:39 +00:00
});
2018-09-04 09:24:39 +00:00
2019-01-07 08:33:07 +00:00
it('should confirm the claim observation was edited', async() => {
const result = await page
.waitToGetProperty(selectors.claimBasicData.observationInput, 'value');
2018-10-30 07:51:18 +00:00
2018-10-25 07:03:43 +00:00
expect(result).toEqual('edited observation');
2018-09-12 13:20:39 +00:00
});
2018-09-04 09:24:39 +00:00
2019-01-07 08:33:07 +00:00
it(`should edit the claim to leave it untainted`, async() => {
await page.autocompleteSearch(selectors.claimBasicData.claimStateAutocomplete, 'Pendiente');
await page.clearTextarea(selectors.claimBasicData.observationInput);
2020-01-26 23:48:00 +00:00
await page.type(selectors.claimBasicData.observationInput, 'Observation one');
await page.waitToClick(selectors.claimBasicData.saveButton);
const result = await page.waitForLastSnackbar();
2018-10-25 07:03:43 +00:00
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
2018-09-04 09:24:39 +00:00
});
});