From 8b8b3432e0fb30dec1a85429c23a8bd8059047a4 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 30 Jan 2019 09:40:38 +0100 Subject: [PATCH] #1056 modificar e2e client.risk --- e2e/helpers/selectors.js | 1 + e2e/paths/client-module/14_risk.spec.js | 41 ++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 897048b418..4f8a5410d7 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -160,6 +160,7 @@ export default { }, clientRisk: { riskButton: `vn-left-menu a[ui-sref="client.card.risk.index"]`, + companyAutocomplete: 'vn-client-risk-index vn-autocomplete[field="$ctrl.companyFk"]', newPaymentButton: `${components.vnFloatButton}`, newPaymentBankInut: `vn-client-risk-create vn-textfield[field="$ctrl.receipt.bankFk"] input`, newPaymentAmountInput: `vn-client-risk-create vn-textfield[field="$ctrl.receipt.amountPaid"] input`, diff --git a/e2e/paths/client-module/14_risk.spec.js b/e2e/paths/client-module/14_risk.spec.js index b0613e4fb9..9faea512c7 100644 --- a/e2e/paths/client-module/14_risk.spec.js +++ b/e2e/paths/client-module/14_risk.spec.js @@ -7,12 +7,38 @@ describe('Client risk path', () => { beforeAll(() => { nightmare .loginAndModule('administrative', 'client') - .accessToSearchResult('Petter Parker') - .accessToSection('client.card.risk.index'); + .accessToSearchResult('Petter Parker'); + }); + + it('should now edit the local user config data', async() => { + let result = await nightmare + .waitToClick(selectors.globalItems.userMenuButton) + .autocompleteSearch(selectors.globalItems.userLocalCompany, 'CCs') + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); + + it('should access to the risk section to check the data shown matches the local settings', async() => { + let result = await nightmare + .accessToSection('client.card.risk.index') + .waitToGetProperty(`${selectors.clientRisk.companyAutocomplete} input`, 'value'); + + expect(result).toEqual('CCs'); + }); + + it('should now clear the user local settings', async() => { + let result = await nightmare + .waitToClick(selectors.globalItems.userMenuButton) + .waitToClick(selectors.globalItems.userConfigThirdAutocompleteClear) + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); }); it('should click the new payment button', async() => { let url = await nightmare + .reloadSection('client.card.risk.index') .waitToClick(selectors.clientRisk.newPaymentButton) .waitForURL('/risk') .parsedUrl(); @@ -30,11 +56,16 @@ describe('Client risk path', () => { expect(result).toContain('Data saved!'); }); - it('should check balance is now 0', async() => { - let result = await nightmare + it('should check balance is now 0 and the company is now VNL becouse the user local settings were removed', async() => { + let company = await nightmare + .waitToGetProperty(`${selectors.clientRisk.companyAutocomplete} input`, 'value'); + + let firstRiskLineBalance = await nightmare .waitToGetProperty(selectors.clientRisk.firstRiskLineBalance, 'innerText'); - expect(result).toEqual('0.00 €'); + + expect(company).toEqual('VNL'); + expect(firstRiskLineBalance).toEqual('0.00 €'); }); it('should now click the new payment button', async() => {