MDL-43404 behat: Removing auto accept_alert
authorDavid Monllao <davidm@moodle.com>
Tue, 17 Dec 2013 08:29:56 +0000 (16:29 +0800)
committerDavid Monllao <davidm@moodle.com>
Tue, 17 Dec 2013 08:29:56 +0000 (16:29 +0800)
lib/tests/behat/behat_hooks.php

index 81285c0..401ab50 100644 (file)
@@ -210,15 +210,6 @@ class behat_hooks extends behat_base {
             self::$initprocessesfinished = true;
         }
 
-        // Closing JS dialogs if present. Otherwise they would block this scenario execution.
-        if ($this->running_javascript()) {
-            try {
-                $session->getDriver()->getWebDriverSession()->accept_alert();
-            } catch (NoAlertOpenError $e) {
-                // All ok, there should not be JS dialogs in theory.
-            }
-        }
-
     }
 
     /**
@@ -368,13 +359,6 @@ class behat_hooks extends behat_base {
 
         } catch (NoSuchWindow $e) {
             // If we were interacting with a popup window it will not exists after closing it.
-        } catch (UnexpectedAlertOpen $e) {
-            // We fail the scenario if we find an opened JS alert/confirm, in most of the cases it
-            // will be there because we are leaving an edited form without submitting/cancelling
-            // it, but moodle is using JS confirms and we can not just cancel the JS dialog
-            // as in some cases (delete activity with JS enabled for example) the test writer should
-            // use extra steps to deal with moodle's behaviour.
-            throw new Exception('Modal window present. Ensure there are no edited forms pending to submit/cancel.');
         }
     }