0

During autotest execution ( lib is used to interact with Java GUI elements) address data is entered and button 'Search for address' is pressed. At some addresses notification dialog with progressbar are displayed:

enter image description here

Code of submitAddress function:

public void submitAddress(JFrameOperator flsFrame) {
    // II
    JButtonOperator searchByAddressButton = new JButtonOperator(flsFrame, Chooser.chooseButtonByToolTipText("Открыть квартиру"));

    long start = System.currentTimeMillis();
    searchByAddressButton.clickMouse();

    JTabbedPaneOperator tab = new JTabbedPaneOperator(flsFrame, 0);
    long time = System.currentTimeMillis() - start;
    System.out.println("\nAddress has not been found within " + time + "ms\n");
}

When I set breakpoint on JtabbedPane initialization, execution pointer does not come to it untill I press OK on notification dialog. So the test is halting at searchByAddressButton.clickMouse();

I tried to set following timeouts to 5000 milliseconds but it was in vain (full list of timeouts at jemmy.java.net):

  • Test.WholeTestTimeout
  • ComponentOperator.WaitComponentTimeout
  • ActionProducer.MaxActionTime
  • DialogWaiter.WaitDialogTimeout
  • EventDispatcher.WaitQueueEmptyTimeout
  • EventDispatcher.WaitQueueEmptyTimeout
  • QueueTool.WaitQueueEmptyTimeout
  • QueueTool.LockTimeout
  • ButtonOperator.PushButtonTimeout
  • JProgressBarOperator.WaitValueTimeout

using the following code:

JemmyProperties.setCurrentTimeout("Test.WholeTestTimeout", 5000);

As you see even the whole test timeout does not help to identify that test is strucked at searchByAddressButton.clickMouse();

Any advices, suggestions?

Temporary solution

Set test execution timeout in test annotation

@Test(timeOut = 30000)
public void testOpenFlsTabs() throws Exception {
    ...
0

The solution is to use NoBlock operation (.pushNoBlock();, .pushMenuNoBlock("File|Open");) with manually set timer ComponentOperator.WaitComponentTimeout and checking for any new component that should appear in GUI:

JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 5000); // 5 seconds
...
searchByAddressButton.pushNoBlock();
new JTabbedPaneOperator(flsFrame, 0);   // check that new object has appeared (in 5 seconds)
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.