2019-01-15 07:33:19 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2020-01-23 15:01:29 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2019-01-15 07:33:19 +00:00
|
|
|
|
2019-01-15 07:40:16 +00:00
|
|
|
describe('Claim development', () => {
|
2020-01-23 15:01:29 +00:00
|
|
|
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.development');
|
|
|
|
});
|
2019-01-15 07:33:19 +00:00
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
afterAll(async() => {
|
|
|
|
await browser.close();
|
2019-01-15 07:33:19 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should delete a development and create a new one', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.claimDevelopment.firstDeleteDevelopmentButton);
|
|
|
|
await page.waitToClick(selectors.claimDevelopment.addDevelopmentButton);
|
|
|
|
await page.autocompleteSearch(selectors.claimDevelopment.secondClaimReasonAutocomplete, 'Baja calidad');
|
|
|
|
await page.autocompleteSearch(selectors.claimDevelopment.secondClaimResultAutocomplete, 'Deshidratacion');
|
|
|
|
await page.autocompleteSearch(selectors.claimDevelopment.secondClaimResponsibleAutocomplete, 'Calidad general');
|
|
|
|
await page.autocompleteSearch(selectors.claimDevelopment.secondClaimWorkerAutocomplete, 'deliveryNick');
|
|
|
|
await page.autocompleteSearch(selectors.claimDevelopment.secondClaimRedeliveryAutocomplete, 'Reparto');
|
|
|
|
await page.waitToClick(selectors.claimDevelopment.saveDevelopmentButton);
|
|
|
|
const result = await page.waitForLastSnackbar();
|
2019-01-15 07:33:19 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
2019-04-08 14:12:07 +00:00
|
|
|
}, 15000);
|
|
|
|
|
|
|
|
it(`should redirect to the next section of claims as the role is salesAssistant`, async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitForURL('/action');
|
|
|
|
const url = await page.parsedUrl();
|
2019-04-08 14:12:07 +00:00
|
|
|
|
|
|
|
expect(url.hash).toContain('/action');
|
2019-01-15 07:33:19 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should edit a development', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.reloadSection('claim.card.development');
|
|
|
|
await page.autocompleteSearch(selectors.claimDevelopment.firstClaimReasonAutocomplete, 'Calor');
|
|
|
|
await page.autocompleteSearch(selectors.claimDevelopment.firstClaimResultAutocomplete, 'Cocido');
|
|
|
|
await page.autocompleteSearch(selectors.claimDevelopment.firstClaimResponsibleAutocomplete, 'Calidad general');
|
|
|
|
await page.autocompleteSearch(selectors.claimDevelopment.firstClaimWorkerAutocomplete, 'adminAssistantNick');
|
|
|
|
await page.autocompleteSearch(selectors.claimDevelopment.firstClaimRedeliveryAutocomplete, 'Cliente');
|
|
|
|
await page.waitToClick(selectors.claimDevelopment.saveDevelopmentButton);
|
|
|
|
const result = await page.waitForLastSnackbar();
|
2019-01-15 07:33:19 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should confirm the first development is the expected one', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.reloadSection('claim.card.development');
|
|
|
|
const reason = await page
|
2019-01-15 07:33:19 +00:00
|
|
|
.waitToGetProperty(`${selectors.claimDevelopment.firstClaimReasonAutocomplete} input`, 'value');
|
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
const result = await page
|
2019-01-15 07:33:19 +00:00
|
|
|
.waitToGetProperty(`${selectors.claimDevelopment.firstClaimResultAutocomplete} input`, 'value');
|
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
const responsible = await page
|
2019-01-15 07:33:19 +00:00
|
|
|
.waitToGetProperty(`${selectors.claimDevelopment.firstClaimResponsibleAutocomplete} input`, 'value');
|
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
const worker = await page
|
2019-01-15 07:33:19 +00:00
|
|
|
.waitToGetProperty(`${selectors.claimDevelopment.firstClaimWorkerAutocomplete} input`, 'value');
|
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
const redelivery = await page
|
2019-01-15 07:33:19 +00:00
|
|
|
.waitToGetProperty(`${selectors.claimDevelopment.firstClaimRedeliveryAutocomplete} input`, 'value');
|
|
|
|
|
|
|
|
expect(reason).toEqual('Calor');
|
|
|
|
expect(result).toEqual('Cocido');
|
|
|
|
expect(responsible).toEqual('Calidad general');
|
2019-01-31 13:14:39 +00:00
|
|
|
expect(worker).toEqual('adminAssistantNick');
|
2019-01-15 07:33:19 +00:00
|
|
|
expect(redelivery).toEqual('Cliente');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should confirm the second development is the expected one', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
const reason = await page
|
2019-01-15 07:33:19 +00:00
|
|
|
.waitToGetProperty(`${selectors.claimDevelopment.secondClaimReasonAutocomplete} input`, 'value');
|
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
const result = await page
|
2019-01-15 07:33:19 +00:00
|
|
|
.waitToGetProperty(`${selectors.claimDevelopment.secondClaimResultAutocomplete} input`, 'value');
|
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
const responsible = await page
|
2019-01-15 07:33:19 +00:00
|
|
|
.waitToGetProperty(`${selectors.claimDevelopment.secondClaimResponsibleAutocomplete} input`, 'value');
|
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
const worker = await page
|
2019-01-15 07:33:19 +00:00
|
|
|
.waitToGetProperty(`${selectors.claimDevelopment.secondClaimWorkerAutocomplete} input`, 'value');
|
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
const redelivery = await page
|
2019-01-15 07:33:19 +00:00
|
|
|
.waitToGetProperty(`${selectors.claimDevelopment.secondClaimRedeliveryAutocomplete} input`, 'value');
|
|
|
|
|
|
|
|
expect(reason).toEqual('Baja calidad');
|
|
|
|
expect(result).toEqual('Deshidratacion');
|
|
|
|
expect(responsible).toEqual('Calidad general');
|
2019-01-31 13:14:39 +00:00
|
|
|
expect(worker).toEqual('deliveryNick');
|
2019-01-15 07:33:19 +00:00
|
|
|
expect(redelivery).toEqual('Reparto');
|
|
|
|
});
|
|
|
|
});
|