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
|
|
|
|
2018-10-24 08:57:14 +00:00
|
|
|
describe('Client', () => {
|
2018-04-05 06:55:47 +00:00
|
|
|
describe('Edit pay method path', () => {
|
|
|
|
const nightmare = createNightmare();
|
2017-12-11 11:33:27 +00:00
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
beforeAll(() => {
|
2018-10-24 08:57:14 +00:00
|
|
|
nightmare
|
2018-10-11 07:14:26 +00:00
|
|
|
.waitForLogin('administrative');
|
2018-04-05 06:55:47 +00:00
|
|
|
});
|
2018-03-02 11:15:17 +00:00
|
|
|
|
2018-10-24 08:57:14 +00:00
|
|
|
it('should click on the Clients button of the top bar menu', async() => {
|
|
|
|
let url = await nightmare
|
2018-04-05 06:55:47 +00:00
|
|
|
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
|
|
|
.wait(selectors.globalItems.applicationsMenuVisible)
|
|
|
|
.waitToClick(selectors.globalItems.clientsButton)
|
|
|
|
.wait(selectors.clientsIndex.createClientButton)
|
2018-10-24 08:57:14 +00:00
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toEqual('#!/client/index');
|
2018-02-20 09:00:19 +00:00
|
|
|
});
|
2017-12-11 11:33:27 +00:00
|
|
|
|
2018-10-24 08:57:14 +00:00
|
|
|
it('should search for the user Bruce Banner', async() => {
|
|
|
|
let resultCount = await nightmare
|
2018-04-05 06:55:47 +00:00
|
|
|
.wait(selectors.clientsIndex.searchResult)
|
|
|
|
.type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
|
|
|
|
.click(selectors.clientsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
2018-10-24 08:57:14 +00:00
|
|
|
.countElement(selectors.clientsIndex.searchResult);
|
|
|
|
|
|
|
|
expect(resultCount).toEqual(1);
|
2018-02-20 09:00:19 +00:00
|
|
|
});
|
2017-12-11 11:33:27 +00:00
|
|
|
|
2018-10-24 08:57:14 +00:00
|
|
|
it(`should click on the search result to access to the client's pay method`, async() => {
|
|
|
|
let url = await nightmare
|
2018-04-05 06:55:47 +00:00
|
|
|
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
|
|
|
|
.waitToClick(selectors.clientsIndex.searchResult)
|
|
|
|
.waitToClick(selectors.clientPayMethod.payMethodButton)
|
|
|
|
.waitForURL('billing-data')
|
2018-10-24 08:57:14 +00:00
|
|
|
.url();
|
|
|
|
|
|
|
|
expect(url).toContain('billing-data');
|
2018-02-20 09:00:19 +00:00
|
|
|
});
|
2017-12-11 11:33:27 +00:00
|
|
|
|
2018-10-24 08:57:14 +00:00
|
|
|
it(`should attempt to edit the Pay method without an IBAN but fail`, async() => {
|
|
|
|
let snackbarMessage = await nightmare
|
2018-04-05 06:55:47 +00:00
|
|
|
.waitToClick(selectors.clientPayMethod.payMethodInput)
|
|
|
|
.waitToClick(selectors.clientPayMethod.payMethodIBANOption)
|
2018-08-31 05:53:38 +00:00
|
|
|
.waitForTextInInput(selectors.clientPayMethod.payMethodInput, 'PayMethod with IBAN')
|
2018-04-05 06:55:47 +00:00
|
|
|
.clearInput(selectors.clientPayMethod.dueDayInput)
|
|
|
|
.type(selectors.clientPayMethod.dueDayInput, '60')
|
2018-08-31 05:53:38 +00:00
|
|
|
.waitForTextInInput(selectors.clientPayMethod.dueDayInput, '60')
|
2018-07-10 12:56:50 +00:00
|
|
|
.waitToClick(selectors.clientPayMethod.receivedCoreLCRCheckbox)
|
2018-04-05 06:55:47 +00:00
|
|
|
.waitToClick(selectors.clientPayMethod.receivedCoreVNLCheckbox)
|
|
|
|
.waitToClick(selectors.clientPayMethod.receivedB2BVNLCheckbox)
|
|
|
|
.waitToClick(selectors.clientPayMethod.saveButton)
|
2018-10-24 08:57:14 +00:00
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(snackbarMessage).toEqual('That payment method requires an IBAN');
|
2018-02-20 09:00:19 +00:00
|
|
|
});
|
2017-12-11 11:33:27 +00:00
|
|
|
|
2018-10-24 08:57:14 +00:00
|
|
|
it(`should add the IBAN but fail as it requires a BIC code`, async() => {
|
|
|
|
let snackbarMessage = await nightmare
|
2018-04-05 06:55:47 +00:00
|
|
|
.clearInput(selectors.clientPayMethod.IBANInput)
|
|
|
|
.type(selectors.clientPayMethod.IBANInput, 'ES91 2100 0418 4502 0005 1332')
|
2018-08-31 05:53:38 +00:00
|
|
|
.waitForTextInInput(selectors.clientPayMethod.IBANInput, 'ES91 2100 0418 4502 0005 1332')
|
2018-04-05 06:55:47 +00:00
|
|
|
.waitToClick(selectors.clientPayMethod.saveButton)
|
2018-10-24 08:57:14 +00:00
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(snackbarMessage).toEqual('That payment method requires a BIC');
|
2018-02-20 09:00:19 +00:00
|
|
|
});
|
2017-12-11 11:33:27 +00:00
|
|
|
|
2018-10-24 08:57:14 +00:00
|
|
|
it(`should create a new BIC code`, async() => {
|
|
|
|
let newcode = await nightmare
|
|
|
|
.click(selectors.clientPayMethod.newBankEntityButton)
|
|
|
|
.type(selectors.clientPayMethod.newBankEntityName, 'Gotham City Banks')
|
|
|
|
.type(selectors.clientPayMethod.newBankEntityBIC, 'GTHMCT')
|
|
|
|
.click(selectors.clientPayMethod.acceptBankEntityButton)
|
|
|
|
.getInputValue(selectors.clientPayMethod.swiftBicInput);
|
|
|
|
|
|
|
|
expect(newcode).toEqual('');
|
2018-02-20 09:00:19 +00:00
|
|
|
});
|
2017-12-11 11:33:27 +00:00
|
|
|
|
2018-10-24 08:57:14 +00:00
|
|
|
it(`should confirm the IBAN pay method is sucessfully saved`, async() => {
|
|
|
|
let payMethod = await nightmare
|
|
|
|
.getInputValue(selectors.clientPayMethod.payMethodInput);
|
|
|
|
|
|
|
|
expect(payMethod).toEqual('PayMethod with IBAN');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should confirm the due day have been edited', async() => {
|
|
|
|
let dueDate = await nightmare
|
|
|
|
.getInputValue(selectors.clientPayMethod.dueDayInput);
|
|
|
|
|
|
|
|
expect(dueDate).toEqual('60');
|
2018-02-20 09:00:19 +00:00
|
|
|
});
|
2018-01-09 12:51:41 +00:00
|
|
|
|
2018-10-24 08:57:14 +00:00
|
|
|
it('should confirm the IBAN was saved', async() => {
|
|
|
|
let IBAN = await nightmare
|
|
|
|
.waitProperty(selectors.clientPayMethod.IBANInput, 'value')
|
|
|
|
.getProperty(selectors.clientPayMethod.IBANInput, 'value');
|
|
|
|
|
|
|
|
expect(IBAN).toEqual('ES91 2100 0418 4502 0005 1332');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should confirm the swift / BIC code was saved', async() => {
|
|
|
|
let code = await nightmare
|
|
|
|
.waitProperty(selectors.clientPayMethod.swiftBicInput, 'value')
|
|
|
|
.getProperty(selectors.clientPayMethod.swiftBicInput, 'value');
|
|
|
|
|
|
|
|
expect(code).toEqual('GTHMCT');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should confirm Received LCR checkbox is checked', async() => {
|
|
|
|
let checkedBox = await nightmare
|
2018-04-05 06:55:47 +00:00
|
|
|
.evaluate(selector => {
|
|
|
|
return document.querySelector(selector).checked;
|
2018-10-24 08:57:14 +00:00
|
|
|
}, selectors.clientPayMethod.receivedCoreLCRCheckbox);
|
|
|
|
|
|
|
|
expect(checkedBox).toBeTruthy();
|
2018-02-20 09:00:19 +00:00
|
|
|
});
|
2018-01-09 12:51:41 +00:00
|
|
|
|
2018-10-24 08:57:14 +00:00
|
|
|
it('should confirm Received core VNL checkbox is unchecked', async() => {
|
|
|
|
let checkedBox = await nightmare
|
2018-04-05 06:55:47 +00:00
|
|
|
.evaluate(selector => {
|
|
|
|
return document.querySelector(selector).checked;
|
2018-10-24 08:57:14 +00:00
|
|
|
}, selectors.clientPayMethod.receivedCoreVNLCheckbox);
|
|
|
|
|
|
|
|
expect(checkedBox).toBeFalsy();
|
2018-02-20 09:00:19 +00:00
|
|
|
});
|
2018-01-09 12:51:41 +00:00
|
|
|
|
2018-10-24 08:57:14 +00:00
|
|
|
it('should confirm Received B2B VNL checkbox is unchecked', async() => {
|
|
|
|
let checkedBox = await nightmare
|
2018-04-05 06:55:47 +00:00
|
|
|
.evaluate(selector => {
|
|
|
|
return document.querySelector(selector).checked;
|
2018-10-24 08:57:14 +00:00
|
|
|
}, selectors.clientPayMethod.receivedB2BVNLCheckbox);
|
|
|
|
|
|
|
|
expect(checkedBox).toBeFalsy();
|
2018-02-20 09:00:19 +00:00
|
|
|
});
|
2018-01-09 12:51:41 +00:00
|
|
|
});
|
2017-12-11 11:33:27 +00:00
|
|
|
});
|