Skip to content

Commit

Permalink
[ESQUE-19] Added rudimentary FX test
Browse files Browse the repository at this point in the history
  • Loading branch information
grofoli committed Mar 15, 2019
1 parent b58b636 commit 308817e
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pom.xml
Expand Up @@ -88,6 +88,14 @@
<version>1.1</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.testfx/testfx-junit -->
<dependency>
<groupId>org.testfx</groupId>
<artifactId>testfx-junit</artifactId>
<version>4.0.15-alpha</version>
<scope>test</scope>
</dependency>


</dependencies>

Expand Down
38 changes: 38 additions & 0 deletions src/test/java/at/esque/kafka/dialog/TraceInputDialogTest.java
@@ -0,0 +1,38 @@
package at.esque.kafka.dialog;

import at.esque.kafka.dialogs.TraceInputDialog;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import org.junit.Before;
import org.junit.Test;
import org.testfx.api.FxToolkit;
import org.testfx.framework.junit.ApplicationTest;

import java.util.concurrent.TimeoutException;

import static org.testfx.assertions.api.Assertions.assertThat;

public class TraceInputDialogTest extends ApplicationTest {

@Before
public void setup() throws TimeoutException {
FxToolkit.setupSceneRoot(() -> {
Button openDialogButton = new Button("Open Dialog");
openDialogButton.setId("openDialog");
openDialogButton.setOnAction(event -> {
TraceInputDialog.show(true, false);
});
StackPane root = new StackPane(openDialogButton);
root.setPrefSize(800, 500);
return new StackPane(root);
});
FxToolkit.setupStage(Stage::show);
}

@Test
public void shouldContainFastTraceForNonAvroKey(){
clickOn("#openDialog");
assertThat(targetWindow("Trace Key").lookup(".label").nth(2).queryLabeled().getText()).contains("fast trace");
}
}

0 comments on commit 308817e

Please sign in to comment.