Skip to content
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

How to synchronize on enterText? #48

Open
AlexanderZobkov opened this issue Jan 29, 2016 · 2 comments
Open

How to synchronize on enterText? #48

AlexanderZobkov opened this issue Jan 29, 2016 · 2 comments
Labels

Comments

@AlexanderZobkov
Copy link

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.

@renatoathaydes
Copy link
Owner

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...

@AlexanderZobkov
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants