MDL-55071 behat: Normalise space on multi-field admin elements
authorFrédéric Massart <fred@moodle.com>
Tue, 27 Sep 2016 13:59:48 +0000 (15:59 +0200)
committerFrédéric Massart <fred@moodle.com>
Tue, 27 Sep 2016 15:39:29 +0000 (17:39 +0200)
admin/templates/setting_courselist_frontpage.mustache
admin/tests/behat/behat_admin.php

index 1cde3aa..2fe18cc 100644 (file)
@@ -39,7 +39,7 @@
 }}
 <div class="form-group">
     {{#selects}}
-        <select id="{{id}}{{key}}" name="{{name}}[]">
+        <select id="{{id}}{{key}}" name="{{name}}[]" class="form-select">
             {{#options}}
                 <option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
             {{/options}}
index 3f5cb46..73ce572 100644 (file)
@@ -89,8 +89,10 @@ class behat_admin extends behat_base {
             } catch (ElementNotFoundException $e) {
 
                 // Multi element settings, interacting only the first one.
-                $fieldxpath = "//*[label[.= $label]|span[.= $label]]/ancestor::div[contains(concat(' ', normalize-space(@class), ' '), ' form-item ')]" .
-                    "/descendant::div[@class='form-group']/descendant::*[self::input | self::textarea | self::select][not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')]";
+                $fieldxpath = "//*[label[normalize-space(.)= $label]|span[normalize-space(.)= $label]]/" .
+                    "ancestor::div[contains(concat(' ', normalize-space(@class), ' '), ' form-item ')]" .
+                    "/descendant::div[@class='form-group']/descendant::*[self::input | self::textarea | self::select]" .
+                    "[not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')]";
                 $fieldnode = $this->find('xpath', $fieldxpath);
 
                 // It is the same one that contains the type.