From 03cc30d680dd91a66918808225e49b02a5aa943e Mon Sep 17 00:00:00 2001 From: Carlos Jimenez <=> Date: Fri, 2 Mar 2018 18:42:35 +0100 Subject: [PATCH] refactor on e2e paths --- .../client-module/01_create_client.spec.js | 85 ++---- .../client-module/02_edit_basic_data.spec.js | 110 +------- .../client-module/03_edit_fiscal_data.spec.js | 244 +++--------------- .../client-module/04_edit_pay_method.spec.js | 94 +------ 4 files changed, 74 insertions(+), 459 deletions(-) diff --git a/e2e/paths/client-module/01_create_client.spec.js b/e2e/paths/client-module/01_create_client.spec.js index a5036e484a..4b7df7464e 100644 --- a/e2e/paths/client-module/01_create_client.spec.js +++ b/e2e/paths/client-module/01_create_client.spec.js @@ -50,76 +50,13 @@ describe('create client path', () => { }); }); - it('should receive an error when clicking the create button having all the form fields empty but name', () => { + it('should receive an error when clicking the create button having name and Business name fields empty', () => { return nightmare - .type(selectors.createClientView.name, 'Carol Danvers') - .click(selectors.createClientView.createButton) - .waitForSnackbar() - .then(result => { - expect(result).toContain('Some fields are invalid'); - }); - }); - - it('should receive an error when clicking the create button having all the form fields empty but Tax Number', () => { - return nightmare - .clearInput(selectors.createClientView.name) .type(selectors.createClientView.taxNumber, '16195279J') - .click(selectors.createClientView.createButton) - .waitForSnackbar() - .then(result => { - expect(result).toContain('Some fields are invalid'); - }); - }); - - it('should receive an error when clicking the create button having all the form fields empty but Business Name', () => { - return nightmare - .clearInput(selectors.createClientView.taxNumber) - .type(selectors.createClientView.socialName, 'Avengers team') - .click(selectors.createClientView.createButton) - .waitForSnackbar() - .then(result => { - expect(result).toContain('Some fields are invalid'); - }); - }); - - it('should receive an error when clicking the create button having all the form fields empty but User Name', () => { - return nightmare - .clearInput(selectors.createClientView.socialName) .type(selectors.createClientView.userName, 'CaptainMarvel') - .click(selectors.createClientView.createButton) - .waitForSnackbar() - .then(result => { - expect(result).toContain('Some fields are invalid'); - }); - }); - - it('should receive an error when clicking the create button having all the form fields empty but email while email have incorrect format', () => { - return nightmare - .clearInput(selectors.createClientView.userName) - .type(selectors.createClientView.email, 'I will save the Avengers!') - .click(selectors.createClientView.createButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Some fields are invalid'); - }); - }); - - it('should receive an error when clicking the create button having all the form fields empty but email', () => { - return nightmare - .clearInput(selectors.createClientView.email) .type(selectors.createClientView.email, 'CarolDanvers@verdnatura.es') - .click(selectors.createClientView.createButton) - .waitForSnackbar() - .then(result => { - expect(result).toContain('Some fields are invalid'); - }); - }); - - it('should receive an error when clicking the create button having all the form fields empty but sales person', () => { - return nightmare .waitToClick(selectors.createClientView.salesPersonInput) .waitToClick(selectors.createClientView.salesBruceBannerOption) - .wait(200) .click(selectors.createClientView.createButton) .waitForSnackbar() .then(result => { @@ -127,15 +64,23 @@ describe('create client path', () => { }); }); - it(`should create a new user with all it's data`, () => { + it(`should attempt to create a new user with all it's data but wrong email`, () => { return nightmare - .wait(selectors.createClientView.email) - .clearInput(selectors.createClientView.email) .type(selectors.createClientView.name, 'Carol Danvers') - .type(selectors.createClientView.taxNumber, '16195279J') .type(selectors.createClientView.socialName, 'AVG tax') - .type(selectors.createClientView.userName, 'CaptainMarvel') - .type(selectors.createClientView.email, 'CarolDanvers@verdnatura.es') + .clearInput(selectors.createClientView.email) + .type(selectors.createClientView.email, 'incorrect email format') + .click(selectors.createClientView.createButton) + .waitForSnackbar() + .then(result => { + expect(result).toContain('Some fields are invalid'); + }); + }); + + it(`should create a new user with all correct data`, () => { + return nightmare + .clearInput(selectors.createClientView.email) + .type(selectors.createClientView.email, 'caroldanvers@verdnatura.es') .click(selectors.createClientView.createButton) .waitForSnackbar() .then(result => { diff --git a/e2e/paths/client-module/02_edit_basic_data.spec.js b/e2e/paths/client-module/02_edit_basic_data.spec.js index 695f4d9c2a..ea58176cf5 100644 --- a/e2e/paths/client-module/02_edit_basic_data.spec.js +++ b/e2e/paths/client-module/02_edit_basic_data.spec.js @@ -44,11 +44,23 @@ describe('Edit basicData path', () => { }); }); - it('should edit the name', () => { + it('should edit the client basic data', () => { return nightmare .wait(selectors.clientBasicData.nameInput) .clearInput(selectors.clientBasicData.nameInput) .type(selectors.clientBasicData.nameInput, 'Ororo Munroe') + .clearInput(selectors.clientBasicData.contactInput) + .type(selectors.clientBasicData.contactInput, 'Black Panther') + .clearInput(selectors.clientBasicData.phoneInput) + .type(selectors.clientBasicData.phoneInput, '123456789') + .clearInput(selectors.clientBasicData.mobileInput) + .type(selectors.clientBasicData.mobileInput, '987654321') + .clearInput(selectors.clientBasicData.emailInput) + .type(selectors.clientBasicData.emailInput, 'Storm@verdnatura.es') + .waitToClick(selectors.clientBasicData.salesPersonInput) + .waitToClick(selectors.clientBasicData.salesPersonOptionOne) + .waitToClick(selectors.clientBasicData.channelInput) + .waitToClick(selectors.clientBasicData.channelMetropolisOption) .click(selectors.clientBasicData.saveButton) .waitForSnackbar() .then(result => { @@ -68,144 +80,48 @@ describe('Edit basicData path', () => { }); }); - it('should edit the contact name', () => { - return nightmare - .wait(selectors.clientBasicData.contactInput) - .clearInput(selectors.clientBasicData.contactInput) - .type(selectors.clientBasicData.contactInput, 'Black Panther') - .click(selectors.clientBasicData.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - }); - }); - it('should confirm the contact name have been edited', () => { return nightmare - .click(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.addressInput) - .click(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.contactInput) .getInputValue(selectors.clientBasicData.contactInput) .then(result => { expect(result).toEqual('Black Panther'); }); }); - it('should add the landline phone number', () => { - return nightmare - .wait(selectors.clientBasicData.phoneInput) - .clearInput(selectors.clientBasicData.phoneInput) - .type(selectors.clientBasicData.phoneInput, '123456789') - .click(selectors.clientBasicData.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - }); - }); - it('should confirm the landline phone number have been added', () => { return nightmare - .click(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.addressInput) - .click(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.phoneInput) .getInputValue(selectors.clientBasicData.phoneInput) .then(result => { expect(result).toEqual('123456789'); }); }); - it('should add the mobile phone number', () => { - return nightmare - .wait(selectors.clientBasicData.mobileInput) - .clearInput(selectors.clientBasicData.mobileInput) - .type(selectors.clientBasicData.mobileInput, '987654321') - .click(selectors.clientBasicData.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - }); - }); - it('should confirm the mobile phone number have been added', () => { return nightmare - .click(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.addressInput) - .click(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.mobileInput) .getInputValue(selectors.clientBasicData.mobileInput) .then(result => { expect(result).toEqual('987654321'); }); }); - it('should edit the email', () => { - return nightmare - .wait(selectors.clientBasicData.emailInput) - .clearInput(selectors.clientBasicData.emailInput) - .type(selectors.clientBasicData.emailInput, 'Storm@verdnatura.es') - .click(selectors.clientBasicData.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - }); - }); - it('should confirm the email have been edited', () => { return nightmare - .click(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.addressInput) - .click(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.emailInput) .getInputValue(selectors.clientBasicData.emailInput) .then(result => { expect(result).toEqual('Storm@verdnatura.es'); }); }); - it('should select the sales person first option', () => { - return nightmare - .waitToClick(selectors.clientBasicData.salesPersonInput) - .waitToClick(selectors.clientBasicData.salesPersonOptionOne) - .wait(200) - .waitToClick(selectors.clientBasicData.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - }); - }); - it('should confirm the sales person have been selected', () => { return nightmare - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.addressInput) - .waitToClick(selectors.clientBasicData.basicDataButton) - .wait(200) .getInputValue(selectors.clientBasicData.salesPersonInput) .then(result => { expect(result).toEqual('accessory accessory'); }); }); - it('should select the channel', () => { - return nightmare - .waitToClick(selectors.clientBasicData.channelInput) - .waitToClick(selectors.clientBasicData.channelMetropolisOption) - .wait(400) - .waitToClick(selectors.clientBasicData.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - }); - }); - it('should confirm the channel have been selected', () => { return nightmare - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.addressInput) - .waitToClick(selectors.clientBasicData.basicDataButton) - .wait(400) .getInputValue(selectors.clientBasicData.channelInput) .then(result => { expect(result).toEqual('Metropolis newspaper'); diff --git a/e2e/paths/client-module/03_edit_fiscal_data.spec.js b/e2e/paths/client-module/03_edit_fiscal_data.spec.js index 55c201ab95..6e780cf241 100644 --- a/e2e/paths/client-module/03_edit_fiscal_data.spec.js +++ b/e2e/paths/client-module/03_edit_fiscal_data.spec.js @@ -84,58 +84,29 @@ describe('Edit fiscalData path', () => { }); }); - it('should edit the social name', () => { + it('should edit the clients fiscal data', () => { return nightmare .wait(selectors.clientFiscalData.socialNameInput) .clearInput(selectors.clientFiscalData.socialNameInput) - .type(selectors.clientFiscalData.socialNameInput, 'Hulk edited') - .click(selectors.clientFiscalData.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - }); - }); - - it('should confirm the social name have been edited', () => { - return nightmare - .waitToClick(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.nameInput) - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.socialNameInput) - .getInputValue(selectors.clientFiscalData.socialNameInput) - .then(result => { - expect(result).toEqual('Hulk edited'); - }); - }); - - it('should edit the fiscal id', () => { - return nightmare - .wait(selectors.clientFiscalData.fiscalIdInput) + .type(selectors.clientFiscalData.socialNameInput, 'SMASH!') .clearInput(selectors.clientFiscalData.fiscalIdInput) .type(selectors.clientFiscalData.fiscalIdInput, '94980061C') - .click(selectors.clientFiscalData.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - }); - }); - - it('should confirm the fiscal id have been edited', () => { - return nightmare - .waitToClick(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.nameInput) - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.fiscalIdInput) - .getInputValue(selectors.clientFiscalData.fiscalIdInput) - .then(result => { - expect(result).toEqual('94980061C'); - }); - }); - - it('should check the Equalization tax checkbox', () => { - return nightmare .waitToClick(selectors.clientFiscalData.equalizationTaxCheckboxLabel) - .waitToClick(selectors.clientFiscalData.saveButton) + .clearInput(selectors.clientFiscalData.addressInput) + .type(selectors.clientFiscalData.addressInput, 'Somewhere edited') + .clearInput(selectors.clientFiscalData.cityInput) + .type(selectors.clientFiscalData.cityInput, 'N/A') + .clearInput(selectors.clientFiscalData.postcodeInput) + .type(selectors.clientFiscalData.postcodeInput, '12345') + .waitToClick(selectors.clientFiscalData.provinceInput) + .waitToClick(selectors.clientFiscalData.provinceFifthOption) + .waitToClick(selectors.clientFiscalData.activeCheckboxLabel) + .waitToClick(selectors.clientFiscalData.invoiceByAddressCheckboxInput) + .waitToClick(selectors.clientFiscalData.verifiedDataCheckboxInput) + .waitToClick(selectors.clientFiscalData.hasToInvoiceCheckboxLabel) + .waitToClick(selectors.clientFiscalData.invoiceByMailCheckboxLabel) + .waitToClick(selectors.clientFiscalData.viesCheckboxInput) + .click(selectors.clientFiscalData.saveButton) .waitForSnackbar() .then(result => { expect(result).toEqual('Data saved!'); @@ -151,21 +122,7 @@ describe('Edit fiscalData path', () => { }); }); - it('should confirm Equalization tax checkbox is checked', () => { - return nightmare - .waitToClick(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.nameInput) - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.equalizationTaxCheckboxLabel) - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientFiscalData.equalizationTaxCheckboxLabel) - .then(value => { - expect(value).toBeTruthy(); - }); - }); - - describe('Confirm all addresses have now EQtax checked', () => { + describe('confirm all addresses have now EQtax checked', () => { it(`should click on the addresses button to access to the client's addresses`, () => { return nightmare .waitToClick(selectors.clientAddresses.addressesButton) @@ -204,119 +161,68 @@ describe('Edit fiscalData path', () => { }); }); - it('should go to fiscal data then edit the address', () => { + it('should navigate back to fiscal data to confirm it have been edited', () => { return nightmare .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.addressInput) - .clearInput(selectors.clientFiscalData.addressInput) - .type(selectors.clientFiscalData.addressInput, 'Somewhere edited') - .click(selectors.clientFiscalData.saveButton) - .waitForSnackbar() + .wait(selectors.clientFiscalData.socialNameInput) + .getInputValue(selectors.clientFiscalData.socialNameInput) .then(result => { - expect(result).toEqual('Data saved!'); + expect(result).toEqual('SMASH!'); + }); + }); + + it('should confirm the fiscal id have been edited', () => { + return nightmare + .getInputValue(selectors.clientFiscalData.fiscalIdInput) + .then(result => { + expect(result).toEqual('94980061C'); + }); + }); + + it('should confirm Equalization tax checkbox is checked', () => { + return nightmare + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.clientFiscalData.equalizationTaxCheckboxLabel) + .then(value => { + expect(value).toBeTruthy(); }); }); it('should confirm the address have been edited', () => { return nightmare - .click(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.nameInput) - .click(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.addressInput) .getInputValue(selectors.clientFiscalData.addressInput) .then(result => { expect(result).toEqual('Somewhere edited'); }); }); - it('should edit the city', () => { - return nightmare - .wait(selectors.clientFiscalData.cityInput) - .clearInput(selectors.clientFiscalData.cityInput) - .type(selectors.clientFiscalData.cityInput, 'N/A') - .click(selectors.clientFiscalData.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - }); - }); - it('should confirm the city have been edited', () => { return nightmare - .click(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.nameInput) - .click(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.cityInput) .getInputValue(selectors.clientFiscalData.cityInput) .then(result => { expect(result).toEqual('N/A'); }); }); - it('should edit the postcode', () => { - return nightmare - .wait(selectors.clientFiscalData.postcodeInput) - .clearInput(selectors.clientFiscalData.postcodeInput) - .type(selectors.clientFiscalData.postcodeInput, '12345') - .click(selectors.clientFiscalData.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - }); - }); - it('should confirm the postcode have been edited', () => { return nightmare - .click(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.nameInput) - .click(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.postcodeInput) .getInputValue(selectors.clientFiscalData.postcodeInput) .then(result => { expect(result).toEqual('12345'); }); }); - it(`should edit the province`, () => { - return nightmare - .waitToClick(selectors.clientFiscalData.provinceInput) - .waitToClick(selectors.clientFiscalData.provinceFifthOption) - .wait(200) - .waitToClick(selectors.clientFiscalData.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - }); - }); - it(`should confirm the province have been selected`, () => { return nightmare - .click(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.nameInput) - .click(selectors.clientFiscalData.fiscalDataButton) - .wait(200) .getInputValue(selectors.clientFiscalData.provinceInput) .then(result => { expect(result).toEqual('Province two'); }); }); - it('should uncheck the active checkbox', () => { - return nightmare - .waitToClick(selectors.clientFiscalData.activeCheckboxLabel) - .waitToClick(selectors.clientFiscalData.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - }); - }); - it('should confirm active checkbox is unchecked', () => { return nightmare - .waitToClick(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.nameInput) - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.activeCheckboxLabel) .evaluate(selector => { return document.querySelector(selector).checked; }, selectors.clientFiscalData.activeCheckboxLabel) @@ -325,22 +231,8 @@ describe('Edit fiscalData path', () => { }); }); - it('should uncheck the invoice by address checkbox', () => { - return nightmare - .waitToClick(selectors.clientFiscalData.invoiceByAddressCheckboxInput) - .waitToClick(selectors.clientFiscalData.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - }); - }); - it('should confirm invoice by address checkbox is unchecked', () => { return nightmare - .waitToClick(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.nameInput) - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.invoiceByAddressCheckboxInput) .evaluate(selector => { return document.querySelector(selector).checked; }, selectors.clientFiscalData.invoiceByAddressCheckboxInput) @@ -349,22 +241,8 @@ describe('Edit fiscalData path', () => { }); }); - it('should check the Verified data checkbox', () => { - return nightmare - .waitToClick(selectors.clientFiscalData.verifiedDataCheckboxInput) - .waitToClick(selectors.clientFiscalData.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - }); - }); - it('should confirm Verified data checkbox is checked', () => { return nightmare - .waitToClick(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.nameInput) - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.verifiedDataCheckboxInput) .evaluate(selector => { return document.querySelector(selector).checked; }, selectors.clientFiscalData.verifiedDataCheckboxInput) @@ -373,22 +251,8 @@ describe('Edit fiscalData path', () => { }); }); - it('should uncheck the Has to invoice checkbox', () => { - return nightmare - .waitToClick(selectors.clientFiscalData.hasToInvoiceCheckboxLabel) - .waitToClick(selectors.clientFiscalData.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - }); - }); - it('should confirm Has to invoice checkbox is unchecked', () => { return nightmare - .waitToClick(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.nameInput) - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.hasToInvoiceCheckboxLabel) .evaluate(selector => { return document.querySelector(selector).checked; }, selectors.clientFiscalData.hasToInvoiceCheckboxLabel) @@ -397,22 +261,8 @@ describe('Edit fiscalData path', () => { }); }); - it('should uncheck the Invoice by mail checkbox', () => { - return nightmare - .waitToClick(selectors.clientFiscalData.invoiceByMailCheckboxLabel) - .waitToClick(selectors.clientFiscalData.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - }); - }); - it('should confirm Invoice by mail checkbox is unchecked', () => { return nightmare - .waitToClick(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.nameInput) - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.invoiceByMailCheckboxLabel) .evaluate(selector => { return document.querySelector(selector).checked; }, selectors.clientFiscalData.invoiceByMailCheckboxLabel) @@ -421,22 +271,8 @@ describe('Edit fiscalData path', () => { }); }); - it('should check the Vies checkbox', () => { - return nightmare - .waitToClick(selectors.clientFiscalData.viesCheckboxInput) - .waitToClick(selectors.clientFiscalData.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - }); - }); - it('should confirm Vies checkbox is checked', () => { return nightmare - .waitToClick(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.nameInput) - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.viesCheckboxInput) .evaluate(selector => { return document.querySelector(selector).checked; }, selectors.clientFiscalData.viesCheckboxInput) 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 80dda38bba..612629288b 100644 --- a/e2e/paths/client-module/04_edit_pay_method.spec.js +++ b/e2e/paths/client-module/04_edit_pay_method.spec.js @@ -45,35 +45,15 @@ describe('Edit pay method path', () => { }); }); - it(`should edit the Pay method to any without IBAN`, () => { - return nightmare - .waitToClick(selectors.clientPayMethod.payMethodInput) - .waitToClick(selectors.clientPayMethod.payMethodOptionOne) - .wait(200) - .waitToClick(selectors.clientPayMethod.saveButton) - .waitToClick(selectors.clientPayMethod.cancelNotificationButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - }); - }); - - it(`should confirm the Pay method have been selected`, () => { - return nightmare - .click(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.nameInput) - .click(selectors.clientPayMethod.payMethodButton) - .wait(200) - .getInputValue(selectors.clientPayMethod.payMethodInput) - .then(result => { - expect(result).toEqual('PayMethod one'); - }); - }); - - it(`should receive an error when changing payMethod to IBAN without an IBAN entered`, () => { + it(`should attempt to edit the Pay method without an IBAN but fail`, () => { return nightmare .waitToClick(selectors.clientPayMethod.payMethodInput) .waitToClick(selectors.clientPayMethod.payMethodIBANOption) + .clearInput(selectors.clientPayMethod.dueDayInput) + .type(selectors.clientPayMethod.dueDayInput, '60') + .waitToClick(selectors.clientPayMethod.receivedCoreVNHCheckbox) + .waitToClick(selectors.clientPayMethod.receivedCoreVNLCheckbox) + .waitToClick(selectors.clientPayMethod.receivedB2BVNLCheckbox) .wait(200) .waitToClick(selectors.clientPayMethod.saveButton) .waitToClick(selectors.clientPayMethod.cancelNotificationButton) @@ -97,56 +77,22 @@ describe('Edit pay method path', () => { it(`should confirm the IBAN pay method is sucessfully saved`, () => { return nightmare - .click(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.nameInput) - .click(selectors.clientPayMethod.payMethodButton) - .wait(200) .getInputValue(selectors.clientPayMethod.payMethodInput) .then(result => { expect(result).toEqual('PayMethod with IBAN'); }); }); - it(`should edit the due day`, () => { - return nightmare - .clearInput(selectors.clientPayMethod.dueDayInput) - .type(selectors.clientPayMethod.dueDayInput, '60') - .waitToClick(selectors.clientPayMethod.saveButton) - .waitToClick(selectors.clientPayMethod.cancelNotificationButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - }); - }); - it('should confirm the due day have been edited', () => { return nightmare - .waitToClick(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.nameInput) - .waitToClick(selectors.clientPayMethod.payMethodButton) - .wait(selectors.clientPayMethod.dueDayInput) .getInputValue(selectors.clientPayMethod.dueDayInput) .then(result => { expect(result).toEqual('60'); }); }); - it('should uncheck the Received core VNH checkbox', () => { - return nightmare - .waitToClick(selectors.clientPayMethod.receivedCoreVNHCheckbox) - .waitToClick(selectors.clientPayMethod.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - }); - }); - it('should confirm Received core VNH checkbox is unchecked', () => { return nightmare - .waitToClick(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.nameInput) - .waitToClick(selectors.clientPayMethod.payMethodButton) - .wait(selectors.clientPayMethod.receivedCoreVNHCheckbox) .evaluate(selector => { return document.querySelector(selector).checked; }, selectors.clientPayMethod.receivedCoreVNHCheckbox) @@ -155,22 +101,8 @@ describe('Edit pay method path', () => { }); }); - it('should uncheck the Received core VNL checkbox', () => { - return nightmare - .waitToClick(selectors.clientPayMethod.receivedCoreVNLCheckbox) - .waitToClick(selectors.clientPayMethod.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - }); - }); - it('should confirm Received core VNL checkbox is unchecked', () => { return nightmare - .waitToClick(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.nameInput) - .waitToClick(selectors.clientPayMethod.payMethodButton) - .wait(selectors.clientPayMethod.receivedCoreVNLCheckbox) .evaluate(selector => { return document.querySelector(selector).checked; }, selectors.clientPayMethod.receivedCoreVNLCheckbox) @@ -179,22 +111,8 @@ describe('Edit pay method path', () => { }); }); - it('should uncheck the Received B2B VNL checkbox', () => { - return nightmare - .waitToClick(selectors.clientPayMethod.receivedB2BVNLCheckbox) - .waitToClick(selectors.clientPayMethod.saveButton) - .waitForSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - }); - }); - it('should confirm Received B2B VNL checkbox is unchecked', () => { return nightmare - .waitToClick(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.nameInput) - .waitToClick(selectors.clientPayMethod.payMethodButton) - .wait(selectors.clientPayMethod.receivedB2BVNLCheckbox) .evaluate(selector => { return document.querySelector(selector).checked; }, selectors.clientPayMethod.receivedB2BVNLCheckbox)