in a unit test a new window is created (via FXML). When calling write("something") the text is not written into the textfield in new window but to the previous window.
When doing the same thing in the real application this is working (and I think to remember that this also worked in 3.x). Before showing the stage an explicit call to Stage.requestFocus() is made.
After setting the new window via target() the text is written into the correct window/textfield. But is there an easier approach that the target() is already set correctly?
Bernhard
Bernhard
--
You received this message because you are subscribed to the Google Groups "TestFX" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testfx-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
the "problem" is that I have to verify that the text is written into the correct textfield even without clicking anywhere.
That is, the target for the text should be the same as it would be when running "live".
Of course I could set the target manually or via clickOn(), but then I am not testing the scenario I want to.
We call Stage.requestFocus() manually, but tests have shown this is not really necessary.
+Bernhard
I extended the API and implemented a type(String) method that uses type(KeyCode) internally (supports alpha-numeric characters, could be extended to suppert e.g. whitespace etc.). Then it works as expected for me (without the need to call requestFocus()).
Will send you a Pull Request for this.
Cheers,
Bernhard