2

I'm trying to use waitUntil() method from TestFX to wait until a dialog appears on the screen. I found the example provided by the Wiki, but it doesn't seem to work with me. Can anyone help me to figure this out?

2 Answers2

3

You can use this method also:

import org.testfx.util.WaitForAsyncUtils;

WaitForAsyncUtils.waitFor(10, TimeUnit.SECONDS, new Callable<Boolean>() {
    @Override
    public Boolean call() throws Exception {
        return find(".dialog-pane").isVisible();
    }
});

With this solution you can also define the TimeUnit.

Hemã Vidal
  • 1,742
  • 2
  • 17
  • 28
2

I managed to resolve this by using:

import org.hamcrest.Matchers;
import org.loadui.testfx.controls.impl.VisibleNodesMatcher;

waitUntil(".dialog-pane", Matchers.is(VisibleNodesMatcher.visible()));
  • You can also pass timeout parameter in seconds: waitUntil(".dialog-pane", Matchers.is(VisibleNodesMatcher.visible()), 10); – Hemã Vidal May 23 '17 at 19:15