-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to interact with FileChooser #715
Comments
Facing the same issue. Googling, I found this variant of FileChooser, claiming to be testable using TestFX. I don't know yet if it's any good, or if there are better options. |
I think, JavaFX uses the platforms native file chooser. Hence, the robot is not able to interact with these elements. May be this is something to be discussed also for JavaFX/OpenJFX in general. Besides that, the FXFileChooser is currently kind of outdated and requires some more care to get it into shape. Nevertheless, its plain JavaFX inside and as such it can be tested using TestFX. But it's still on JavaFX8 and Java8. |
My solution was to abstract the file choosing logic away using an interface. When testing, I set up a mock instance which will return the file I want for this test. Works perfectly fine. |
File chooser is declared inside the controller class:
User clicks the add button which opens the file chooser. Returned files are then processed
public void add() {
List files = fileChooser.showOpenMultipleDialog(stage);
process(files);
}
After the file chooser is launched, TestFX is unable to interact with the file chooser. clickOn, doubleClickOn, press or write don't work. I am not even able to close the chooser dialog.
I need the test to select a file and return back. How can this be achieved?
Expected Behavior
Select a file and return
Actual Behavior
Does nothing
To get the fastest possible support, create a minimal example
and upload it to GitHub.
Specifications
The text was updated successfully, but these errors were encountered: