MDL-51102 behat: Add a non-JS version of wait
authorAndrew Nicols <andrew@nicols.co.uk>
Thu, 13 Aug 2015 07:56:22 +0000 (15:56 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Thu, 13 Aug 2015 07:56:22 +0000 (15:56 +0800)
lib/tests/behat/behat_general.php

index 31fd15c..7781fb6 100644 (file)
@@ -244,12 +244,11 @@ class behat_general extends behat_base {
      * @param int $seconds
      */
     public function i_wait_seconds($seconds) {
-
-        if (!$this->running_javascript()) {
-            throw new DriverException('Waits are disabled in scenarios without Javascript support');
+        if ($this->running_javascript()) {
+            $this->getSession()->wait($seconds * 1000, false);
+        } else {
+            sleep($seconds);
         }
-
-        $this->getSession()->wait($seconds * 1000, false);
     }
 
     /**