From 93bb85ffaa1450b93ec6574908b43893bec83827 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Tue, 19 Dec 2023 12:35:35 +0900 Subject: [PATCH] Fix tests --- .../AltcoinTests/AltcoinTests.cs | 18 ++++++++++++++++-- BTCPayServer.Tests/ThirdPartyTests.cs | 2 +- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs b/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs index 414e7a86a..1e64d18e1 100644 --- a/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs +++ b/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs @@ -23,6 +23,7 @@ using Newtonsoft.Json.Linq; using OpenQA.Selenium; using Xunit; using Xunit.Abstractions; +using Xunit.Sdk; using WalletSettingsViewModel = BTCPayServer.Models.StoreViewModels.WalletSettingsViewModel; namespace BTCPayServer.Tests @@ -808,8 +809,21 @@ normal: vmpos.Template = AppService.SerializeTemplate(MigrationStartupTask.ParsePOSYML(vmpos.Template)); Assert.IsType(pos.UpdatePointOfSale(app.Id, vmpos).Result); - Assert.IsType(publicApps - .ViewPointOfSale(app.Id, PosViewType.Cart, 1, choiceKey: "btconly").Result); + try + { + Assert.IsType(publicApps + .ViewPointOfSale(app.Id, PosViewType.Cart, 1, choiceKey: "btconly").Result); + } + catch (IsTypeException) + { + TestLogs.LogInformation("This test sometimes fails, so we try to find the issue here..."); + TestLogs.LogInformation("Template: " + vmpos.Template); + var retryOk = publicApps.ViewPointOfSale(app.Id, PosViewType.Cart, 1, choiceKey: "btconly").Result is RedirectToActionResult; + var noChoiceKey = publicApps.ViewPointOfSale(app.Id, PosViewType.Cart, 1).Result is RedirectToActionResult; + TestLogs.LogInformation("RetryOk: " + retryOk); + TestLogs.LogInformation("NoChoiceKey: " + retryOk); + throw; + } Assert.IsType(publicApps .ViewPointOfSale(app.Id, PosViewType.Cart, 1, choiceKey: "normal").Result); invoices = user.BitPay.GetInvoices(); diff --git a/BTCPayServer.Tests/ThirdPartyTests.cs b/BTCPayServer.Tests/ThirdPartyTests.cs index f66f0f972..e711e845f 100644 --- a/BTCPayServer.Tests/ThirdPartyTests.cs +++ b/BTCPayServer.Tests/ThirdPartyTests.cs @@ -358,7 +358,7 @@ retry: .Select(c => new CurrencyPair(c.CryptoCode, "USD")) .ToHashSet(); - string[] brokenShitcoins = { "BTG", "BTX" }; + string[] brokenShitcoins = { "BTG", "BTX", "GRS" }; bool IsBrokenShitcoin(CurrencyPair p) => brokenShitcoins.Contains(p.Left) || brokenShitcoins.Contains(p.Right); foreach (var _ in brokenShitcoins) {