Make tests more resilient

This commit is contained in:
nicolas.dorier
2020-01-12 15:50:23 +09:00
parent 430a9eb261
commit 529c2df1cc
2 changed files with 9 additions and 9 deletions

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);