On Thu, 18 Sep 2025 12:17:05 GMT, Kevin Rushforth <k...@openjdk.org> wrote:
>> 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). Thanks for the suggestion. Second option seems better, with some refactoring moving stage closing logic to `@BeforeEach` method works and it takes proper screen capture of test window also. ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/1910#discussion_r2359405174