RFR: 8367915: [TestBug] Add system property to ScreenCaptureTestWatcher
Jayathirth D V
jdv at openjdk.org
Thu Sep 18 09:13:00 UTC 2025
On Wed, 17 Sep 2025 18:07:33 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
> Added `test.screenshot` system property to the `ScreenCaptureTestWatcher` to control writing of the screenshot data url to stderr.
>
> Added corresponding gradle option `TEST_SCREENSHOT`.
>
> The function is disabled by default for privacy reasons.
tests/system/src/test/java/test/util/ScreenCaptureTestWatcher.java line 36:
> 34: * {@code -Dtest.screenshot=true} command line argument.
> 35: * <p>
> 36: * Using Safari, the screenshot {@code data:} URL can be pasted into the address bar
Tested with Safari, Firefox and Chrome. Only Chrome has limitation of length for large data URL's and truncates the image. If the desktop is large/diverse enough even Safari is not able to load the data URL's in my Macbook. May be we should make generic statement and mention Safari worked better for us.
tests/system/src/test/java/test/util/ScreenCaptureTestWatcher.java line 52:
> 50:
> 51: @Override
> 52: public void testFailed(ExtensionContext extensionContext, Throwable err) {
If i induce failure in `test.robot.javafx.scene.layout.RegionBackgroundFillUITest.basicFill_Radius4` and run it with `@ExtendWith(ScreenCaptureTestWatcher.class)` annotation on RegionBackgroundFillUITest class. I see that screen capture happens after the test window in closed.
May be in such cases, its better to call `ScreenshotCapture.writeScreenshot()` directly before we throw AssertionError on failure?
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1910#discussion_r2358111261
PR Review Comment: https://git.openjdk.org/jfx/pull/1910#discussion_r2358157406
More information about the openjfx-dev
mailing list