Make CanUsePayjoinForTopUp more resilient

This commit is contained in:
nicolas.dorier 2021-10-05 15:47:57 +09:00
parent cf2c147f4f
commit 156ddd24fa
No known key found for this signature in database
GPG Key ID: 6618763EF09186FE
2 changed files with 6 additions and 4 deletions

View File

@ -49,12 +49,14 @@ namespace BTCPayServer.Tests
}
// Sometimes, selenium is flaky...
public static IWebElement FindElementUntilNotStaled(this IWebDriver driver, By by)
public static IWebElement FindElementUntilNotStaled(this IWebDriver driver, By by, Action<IWebElement> act)
{
retry:
try
{
return driver.FindElement(by);
var el = driver.FindElement(by);
act(el);
return el;
}
catch (StaleElementReferenceException)
{

View File

@ -255,8 +255,8 @@ namespace BTCPayServer.Tests
s.Driver.FindElement(By.Id("bip21parse")).Click();
s.Driver.SwitchTo().Alert().SendKeys(bip21);
s.Driver.SwitchTo().Alert().Accept();
s.Driver.FindElementUntilNotStaled(By.Id("Outputs_0__Amount")).Clear();
s.Driver.FindElementUntilNotStaled(By.Id("Outputs_0__Amount")).SendKeys("0.023");
s.Driver.FindElementUntilNotStaled(By.Id("Outputs_0__Amount"), we => we.Clear());
s.Driver.FindElementUntilNotStaled(By.Id("Outputs_0__Amount"), we => we.SendKeys("0.023"));
s.Driver.FindElement(By.Id("SignTransaction")).Click();