MDL-77092 Behat: Expand all fieldsets fails with single fieldset

The Behat step to expand all fieldsets did not work if the page
contains only one fieldset.
This commit is contained in:
sam marshall 2023-01-31 13:55:59 +00:00
parent 880462a168
commit b639c1455a
2 changed files with 18 additions and 1 deletions

View File

@ -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,

View File

@ -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"