MDL-38410 behat: Step to select from radio inputs
authorDavid Monllao <davidm@moodle.com>
Tue, 12 Mar 2013 02:54:25 +0000 (10:54 +0800)
committerDavid Monllao <davidm@moodle.com>
Tue, 19 Mar 2013 08:42:59 +0000 (16:42 +0800)
lib/tests/behat/behat_forms.php

index 4ce8061..e2f9292 100644 (file)
@@ -179,6 +179,22 @@ class behat_forms extends behat_base {
         $selectnode->click();
     }
 
+    /**
+     * Selects the specified id|name|label from the specified radio button.
+     *
+     * @When /^I select "(?P<radio_button_string>(?:[^"]|\\")*)" radio button$/
+     * @throws ElementNotFoundException Thrown by behat_base::find
+     * @param string $radio
+     */
+    public function select_radio($radio) {
+
+        $radionode = $this->find_radio($radio);
+        $radionode->check();
+
+        // Adding a click as Selenium requires it to fire some JS events.
+        $radionode->click();
+    }
+
     /**
      * Checks checkbox with specified id|name|label|value.
      *