My scenario is that from my app I open the waze wait 25sec, go to home screen, wait 10sec, than the system move back to waze, than I wait 15sec than again going to home page and wait there 10sec,
mainScreen.openWaze();
TimeWatch watch = TimeWatch.start();
double passedTimeInSeconds = 0;
System.out.println("start");
while (passedTimeInSeconds < 26.0) {
passedTimeInSeconds = watch.time(TimeUnit.SECONDS);
System.out.println("the seconds of 1 " + passedTimeInSeconds);
wazeInApp.validateWhereToField();
}
watch.reset();
passedTimeInSeconds = 0;
wazeInApp.goToHomeScreen();
while (passedTimeInSeconds < 11.0) {
passedTimeInSeconds = watch.time(TimeUnit.SECONDS);
System.out.println("the seconds of 2 " + passedTimeInSeconds);
wazeInApp.validateWhereToField();
}
watch.reset();
passedTimeInSeconds = 0;
while (passedTimeInSeconds < 16.0) {
passedTimeInSeconds = watch.time(TimeUnit.SECONDS);
System.out.println("the seconds 3 " + passedTimeInSeconds);
wazeInApp.validateWhereToField();
}
wazeInApp.goToHomeScreen();
my console prints :
start
the seconds of 1 0.0
the seconds of 1 12.0
the seconds of 1 13.0
the seconds of 1 13.0
the seconds of 1 34.0
the seconds of 2 0.0
the seconds of 2 0.0
the seconds of 2 0.0
the seconds of 2 0.0
the seconds of 2 9.0
the seconds of 2 15.0
the seconds 3 0.0
the seconds 3 2.0
the seconds 3 4.0
the seconds 3 6.0
the seconds 3 9.0
the seconds 3 11.0
the seconds 3 13.0
the seconds 3 34.0
it looks strange that the prints are not at the correct time, also it beyond the time limits , and also does these is the right solution for just wait (for nothing)? Thank you