2020-01-14 08:20:14 +00:00
|
|
|
import selectors from '../../helpers/selectors';
|
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2018-03-02 13:45:22 +00:00
|
|
|
|
2020-03-17 10:00:16 +00:00
|
|
|
describe('Client lock verified data path', () => {
|
2020-01-14 08:20:14 +00:00
|
|
|
let browser;
|
2019-12-31 11:00:16 +00:00
|
|
|
let page;
|
|
|
|
beforeAll(async() => {
|
2020-01-14 08:20:14 +00:00
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.loginAndModule('salesPerson', 'client');
|
|
|
|
await page.accessToSearchResult('Hank Pym');
|
|
|
|
await page.accessToSection('client.card.fiscalData');
|
|
|
|
});
|
2018-09-05 06:24:15 +00:00
|
|
|
|
2019-12-31 11:00:16 +00:00
|
|
|
afterAll(async() => {
|
2020-01-14 08:40:50 +00:00
|
|
|
await browser.close();
|
2019-12-31 11:00:16 +00:00
|
|
|
});
|
2018-10-29 11:35:25 +00:00
|
|
|
|
2019-12-31 11:00:16 +00:00
|
|
|
describe('as salesPerson', () => {
|
2019-01-16 14:02:50 +00:00
|
|
|
it('should confirm verified data button is disabled for salesPerson', async() => {
|
2020-11-23 17:28:39 +00:00
|
|
|
await page.waitForTimeout(200);
|
|
|
|
await page.waitForSelector(selectors.clientFiscalData.verifiedDataCheckbox);
|
2019-12-31 11:00:16 +00:00
|
|
|
const result = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
2018-10-29 11:35:25 +00:00
|
|
|
|
|
|
|
expect(result).toBeTruthy();
|
|
|
|
});
|
|
|
|
|
2019-01-16 14:02:50 +00:00
|
|
|
it('should edit the social name', async() => {
|
2020-11-23 17:28:39 +00:00
|
|
|
await page.waitForSelector(selectors.clientFiscalData.socialName);
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.clearInput(selectors.clientFiscalData.socialName);
|
|
|
|
await page.write(selectors.clientFiscalData.socialName, 'Captain America Civil War');
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2018-10-29 11:35:25 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2018-10-29 11:35:25 +00:00
|
|
|
});
|
|
|
|
|
2019-01-16 14:02:50 +00:00
|
|
|
it('should confirm the social name have been edited', async() => {
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.reloadSection('client.card.fiscalData');
|
2020-02-03 14:55:11 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.clientFiscalData.socialName, 'value');
|
2018-10-29 11:35:25 +00:00
|
|
|
|
2023-06-27 05:18:36 +00:00
|
|
|
expect(result).toEqual('CAPTAIN AMERICA CIVIL WAR');
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('as administrative', () => {
|
2019-12-31 11:00:16 +00:00
|
|
|
beforeAll(async() => {
|
|
|
|
await page.loginAndModule('administrative', 'client');
|
|
|
|
await page.accessToSearchResult('Hank Pym');
|
|
|
|
await page.accessToSection('client.card.fiscalData');
|
2018-10-29 11:35:25 +00:00
|
|
|
});
|
|
|
|
|
2019-01-16 14:02:50 +00:00
|
|
|
it('should confirm verified data button is enabled for administrative', async() => {
|
2019-12-31 11:00:16 +00:00
|
|
|
const result = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
2018-10-29 11:35:25 +00:00
|
|
|
|
2019-02-14 19:17:22 +00:00
|
|
|
expect(result).toBeFalsy();
|
2018-10-29 11:35:25 +00:00
|
|
|
});
|
|
|
|
|
2019-01-16 14:02:50 +00:00
|
|
|
it('should check the Verified data checkbox', async() => {
|
2020-10-28 13:12:57 +00:00
|
|
|
await page.autocompleteSearch(selectors.clientFiscalData.sageTax, 'operaciones no sujetas');
|
|
|
|
await page.autocompleteSearch(selectors.clientFiscalData.sageTransaction, 'regularización de inversiones');
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.waitToClick(selectors.clientFiscalData.verifiedDataCheckbox);
|
|
|
|
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
2020-10-01 06:53:31 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.acceptButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2018-10-29 11:35:25 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2018-10-29 11:35:25 +00:00
|
|
|
});
|
|
|
|
|
2019-01-16 14:02:50 +00:00
|
|
|
it('should confirm Verified data checkbox is checked', async() => {
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.reloadSection('client.card.fiscalData');
|
|
|
|
const isChecked = await page.checkboxState(selectors.clientFiscalData.verifiedDataCheckbox);
|
2018-10-29 11:35:25 +00:00
|
|
|
|
2019-06-19 12:40:47 +00:00
|
|
|
expect(isChecked).toEqual('checked');
|
2018-10-29 11:35:25 +00:00
|
|
|
});
|
|
|
|
|
2019-01-16 14:02:50 +00:00
|
|
|
it('should again edit the social name', async() => {
|
2020-11-23 17:28:39 +00:00
|
|
|
await page.waitForSelector(selectors.clientFiscalData.socialName);
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.clearInput(selectors.clientFiscalData.socialName);
|
|
|
|
await page.write(selectors.clientFiscalData.socialName, 'Ant man and the Wasp');
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2018-10-29 11:35:25 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2018-10-29 11:35:25 +00:00
|
|
|
});
|
|
|
|
|
2019-01-16 14:02:50 +00:00
|
|
|
it('should again confirm the social name have been edited', async() => {
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.reloadSection('client.card.fiscalData');
|
2020-02-03 14:55:11 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.clientFiscalData.socialName, 'value');
|
2018-10-29 11:35:25 +00:00
|
|
|
|
2023-06-27 05:18:36 +00:00
|
|
|
expect(result).toEqual('ANT MAN AND THE WASP');
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('as salesPerson second run', () => {
|
2019-12-31 11:00:16 +00:00
|
|
|
beforeAll(async() => {
|
|
|
|
await page.loginAndModule('salesPerson', 'client');
|
|
|
|
await page.accessToSearchResult('Hank Pym');
|
|
|
|
await page.accessToSection('client.card.fiscalData');
|
2018-10-29 11:35:25 +00:00
|
|
|
});
|
|
|
|
|
2019-01-16 14:02:50 +00:00
|
|
|
it('should confirm verified data button is disabled once again for salesPerson', async() => {
|
2019-12-31 11:00:16 +00:00
|
|
|
const isDisabled = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
2018-10-29 11:35:25 +00:00
|
|
|
|
2019-09-30 18:46:22 +00:00
|
|
|
expect(isDisabled).toBeTruthy();
|
2018-10-29 11:35:25 +00:00
|
|
|
});
|
|
|
|
|
2019-01-16 14:02:50 +00:00
|
|
|
it('should not be able to save change throwing a verified data error', async() => {
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.clearInput(selectors.clientFiscalData.socialName);
|
|
|
|
await page.write(selectors.clientFiscalData.socialName, 'This wont happen');
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2018-10-29 11:35:25 +00:00
|
|
|
|
2022-05-10 06:48:51 +00:00
|
|
|
expect(message.text).toContain(`Not enough privileges to edit a client with verified data`);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2020-03-17 10:00:16 +00:00
|
|
|
describe('as salesAssistant', () => {
|
2020-02-04 15:21:10 +00:00
|
|
|
it('should log in as salesAssistant then get to the client fiscal data', async() => {
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.forceReloadSection('client.card.fiscalData');
|
|
|
|
await page.loginAndModule('salesAssistant', 'client');
|
|
|
|
await page.accessToSearchResult('Hank Pym');
|
|
|
|
await page.accessToSection('client.card.fiscalData');
|
2020-02-04 15:21:10 +00:00
|
|
|
}, 20000);
|
2018-10-29 11:35:25 +00:00
|
|
|
|
2022-05-27 08:08:40 +00:00
|
|
|
it('should confirm verified data button is enabled for salesAssistant', async() => {
|
2019-12-31 11:00:16 +00:00
|
|
|
const isDisabled = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
2018-10-29 11:35:25 +00:00
|
|
|
|
2022-05-27 07:45:08 +00:00
|
|
|
expect(isDisabled).toBeFalsy();
|
2018-10-29 11:35:25 +00:00
|
|
|
});
|
|
|
|
|
2022-05-27 07:45:08 +00:00
|
|
|
it('should now edit the social name', async() => {
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.clearInput(selectors.clientFiscalData.socialName);
|
|
|
|
await page.write(selectors.clientFiscalData.socialName, 'new social name edition');
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2018-10-29 11:35:25 +00:00
|
|
|
|
2022-05-27 07:45:08 +00:00
|
|
|
expect(message.text).toContain(`Data saved!`);
|
2018-10-29 11:35:25 +00:00
|
|
|
});
|
|
|
|
|
2019-01-16 14:02:50 +00:00
|
|
|
it('should now confirm the social name have been edited once and for all', async() => {
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.reloadSection('client.card.fiscalData');
|
2020-02-03 14:55:11 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.clientFiscalData.socialName, 'value');
|
2018-10-29 11:35:25 +00:00
|
|
|
|
2023-06-27 05:18:36 +00:00
|
|
|
expect(result).toEqual('NEW SOCIAL NAME EDITION');
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('as salesPerson third run', () => {
|
2019-12-31 11:00:16 +00:00
|
|
|
beforeAll(async() => {
|
|
|
|
await page.loginAndModule('salesPerson', 'client');
|
|
|
|
await page.accessToSearchResult('Hank Pym');
|
|
|
|
await page.accessToSection('client.card.fiscalData');
|
2018-10-29 11:35:25 +00:00
|
|
|
});
|
|
|
|
|
2019-01-16 14:02:50 +00:00
|
|
|
it('should confirm verified data button is enabled once again', async() => {
|
2019-12-31 11:00:16 +00:00
|
|
|
const isDisabled = await page;
|
|
|
|
await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
2018-10-29 11:35:25 +00:00
|
|
|
|
2019-09-30 18:46:22 +00:00
|
|
|
expect(isDisabled).toBeTruthy();
|
2018-10-29 11:35:25 +00:00
|
|
|
});
|
|
|
|
|
2019-01-16 14:02:50 +00:00
|
|
|
it('should confirm the form is enabled for salesPerson', async() => {
|
2020-11-23 17:28:39 +00:00
|
|
|
await page.waitForSelector(selectors.clientFiscalData.socialName);
|
2019-12-31 11:00:16 +00:00
|
|
|
const result = await page.evaluate(selector => {
|
|
|
|
return document.querySelector(selector).disabled;
|
|
|
|
}, 'vn-textfield[ng-model="$ctrl.client.socialName"] > div');
|
2018-10-29 11:35:25 +00:00
|
|
|
|
2019-02-14 19:17:22 +00:00
|
|
|
expect(result).toBeFalsy();
|
2018-03-12 10:10:05 +00:00
|
|
|
});
|
|
|
|
});
|
2018-03-02 13:45:22 +00:00
|
|
|
});
|