javajavafxautomated-teststestfx

TestFX working with popup


I have a scene in JavaFX in which there is a CustomTextField with an autocomplete function. When user is typing a popup is opened with more columns. I have done an automatic scenario in TestFX witch is typing in the CustomTextField.

Is there any way to navigate through the popup, through it's columns?

clickOn(article2SearchTxt);
write(cfgUiTest.article2SearchVal);
push(KeyCode.ENTER);

The structure is: Scene, Popup, HBox, VBox, Cells. Actually there is a popup with columns from a database. Content of Popup is HBox and VBox. (a table) I want to access the content of the cells. With "clickOn" on the text is not working, but if I get the content of the cell I can move with "TAB" over it and press "ENTER"

If I do a sysout on this:

System.out.println(((PopupColumn) ((VBox) IntellitaxUI.getPopup().getContentHBox().getChildren().get(5)).getChildren().get(2)).getItems());

I get the content of the cells but in a TextFlow. Ho can I get the content of it?

selectedItem popupcontent selectedItem], TextFlow@7f3d205f[styleClass=popupcontent selectedItem], TextFlow@761997b6[styleClass=popupcontent selectedItem], TextFlow@777a8ef1[styleClass=popupcontent selectedItem], TextFlow@6a680ebb[styleClass=popupcontent selectedItem], TextFlow@50f69067[styleClass=popupcontent selectedItem], 

Solution

  • The navigation through a popup with rows/columns can be done by two ways:

    1) Emulating DOWN/UP/LEFT/RIGHT arrow pressing:

    press(KeyCode.DOWN).release(KeyCode.DOWN);
    

    2) Emulating mouse click or double click on a specific text:

    clickOn("expected text");
    doubleClickOn("expected text");
    

    UPDATE:

    According to your println expression and its result I draw by hand the next model of your table:

    enter image description here

    What I can see is a collection of TextFlow controls in each cell. Is it correct? May be only one TextFlow is to be in the cell?

    BTW, why not to use the standard TableView control for database data presentation?