Improve test flakyness

This commit is contained in:
nicolas.dorier 2021-10-31 14:20:31 +09:00
parent 24b7705094
commit fd543bcee1
No known key found for this signature in database
GPG key ID: 6618763EF09186FE

View file

@ -119,10 +119,19 @@ namespace BTCPayServer.Tests
var wait = new WebDriverWait(driver, SeleniumTester.ImplicitWait);
wait.UntilJsIsReady();
var el = driver.FindElement(selector);
wait.Until(d => el.Displayed && el.Enabled);
el.Click();
int retriesLeft = 4;
retry:
try
{
var el = driver.FindElement(selector);
wait.Until(d => el.Displayed && el.Enabled);
el.Click();
}
catch (ElementClickInterceptedException) when (retriesLeft > 0)
{
retriesLeft--;
goto retry;
}
wait.UntilJsIsReady();
}