diff --git a/BTCPayServer.Tests/ApiKeysTests.cs b/BTCPayServer.Tests/ApiKeysTests.cs index ded6da050..746f84cb6 100644 --- a/BTCPayServer.Tests/ApiKeysTests.cs +++ b/BTCPayServer.Tests/ApiKeysTests.cs @@ -7,7 +7,6 @@ using BTCPayServer.Client; using BTCPayServer.Client.Models; using BTCPayServer.Data; using BTCPayServer.Security.Greenfield; -using BTCPayServer.Tests.Logging; using BTCPayServer.Views.Manage; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -91,7 +90,6 @@ namespace BTCPayServer.Tests s.Driver.FindElement(By.Id("AddApiKey")).Click(); s.Driver.FindElement(By.CssSelector("button[value='btcpay.store.canmodifystoresettings:change-store-mode']")).Click(); //there should be a store already by default in the dropdown - var src = s.Driver.PageSource; var getPermissionValueIndex = s.Driver.FindElement(By.CssSelector("input[value='btcpay.store.canmodifystoresettings']")) .GetAttribute("name") @@ -203,6 +201,7 @@ namespace BTCPayServer.Tests foreach (var checkbox in s.Driver.FindElements(By.ClassName("form-check-input"))) { checkedPermissionCount++; + s.Driver.ScrollTo(checkbox); checkbox.Click(); } s.Driver.FindElement(By.Id("Generate")).Click(); diff --git a/BTCPayServer.Tests/Extensions.cs b/BTCPayServer.Tests/Extensions.cs index 60dfaa000..36f9b29e9 100644 --- a/BTCPayServer.Tests/Extensions.cs +++ b/BTCPayServer.Tests/Extensions.cs @@ -106,8 +106,6 @@ retry: driver.ExecuteJavaScript($"document.getElementById('{collapseId}').classList.add('show')"); } - - public static void SetAttribute(this IWebDriver driver, string element, string attribute, string value) { driver.ExecuteJavaScript($"document.getElementById('{element}').setAttribute('{attribute}', '{value}')"); @@ -127,12 +125,17 @@ retry: return el; } + + public static void ScrollTo(this IWebDriver driver, IWebElement element) + { + driver.ExecuteJavaScript("arguments[0].scrollIntoView();", element); + } public static void ScrollTo(this IWebDriver driver, By selector) { - var element = driver.FindElement(selector); - driver.ExecuteJavaScript("arguments[0].scrollIntoView();", element); + ScrollTo(driver, driver.FindElement(selector)); } + public static void WaitForAndClick(this IWebDriver driver, By selector) { // Try fast path