diff --git a/admin/tests/behat/behat_admin.php b/admin/tests/behat/behat_admin.php index b2f9ae8fca2..987901491a3 100644 --- a/admin/tests/behat/behat_admin.php +++ b/admin/tests/behat/behat_admin.php @@ -80,7 +80,8 @@ class behat_admin extends behat_base { // Single element settings. try { $fieldxpath = "//*[self::input | self::textarea | self::select][not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')]" . - "[@id=//label[contains(normalize-space(.), $label)]/@for]"; + "[@id=//label[contains(normalize-space(.), $label)]/@for or " . + "@id=//span[contains(normalize-space(.), $label)]/preceding-sibling::label[1]/@for]"; $fieldnode = $this->find('xpath', $fieldxpath, $exception); $formfieldtypenode = $this->find('xpath', $fieldxpath . "/ancestor::div[@class='form-setting']" . @@ -89,7 +90,7 @@ class behat_admin extends behat_base { } catch (ElementNotFoundException $e) { // Multi element settings, interacting only the first one. - $fieldxpath = "//descendant::label[.= $label]/ancestor::div[contains(concat(' ', normalize-space(@class), ' '), ' form-item ')]" . + $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')]"; $fieldnode = $this->find('xpath', $fieldxpath); diff --git a/admin/tests/behat/set_admin_settings_value.feature b/admin/tests/behat/set_admin_settings_value.feature new file mode 100644 index 00000000000..4edbb5c46e1 --- /dev/null +++ b/admin/tests/behat/set_admin_settings_value.feature @@ -0,0 +1,27 @@ +@core @core_admin +Feature: Set admin settings value + In order to set admin settings value + As an admin + I need to set admin setting value and verify it is applied + + Background: + Given the following "courses" exist: + | fullname | shortname | category | + | Course fullname | C_shortname | 0 | + And I log in as "admin" + And I should see "Course fullname" + And I should not see "C_shortname Course fullname" + + Scenario: set admin value with full name + Given I set the following administration settings values: + | Display extended course names | 1 | + When I press "Save changes" + And I am on homepage + Then I should see "C_shortname Course fullname" + + Scenario: set admin value with short name + Given I set the following administration settings values: + | courselistshortnames | 1 | + When I press "Save changes" + And I am on homepage + Then I should see "C_shortname Course fullname" \ No newline at end of file