From 6bb4f04bd14b99a8437d954c110fa45bd2f487c8 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Thu, 7 Mar 2019 12:11:06 +0100 Subject: [PATCH] #1211 client.billingData --- e2e/helpers/selectors.js | 1 + .../client-module/04_edit_pay_method.spec.js | 1 + .../client/front/billing-data/index.spec.js | 21 ++++++++++++++++--- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 68aa59a09..9c7f71770 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -87,6 +87,7 @@ export default { newBankEntityButton: 'vn-client-billing-data vn-icon-button[vn-tooltip="New bank entity"] > button', newBankEntityName: 'vn-client-billing-data > vn-dialog vn-textfield[label="Name"] input', newBankEntityBIC: 'vn-client-billing-data > vn-dialog vn-textfield[label="Swift / BIC"] input', + newBankEntityCode: 'vn-client-billing-data > vn-dialog vn-textfield[label="Code"] input', acceptBankEntityButton: 'vn-client-billing-data > vn-dialog button[response="ACCEPT"]', saveButton: `${components.vnSubmit}` }, diff --git a/e2e/paths/client-module/04_edit_pay_method.spec.js b/e2e/paths/client-module/04_edit_pay_method.spec.js index a8b58ca11..ef8c514d8 100644 --- a/e2e/paths/client-module/04_edit_pay_method.spec.js +++ b/e2e/paths/client-module/04_edit_pay_method.spec.js @@ -44,6 +44,7 @@ describe('Client Edit pay method path', () => { const newcode = await nightmare .waitToClick(selectors.clientPayMethod.newBankEntityButton) .write(selectors.clientPayMethod.newBankEntityName, 'Gotham City Bank') + .write(selectors.clientPayMethod.newBankEntityCode, 999) .write(selectors.clientPayMethod.newBankEntityBIC, 'GTHMCT') .waitToClick(selectors.clientPayMethod.acceptBankEntityButton) .waitToGetProperty(`${selectors.clientPayMethod.swiftBicAutocomplete} input`, 'value'); diff --git a/modules/client/front/billing-data/index.spec.js b/modules/client/front/billing-data/index.spec.js index 277ff7a2d..7ce5440df 100644 --- a/modules/client/front/billing-data/index.spec.js +++ b/modules/client/front/billing-data/index.spec.js @@ -51,7 +51,8 @@ describe('Client', () => { controller.newBankEntity = { name: '', bic: 'ES123', - countryFk: 1 + countryFk: 1, + id: 999 }; controller.onBankEntityResponse('ACCEPT'); @@ -62,18 +63,32 @@ describe('Client', () => { controller.newBankEntity = { name: 'My new bank entity', bic: '', - countryFk: 1 + countryFk: 1, + id: 999 }; controller.onBankEntityResponse('ACCEPT'); expect(vnApp.showError).toHaveBeenCalledWith(`Swift / BIC can't be empty`); }); + it(`should throw an error if id property is empty`, () => { + controller.newBankEntity = { + name: 'My new bank entity', + bic: 'ES123', + countryFk: 1, + id: null + }; + controller.onBankEntityResponse('ACCEPT'); + + expect(vnApp.showError).toHaveBeenCalledWith(`Code can't be empty`); + }); + it('should request to create a new bank entity', () => { let newBankEntity = { name: 'My new bank entity', bic: 'ES123', - countryFk: 1 + countryFk: 1, + id: 999 }; controller.newBankEntity = newBankEntity; $httpBackend.when('POST', '/client/api/BankEntities').respond('done');