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

111 lines
5.2 KiB
JavaScript
Raw Normal View History

import getBrowser from '../../helpers/puppeteer';
2023-05-04 08:00:21 +00:00
const $ = {
payMethod: 'vn-client-billing-data vn-autocomplete[ng-model="$ctrl.client.payMethodFk"]',
IBAN: 'vn-client-billing-data vn-textfield[ng-model="$ctrl.client.iban"]',
dueDay: 'vn-client-billing-data vn-input-number[ng-model="$ctrl.client.dueDay"]',
receivedCoreLCRCheckbox: 'vn-client-billing-data vn-check[label="Received LCR"]',
receivedCoreVNLCheckbox: 'vn-client-billing-data vn-check[label="Received core VNL"]',
receivedB2BVNLCheckbox: 'vn-client-billing-data vn-check[label="Received B2B VNL"]',
swiftBic: 'vn-client-billing-data vn-autocomplete[ng-model="$ctrl.client.bankEntityFk"]',
newBankEntityButton: 'vn-client-billing-data vn-icon-button[vn-tooltip="New bank entity"] > button',
newBankEntityName: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.data.name"]',
newBankEntityBIC: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.data.bic"]',
newBankEntityCountry: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.data.countryFk"]',
newBankEntityCode: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.data.id"]',
acceptBankEntityButton: '.vn-dialog.shown button[response="accept"]',
saveButton: 'vn-client-billing-data button[type=submit]',
watcher: 'vn-client-billing-data vn-watcher'
};
2024-09-09 13:59:40 +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() => {
2023-05-04 08:00:21 +00:00
await page.autocompleteSearch($.payMethod, 'PayMethod with IBAN');
2024-09-09 13:59:17 +00:00
await page.waitToClick($.saveButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('That payment method requires an IBAN');
});
it(`should edit the billing data and save the form`, async() => {
await page.autocompleteSearch($.payMethod, 'PayMethod five');
2023-05-04 08:00:21 +00:00
await page.autocompleteSearch($.swiftBic, 'BBKKESMMMMM');
await page.clearInput($.dueDay);
await page.write($.dueDay, '60');
await page.waitForTextInField($.dueDay, '60');
await page.waitToClick($.receivedCoreLCRCheckbox);
await page.waitToClick($.receivedCoreVNLCheckbox);
await page.waitToClick($.receivedB2BVNLCheckbox);
await page.waitToClick($.saveButton);
2020-04-08 09:24:40 +00:00
const message = await page.waitForSnackbar();
2024-09-09 13:59:17 +00:00
expect(message.text).toContain('Notification sent!');
});
2021-06-23 11:23:07 +00:00
it(`should create a new BIC code`, async() => {
2024-09-09 13:59:17 +00:00
await page.loginAndModule('financial', 'client');
await page.accessToSearchResult('Bruce Banner');
await page.accessToSection('client.card.billingData');
2023-05-04 08:00:21 +00:00
await page.waitToClick($.newBankEntityButton);
await page.write($.newBankEntityName, 'Gotham City Bank');
await page.write($.newBankEntityBIC, 'GTHMCT');
await page.autocompleteSearch($.newBankEntityCountry, 'España');
await page.write($.newBankEntityCode, '9999');
await page.waitToClick($.acceptBankEntityButton);
const message = await page.waitForSnackbar();
2023-05-04 08:00:21 +00:00
await page.waitForTextInField($.swiftBic, 'GTHMCT');
const newcode = await page.waitToGetProperty($.swiftBic, 'value');
2023-05-04 08:00:21 +00:00
expect(newcode).toEqual('GTHMCT');
expect(message.text).toContain('Data saved!');
});
2021-06-23 11:23:07 +00:00
it(`should confirm the IBAN pay method was sucessfully saved`, async() => {
2023-05-04 08:00:21 +00:00
const payMethod = await page.waitToGetProperty($.payMethod, 'value');
2024-09-09 13:59:17 +00:00
expect(payMethod).toEqual('PayMethod five');
});
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() => {
2023-05-04 08:00:21 +00:00
await page.write($.IBAN, 'ES9121000418450200051332');
2019-12-31 11:00:16 +00:00
await page.keyboard.press('Tab');
await page.keyboard.press('Tab');
2023-05-04 08:00:21 +00:00
await page.waitForTextInField($.swiftBic, 'caixesbb');
let automaticCode = await page.waitToGetProperty($.swiftBic, 'value');
2019-01-09 15:45:56 +00:00
2023-05-04 08:00:21 +00:00
expect(automaticCode).toEqual('CAIXESBB');
2019-01-09 15:45:56 +00:00
});
2023-05-04 08:00:21 +00:00
it('should confirm the billing data have been edited', async() => {
const dueDate = await page.waitToGetProperty($.dueDay, 'value');
const IBAN = await page.waitToGetProperty($.IBAN, 'value');
const swiftBic = await page.waitToGetProperty($.swiftBic, 'value');
const receivedCoreLCR = await page.checkboxState($.receivedCoreLCRCheckbox);
const receivedCoreVNL = await page.checkboxState($.receivedCoreVNLCheckbox);
const receivedB2BVNL = await page.checkboxState($.receivedB2BVNLCheckbox);
2024-09-09 13:59:17 +00:00
const payMethod = await page.waitToGetProperty($.payMethod, 'value');
2024-09-09 13:59:17 +00:00
expect(payMethod).toEqual('PayMethod five');
expect(dueDate).toEqual('60');
expect(IBAN).toEqual('ES9121000418450200051332');
2023-05-04 08:00:21 +00:00
expect(swiftBic).toEqual('CAIXESBB');
expect(receivedCoreLCR).toBe('checked');
expect(receivedCoreVNL).toBe('unchecked');
expect(receivedB2BVNL).toBe('unchecked');
});
2017-12-11 11:33:27 +00:00
});