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

127 lines
5.3 KiB
JavaScript
Raw Normal View History

import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
describe('Client Edit pay method path', () => {
const nightmare = createNightmare();
beforeAll(() => {
nightmare
.loginAndModule('administrative', 'client')
.accessToSearchResult('Bruce Banner')
.accessToSection('client.card.billingData');
});
2019-01-07 08:33:07 +00:00
it(`should attempt to edit the Pay method without an IBAN but fail`, async() => {
const snackbarMessage = await nightmare
2019-01-07 08:33:07 +00:00
.autocompleteSearch(selectors.clientPayMethod.payMethodAutocomplete, 'PayMethod with IBAN')
.autocompleteSearch(selectors.clientPayMethod.swiftBicAutocomplete, 'BBKKESMMMMM')
.clearInput(selectors.clientPayMethod.dueDayInput)
2019-01-23 14:33:25 +00:00
.write(selectors.clientPayMethod.dueDayInput, '60')
.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() => {
const snackbarMessage = await nightmare
.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)
.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() => {
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');
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
2019-01-07 08:33:07 +00:00
.waitToGetProperty(`${selectors.clientPayMethod.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.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() => {
const dueDate = await nightmare
.waitToGetProperty(selectors.clientPayMethod.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.clientPayMethod.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
2019-01-07 08:33:07 +00:00
.waitToGetProperty(`${selectors.clientPayMethod.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 checkedBox = await nightmare
.evaluate(selector => {
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() => {
const checkedBox = await nightmare
.evaluate(selector => {
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() => {
const checkedBox = await nightmare
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientPayMethod.receivedB2BVNLCheckbox);
expect(checkedBox).toBeFalsy();
});
2017-12-11 11:33:27 +00:00
});