I am using FEST to test my Java dialogs and I need to test that a new modal dialog is created.
@Before
public void setUp() throws Exception {
    TestFrame testFrame = GuiActionRunner.execute(new GuiQuery<TestFrame>() {
        @Override
        protected TestFrame executeInEDT() throws Throwable {
            panel = new CustomPanel();
            return new TestFrame(panel);
        }
    });
    frameFixture = new FrameFixture(testFrame);
    frameFixture.show();
    frameFixture.robot.waitForIdle();
}
Note: TestFrame is a helper class which extends JFrame for use in unit testing.
In my test, I click a button which makes a modal dialog appear. I am trying to find and verify the dialog is created, however all of my attempts aren't able to find anything:
WindowFinder.findDialog("Window Title")).using(robot);
Where robot =
I have also tried specifying the lookup scope of the robot:
robot.settings().componentLookupScope(ComponentLookupScope.ALL);
There are lots of FEST examples online which make a call to robot() but I can't find out how or what this robot function is supposed to be.
Why am I unable to find my newly created popup dialog?
Try adding a lookup time:
WindowFinder.findDialog(MyDialog.class).withTimeout(10000).using(robot);
For more info: http://fest.googlecode.com/svn-history/r458/trunk/fest/fest-swing/javadocs/org/fest/swing/fixture/util/WindowFinder.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With