Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I do not know what are your robot settings but you can at least try to set idleTimeout and other timeouts for the robot you use. The default timeout is 10 sec (look in org.fest.swing.core.Settings). After I decrease it (first 1000ms, next 100ms) I noticed that robot works faster.</p> <pre><code>robot().settings().idleTimeout(YOUR_TIMEOUT) </code></pre> <p>Here is my test setup and one test method. Hope is clear. Here you have my before/after</p> <pre><code>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 { // my workaround to be able to start the app once and reuse for all tests if (testMethodCounter == 0) { robot2 = BasicRobot.robotWithNewAwtHierarchy(); GuiActionRunner.execute(new GuiTask() { @Override protected void executeInEDT() throws Throwable { ApplicationLauncher.application(ProgramRun.class).start(); } }); } else { // the second test method see all before created gui components 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(); } @Test public void someSmokeTest() throws Exception { Pause.pause(1000); // perform some test specific gui actions // here is very important moment, I need new robot because // workbenchFrame.button(ButtonNames.SOME_BUTTON_NAME).click(); creates new dialog // which will be avilable in AWT stack after creation robot2.cleanUpWithoutDisposingWindows(); robot2 = BasicRobot.robotWithCurrentAwtHierarchy(); // the new Robot needs timeout setup // without this I have long breaks between gui events robot2.settings().idleTimeout(myIdleTimeout); workbenchFrame.button(ButtonNames.SOME_BUTTON_NAME).click(); DialogFixture dialog = WindowFinder.findDialog("dialog2") .withTimeout(5000).using(robot2); // some actions on the dialog // once again next new dialog workbenchFrame.menuItem(MenuItemNames.NAME).click(); robot2.cleanUpWithoutDisposingWindows(); robot2 = BasicRobot.robotWithCurrentAwtHierarchy(); // and idleTimeout setup once again, new Robot needs new setup robot2.settings().idleTimeout(myIdleTimeout); // next actions + assertion } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload