What changed, and why it matters
This commit only changes a test file. It replaces some direct text equality checks with Playwright's built-in 'expect element to contain text' helper, which waits for the text to appear rather than checking instantly. The goal is to make a flaky (sometimes failing) test more stable. There is no change to production code and no security relevance.
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 BTCPayServer.Tests/POSTests.cs, a Playwright UI test for the point-of-sale keypad flow. It swaps Assert.Equal/Assert.Contains calls against immediate TextContentAsync results for await Expect(…).ToContainTextAsync(…) calls. This is a standard pattern to reduce race conditions between DOM updates and assertions. No application code is touched.
Changed components
BTCPayServer.Tests/POSTests.csInspect captured patch +8 / −9
diff --git a/BTCPayServer.Tests/POSTests.cs b/BTCPayServer.Tests/POSTests.cs
index ea88fbb..1c40ee2 100644
--- a/BTCPayServer.Tests/POSTests.cs
+++ b/BTCPayServer.Tests/POSTests.cs
@@ -817,7 +817,7 @@ goodies:
// Amount: 1234,56
await EnterKeypad(s, "123400");
- Assert.Equal("1.234,00", await s.Page.TextContentAsync("#Amount"));
+ await Expect(s.Page.Locator("#Amount")).ToContainTextAsync("1.234,00");
Assert.Equal("", await s.Page.TextContentAsync("#Calculation"));
await EnterKeypad(s, "+56");
Assert.Equal("0,56", await s.Page.TextContentAsync("#Amount"));
@@ -828,20 +828,21 @@ goodies:
// Discount: 10%
await s.Page.ClickAsync("label[for='ModeTablist-discount']");
await EnterKeypad(s, "10");
- Assert.Contains("0,56", await s.Page.TextContentAsync("#Amount"));
- Assert.Contains("10% discount", await s.Page.TextContentAsync("#Discount"));
+ await Expect(s.Page.Locator("#Amount")).ToContainTextAsync("0,56");
+ await Expect(s.Page.Locator("#Discount")).ToContainTextAsync("10% discount");
await AssertKeypadCalculation(s, "1.234,00 € + 0,56 € - 123,46 € (10%)", "1.111,10 €");
// Tip: 10%
await s.Page.ClickAsync("label[for='ModeTablist-tip']");
await s.Page.ClickAsync("#Tip-10");
Assert.Contains("0,56", await s.Page.TextContentAsync("#Amount"));
+ await Expect(s.Page.Locator("#Amount")).ToContainTextAsync("0,56");
await AssertKeypadCalculation(s, "1.234,00 € + 0,56 € - 123,46 € (10%) + 111,11 € (10%)", "1.222,21 €");
// Pay
await s.Page.ClickAsync("#pay-button");
await s.Page.ClickAsync("#DetailsToggle");
- Assert.Contains("1 222,21 €", await s.Page.TextContentAsync("#PaymentDetails-TotalFiat"));
+ await Expect(s.Page.Locator("#PaymentDetails-TotalFiat")).ToContainTextAsync("1 222,21 €");
await s.PayInvoice(true);
// Receipt
@@ -876,15 +877,14 @@ goodies:
await s.Page.ClickAsync("#ItemsListOffcanvas button[data-bs-dismiss='offcanvas']");
await EnterKeypad(s, "123");
- Assert.Contains("1,23", await s.Page.TextContentAsync("#Amount"));
+ await Expect(s.Page.Locator("#Amount")).ToContainTextAsync("1,23");
await AssertKeypadCalculation(s, "2 x Green Tea (1,00 €) = 2,00 € + 1 x Black Tea (1,00 €) = 1,00 € + 1,23 € + 0,42 € (10%)", "4,65 €");
// Pay
await s.Page.ClickAsync("#pay-button");
await s.Page.WaitForSelectorAsync("#Checkout");
await s.Page.ClickAsync("#DetailsToggle");
- await s.Page.WaitForSelectorAsync("#PaymentDetails-TotalFiat");
- Assert.Contains("4,65 €", await s.Page.TextContentAsync("#PaymentDetails-TotalFiat"));
+ await Expect(s.Page.Locator("#PaymentDetails-TotalFiat")).ToContainTextAsync("4,65 €");
await s.PayInvoice(true);
@@ -944,8 +944,7 @@ goodies:
await s.Page.ClickAsync("#pay-button");
await s.Page.WaitForSelectorAsync("#Checkout");
await s.Page.ClickAsync("#DetailsToggle");
- await s.Page.WaitForSelectorAsync("#PaymentDetails-TotalFiat");
- Assert.Contains("1,35 €", await s.Page.TextContentAsync("#PaymentDetails-TotalFiat"));
+ await Expect(s.Page.Locator("#PaymentDetails-TotalFiat")).ToContainTextAsync("1,35 €");
}
private static async Task AssertKeypadCalculation(PlaywrightTester s, string expectedCalculation, string expectedTotal)
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.