On Thu, 15 May 2025 16:36:28 GMT, Alexey Ivanov <aiva...@openjdk.org> wrote:

> > > However, the CountDownLatch is currently set to 1, which means the test 
> > > only waits for the first open/close interaction to complete. As a result, 
> > > it does not wait for the second attempt (opening the dialog again and 
> > > pressing ESC to close it), because the latch reaches zero after the first 
> > > attempt.
> > > This causes the test to proceed immediately to the validation step:
> > > if (fd.isVisible()) {
> > > throw new RuntimeException("File Dialog is not closed");
> > > }
> > 
> > 
> > I don't see the existing code ignores the second attempt, that is due to 
> > longer delay put after the robot operations. You can add print statements 
> > and observe the behavior.
> > However, I agree the countdown latch should be initialize to 2 to behave 
> > correctly.
> 
> Technically, longer delays do add up, yet if it takes longer to display the 
> dialog and hide it, it's well possible that the dialog isn't hidden by the 
> time the main thread reaches the point where it calls `fd.isVisible()`.

Yes, I agree. That's why I am in favour of increasing the latch count to 2 
which will ensure everything is all right.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/25184#issuecomment-2885876078

Reply via email to