diff --git a/src/test/java/unicash/ui/CommandBoxUiTest.java b/src/test/java/unicash/ui/CommandBoxUiTest.java index d899ba140c9..ad13f0b4004 100644 --- a/src/test/java/unicash/ui/CommandBoxUiTest.java +++ b/src/test/java/unicash/ui/CommandBoxUiTest.java @@ -2,15 +2,21 @@ import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.testfx.api.FxRobot; +import org.testfx.api.FxToolkit; import org.testfx.framework.junit5.ApplicationExtension; import org.testfx.framework.junit5.Start; import javafx.scene.Scene; import javafx.scene.input.KeyCode; import javafx.stage.Stage; +import org.testfx.util.WaitForAsyncUtils; +import unicash.MainApp; + +import java.util.concurrent.TimeoutException; @ExtendWith(ApplicationExtension.class) @@ -18,6 +24,14 @@ public class CommandBoxUiTest { private CommandBox commandBox; + @BeforeEach + public void runAppToTests() throws TimeoutException { + FxToolkit.registerPrimaryStage(); + FxToolkit.setupApplication(() -> new MainApp()); + FxToolkit.showStage(); + WaitForAsyncUtils.waitForFxEvents(100); + } + @Start public void start(Stage stage) { CommandBox.CommandExecutor dummyExecutor = (commandText) -> {