From 59ae3892f8e2f1c2507ddd66a1a8751b7b21f1d9 Mon Sep 17 00:00:00 2001 From: dzmipt Date: Fri, 5 Jan 2024 22:54:18 +0100 Subject: [PATCH] adding more delay with a condition for testCancelOnFrameClosure --- test-integration/studio/ui/EditorTest.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/test-integration/studio/ui/EditorTest.java b/test-integration/studio/ui/EditorTest.java index f72b10a4..f4d7db3b 100644 --- a/test-integration/studio/ui/EditorTest.java +++ b/test-integration/studio/ui/EditorTest.java @@ -4,6 +4,8 @@ import org.assertj.swing.finder.WindowFinder; import org.assertj.swing.fixture.FrameFixture; import org.assertj.swing.fixture.JMenuItemFixture; +import org.assertj.swing.timing.Condition; +import org.assertj.swing.timing.Timeout; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -121,7 +123,12 @@ protected boolean isMatching(StudioWindow f) { //tear down newFrameFixture.close(); optionPaneButtonClick("No"); - pause(50, TimeUnit.MILLISECONDS); // wait as closure happens asynchronously - newFrameFixture.requireNotVisible(); + + pause(new Condition("Wait till new window is closed") { + @Override + public boolean test() { + return !execute(newFrameFixture.target()::isVisible); + } + }, Timeout.timeout(1, TimeUnit.SECONDS)); } }