| @@ 187-200 (lines=14) @@ | ||
| 184 | $message = "The text '$expected' was not found after a $count seconds timeout"; |
|
| 185 | ||
| 186 | $found = false; |
|
| 187 | do { |
|
| 188 | try { |
|
| 189 | usleep(1000); |
|
| 190 | $node = $this->getSession()->getPage()->find('css', $element); |
|
| 191 | $this->assertContains($expected, $node->getText(), $message); |
|
| 192 | return; |
|
| 193 | } |
|
| 194 | catch (ExpectationException $e) { |
|
| 195 | /* Intentionaly leave blank */ |
|
| 196 | } |
|
| 197 | catch (StaleElementReference $e) { |
|
| 198 | // assume page reloaded whilst we were still waiting |
|
| 199 | } |
|
| 200 | } while (!$found && (time() - $startTime < $count)); |
|
| 201 | } |
|
| 202 | ||
| 203 | /** |
|
| @@ 241-252 (lines=12) @@ | ||
| 238 | $found = false; |
|
| 239 | $startTime = time(); |
|
| 240 | ||
| 241 | do { |
|
| 242 | try { |
|
| 243 | usleep(1000); |
|
| 244 | $node = $this->getSession()->getPage()->findAll('css', $element); |
|
| 245 | $this->assertCount(1, $node); |
|
| 246 | $found = true; |
|
| 247 | } |
|
| 248 | catch (ExpectationException $e) { |
|
| 249 | /* Intentionnaly leave blank */ |
|
| 250 | } |
|
| 251 | } |
|
| 252 | while (!$found && (time() - $startTime < $count)); |
|
| 253 | ||
| 254 | if ($found === false) { |
|
| 255 | $message = "The element '$element' was not found after a $count seconds timeout"; |
|