2018-09-04 09:24:39 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2020-01-23 15:01:29 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2018-09-04 09:24:39 +00:00
|
|
|
|
2020-06-04 07:49:13 +00:00
|
|
|
describe('Claim edit basic data path', () => {
|
2020-01-23 15:01:29 +00:00
|
|
|
let browser;
|
|
|
|
let page;
|
|
|
|
|
|
|
|
beforeAll(async() => {
|
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
|
|
|
});
|
2018-09-04 09:24:39 +00:00
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
afterAll(async() => {
|
|
|
|
await browser.close();
|
2018-09-12 13:20:39 +00:00
|
|
|
});
|
2018-09-04 09:24:39 +00:00
|
|
|
|
2020-10-26 11:16:57 +00:00
|
|
|
it(`should log in as claimManager then reach basic data of the target claim`, async() => {
|
|
|
|
await page.loginAndModule('claimManager', 'claim');
|
2020-01-29 13:54:07 +00:00
|
|
|
await page.accessToSearchResult('1');
|
|
|
|
await page.accessToSection('claim.card.basicData');
|
|
|
|
});
|
|
|
|
|
2019-06-04 09:00:05 +00:00
|
|
|
it(`should edit claim state and observation fields`, async() => {
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.autocompleteSearch(selectors.claimBasicData.claimState, 'Gestionado');
|
|
|
|
await page.clearTextarea(selectors.claimBasicData.observation);
|
|
|
|
await page.write(selectors.claimBasicData.observation, 'edited observation');
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.claimBasicData.saveButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2018-10-30 07:51:18 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2018-09-12 13:20:39 +00:00
|
|
|
});
|
2018-09-04 09:24:39 +00:00
|
|
|
|
2020-10-26 11:16:57 +00:00
|
|
|
it(`should have been redirected to the next section of claims as the role is claimManager`, async() => {
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('claim.card.detail');
|
2019-04-08 13:38:47 +00:00
|
|
|
});
|
|
|
|
|
2020-06-03 12:46:58 +00:00
|
|
|
it('should check the "Pick up" checkbox', async() => {
|
|
|
|
await page.reloadSection('claim.card.basicData');
|
|
|
|
await page.waitToClick(selectors.claimBasicData.hasToPickUpCheckbox);
|
|
|
|
await page.waitToClick(selectors.claimBasicData.saveButton);
|
|
|
|
const message = await page.waitForSnackbar();
|
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2020-06-03 12:46:58 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should confirm the claim state was edited', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.reloadSection('claim.card.basicData');
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.wait(selectors.claimBasicData.claimState);
|
|
|
|
const result = await page.waitToGetProperty(selectors.claimBasicData.claimState, '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
|
|
|
|
2020-06-03 12:46:58 +00:00
|
|
|
it('should confirm the "is paid with mana" and "Pick up" checkbox are checked', async() => {
|
|
|
|
const hasToPickUpCheckbox = await page.checkboxState(selectors.claimBasicData.hasToPickUpCheckbox);
|
|
|
|
|
|
|
|
expect(hasToPickUpCheckbox).toBe('checked');
|
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should confirm the claim observation was edited', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
const result = await page
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.claimBasicData.observation, '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() => {
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.autocompleteSearch(selectors.claimBasicData.claimState, 'Pendiente');
|
|
|
|
await page.clearTextarea(selectors.claimBasicData.observation);
|
|
|
|
await page.write(selectors.claimBasicData.observation, 'Observation one');
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.claimBasicData.saveButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2018-10-25 07:03:43 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2018-09-04 09:24:39 +00:00
|
|
|
});
|
|
|
|
});
|