Automated ui testing and keyboard events


I’m trying to create an automated UI testing framework called haxeium (currently focusing on supporting HaxeUI, with plans to also support FeathersUI and maybe OpenFl directly) and the way it works is that there is one part that gets linked in with your app and runs inside of it. and the second part is a test app running testcases using utest and haxeium lib to communicate and control your app.
it’s basically meant to be somewhat of an equivalent of selenium but for Haxe applications (of course it’s nowhere close currently, but that’s the general idea behind it).

now I’m struggling with keyboard events. I would like to emit keyboard events in a way that they show up in input fields just like they would from a regular keyboard. my attempts have been less than successful, but I don’t really understand how keyboard stuff works in OpenFl / Lime, so that might be just me looking at all the wrong places.

is there a way to simulate keyboard events and let them be handled by all the right places so that they show up in input fields?

I think that you need to use stage.window.onTextInput.dispatch("new text") to get input TextFields to recognize your input. onTextInput is a Lime API.

There is also onKeyDown and onKeyUp for special keys, like Backspace/Delete/Enter.


thanks, that seems to be the way to go. I’ll probably also send mouse events through there, so I don’t send events directly to components.