Fix flaky tests

This commit is contained in:
nicolas.dorier
2025-06-16 15:46:21 +09:00
parent 49f1f198f3
commit 0b29415d0e
4 changed files with 7 additions and 23 deletions

View File

@@ -566,21 +566,11 @@ namespace BTCPayServer.Tests
} }
await Page.ClickAsync("#FakePayment"); await Page.ClickAsync("#FakePayment");
await Page.Locator("#CheatSuccessMessage").WaitForAsync(); await Page.Locator("#CheatSuccessMessage").WaitForAsync();
// TODO: Fix flakyness
try
{
await Page.Locator("text=Payment Received").WaitForAsync();
}
catch
{
await TakeScreenshot("PayInvoice.png");
throw;
}
if (mine) if (mine)
{ {
await MineBlockOnInvoiceCheckout(); await MineBlockOnInvoiceCheckout();
} }
await Page.Locator("xpath=//*[text()=\"Invoice Paid\" or text()=\"Payment Received\"]").WaitForAsync();
} }
/// <summary> /// <summary>

View File

@@ -74,6 +74,7 @@ public class WalletTests(ITestOutputHelper helper) : UnitTestBase(helper)
await s.ClickPagePrimary(); await s.ClickPagePrimary();
await s.Page.ClickAsync("#BroadcastTransaction"); await s.Page.ClickAsync("#BroadcastTransaction");
await s.FindAlertMessage();
await s.Page.ReloadAsync(); await s.Page.ReloadAsync();
var rbfTx = (await client.ShowOnChainWalletTransactions(s.StoreId, "BTC")).Select(t => t.TransactionHash).ToArray()[0]; var rbfTx = (await client.ShowOnChainWalletTransactions(s.StoreId, "BTC")).Select(t => t.TransactionHash).ToArray()[0];
@@ -82,17 +83,7 @@ public class WalletTests(ITestOutputHelper helper) : UnitTestBase(helper)
await w.AssertNotFound(cpfpTx); await w.AssertNotFound(cpfpTx);
// However, the new transaction should have copied the CPFP tag from the transaction it replaced, and have a RBF label as well. // However, the new transaction should have copied the CPFP tag from the transaction it replaced, and have a RBF label as well.
try await w.AssertHasLabels(rbfTx, "CPFP");
{
await w.AssertHasLabels(rbfTx, "CPFP");
}
catch
{
// TODO: Flaky
await s.TakeScreenshot("AssertHasLabels-Fails.png");
throw;
}
await w.AssertHasLabels(rbfTx, "RBF"); await w.AssertHasLabels(rbfTx, "RBF");
// Now, we sweep all the UTXOs to a single destination. This should be RBF-able. (Fee deducted on the lone UTXO) // Now, we sweep all the UTXOs to a single destination. This should be RBF-able. (Fee deducted on the lone UTXO)

View File

@@ -88,7 +88,7 @@ namespace BTCPayServer
} }
if (Logs.Events.IsEnabled(LogLevel.Information)) if (Logs.Events.IsEnabled(LogLevel.Information))
Logs.Events.LogInformation("Event published {0}", evt); Logs.Events.LogInformation("Event published {0}", string.IsNullOrEmpty(evt?.ToString()) ? evtType.GetType().Name : evt.ToString());
foreach (var sub in actionList) foreach (var sub in actionList)
{ {

View File

@@ -47,4 +47,7 @@ public class InvoiceWebhookDeliveryRequest(
res = InterpolateJsonField(res, "Invoice.Metadata", Invoice.Metadata.ToJObject()); res = InterpolateJsonField(res, "Invoice.Metadata", Invoice.Metadata.ToJObject());
return res; return res;
} }
public override string ToString()
=> $"Webhook delivery request ({webhookEvent.Type})";
} }