2018-09-04 09:24:39 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2018-10-24 08:57:14 +00:00
|
|
|
import createNightmare from '../../helpers/nightmare';
|
2018-09-04 09:24:39 +00:00
|
|
|
|
2018-09-12 13:20:39 +00:00
|
|
|
describe('Claim edit basic data path', () => {
|
|
|
|
const nightmare = createNightmare();
|
2018-09-04 09:24:39 +00:00
|
|
|
|
2018-09-12 13:20:39 +00:00
|
|
|
beforeAll(() => {
|
2018-10-25 07:03:43 +00:00
|
|
|
nightmare
|
2018-09-12 13:20:39 +00:00
|
|
|
.waitForLogin('salesAssistant');
|
|
|
|
});
|
2018-09-04 09:24:39 +00:00
|
|
|
|
2018-10-25 07:03:43 +00:00
|
|
|
it('should click on the Claims button of the top bar menu', async() => {
|
|
|
|
let url = await nightmare
|
2018-09-12 13:20:39 +00:00
|
|
|
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
|
|
|
.wait(selectors.globalItems.applicationsMenuVisible)
|
|
|
|
.waitToClick(selectors.globalItems.claimsButton)
|
|
|
|
.wait(selectors.claimsIndex.searchClaimInput)
|
2018-10-25 07:03:43 +00:00
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toEqual('#!/claim/index');
|
2018-09-12 13:20:39 +00:00
|
|
|
});
|
2018-09-04 09:24:39 +00:00
|
|
|
|
2018-10-25 07:03:43 +00:00
|
|
|
it('should search for the claim with id 1', async() => {
|
|
|
|
let resultCount = await nightmare
|
2018-09-12 13:20:39 +00:00
|
|
|
.wait(selectors.claimsIndex.searchResult)
|
|
|
|
.type(selectors.claimsIndex.searchClaimInput, '1')
|
|
|
|
.click(selectors.claimsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.claimsIndex.searchResult, 1)
|
2018-10-25 07:03:43 +00:00
|
|
|
.countElement(selectors.claimsIndex.searchResult);
|
|
|
|
|
|
|
|
expect(resultCount).toEqual(1);
|
2018-09-12 13:20:39 +00:00
|
|
|
});
|
2018-09-04 09:24:39 +00:00
|
|
|
|
2018-10-25 07:03:43 +00:00
|
|
|
it(`should click on the search result to access to the claim Basic Data`, async() => {
|
|
|
|
let url = await nightmare
|
2018-09-12 13:20:39 +00:00
|
|
|
.waitToClick(selectors.claimsIndex.searchResult)
|
|
|
|
.waitToClick(selectors.claimBasicData.basicDataButton)
|
|
|
|
.waitForURL('basic-data')
|
2018-10-25 07:03:43 +00:00
|
|
|
.url();
|
|
|
|
|
|
|
|
expect(url).toContain('basic-data');
|
2018-09-12 13:20:39 +00:00
|
|
|
});
|
2018-09-04 09:24:39 +00:00
|
|
|
|
2018-10-25 07:03:43 +00:00
|
|
|
it(`should edit claim state, is paid with mana and observation fields`, async() => {
|
|
|
|
let result = await nightmare
|
2018-09-12 13:20:39 +00:00
|
|
|
.waitToClick(selectors.claimBasicData.claimStateSelect)
|
|
|
|
.waitToClick(selectors.claimBasicData.claimStateSelectThirdOption)
|
|
|
|
.waitToClick(selectors.claimBasicData.isPaidWithManaCheckbox)
|
|
|
|
.clearInput(selectors.claimBasicData.observationInput)
|
|
|
|
.type(selectors.claimBasicData.observationInput, 'edited observation')
|
|
|
|
.click(selectors.claimBasicData.saveButton)
|
2018-10-25 07:03:43 +00:00
|
|
|
.waitForSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
|
2018-09-12 13:20:39 +00:00
|
|
|
});
|
2018-09-04 09:24:39 +00:00
|
|
|
|
2018-10-25 07:03:43 +00:00
|
|
|
it('should confirm the claim state was edited', async() => {
|
|
|
|
let result = await nightmare
|
2018-09-12 13:20:39 +00:00
|
|
|
.click(selectors.claimDetails.detailsButton)
|
|
|
|
.wait(selectors.claimDetails.addItemButton)
|
|
|
|
.click(selectors.claimBasicData.basicDataButton)
|
|
|
|
.wait(selectors.claimBasicData.claimStateSelect)
|
2018-10-25 07:03:43 +00:00
|
|
|
.getInputValue(selectors.claimBasicData.claimStateSelect);
|
|
|
|
|
|
|
|
expect(result).toEqual('Gestionado');
|
2018-09-12 13:20:39 +00:00
|
|
|
});
|
2018-09-04 09:24:39 +00:00
|
|
|
|
2018-10-25 07:03:43 +00:00
|
|
|
it('should confirm the Is paid with mana checkbox is checked', async() => {
|
|
|
|
let value = await nightmare
|
2018-09-12 13:20:39 +00:00
|
|
|
.evaluate(selector => {
|
|
|
|
return document.querySelector(selector).checked;
|
2018-10-25 07:03:43 +00:00
|
|
|
}, selectors.claimBasicData.isPaidWithManaCheckbox);
|
|
|
|
|
|
|
|
expect(value).toBeTruthy();
|
2018-09-12 13:20:39 +00:00
|
|
|
});
|
2018-09-04 09:24:39 +00:00
|
|
|
|
2018-10-25 07:03:43 +00:00
|
|
|
it('should confirm the claim observation was edited', async() => {
|
|
|
|
let result = await nightmare
|
|
|
|
.getInputValue(selectors.claimBasicData.observationInput);
|
|
|
|
|
|
|
|
expect(result).toEqual('edited observation');
|
2018-09-12 13:20:39 +00:00
|
|
|
});
|
2018-09-04 09:24:39 +00:00
|
|
|
|
2018-10-25 07:03:43 +00:00
|
|
|
it(`should edit the claim to leave it untainted`, async() => {
|
|
|
|
let result = await nightmare
|
2018-09-12 13:20:39 +00:00
|
|
|
.waitToClick(selectors.claimBasicData.claimStateSelect)
|
|
|
|
.waitToClick(selectors.claimBasicData.claimStateSelectFourthOption)
|
|
|
|
.waitToClick(selectors.claimBasicData.isPaidWithManaCheckbox)
|
|
|
|
.clearInput(selectors.claimBasicData.observationInput)
|
|
|
|
.type(selectors.claimBasicData.observationInput, 'Observation one')
|
|
|
|
.click(selectors.claimBasicData.saveButton)
|
2018-10-25 07:03:43 +00:00
|
|
|
.waitForSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
|
2018-09-04 09:24:39 +00:00
|
|
|
});
|
|
|
|
});
|