From 47a7b151618cb788c84c8f4d6988023bf6ebcd5e 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 | 5 ++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/NzbDrone.Automation.Test/AutomationTest.cs b/src/NzbDrone.Automation.Test/AutomationTest.cs index ae1bcc5e1..dc8bf7146 100644 --- a/src/NzbDrone.Automation.Test/AutomationTest.cs +++ b/src/NzbDrone.Automation.Test/AutomationTest.cs @@ -39,15 +39,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:9696"; + driver.Navigate().GoToUrl("http://localhost:9696"); var page = new PageBase(driver); page.WaitForNoSpinner(); @@ -67,7 +68,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 02078c47e..1124cde4b 100644 --- a/src/NzbDrone.Automation.Test/PageModel/PageBase.cs +++ b/src/NzbDrone.Automation.Test/PageModel/PageBase.cs @@ -7,12 +7,11 @@ namespace NzbDrone.Automation.Test.PageModel { public class PageBase { - private readonly WebDriver _driver; + private readonly IWebDriver _driver; - public PageBase(WebDriver driver) + public PageBase(IWebDriver driver) { _driver = driver; - driver.Manage().Window.Maximize(); } public IWebElement FindByClass(string className, int timeout = 5)