Make tests more resilient

This commit is contained in:
nicolas.dorier 2020-01-12 15:50:23 +09:00
parent 430a9eb261
commit 529c2df1cc
No known key found for this signature in database
GPG key ID: 6618763EF09186FE
2 changed files with 9 additions and 9 deletions

View file

@ -5,7 +5,7 @@
<TargetFramework Condition="'$(TargetFrameworkOverride)' != ''">$(TargetFrameworkOverride)</TargetFramework>
<IsPackable>false</IsPackable>
<NoWarn>NU1701,CA1816,CA1308,CA1810,CA2208</NoWarn>
<LangVersion>7.2</LangVersion>
<LangVersion>8.0</LangVersion>
<UserSecretsId>AB0AC1DD-9D26-485B-9416-56A33F268117</UserSecretsId>
</PropertyGroup>

View file

@ -72,16 +72,16 @@ namespace BTCPayServer.Tests
internal void AssertHappyMessage()
{
try
using var cts = new CancellationTokenSource(10_000);
while (!cts.IsCancellationRequested)
{
Assert.Single(Driver.FindElements(By.ClassName("alert-success")).Where(el => el.Displayed));
}
catch (Xunit.Sdk.SingleException)
{
Logs.Tester.LogInformation("Should have shown happy message, but instead got");
Logs.Tester.LogInformation(this.Driver.PageSource);
throw;
var success = Driver.FindElements(By.ClassName("alert-success")).Where(el => el.Displayed).Any();
if (success)
return;
Thread.Sleep(100);
}
Logs.Tester.LogInformation(this.Driver.PageSource);
Assert.True(false, "Should have shown happy message");
}
public static readonly TimeSpan ImplicitWait = TimeSpan.FromSeconds(10);