From 96f956a5d6d0aa653fdc31729a4c8e96688c43b4 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Sun, 8 Jun 2025 15:27:13 +0300 Subject: [PATCH] Fix fullscreen automation screenshots --- src/NzbDrone.Automation.Test/AutomationTest.cs | 7 ++++--- src/NzbDrone.Automation.Test/PageModel/PageBase.cs | 6 ++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/NzbDrone.Automation.Test/AutomationTest.cs b/src/NzbDrone.Automation.Test/AutomationTest.cs index bcf777431..51c79539e 100644 --- a/src/NzbDrone.Automation.Test/AutomationTest.cs +++ b/src/NzbDrone.Automation.Test/AutomationTest.cs @@ -40,15 +40,16 @@ namespace NzbDrone.Automation.Test var service = ChromeDriverService.CreateDefaultService(); // Timeout as windows automation tests seem to take alot longer to get going - driver = new ChromeDriver(service, options, new TimeSpan(0, 3, 0)); + driver = new ChromeDriver(service, options, TimeSpan.FromMinutes(3)); driver.Manage().Window.Size = new System.Drawing.Size(1920, 1080); + driver.Manage().Window.FullScreen(); _runner = new NzbDroneRunner(LogManager.GetCurrentClassLogger(), null); _runner.KillAll(); _runner.Start(true); - driver.Url = "http://localhost:8686"; + driver.Navigate().GoToUrl("http://localhost:8686"); var page = new PageBase(driver); page.WaitForNoSpinner(); @@ -68,7 +69,7 @@ namespace NzbDrone.Automation.Test { try { - var image = ((ITakesScreenshot)driver).GetScreenshot(); + var image = (driver as ITakesScreenshot).GetScreenshot(); image.SaveAsFile($"./{name}_test_screenshot.png", ScreenshotImageFormat.Png); } catch (Exception ex) diff --git a/src/NzbDrone.Automation.Test/PageModel/PageBase.cs b/src/NzbDrone.Automation.Test/PageModel/PageBase.cs index c9a7e8891..664ec7258 100644 --- a/src/NzbDrone.Automation.Test/PageModel/PageBase.cs +++ b/src/NzbDrone.Automation.Test/PageModel/PageBase.cs @@ -1,19 +1,17 @@ using System; using System.Threading; using OpenQA.Selenium; -using OpenQA.Selenium.Remote; using OpenQA.Selenium.Support.UI; namespace NzbDrone.Automation.Test.PageModel { public class PageBase { - private readonly RemoteWebDriver _driver; + private readonly IWebDriver _driver; - public PageBase(RemoteWebDriver driver) + public PageBase(IWebDriver driver) { _driver = driver; - driver.Manage().Window.Maximize(); } public IWebElement FindByClass(string className, int timeout = 5)