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-04-16 09:32:45 +00:00
|
|
|
describe('Client Edit billing data 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-04-16 09:32:45 +00:00
|
|
|
it(`should attempt to edit the billing data without an IBAN but fail`, async() => {
|
2018-10-31 10:58:10 +00:00
|
|
|
const snackbarMessage = await nightmare
|
2019-04-16 09:32:45 +00:00
|
|
|
.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)
|
2018-10-31 10:58:10 +00:00
|
|
|
.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
|
2019-04-16 09:32:45 +00:00
|
|
|
.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)
|
2019-04-16 09:32:45 +00:00
|
|
|
.waitToClick(selectors.clientBillingData.saveButton)
|
2018-10-31 10:58:10 +00:00
|
|
|
.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-04-16 09:32:45 +00:00
|
|
|
.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');
|
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-04-16 09:32:45 +00:00
|
|
|
.waitToGetProperty(`${selectors.clientBillingData.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
|
2019-04-16 09:32:45 +00:00
|
|
|
.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
|
2019-04-16 09:32:45 +00:00
|
|
|
.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() => {
|
2018-10-31 10:58:10 +00:00
|
|
|
const dueDate = await nightmare
|
2019-04-16 09:32:45 +00:00
|
|
|
.waitToGetProperty(selectors.clientBillingData.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
|
2019-04-16 09:32:45 +00:00
|
|
|
.waitToGetProperty(selectors.clientBillingData.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-04-16 09:32:45 +00:00
|
|
|
.waitToGetProperty(`${selectors.clientBillingData.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() => {
|
2019-02-14 19:17:22 +00:00
|
|
|
const result = await nightmare
|
2019-04-16 09:32:45 +00:00
|
|
|
.checkboxState(selectors.clientBillingData.receivedCoreLCRCheckbox);
|
2018-10-31 10:58:10 +00:00
|
|
|
|
2019-02-14 19:17:22 +00:00
|
|
|
expect(result).toBe('checked');
|
2018-10-31 10:58:10 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should confirm Received core VNL checkbox is unchecked', async() => {
|
2019-02-14 19:17:22 +00:00
|
|
|
const result = await nightmare
|
2019-04-16 09:32:45 +00:00
|
|
|
.checkboxState(selectors.clientBillingData.receivedCoreVNLCheckbox);
|
2018-10-31 10:58:10 +00:00
|
|
|
|
2019-02-14 19:17:22 +00:00
|
|
|
expect(result).toBe('unchecked');
|
2018-10-31 10:58:10 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should confirm Received B2B VNL checkbox is unchecked', async() => {
|
2019-02-14 19:17:22 +00:00
|
|
|
const result = await nightmare
|
2019-04-16 09:32:45 +00:00
|
|
|
.checkboxState(selectors.clientBillingData.receivedB2BVNLCheckbox);
|
2018-10-31 10:58:10 +00:00
|
|
|
|
2019-02-14 19:17:22 +00:00
|
|
|
expect(result).toBe('unchecked');
|
2018-01-09 12:51:41 +00:00
|
|
|
});
|
2017-12-11 11:33:27 +00:00
|
|
|
});
|