From eb3ba951145430b2af76d20e8f3fda1cd604e207 Mon Sep 17 00:00:00 2001 From: d11n Date: Mon, 13 Mar 2023 02:02:07 +0100 Subject: [PATCH] Make CanUsePullPaymentsViaUI more robust (#4762) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes this nasty flaky test failure: ``` Failed CanUsePullPaymentsViaUI [17 s] Error Message: Assert.Equal() Failure ↓ (pos 1) Expected: payout Actual: pull-payment ↑ (pos 1) Stack Trace: at BTCPayServer.Tests.ChromeTests.CanUsePullPaymentsViaUI() in /source/BTCPayServer.Tests/SeleniumTests.cs:line 1622 ``` Because there are actually two labels, the previous selector was dependent on the correct ordern, because it always chose the first one … --- BTCPayServer.Tests/SeleniumTests.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/BTCPayServer.Tests/SeleniumTests.cs b/BTCPayServer.Tests/SeleniumTests.cs index a7f055db2..9b84755c0 100644 --- a/BTCPayServer.Tests/SeleniumTests.cs +++ b/BTCPayServer.Tests/SeleniumTests.cs @@ -1619,7 +1619,10 @@ namespace BTCPayServer.Tests s.Driver.Navigate().Refresh(); Assert.Contains("transaction-label", s.Driver.PageSource); }); - Assert.Equal("payout", s.Driver.FindElement(By.ClassName("transaction-label")).Text); + var labels = s.Driver.FindElements(By.CssSelector("#WalletTransactionsList tr:first-child div.transaction-label")); + Assert.Equal(2, labels.Count); + Assert.Contains(labels, element => element.Text == "payout"); + Assert.Contains(labels, element => element.Text == "pull-payment"); s.GoToStore(s.StoreId, StoreNavPages.Payouts); s.Driver.FindElement(By.Id($"{PayoutState.InProgress}-view")).Click();