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);
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.autocompleteSearch(selectors.claimDevelopment.secondClaimReason, 'Baja calidad');
|
|
|
|
await page.autocompleteSearch(selectors.claimDevelopment.secondClaimResult, 'Deshidratacion');
|
|
|
|
await page.autocompleteSearch(selectors.claimDevelopment.secondClaimResponsible, 'Calidad general');
|
|
|
|
await page.autocompleteSearch(selectors.claimDevelopment.secondClaimWorker, 'deliveryNick');
|
|
|
|
await page.autocompleteSearch(selectors.claimDevelopment.secondClaimRedelivery, 'Reparto');
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.claimDevelopment.saveDevelopmentButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-01-15 07:33:19 +00:00
|
|
|
|
2020-04-08 09:24:40 +00:00
|
|
|
expect(message.type).toBe('success');
|
2020-02-12 06:21:53 +00:00
|
|
|
});
|
2019-04-08 14:12:07 +00:00
|
|
|
|
|
|
|
it(`should redirect to the next section of claims as the role is salesAssistant`, async() => {
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('claim.card.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');
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.autocompleteSearch(selectors.claimDevelopment.firstClaimReason, 'Calor');
|
|
|
|
await page.autocompleteSearch(selectors.claimDevelopment.firstClaimResult, 'Cocido');
|
|
|
|
await page.autocompleteSearch(selectors.claimDevelopment.firstClaimResponsible, 'Calidad general');
|
|
|
|
await page.autocompleteSearch(selectors.claimDevelopment.firstClaimWorker, 'adminAssistantNick');
|
|
|
|
await page.autocompleteSearch(selectors.claimDevelopment.firstClaimRedelivery, 'Cliente');
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.claimDevelopment.saveDevelopmentButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-01-15 07:33:19 +00:00
|
|
|
|
2020-04-08 09:24:40 +00:00
|
|
|
expect(message.type).toBe('success');
|
2019-01-15 07:33:19 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
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
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.claimDevelopment.firstClaimReason, 'value');
|
2019-01-15 07:33:19 +00:00
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
const result = await page
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.claimDevelopment.firstClaimResult, 'value');
|
2019-01-15 07:33:19 +00:00
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
const responsible = await page
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.claimDevelopment.firstClaimResponsible, 'value');
|
2019-01-15 07:33:19 +00:00
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
const worker = await page
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.claimDevelopment.firstClaimWorker, 'value');
|
2019-01-15 07:33:19 +00:00
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
const redelivery = await page
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.claimDevelopment.firstClaimRedelivery, 'value');
|
2019-01-15 07:33:19 +00:00
|
|
|
|
|
|
|
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
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.claimDevelopment.secondClaimReason, 'value');
|
2019-01-15 07:33:19 +00:00
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
const result = await page
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.claimDevelopment.secondClaimResult, 'value');
|
2019-01-15 07:33:19 +00:00
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
const responsible = await page
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.claimDevelopment.secondClaimResponsible, 'value');
|
2019-01-15 07:33:19 +00:00
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
const worker = await page
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.claimDevelopment.secondClaimWorker, 'value');
|
2019-01-15 07:33:19 +00:00
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
const redelivery = await page
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.claimDevelopment.secondClaimRedelivery, 'value');
|
2019-01-15 07:33:19 +00:00
|
|
|
|
|
|
|
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');
|
|
|
|
});
|
|
|
|
});
|