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

106 lines
4.8 KiB
JavaScript
Raw Normal View History

import selectors from '../../helpers/selectors';
import getBrowser from '../../helpers/puppeteer';
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() => {
2019-12-31 11:00:16 +00:00
await page.autocompleteSearch(selectors.clientBillingData.payMethodAutocomplete, 'PayMethod with IBAN');
await page.autocompleteSearch(selectors.clientBillingData.swiftBicAutocomplete, 'BBKKESMMMMM');
await page.clearInput(selectors.clientBillingData.dueDayInput);
await page.write(selectors.clientBillingData.dueDayInput, '60');
await page.waitForTextInInput(selectors.clientBillingData.dueDayInput, '60');
await page.waitToClick(selectors.clientBillingData.receivedCoreLCRCheckbox);
await page.waitToClick(selectors.clientBillingData.receivedCoreVNLCheckbox);
await page.waitToClick(selectors.clientBillingData.receivedB2BVNLCheckbox);
await page.waitToClick(selectors.clientBillingData.saveButton);
let snackbarMessage = await page.waitForLastSnackbar();
expect(snackbarMessage).toEqual('That payment method requires an IBAN');
});
2019-01-07 08:33: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.newBankEntityCode, '9999');
await page.write(selectors.clientBillingData.newBankEntityBIC, 'GTHMCT');
await page.waitToClick(selectors.clientBillingData.acceptBankEntityButton);
await page.waitForTextInInput(selectors.clientBillingData.swiftBicAutocomplete, 'Gotham City Bank');
2019-12-31 11:00:16 +00:00
let newcode = await page.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value');
2019-01-09 15:45:56 +00:00
expect(newcode).toEqual('GTHMCT Gotham City Bank');
});
2019-12-31 11:00:16 +00:00
it(`should confirm the IBAN pay method was sucessfully saved`, async() => {
let payMethod = await page.waitToGetProperty(`${selectors.clientBillingData.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() => {
2019-12-31 11:00:16 +00:00
await page.write(selectors.clientBillingData.IBANInput, 'ES9121000418450200051332');
await page.keyboard.press('Tab');
await page.keyboard.press('Tab');
await page.waitForTextInInput(selectors.clientBillingData.swiftBicAutocomplete, 'caixesbb');
2019-12-31 11:00:16 +00:00
let automaticCode = await page.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, '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);
let snackbarMessage = await page.waitForLastSnackbar();
2019-01-10 07:54:21 +00:00
2019-12-31 11:00:16 +00:00
expect(snackbarMessage).toEqual('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() => {
let dueDate = await page.waitToGetProperty(`${selectors.clientBillingData.dueDayInput} input`, 'value');
expect(dueDate).toEqual('60');
});
2019-01-07 08:33:07 +00:00
it('should confirm the IBAN was saved', async() => {
let IBAN = await page.waitToGetProperty(`${selectors.clientBillingData.IBANInput} input`, 'value');
expect(IBAN).toEqual('ES9121000418450200051332');
});
2019-01-07 08:33:07 +00:00
it('should confirm the swift / BIC code was saved', async() => {
2019-12-31 11:00:16 +00:00
let code = await page.waitToGetProperty(`${selectors.clientBillingData.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() => {
2019-12-31 11:00:16 +00:00
let 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() => {
2019-12-31 11:00:16 +00:00
let 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() => {
2019-12-31 11:00:16 +00:00
let result = await page.checkboxState(selectors.clientBillingData.receivedB2BVNLCheckbox);
expect(result).toBe('unchecked');
});
2017-12-11 11:33:27 +00:00
});