MDL-56511 behat: Fix failing behat tests (again)
authorDavid Monllao <davidm@moodle.com>
Fri, 20 Apr 2018 12:25:10 +0000 (14:25 +0200)
committerDavid Monllao <davidm@moodle.com>
Fri, 20 Apr 2018 13:52:58 +0000 (15:52 +0200)
lib/templates/action_menu_trigger.mustache
theme/boost/templates/core/action_menu_trigger.mustache
theme/boost/tests/behat/behat_theme_boost_behat_action_menu.php
theme/boost/tests/behat/contextmenu.feature
theme/boost/tests/behat/regionmainsettingsmenu.feature

index 2a79115..fce1a8b 100644 (file)
@@ -27,4 +27,4 @@
         "triggerextraclasses": ""
     }
 }}
-<a href="#" class="{{triggerextraclasses}} toggle-display {{#menutrigger}}textmenu{{/menutrigger}}" id="action-menu-toggle-{{instance}}" title="{{title}}">{{{actiontext}}}{{{menutrigger}}}{{#icon}}{{#pix}}{{key}}, {{component}}, {{title}}{{/pix}}{{/icon}}{{#rawicon}}{{{.}}}{{/rawicon}}{{#menutrigger}}<b class="caret"></b>{{/menutrigger}}</a>
+<a href="#" class="{{triggerextraclasses}} toggle-display {{#menutrigger}}textmenu{{/menutrigger}}" id="action-menu-toggle-{{instance}}" title="{{title}}" role="menuitem">{{{actiontext}}}{{{menutrigger}}}{{#icon}}{{#pix}}{{key}}, {{component}}, {{title}}{{/pix}}{{/icon}}{{#rawicon}}{{{.}}}{{/rawicon}}{{#menutrigger}}<b class="caret"></b>{{/menutrigger}}</a>
index f5078f9..e53f52b 100644 (file)
@@ -78,7 +78,7 @@
     }
 }}
 <div class="dropdown">
-    <a href="#" class="{{triggerextraclasses}} dropdown-toggle" id="dropdown-{{instance}}" title="{{title}}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+    <a href="#" class="{{triggerextraclasses}} dropdown-toggle" id="dropdown-{{instance}}" title="{{title}}" role="menuitem" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
         {{{actiontext}}}
         {{{menutrigger}}}
             {{#icon}}
index c7e536b..1559792 100644 (file)
@@ -39,7 +39,7 @@ class behat_theme_boost_behat_action_menu extends behat_action_menu {
 
     public function i_open_the_action_menu_in($element, $selectortype) {
         // Gets the node based on the requested selector type and locator.
-        $node = $this->get_node_in_container("css_element", "[role=button][aria-haspopup=true]", $selectortype, $element);
+        $node = $this->get_node_in_container("css_element", "[role=menuitem][aria-haspopup=true]", $selectortype, $element);
 
         // Check if it is not already opened.
         if ($node->getAttribute('aria-expanded') === 'true') {
index 7e5a100..f884b25 100644 (file)
@@ -18,7 +18,7 @@ Feature: Context settings menu
   Scenario: Teacher can use the context settings menu
     And I log in as "teacher1"
     And I am on "Course 1" course homepage
-    And I click on ".context-header-settings-menu [role=button]" "css_element"
+    And I click on ".context-header-settings-menu [role=menuitem]" "css_element"
     And I choose "Edit settings" in the open action menu
     And I should see "Edit course settings"
     And I log out
@@ -26,5 +26,5 @@ Feature: Context settings menu
   Scenario: Student cannot use the context settings menu
     And I log in as "student1"
     And I am on "Course 1" course homepage
-    And ".context-header-settings-menu [role=button]" "css_element" should not exist
+    And ".context-header-settings-menu [role=menuitem]" "css_element" should not exist
     And I log out
index 37fd450..fc1824f 100644 (file)
@@ -21,13 +21,13 @@ Feature: Region main settings menu
   Scenario: Teacher can use the region main settings menu
     And I log in as "teacher1"
     And I am on "Course 1" course homepage
-    And "#region-main-settings-menu [role=button]" "css_element" should not exist
+    And "#region-main-settings-menu [role=menuitem]" "css_element" should not exist
     And I follow "Choice name"
-    And I click on "#region-main-settings-menu [role=button]" "css_element"
+    And I click on "#region-main-settings-menu [role=menuitem]" "css_element"
     And I choose "Edit settings" in the open action menu
     And I should see "Updating: Choice"
     And I navigate to course participants
-    And I click on "#region-main-settings-menu [role=button]" "css_element"
+    And I click on "#region-main-settings-menu [role=menuitem]" "css_element"
     And I choose "Enrolment methods" in the open action menu
     And I should see "Enrolment methods"
     And I log out
@@ -35,7 +35,7 @@ Feature: Region main settings menu
   Scenario: Student cannot use all options in the region main settings menu
     And I log in as "student1"
     And I am on "Course 1" course homepage
-    And "#region-main-settings-menu [role=button]" "css_element" should not exist
+    And "#region-main-settings-menu [role=menuitem]" "css_element" should not exist
     And I follow "Choice name"
-    And "#region-main-settings-menu [role=button]" "css_element" should not exist
+    And "#region-main-settings-menu [role=menuitem]" "css_element" should not exist
     And I log out