diff --git a/lib/tests/behat/behat_forms.php b/lib/tests/behat/behat_forms.php index 323fbe485c7..7acbe001d40 100644 --- a/lib/tests/behat/behat_forms.php +++ b/lib/tests/behat/behat_forms.php @@ -152,7 +152,7 @@ class behat_forms extends behat_base { $expandsectionold = "//legend[@class='ftoggler']" . "//a[contains(concat(' ', @class, ' '), ' icons-collapse-expand ') and @aria-expanded = 'false']"; // Else, look for the first expand fieldset link (current theme structure). - $expandsectioncurrent = "//legend/div[contains(concat(' ', @class, ' '), ' ftoggler ')]" . + $expandsectioncurrent = "//fieldset//div[contains(concat(' ', @class, ' '), ' ftoggler ')]" . "//a[contains(concat(' ', @class, ' '), ' icons-collapse-expand ') and @aria-expanded = 'false']"; $collapseexpandlink = $this->find('xpath', $expandallxpath . '|' . $expandsectionold . '|' . $expandsectioncurrent, diff --git a/lib/tests/behat/expand_single_fieldset.feature b/lib/tests/behat/expand_single_fieldset.feature new file mode 100644 index 00000000000..e8057a2a096 --- /dev/null +++ b/lib/tests/behat/expand_single_fieldset.feature @@ -0,0 +1,17 @@ +@core +Feature: Expand single fieldset in Behat tests + In order to expand all fieldsets when there is only one + As a developer + I need Behat to successfully expand that fieldset + + @javascript + Scenario: Test expand all fieldsets when there is only one fieldset + Given I log in as "admin" + # This page was selected because it only has one fieldset. + When I navigate to "Users > Accounts > Upload users" in site administration + # Close the fieldset manually... + And I click on "//a[@data-toggle='collapse']" "xpath_element" + And I should not see "Example text file" + # Expand using 'expand all' step. + And I expand all fieldsets + Then I should see "Example text file"