2020-01-14 08:20:14 +00:00
|
|
|
import selectors from '../../helpers/selectors';
|
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2017-12-13 10:25:50 +00:00
|
|
|
|
2020-04-02 16:55:07 +00:00
|
|
|
describe('Client Edit billing data path', () => {
|
2020-01-14 08:20:14 +00:00
|
|
|
let browser;
|
2019-12-31 11:00:16 +00:00
|
|
|
let page;
|
|
|
|
beforeAll(async() => {
|
2020-01-14 08:20:14 +00:00
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.loginAndModule('administrative', 'client');
|
|
|
|
await page.accessToSearchResult('Bruce Banner');
|
|
|
|
await page.accessToSection('client.card.billingData');
|
|
|
|
});
|
2018-10-31 10:58:10 +00:00
|
|
|
|
2019-12-31 11:00:16 +00:00
|
|
|
afterAll(async() => {
|
2020-01-14 08:20:14 +00:00
|
|
|
await browser.close();
|
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() => {
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.autocompleteSearch(selectors.clientBillingData.payMethod, 'PayMethod with IBAN');
|
|
|
|
await page.autocompleteSearch(selectors.clientBillingData.swiftBic, 'BBKKESMMMMM');
|
|
|
|
await page.clearInput(selectors.clientBillingData.dueDay);
|
|
|
|
await page.write(selectors.clientBillingData.dueDay, '60');
|
|
|
|
await page.waitForTextInField(selectors.clientBillingData.dueDay, '60');
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.waitToClick(selectors.clientBillingData.receivedCoreLCRCheckbox);
|
|
|
|
await page.waitToClick(selectors.clientBillingData.receivedCoreVNLCheckbox);
|
|
|
|
await page.waitToClick(selectors.clientBillingData.receivedB2BVNLCheckbox);
|
|
|
|
await page.waitToClick(selectors.clientBillingData.saveButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2018-10-31 10:58:10 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('That payment method requires an IBAN');
|
2018-10-31 10:58:10 +00:00
|
|
|
});
|
|
|
|
|
2020-05-19 06:46:42 +00:00
|
|
|
// 2256: Windows (hidden mode): Entity code doesn't get the focus, '9999' is written in entity name.
|
2020-04-03 13:14:53 +00:00
|
|
|
xit(`should create a new BIC code`, async() => {
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.waitToClick(selectors.clientBillingData.newBankEntityButton);
|
|
|
|
await page.write(selectors.clientBillingData.newBankEntityName, 'Gotham City Bank');
|
|
|
|
await page.write(selectors.clientBillingData.newBankEntityCode, '9999');
|
|
|
|
await page.write(selectors.clientBillingData.newBankEntityBIC, 'GTHMCT');
|
|
|
|
await page.waitToClick(selectors.clientBillingData.acceptBankEntityButton);
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.waitForTextInField(selectors.clientBillingData.swiftBic, 'Gotham City Bank');
|
2020-04-08 09:24:40 +00:00
|
|
|
const newcode = await page.waitToGetProperty(selectors.clientBillingData.swiftBic, '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
|
|
|
});
|
|
|
|
|
2020-04-03 13:14:53 +00:00
|
|
|
xit(`should confirm the IBAN pay method was sucessfully saved`, async() => {
|
2020-04-08 09:24:40 +00:00
|
|
|
const payMethod = await page.waitToGetProperty(selectors.clientBillingData.payMethod, '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() => {
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.write(selectors.clientBillingData.IBAN, 'ES9121000418450200051332');
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.keyboard.press('Tab');
|
|
|
|
await page.keyboard.press('Tab');
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.waitForTextInField(selectors.clientBillingData.swiftBic, 'caixesbb');
|
|
|
|
let automaticCode = await page.waitToGetProperty(selectors.clientBillingData.swiftBic, 'value');
|
2019-01-09 15:45:56 +00:00
|
|
|
|
2019-12-31 11:00:16 +00:00
|
|
|
expect(automaticCode).toEqual('CAIXESBB Caixa Bank');
|
2019-01-09 15:45:56 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should save the form with all its new data`, async() => {
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.waitForWatcherData(selectors.clientBillingData.watcher);
|
|
|
|
await page.waitToClick(selectors.clientBillingData.saveButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-01-10 07:54:21 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Notification sent!');
|
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() => {
|
2020-04-08 09:24:40 +00:00
|
|
|
const dueDate = await page.waitToGetProperty(selectors.clientBillingData.dueDay, '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() => {
|
2020-04-08 09:24:40 +00:00
|
|
|
const IBAN = await page.waitToGetProperty(selectors.clientBillingData.IBAN, '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() => {
|
2020-04-08 09:24:40 +00:00
|
|
|
const code = await page.waitToGetProperty(selectors.clientBillingData.swiftBic, '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() => {
|
2020-04-08 09:24:40 +00:00
|
|
|
const result = await page.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() => {
|
2020-04-08 09:24:40 +00:00
|
|
|
const result = await page.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() => {
|
2020-04-08 09:24:40 +00:00
|
|
|
const result = await page.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
|
|
|
});
|