renatoathaydes / Automaton

Simple framework which allows the testing of Swing and JavaFX2 applications.
Apache License 2.0
100 stars 21 forks source link

always bring stage to front #12

Closed cwiejack closed 10 years ago

cwiejack commented 10 years ago

Hi,

I'm new to JavaFX and I just started playing around with JavaFX-UI Testing. Your Framework works very well, a big thank you for that.

What I recently came up with, is that I started debugging during a test is running. So the application under test goes in the background. If I continue the mouse moves to the correct location on screen, but types in my IDE because it is at the front.

So, it should be very easy to ensure that the stage is at the front each time an "action" is called at the FXer class.

def stage = FXApp.stage; //geter for stage must be added
...
FXer clickOn( String selector, Speed speed = DEFAULT ) {
        FXApp.doInFXThreadBlocking(new Runnable() {
            @Override
            void run() {
                stage.toFront()
            }
        })
        delegate.clickOn( this[ selector ], speed )
        this
    }

Do you think this is a good idea?

Regards Christian

renatoathaydes commented 10 years ago

Hi Christian. Thank you for your feedback! I saw this problem before as well, and think this is a good idea. If you want you can create a pull request for this!

renatoathaydes commented 10 years ago

Fixed with #16