feat(client_balance): test e2e
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Vicent Llopis 2021-11-09 14:36:39 +01:00
parent f5977d9f01
commit 833822978a
2 changed files with 16 additions and 1 deletions

View File

@ -98,6 +98,19 @@ describe('Client balance path', () => {
expect(message.text).toContain('Data saved!');
});
it('should create a new payment and check the cash exceeded the maximum', async() => {
const amountPaid = '1001';
await page.waitToClick(selectors.clientBalance.newPaymentButton);
await page.write(selectors.clientBalance.newPaymentAmount, amountPaid);
await page.clearInput(selectors.clientBalance.newDescription);
await page.write(selectors.clientBalance.newDescription, 'Payment');
await page.waitToClick(selectors.clientBalance.saveButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Amount exceeded');
});
it('should check the balance value is now -100', async() => {
let result = await page
.waitToGetProperty(selectors.clientBalance.firstLineBalance, 'innerText');

View File

@ -129,7 +129,9 @@ class Controller extends Dialog {
if (response !== 'accept')
return super.responseHandler(response);
if (this.bankSelection.accountingType.code == 'cash' && this.receipt.amountPaid > this.maxAmount)
const exceededAmount = this.receipt.amountPaid > this.maxAmount;
if (this.bankSelection.accountingType.code == 'cash' && exceededAmount)
return this.vnApp.showError(this.$t('Amount exceeded', {maxAmount: this.maxAmount}));
let receiptId;