Skip to content

Commit

Permalink
Making .NET screenshot test resize window to remove scrollbar before …
Browse files Browse the repository at this point in the history
…screenshot
  • Loading branch information
jimevans committed Aug 8, 2019
1 parent f74b4dc commit 9535fdf
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions dotnet/test/common/TakesScreenshotTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ public void ShouldCaptureScreenshotAtFramePage()
}

[Test]
[IgnoreBrowser(Browser.IE, "Color comparisons fail on IE")]
public void ShouldCaptureScreenshotAtIFramePage()
{
ITakesScreenshot screenshotCapableDriver = driver as ITakesScreenshot;
Expand All @@ -312,7 +311,12 @@ public void ShouldCaptureScreenshotAtIFramePage()

driver.Url = EnvironmentManager.Instance.UrlBuilder.WhereIs("screen/screen_iframes.html");

// Resize the window to avoid scrollbars in screenshot
Size originalSize = driver.Manage().Window.Size;
driver.Manage().Window.Size = new Size(1040, 700);

Screenshot screenshot = screenshotCapableDriver.GetScreenshot();
driver.Manage().Window.Size = originalSize;

HashSet<string> actualColors = ScanActualColors(screenshot,
/* stepX in pixels */ 5,
Expand Down Expand Up @@ -366,7 +370,6 @@ public void ShouldCaptureScreenshotAtFramePageAfterSwitching()
}

[Test]
[IgnoreBrowser(Browser.IE, "Color comparisons fail on IE")]
[IgnoreBrowser(Browser.Firefox, "Color comparisons fail on Firefox")]
public void ShouldCaptureScreenshotAtIFramePageAfterSwitching()
{
Expand All @@ -378,9 +381,14 @@ public void ShouldCaptureScreenshotAtIFramePageAfterSwitching()

driver.Url = EnvironmentManager.Instance.UrlBuilder.WhereIs("screen/screen_iframes.html");

// Resize the window to avoid scrollbars in screenshot
Size originalSize = driver.Manage().Window.Size;
driver.Manage().Window.Size = new Size(1040, 700);

driver.SwitchTo().Frame(driver.FindElement(By.Id("iframe2")));

Screenshot screenshot = screenshotCapableDriver.GetScreenshot();
driver.Manage().Window.Size = originalSize;

HashSet<string> actualColors = ScanActualColors(screenshot,
/* stepX in pixels */ 5,
Expand Down

0 comments on commit 9535fdf

Please sign in to comment.