Skip to content

Commit 3103506

Browse files
committed
Only take screenshot of canvas
1 parent c48b0fa commit 3103506

19 files changed

+5
-3
lines changed

chartjs-java-model/src/test/java/software/xdev/chartjs/model/AbstractChartTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
import java.nio.file.Path;
2424
import java.util.Arrays;
2525

26+
import org.openqa.selenium.By;
2627
import org.openqa.selenium.OutputType;
28+
import org.openqa.selenium.TakesScreenshot;
2729
import org.openqa.selenium.chrome.ChromeOptions;
2830
import org.slf4j.bridge.SLF4JBridgeHandler;
2931
import org.testcontainers.utility.MountableFile;
@@ -81,7 +83,7 @@ protected void createScreenshotAndCompare(
8183
"new Chart(document.getElementById('c').getContext('2d'), %s)",
8284
chart.toJson()));
8385
this.assertCurrentBrowserViewEqualsScreenshot(
84-
browserContainer,
86+
browserContainer.webDriver().findElement(By.id("c")),
8587
chart.getClass().getSimpleName() + screenshotReference);
8688
}
8789
catch(final IOException ioe)
@@ -91,10 +93,10 @@ protected void createScreenshotAndCompare(
9193
}
9294

9395
protected void assertCurrentBrowserViewEqualsScreenshot(
94-
final SeleniumBrowserWebDriverContainer browserContainer,
96+
final TakesScreenshot takesScreenshot,
9597
final String screenshotReference) throws IOException
9698
{
97-
final byte[] actual = browserContainer.webDriver().getScreenshotAs(OutputType.BYTES);
99+
final byte[] actual = takesScreenshot.getScreenshotAs(OutputType.BYTES);
98100

99101
byte[] expected = new byte[0];
100102

-2.89 KB
Loading
-2.74 KB
Loading
-2.87 KB
Loading
-2.98 KB
Loading
-3.39 KB
Loading
-3.59 KB
Loading
-3.82 KB
Loading
-3.21 KB
Loading
-3.01 KB
Loading

0 commit comments

Comments
 (0)