What changed, and why it matters
This commit only changes a test file and adds a test marker to a UI message. It makes an automated browser test more reliable by waiting for elements to appear and checking their text in a more stable way. There is no security relevance.
No security action needed; this is a routine test reliability fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff updates Playwright test assertions to use async expectation helpers instead of synchronous string checks on full page content, reducing flakiness. It also adds a data-testid="no-invoices" attribute to the empty-state paragraph in the invoice list view. No functional code, authorization, input handling, or cryptography is modified.
Changed components
BTCPayServer.Tests/PlaywrightTests.csBTCPayServer/Views/UIInvoice/ListInvoices.cshtmlInspect captured patch +4 / −4
diff --git a/BTCPayServer.Tests/PlaywrightTests.cs b/BTCPayServer.Tests/PlaywrightTests.cs
index e0ad14d..78337c5 100644
--- a/BTCPayServer.Tests/PlaywrightTests.cs
+++ b/BTCPayServer.Tests/PlaywrightTests.cs
@@ -2389,7 +2389,7 @@ namespace BTCPayServer.Tests
}
await s.GoToInvoices(storeId);
- Assert.Contains("There are no invoices matching your criteria.", await s.Page.ContentAsync());
+ await Expect(s.Page.GetByTestId("no-invoices")).ToContainTextAsync("There are no invoices matching your criteria.");
var invoiceId = await s.CreateInvoice(storeId);
await s.FindAlertMessage();
@@ -2398,7 +2398,7 @@ namespace BTCPayServer.Tests
//let's test archiving an invoice
Assert.DoesNotContain("Archived", await s.Page.Locator("#btn-archive-toggle").InnerTextAsync());
await s.Page.Locator("#btn-archive-toggle").ClickAsync();
- Assert.Contains("Unarchive", await s.Page.Locator("#btn-archive-toggle").InnerTextAsync());
+ await Expect(s.Page.Locator("#btn-archive-toggle")).ToContainTextAsync("Unarchive");
//check that it no longer appears in list
await s.GoToInvoices(storeId);
@@ -2408,7 +2408,7 @@ namespace BTCPayServer.Tests
await s.Page.GotoAsync(invoiceUrl);
await s.Page.Locator("#btn-archive-toggle").ClickAsync();
await s.FindAlertMessage();
- Assert.DoesNotContain("Unarchive", await s.Page.Locator("#btn-archive-toggle").InnerTextAsync());
+ await Expect(s.Page.Locator("#btn-archive-toggle")).Not.ToContainTextAsync("Unarchive");
await s.GoToInvoices(storeId);
await s.Page.WaitForSelectorAsync($"tr[id=invoice_{invoiceId}]");
Assert.Contains(invoiceId, await s.Page.ContentAsync());
diff --git a/BTCPayServer/Views/UIInvoice/ListInvoices.cshtml b/BTCPayServer/Views/UIInvoice/ListInvoices.cshtml
index 0feb767..c54bf4b 100644
--- a/BTCPayServer/Views/UIInvoice/ListInvoices.cshtml
+++ b/BTCPayServer/Views/UIInvoice/ListInvoices.cshtml
@@ -426,7 +426,7 @@
}
else
{
- <p class="text-secondary mt-3" text-translate="true">
+ <p data-testid="no-invoices" class="text-secondary mt-3" text-translate="true">
There are no invoices matching your criteria.
</p>
}
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.