salix/e2e/paths/02-client-module/04_edit_pay_method.spec.js

122 lines
5.2 KiB
JavaScript
Raw Normal View History

import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
describe('Client Edit billing data path', () => {
const nightmare = createNightmare();
beforeAll(() => {
nightmare
.loginAndModule('administrative', 'client')
.accessToSearchResult('Bruce Banner')
.accessToSection('client.card.billingData');
});
it(`should attempt to edit the billing data without an IBAN but fail`, async() => {
const snackbarMessage = await nightmare
.autocompleteSearch(selectors.clientBillingData.payMethodAutocomplete, 'PayMethod with IBAN')
.autocompleteSearch(selectors.clientBillingData.swiftBicAutocomplete, 'BBKKESMMMMM')
.clearInput(selectors.clientBillingData.dueDayInput)
.write(selectors.clientBillingData.dueDayInput, '60')
.waitForTextInInput(selectors.clientBillingData.dueDayInput, '60')
.waitToClick(selectors.clientBillingData.receivedCoreLCRCheckbox)
.waitToClick(selectors.clientBillingData.receivedCoreVNLCheckbox)
.waitToClick(selectors.clientBillingData.receivedB2BVNLCheckbox)
.waitToClick(selectors.clientBillingData.saveButton)
.waitForLastSnackbar();
expect(snackbarMessage).toEqual('That payment method requires an IBAN');
});
2019-01-07 08:33:07 +00:00
it(`should add the IBAN but fail as it requires a BIC code`, async() => {
const snackbarMessage = await nightmare
.waitToClick(selectors.clientBillingData.clearswiftBicButton)
.clearInput(selectors.clientBillingData.IBANInput)
.write(selectors.clientBillingData.IBANInput, 'FR9121000418450200051332')
.waitForTextInInput(selectors.clientBillingData.IBANInput, 'FR9121000418450200051332')
2019-01-09 15:45:56 +00:00
.wait(1000)
.waitToClick(selectors.clientBillingData.saveButton)
.waitForLastSnackbar();
expect(snackbarMessage).toEqual('That payment method requires a BIC');
});
2019-01-07 08:33:07 +00:00
it(`should create a new BIC code`, async() => {
const newcode = await nightmare
.waitToClick(selectors.clientBillingData.newBankEntityButton)
.write(selectors.clientBillingData.newBankEntityName, 'Gotham City Bank')
.write(selectors.clientBillingData.newBankEntityCode, 9999)
.write(selectors.clientBillingData.newBankEntityBIC, 'GTHMCT')
.waitToClick(selectors.clientBillingData.acceptBankEntityButton)
.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value');
2019-01-09 15:45:56 +00:00
expect(newcode).toEqual('GTHMCT Gotham City Bank');
});
2019-01-07 08:33:07 +00:00
it(`should confirm the IBAN pay method is sucessfully saved`, async() => {
const payMethod = await nightmare
.waitToGetProperty(`${selectors.clientBillingData.payMethodAutocomplete} input`, 'value');
expect(payMethod).toEqual('PayMethod with IBAN');
});
2019-01-09 15:45:56 +00:00
it(`should clear the BIC code field, update the IBAN to see how he BIC code autocompletes`, async() => {
const AutomaticCode = await nightmare
.clearInput(selectors.clientBillingData.IBANInput)
.waitToClick(selectors.clientBillingData.clearswiftBicButton)
.write(selectors.clientBillingData.IBANInput, 'ES9121000418450200051332')
.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value');
2019-01-09 15:45:56 +00:00
expect(AutomaticCode).toEqual('CAIXESBB Caixa Bank');
});
it(`should save the form with all its new data`, async() => {
2019-01-10 07:54:21 +00:00
const snackbarMessages = await nightmare
.waitToClick(selectors.clientBillingData.saveButton)
2019-01-10 07:54:21 +00:00
.waitForSnackbar();
expect(snackbarMessages).toEqual(jasmine.arrayContaining(['Data saved!']));
2019-01-09 15:45:56 +00:00
});
2019-01-07 08:33:07 +00:00
it('should confirm the due day have been edited', async() => {
const dueDate = await nightmare
.waitToGetProperty(selectors.clientBillingData.dueDayInput, 'value');
expect(dueDate).toEqual('60');
});
2019-01-07 08:33:07 +00:00
it('should confirm the IBAN was saved', async() => {
const IBAN = await nightmare
.waitToGetProperty(selectors.clientBillingData.IBANInput, 'value');
expect(IBAN).toEqual('ES9121000418450200051332');
});
2019-01-07 08:33:07 +00:00
it('should confirm the swift / BIC code was saved', async() => {
const code = await nightmare
.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value');
2019-01-09 15:45:56 +00:00
expect(code).toEqual('CAIXESBB Caixa Bank');
});
2019-01-07 08:33:07 +00:00
it('should confirm Received LCR checkbox is checked', async() => {
const result = await nightmare
.checkboxState(selectors.clientBillingData.receivedCoreLCRCheckbox);
expect(result).toBe('checked');
});
2019-01-07 08:33:07 +00:00
it('should confirm Received core VNL checkbox is unchecked', async() => {
const result = await nightmare
.checkboxState(selectors.clientBillingData.receivedCoreVNLCheckbox);
expect(result).toBe('unchecked');
});
2019-01-07 08:33:07 +00:00
it('should confirm Received B2B VNL checkbox is unchecked', async() => {
const result = await nightmare
.checkboxState(selectors.clientBillingData.receivedB2BVNLCheckbox);
expect(result).toBe('unchecked');
});
2017-12-11 11:33:27 +00:00
});