Fix fullscreen automation screenshots

This commit is contained in:
Bogdan
2025-06-08 15:27:13 +03:00
committed by Qstick
parent 11e38ca570
commit 47a7b15161
2 changed files with 6 additions and 6 deletions

View File

@@ -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)

View File

@@ -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)