I am currently facing a weird issue using java awaitility library. I am using awaitility to wait for a minute and check one condition using the below statement.
String currentTime = getAvailableDriveTime();
await("Wait for time")
.atMost(60, TimeUnit.SECONDS)
.until(this::getDriveTime, not(currentTime));
public String getDriveTime() {
String driveTime = appiumDriver.getPageSource();
driveTime = driveTime.split("CurrentTimeString\":\"")[1];
return driveTime.split("\",\"ArcColor\"")[0];
}
The weird part is, the above statement works fine with a sample Appium Test script, but the same does not work with a cucumber+Appium+ java framework and throws the following error.
java.lang.NoSuchMethodError: org.hamcrest.Matcher.describeMismatch(Ljava/lang/Object;Lorg/hamcrest/Description;)
at org.awaitility.core.AbstractHamcrestCondition.getMismatchMessage(AbstractHamcrestCondition.java:76)
at org.awaitility.core.AbstractHamcrestCondition.access$300(AbstractHamcrestCondition.java:25)
at org.awaitility.core.AbstractHamcrestCondition$1.eval(AbstractHamcrestCondition.java:55)
at org.awaitility.core.ConditionAwaiter$ConditionPoller.call(ConditionAwaiter.java:190)
at org.awaitility.core.ConditionAwaiter$ConditionPoller.call(ConditionAwaiter.java:177)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
at ✽.Driving time in the driving overview screen will be updated(file:src/main/resources/EFSFeatureFiles/HOS&DVIR/VehicleMotionFeature/EFSVehicleMotion_DriverLoggedIn.feature:83)