salix/e2e/paths/02-client/04_edit_billing_data.spec.js

107 lines
4.7 KiB
JavaScript
Raw Normal View History

import selectors from '../../helpers/selectors';
import getBrowser from '../../helpers/puppeteer';
2021-03-15 15:35:55 +00:00
describe('Client Edit billing data path', () => {
let browser;
2019-12-31 11:00:16 +00:00
let page;
beforeAll(async() => {
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');
});
2019-12-31 11:00:16 +00:00
afterAll(async() => {
await browser.close();
});
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();
2020-11-10 11:06:21 +00:00
expect(message.text).toContain('That payment method requires an IBAN');
});
2021-06-23 11:23:07 +00:00
it(`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.newBankEntityBIC, 'GTHMCT');
await page.autocompleteSearch(selectors.clientBillingData.newBankEntityCountry, 'España');
await page.write(selectors.clientBillingData.newBankEntityCode, '9999');
2019-12-31 11:00:16 +00:00
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');
2019-01-09 15:45:56 +00:00
expect(newcode).toEqual('GTHMCT Gotham City Bank');
});
2021-06-23 11:23:07 +00:00
it(`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');
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');
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');
expect(IBAN).toEqual('ES9121000418450200051332');
});
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');
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() => {
2020-04-08 09:24:40 +00:00
const result = await page.checkboxState(selectors.clientBillingData.receivedCoreLCRCheckbox);
expect(result).toBe('checked');
});
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);
expect(result).toBe('unchecked');
});
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);
expect(result).toBe('unchecked');
});
2017-12-11 11:33:27 +00:00
});