Ok, I have got it working with a workaround. The problem I had was with the execution of second test method. Component I was looging for could not be found. That is why I use the testMethodCounter.
private static int testMethodCounter = 0;
private static EmergencyAbortListener mEmergencyAbortListener;
private FrameFixture workbenchFrame;
private Robot robot2;
private static final int myIdleTimeout = 100;
@Before
public void setUp() throws Exception {
if (testMethodCounter == 0) {
robot2 = BasicRobot.robotWithNewAwtHierarchy();
GuiActionRunner.execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
ApplicationLauncher.application(VwGlobeRun.class).start();
}
});
} else {
robot2 = BasicRobot.robotWithCurrentAwtHierarchy();
}
testMethodCounter++;
robot2.settings().idleTimeout(myIdleTimeout);
workbenchFrame = WindowFinder.findFrame(FrameNames.WORKBENCH.getName()).withTimeout(10000)
.using(robot2);
}
@After
public void tearDown() {
// current window will not be closed
robot2.cleanUpWithoutDisposingWindows();
}
The second problem long breaks between gui events was because of default
idleTimeout in org.fest.swing.core.Settings class. In my test I need to
get the current AWT hierarchy, after some new dialogs are opened, and
for this I used >
robot2.cleanUpWithoutDisposingWindows();
robot2 = BasicRobot.robotWithCurrentAwtHierarchy();
and this line solves the problem with long breeaks between gui events.
robot2.settings().idleTimeout(some timeout);
I need detailed explanation why. If any of you know it please write it or contact me.
Regards,
Marcin