MDL-46891 behat: Phantomjs require explicit change event
authorRajesh Taneja <rajesh@moodle.com>
Thu, 25 Feb 2016 05:39:33 +0000 (13:39 +0800)
committerRajesh Taneja <rajesh@moodle.com>
Fri, 11 Mar 2016 02:51:16 +0000 (10:51 +0800)
It fails with multiple select while selecting group

group/tests/behat/behat_groups.php

index 6ab66d8..daede1d 100644 (file)
@@ -62,6 +62,11 @@ class behat_groups extends behat_base {
         $fulloption = $groupoption->getText();
         $select->selectOption($fulloption);
 
+        // This is needed by some drivers to ensure relevant event is triggred and button is enabled.
+        $script = "Syn.trigger('change', {}, {{ELEMENT}})";
+        $this->getSession()->getDriver()->triggerSynScript($select->getXpath(), $script);
+        $this->getSession()->wait(self::TIMEOUT * 1000, self::PAGE_READY_JS);
+
         // Here we don't need to wait for the AJAX response.
         $this->find_button(get_string('adduserstogroup', 'group'))->click();