These are chat archives for spockframework/spock

28th
Jul 2017
Juan Lucha
@Ravencrow
Jul 28 2017 08:42
Hello there guys!
I have a question. In a specific part of the program, I need to close a message. But the problem is that the message can be or cannot be there. So, in case it is there, I need to close it, and in case it isn't there, the test should continue. Another additional problem is that it may not be there at the beggining, but appear on 1 or 2 seconds later. How would you fix this issue?
I'm using spock with geb.
I tried with waitFor (2) { if ([button is there]) [close button] }
But it turn out that it failed with a "condition not met in time"
So I'm hacking very badly with something like this:
Juan Lucha
@Ravencrow
Jul 28 2017 08:47
Thread.sleep(2000)
if (tour.skipBtn.present) tour.skipBtn.click()
I have the understanding that using Thread.sleep is a hack of the worst type :D