101 lines
4.6 KiB
JavaScript
101 lines
4.6 KiB
JavaScript
import selectors from '../../helpers/selectors.js';
|
|
import getBrowser from '../../helpers/puppeteer';
|
|
|
|
describe('Claim development', () => {
|
|
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');
|
|
});
|
|
|
|
afterAll(async() => {
|
|
await browser.close();
|
|
});
|
|
|
|
it('should delete a development and create a new one', async() => {
|
|
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();
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
}, 15000);
|
|
|
|
it(`should redirect to the next section of claims as the role is salesAssistant`, async() => {
|
|
await page.waitForURL('/action');
|
|
const url = await page.parsedUrl();
|
|
|
|
expect(url.hash).toContain('/action');
|
|
});
|
|
|
|
it('should edit a development', async() => {
|
|
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();
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
});
|
|
|
|
it('should confirm the first development is the expected one', async() => {
|
|
await page.reloadSection('claim.card.development');
|
|
const reason = await page
|
|
.waitToGetProperty(selectors.claimDevelopment.firstClaimReasonAutocomplete, 'value');
|
|
|
|
const result = await page
|
|
.waitToGetProperty(selectors.claimDevelopment.firstClaimResultAutocomplete, 'value');
|
|
|
|
const responsible = await page
|
|
.waitToGetProperty(selectors.claimDevelopment.firstClaimResponsibleAutocomplete, 'value');
|
|
|
|
const worker = await page
|
|
.waitToGetProperty(selectors.claimDevelopment.firstClaimWorkerAutocomplete, 'value');
|
|
|
|
const redelivery = await page
|
|
.waitToGetProperty(selectors.claimDevelopment.firstClaimRedeliveryAutocomplete, 'value');
|
|
|
|
expect(reason).toEqual('Calor');
|
|
expect(result).toEqual('Cocido');
|
|
expect(responsible).toEqual('Calidad general');
|
|
expect(worker).toEqual('adminAssistantNick');
|
|
expect(redelivery).toEqual('Cliente');
|
|
});
|
|
|
|
it('should confirm the second development is the expected one', async() => {
|
|
const reason = await page
|
|
.waitToGetProperty(selectors.claimDevelopment.secondClaimReasonAutocomplete, 'value');
|
|
|
|
const result = await page
|
|
.waitToGetProperty(selectors.claimDevelopment.secondClaimResultAutocomplete, 'value');
|
|
|
|
const responsible = await page
|
|
.waitToGetProperty(selectors.claimDevelopment.secondClaimResponsibleAutocomplete, 'value');
|
|
|
|
const worker = await page
|
|
.waitToGetProperty(selectors.claimDevelopment.secondClaimWorkerAutocomplete, 'value');
|
|
|
|
const redelivery = await page
|
|
.waitToGetProperty(selectors.claimDevelopment.secondClaimRedeliveryAutocomplete, 'value');
|
|
|
|
expect(reason).toEqual('Baja calidad');
|
|
expect(result).toEqual('Deshidratacion');
|
|
expect(responsible).toEqual('Calidad general');
|
|
expect(worker).toEqual('deliveryNick');
|
|
expect(redelivery).toEqual('Reparto');
|
|
});
|
|
});
|