mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 22:25:28 +01:00
Merge pull request #2293 from dennisreimann/flaky-selenium
Tame flaky Selenium tests
This commit is contained in:
commit
b30aa968b0
2 changed files with 10 additions and 16 deletions
|
@ -17,6 +17,7 @@ using Microsoft.Extensions.Configuration;
|
||||||
using NBitcoin;
|
using NBitcoin;
|
||||||
using OpenQA.Selenium;
|
using OpenQA.Selenium;
|
||||||
using OpenQA.Selenium.Chrome;
|
using OpenQA.Selenium.Chrome;
|
||||||
|
using OpenQA.Selenium.Support.Extensions;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace BTCPayServer.Tests
|
namespace BTCPayServer.Tests
|
||||||
|
@ -47,9 +48,7 @@ namespace BTCPayServer.Tests
|
||||||
var runInBrowser = config["RunSeleniumInBrowser"] == "true";
|
var runInBrowser = config["RunSeleniumInBrowser"] == "true";
|
||||||
// Reset this using `dotnet user-secrets remove RunSeleniumInBrowser`
|
// Reset this using `dotnet user-secrets remove RunSeleniumInBrowser`
|
||||||
|
|
||||||
|
var chromeDriverPath = config["ChromeDriverDirectory"] ?? (Server.PayTester.InContainer ? "/usr/bin" : Directory.GetCurrentDirectory());
|
||||||
var chromeDriverPath = config["ChromeDriverDirectory"] ??
|
|
||||||
(Server.PayTester.InContainer ? "/usr/bin" : Directory.GetCurrentDirectory());
|
|
||||||
|
|
||||||
var options = new ChromeOptions();
|
var options = new ChromeOptions();
|
||||||
if (Server.PayTester.InContainer)
|
if (Server.PayTester.InContainer)
|
||||||
|
@ -149,18 +148,13 @@ namespace BTCPayServer.Tests
|
||||||
|
|
||||||
Driver.FindElement(By.Id("ScriptPubKeyType")).Click();
|
Driver.FindElement(By.Id("ScriptPubKeyType")).Click();
|
||||||
Driver.FindElement(By.CssSelector($"#ScriptPubKeyType option[value={format}]")).Click();
|
Driver.FindElement(By.CssSelector($"#ScriptPubKeyType option[value={format}]")).Click();
|
||||||
Driver.FindElement(By.Id("AdvancedSettingsButton")).Click();
|
|
||||||
Driver.SetCheckbox(By.Id("ImportKeysToRPC"), importkeys);
|
|
||||||
Driver.FindElement(By.Id("AdvancedSettingsButton")).Click(); // close again
|
|
||||||
|
|
||||||
try
|
// Open advanced settings via JS, because if we click the link it triggers the toggle animation.
|
||||||
{
|
// This leads to Selenium trying to click the button while it is moving resulting in an error.
|
||||||
Driver.FindElement(By.Id("Continue")).Click();
|
Driver.ExecuteJavaScript("document.getElementById('AdvancedSettings').classList.add('show')");
|
||||||
}
|
|
||||||
catch (ElementClickInterceptedException)
|
Driver.SetCheckbox(By.Id("ImportKeysToRPC"), importkeys);
|
||||||
{
|
Driver.FindElement(By.Id("Continue")).Click();
|
||||||
Driver.WaitForAndClick(By.Id("Continue"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Seed backup page
|
// Seed backup page
|
||||||
FindAlertMessage();
|
FindAlertMessage();
|
||||||
|
|
|
@ -58,10 +58,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
<button class="btn btn-link px-0" type="button" id="AdvancedSettingsButton" data-toggle="collapse" data-target="#advanced-settings" aria-expanded="false" aria-controls="advanced-settings">
|
<button class="btn btn-link px-0" type="button" id="AdvancedSettingsButton" data-toggle="collapse" data-target="#AdvancedSettings" aria-expanded="false" aria-controls="advanced-settings">
|
||||||
Advanced settings
|
Advanced settings
|
||||||
</button>
|
</button>
|
||||||
<div id="advanced-settings" class="collapse @(string.IsNullOrEmpty(Model.Passphrase) && !Model.ImportKeysToRPC ? "" : "show")">
|
<div id="AdvancedSettings" class="collapse @(string.IsNullOrEmpty(Model.Passphrase) && !Model.ImportKeysToRPC ? "" : "show")">
|
||||||
<div class="pt-3 pb-1">
|
<div class="pt-3 pb-1">
|
||||||
@if (isImport) // hide account option when creating a wallet
|
@if (isImport) // hide account option when creating a wallet
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue