Stabilize flaky Playwright tests (#7739)
What changed, and why it matters
This commit only adjusts automated test code to make flaky Playwright browser tests more reliable. It does not change any production code, user-facing behavior, or security mechanisms.
No security action needed; treat as routine test-maintenance commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies three test files: (1) uses a shared TestUtils.TestTimeout constant in PayJoinTests, (2) replaces a store-creation/logout sequence with a URL wait assertion in PlaywrightTests user-management test, and (3) adds an EventuallyAsync retry loop waiting for on-chain UTXO confirmations in WalletTests. All changes are test-only stabilization.
Changed components
BTCPayServer.Tests/PayJoinTests.csBTCPayServer.Tests/PlaywrightTests.csBTCPayServer.Tests/WalletTests.csInspect captured patch +7 / −3
### BTCPayServer.Tests/PayJoinTests.cs
@@ -239,7 +239,7 @@ public async Task CanOnlyUseCorrectAddressFormatsForPayjoin()
}
}
- [Fact(Timeout = TestTimeout)]
+ [Fact(Timeout = TestUtils.TestTimeout)]
[Trait("Playwright", "Playwright-2")]
public async Task CanUsePayjoinForTopUp()
{
### BTCPayServer.Tests/PlaywrightTests.cs
@@ -832,8 +832,7 @@ public async Task CanManageUsers()
{
// Can log again
await s.LogIn(user.Email, "Password@1!");
- await s.CreateNewStore();
- await s.Logout();
+ await s.Page.WaitForURLAsync("**/stores/create");
}
// Manage user details (edit)
### BTCPayServer.Tests/WalletTests.cs
@@ -1189,6 +1189,11 @@ async Task AssertDateRangeTimeZone(string timeZone)
await s.Server.ExplorerNode.GenerateAsync(1);
var client = await s.AsTestAccount().CreateClient();
+ await TestUtils.EventuallyAsync(async () =>
+ {
+ Assert.Contains(await client.GetOnChainWalletUTXOs(s.StoreId, "BTC"),
+ utxo => utxo.Confirmations > 0);
+ });
var nodeAddress = await s.Server.ExplorerNode.GetNewAddressAsync();
var outgoingTx = await client.CreateOnChainTransaction(s.StoreId, "BTC", new CreateOnChainTransactionRequest
{Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.