| @@ 203-216 (lines=14) @@ | ||
| 200 | $message = "The text '$expected' was not found after a $count seconds timeout"; |
|
| 201 | ||
| 202 | $found = false; |
|
| 203 | do { |
|
| 204 | try { |
|
| 205 | usleep(1000); |
|
| 206 | $node = $this->getSession()->getPage()->find('css', $element); |
|
| 207 | $this->assertContains($expected, $node->getText(), $message); |
|
| 208 | return; |
|
| 209 | } |
|
| 210 | catch (ExpectationException $e) { |
|
| 211 | /* Intentionaly leave blank */ |
|
| 212 | } |
|
| 213 | catch (StaleElementReference $e) { |
|
| 214 | // assume page reloaded whilst we were still waiting |
|
| 215 | } |
|
| 216 | } while (!$found && (time() - $startTime < $count)); |
|
| 217 | ||
| 218 | // final assertion... |
|
| 219 | $node = $this->getSession()->getPage()->find('css', $element); |
|
| @@ 261-272 (lines=12) @@ | ||
| 258 | $found = false; |
|
| 259 | $startTime = time(); |
|
| 260 | ||
| 261 | do { |
|
| 262 | try { |
|
| 263 | usleep(1000); |
|
| 264 | $node = $this->getSession()->getPage()->findAll('css', $element); |
|
| 265 | $this->assertCount(1, $node); |
|
| 266 | $found = true; |
|
| 267 | } |
|
| 268 | catch (ExpectationException $e) { |
|
| 269 | /* Intentionnaly leave blank */ |
|
| 270 | } |
|
| 271 | } |
|
| 272 | while (!$found && (time() - $startTime < $count)); |
|
| 273 | ||
| 274 | if ($found === false) { |
|
| 275 | $message = "The element '$element' was not found after a $count seconds timeout"; |
|