From b9e219c02127ec789ae44268d6e9d66ae07e2f83 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 22 Jan 2024 21:59:01 +0100 Subject: harness: fix payment-share integration test The test didn't wait for refreshes to settle before doing balance checks --- .../src/integrationtests/test-payment-share.ts | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/packages/taler-harness/src/integrationtests/test-payment-share.ts b/packages/taler-harness/src/integrationtests/test-payment-share.ts index c4a82c917..ef4f8adeb 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-share.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-share.ts @@ -104,7 +104,7 @@ export async function runPaymentShareTest(t: GlobalTestState) { claimFirstWallet.status === PreparePayResultType.PaymentPossible, ); - //share order from the first wallet + // share order from the first wallet const { privatePayUri } = await firstWallet.call( WalletApiOperation.SharePayment, { @@ -113,7 +113,7 @@ export async function runPaymentShareTest(t: GlobalTestState) { }, ); - //claim from the second wallet + // claim from the second wallet const claimSecondWallet = await secondWallet.call( WalletApiOperation.PreparePayForUri, { talerPayUri: privatePayUri }, @@ -123,11 +123,17 @@ export async function runPaymentShareTest(t: GlobalTestState) { claimSecondWallet.status === PreparePayResultType.PaymentPossible, ); - //pay from the second wallet + // pay from the second wallet const r2 = await secondWallet.call(WalletApiOperation.ConfirmPay, { proposalId: claimSecondWallet.proposalId, }); + // Wait for refresh to settle before we do checks + await secondWallet.call( + WalletApiOperation.TestingWaitTransactionsFinal, + {}, + ); + t.assertTrue(r2.type === ConfirmPayResultType.Done); { const first = await firstWallet.call(WalletApiOperation.GetBalances, {}); @@ -181,7 +187,7 @@ export async function runPaymentShareTest(t: GlobalTestState) { claimFirstWallet.status === PreparePayResultType.PaymentPossible, ); - //share order from the first wallet + // share order from the first wallet const { privatePayUri } = await firstWallet.call( WalletApiOperation.SharePayment, { @@ -190,7 +196,7 @@ export async function runPaymentShareTest(t: GlobalTestState) { }, ); - //claim from the second wallet + // claim from the second wallet const claimSecondWallet = await secondWallet.call( WalletApiOperation.PreparePayForUri, { talerPayUri: privatePayUri }, @@ -200,13 +206,16 @@ export async function runPaymentShareTest(t: GlobalTestState) { claimSecondWallet.status === PreparePayResultType.PaymentPossible, ); - //pay from the second wallet + // pay from the second wallet const r2 = await firstWallet.call(WalletApiOperation.ConfirmPay, { proposalId: claimFirstWallet.proposalId, }); t.assertTrue(r2.type === ConfirmPayResultType.Done); + // Wait for refreshes to settle before doing checks + await firstWallet.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); + const bal1 = await firstWallet.call(WalletApiOperation.GetBalances, {}); t.assertAmountEquals(bal1.balances[0].available, "TESTKUDOS:16.18"); -- cgit v1.2.3