1

What Matcher should I use? visible() seems no longer available and unfortunately I could not find an alternative in the org.hamcrest library.

Thanks in advance!

Adam Papp
  • 11
  • 4

1 Answers1

1

You may use Awaitility utility.

This is an example of a utility method where it waits by default up to 10 seconds starting after 10 milliseconds:

public <T extends Node> T lookupById(final String controlId) {
    Awaitility
            .await()
            .pollDelay(10, TimeUnit.MILLISECONDS)
            .until(() -> robot.lookup(controlId).query() != null);

    return robot.lookup(controlId).query();
}

You may implement any condition of waiting, for example, checking of additional visibility property, etc.

The result of negative scenario:

org.awaitility.core.ConditionTimeoutException: Condition with lambda expression in com.MyClass was not fulfilled within 10 seconds.
Dmytro Maslenko
  • 2,247
  • 9
  • 16