2018-02-15 11:28:05 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2018-10-24 08:57:14 +00:00
|
|
|
import createNightmare from '../../helpers/nightmare';
|
2017-12-13 10:25:50 +00:00
|
|
|
|
2019-01-16 13:01:13 +00:00
|
|
|
describe('Client Edit pay method path', () => {
|
2018-10-31 10:58:10 +00:00
|
|
|
const nightmare = createNightmare();
|
|
|
|
|
|
|
|
beforeAll(() => {
|
|
|
|
nightmare
|
2018-12-02 23:45:34 +00:00
|
|
|
.loginAndModule('administrative', 'client')
|
|
|
|
.accessToSearchResult('Bruce Banner')
|
|
|
|
.accessToSection('client.card.billingData');
|
2018-10-31 10:58:10 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should attempt to edit the Pay method without an IBAN but fail`, async() => {
|
2018-10-31 10:58:10 +00:00
|
|
|
const snackbarMessage = await nightmare
|
2019-01-07 08:33:07 +00:00
|
|
|
.autocompleteSearch(selectors.clientPayMethod.payMethodAutocomplete, 'PayMethod with IBAN')
|
|
|
|
.autocompleteSearch(selectors.clientPayMethod.swiftBicAutocomplete, 'BBKKESMMMMM')
|
2018-10-31 10:58:10 +00:00
|
|
|
.clearInput(selectors.clientPayMethod.dueDayInput)
|
2019-01-23 14:33:25 +00:00
|
|
|
.write(selectors.clientPayMethod.dueDayInput, '60')
|
2018-10-31 10:58:10 +00:00
|
|
|
.waitForTextInInput(selectors.clientPayMethod.dueDayInput, '60')
|
|
|
|
.waitToClick(selectors.clientPayMethod.receivedCoreLCRCheckbox)
|
|
|
|
.waitToClick(selectors.clientPayMethod.receivedCoreVNLCheckbox)
|
|
|
|
.waitToClick(selectors.clientPayMethod.receivedB2BVNLCheckbox)
|
|
|
|
.waitToClick(selectors.clientPayMethod.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() => {
|
2018-10-31 10:58:10 +00:00
|
|
|
const snackbarMessage = await nightmare
|
2018-11-21 10:53:18 +00:00
|
|
|
.waitToClick(selectors.clientPayMethod.clearswiftBicButton)
|
2019-01-09 15:45:56 +00:00
|
|
|
.clearInput(selectors.clientPayMethod.IBANInput)
|
2019-01-23 14:33:25 +00:00
|
|
|
.write(selectors.clientPayMethod.IBANInput, 'FR9121000418450200051332')
|
2019-01-09 15:45:56 +00:00
|
|
|
.waitForTextInInput(selectors.clientPayMethod.IBANInput, 'FR9121000418450200051332')
|
|
|
|
.wait(1000)
|
2018-10-31 10:58:10 +00:00
|
|
|
.waitToClick(selectors.clientPayMethod.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() => {
|
2018-10-31 10:58:10 +00:00
|
|
|
const newcode = await nightmare
|
2019-01-23 14:33:25 +00:00
|
|
|
.waitToClick(selectors.clientPayMethod.newBankEntityButton)
|
|
|
|
.write(selectors.clientPayMethod.newBankEntityName, 'Gotham City Bank')
|
|
|
|
.write(selectors.clientPayMethod.newBankEntityBIC, 'GTHMCT')
|
|
|
|
.waitToClick(selectors.clientPayMethod.acceptBankEntityButton)
|
2019-01-07 08:33:07 +00:00
|
|
|
.waitToGetProperty(`${selectors.clientPayMethod.swiftBicAutocomplete} input`, 'value');
|
2018-10-31 10:58:10 +00:00
|
|
|
|
2019-01-09 15:45:56 +00:00
|
|
|
expect(newcode).toEqual('GTHMCT Gotham City Bank');
|
2018-10-31 10:58:10 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should confirm the IBAN pay method is sucessfully saved`, async() => {
|
2018-10-31 10:58:10 +00:00
|
|
|
const payMethod = await nightmare
|
2019-01-07 08:33:07 +00:00
|
|
|
.waitToGetProperty(`${selectors.clientPayMethod.payMethodAutocomplete} input`, 'value');
|
2018-10-31 10:58:10 +00:00
|
|
|
|
|
|
|
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.clientPayMethod.IBANInput)
|
|
|
|
.waitToClick(selectors.clientPayMethod.clearswiftBicButton)
|
2019-01-23 14:33:25 +00:00
|
|
|
.write(selectors.clientPayMethod.IBANInput, 'ES9121000418450200051332')
|
2019-01-09 15:45:56 +00:00
|
|
|
.waitToGetProperty(`${selectors.clientPayMethod.swiftBicAutocomplete} input`, 'value');
|
|
|
|
|
|
|
|
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
|
2019-01-09 15:45:56 +00:00
|
|
|
.waitToClick(selectors.clientPayMethod.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() => {
|
2018-10-31 10:58:10 +00:00
|
|
|
const dueDate = await nightmare
|
2018-11-22 14:44:33 +00:00
|
|
|
.waitToGetProperty(selectors.clientPayMethod.dueDayInput, 'value');
|
2018-10-31 10:58:10 +00:00
|
|
|
|
|
|
|
expect(dueDate).toEqual('60');
|
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should confirm the IBAN was saved', async() => {
|
2018-10-31 10:58:10 +00:00
|
|
|
const IBAN = await nightmare
|
2018-11-22 11:34:20 +00:00
|
|
|
.waitToGetProperty(selectors.clientPayMethod.IBANInput, 'value');
|
2018-10-31 10:58:10 +00:00
|
|
|
|
2018-12-02 23:45:34 +00:00
|
|
|
expect(IBAN).toEqual('ES9121000418450200051332');
|
2018-10-31 10:58:10 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should confirm the swift / BIC code was saved', async() => {
|
2018-10-31 10:58:10 +00:00
|
|
|
const code = await nightmare
|
2019-01-07 08:33:07 +00:00
|
|
|
.waitToGetProperty(`${selectors.clientPayMethod.swiftBicAutocomplete} input`, 'value');
|
2018-10-31 10:58:10 +00:00
|
|
|
|
2019-01-09 15:45:56 +00:00
|
|
|
expect(code).toEqual('CAIXESBB Caixa Bank');
|
2018-10-31 10:58:10 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should confirm Received LCR checkbox is checked', async() => {
|
2018-10-31 10:58:10 +00:00
|
|
|
const checkedBox = await nightmare
|
2018-11-07 12:32:09 +00:00
|
|
|
.evaluate(selector => {
|
2018-10-31 10:58:10 +00:00
|
|
|
return document.querySelector(selector).checked;
|
|
|
|
}, selectors.clientPayMethod.receivedCoreLCRCheckbox);
|
|
|
|
|
|
|
|
expect(checkedBox).toBeTruthy();
|
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should confirm Received core VNL checkbox is unchecked', async() => {
|
2018-10-31 10:58:10 +00:00
|
|
|
const checkedBox = await nightmare
|
2018-11-07 12:32:09 +00:00
|
|
|
.evaluate(selector => {
|
2018-10-31 10:58:10 +00:00
|
|
|
return document.querySelector(selector).checked;
|
|
|
|
}, selectors.clientPayMethod.receivedCoreVNLCheckbox);
|
|
|
|
|
|
|
|
expect(checkedBox).toBeFalsy();
|
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should confirm Received B2B VNL checkbox is unchecked', async() => {
|
2018-10-31 10:58:10 +00:00
|
|
|
const checkedBox = await nightmare
|
2018-11-07 12:32:09 +00:00
|
|
|
.evaluate(selector => {
|
2018-10-31 10:58:10 +00:00
|
|
|
return document.querySelector(selector).checked;
|
|
|
|
}, selectors.clientPayMethod.receivedB2BVNLCheckbox);
|
|
|
|
|
|
|
|
expect(checkedBox).toBeFalsy();
|
2018-01-09 12:51:41 +00:00
|
|
|
});
|
2017-12-11 11:33:27 +00:00
|
|
|
});
|