These are chat archives for Behat/Behat

15th
Jun 2018
SamyOteroGlez
@SamyOteroGlez
Jun 15 2018 12:25
there is a function to wait certain amount of time. $this->getDriver()->wait()
Christophe Coevoet
@stof
Jun 15 2018 12:28
well, if you just want to wait for some time, usleep would be more efficient actually. The driver API is most useful to pass a JS expression as condition, to wait until it becomes truthy (in the limited of the provided time)
Vinícius
@vinicius978
Jun 15 2018 13:37
@SamyOteroGlez I just want to wait the amount of time taken to element appear on screen after the AJAX finished. Got it?
@stof how can i user this driver API?
SamyOteroGlez
@SamyOteroGlez
Jun 15 2018 20:20
@vinicius978
You could use usleep, as @stof sugested, and wait enough time (lets say, if it usually take 10 sec to do the query and to show the element, you could wait for 30 sec, but that's dirty, it will prove your concept, but dirty). Or you could implement some with $this->getDriver()->wait() evaluating the javascript in charge to launch the element you are waiting for.
@vinicius978
You could also use this same logic but adapted to your needs. In that post the intent is to test a modal launched by a js action.
https://stackoverflow.com/questions/43879989/how-to-test-a-bootstrap-modal-using-behat-mink-and-selenium-standalone-server