Skip to content

Commit

Permalink
portalicious: fix payment graph + test (#6396)
Browse files Browse the repository at this point in the history
* fix: refetch based on PaymentAggregate count

* fix: rm page reload form test

* fix: add await to test

* fix: change expected amount
  • Loading branch information
arsforza authored and Piotrk39 committed Jan 23, 2025
1 parent 97cae65 commit 55d18be
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
4 changes: 1 addition & 3 deletions e2e/portalicious/tests/DoPayment/DoSuccessfulPayment.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ test('[31970] Do successful payment', async ({ page }) => {
date: lastPaymentDate,
paymentAmount: defaultMaxTransferValue,
registrationsNumber: numberOfPas,
successfulTransfers:
defaultMaxTransferValue -
registrationsOCW[4].paymentAmountMultiplier * defaultTransferValue,
successfulTransfers: defaultMaxTransferValue,
failedTransfers: 0,
});
// DO NOT MAKE IT A RULE!!!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,11 @@ test('[32297] Graph should reflect transfer statuses', async ({ page }) => {
await paymentsPage.validatePaymentsDetailsPageByDate(lastPaymentDate);
});

await page.waitForTimeout(5000);

await test.step('Validate payemnt in progress in Payment overview', async () => {
await paymentsPage.validateToastMessage('Payment created.');
await paymentsPage.waitForPaymentToComplete();
// When the reload is not commented out, the test fails because the page is fully loaded and the in progress chip is not visible anymore
await page.reload();
// The graph is not fully loaded when chip is gone, hence one extra reload is needed
// Question is shall we keep it like that or it has to be fixed?
await paymentsPage.validateGraphStatus({
pending: 0,
successful: 16,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
import { MetricApiService } from '~/domains/metric/metric.api.service';
import { PaymentMetricDetails } from '~/domains/metric/metric.model';
import { PaymentApiService } from '~/domains/payment/payment.api.service';
import { PaymentAggregate } from '~/domains/payment/payment.model';
import { ProjectApiService } from '~/domains/project/project.api.service';
import { projectHasFspWithExportFileIntegration } from '~/domains/project/project.helper';
import {
Expand Down Expand Up @@ -107,8 +108,16 @@ export class ProjectPaymentPageComponent {
);
payment = injectQuery(() => ({
...this.paymentApiService.getPayment(this.projectId, this.paymentId)(),
// Refetch the data every second if a payment is in progress
refetchInterval: this.paymentStatus.data()?.inProgress ? 1000 : undefined,
// Refetch the data every second if a payment count !== transactions count
refetchInterval: this.refetchPayment() ? 1000 : undefined,
success: (data: PaymentAggregate) => {
if (
data.success.count + data.failed.count + data.waiting.count ===
this.transactions.data()?.length
) {
this.refetchPayment.set(false);
}
},
}));
payments = injectQuery(this.paymentApiService.getPayments(this.projectId));
transactions = injectQuery(
Expand All @@ -118,6 +127,8 @@ export class ProjectPaymentPageComponent {
}),
);

refetchPayment = signal(true);

allPaymentsLink = computed(() => [
'/',
AppRoutes.project,
Expand Down

0 comments on commit 55d18be

Please sign in to comment.