On Thu, 18 Sep 2025 09:08:33 GMT, Jayathirth D V <j...@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 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? That would be one option; if we do this, we would need to move the property check to `writeScreenshot` (or provide a utility method for that purpose). Another option would be to modify the tests to which you plan to add `ScreenshotCapture` to not hide the stage in their `@AfterEach` method (perhaps moving it to `@BeforeEach` instead). ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/1910#discussion_r2358934095