Open AlexanderZobkov opened 8 years ago
I would do what waitForFxEvents()
does... if that doesn't help, I would try something more intrusive such as FXApp.doInFXThreadBlocking( () -> { } )
(in Groovy just remove the Java-lambda () ->
prefix).
This guarantees that any code after this line runs after enterText()
has run. If this also doesn't help, you've got a screen update delay in your machine... I would have to suggest enterText( "hi" ).pause( millis )
to let the screen update after a delay.
A more sophisticated approach would be to use waitForCondition()
, form the tempus-fugit library I suggest in the README page to deal with timing issues... but that would require you know of a way to confirm the text is actually visible in the screen with code.
By the way, don't you want to submit a PR with the code for taking screenshots? If you just add the code that does it, I can connect it with Automaton's error handling so you get the snapshot after a error is detected...
Thank you for your suggestions! Did not have a chance too try them, hope this week. Regarding the PR you mentioned, let me think what I can do regarding the PR.
In a test, a text that contains a non-Latin characters is entered into a TextArea by using fxter.clickOn(xxx).enterText(" non latin character goes here"). Just after the text is entered, a screen shot is taken. In most times, the entered text is not present in the screen shot taken.
Experiments show that the entered text will be present in the screen shot after some (millis)seconds between moments of entering the text and taking the screen shot.
What would be the approach to synchronize on the moment when the entered text is finally become visible on a form?
Unfortunately, waitForFxEvents() does not help here.