Skip to content

Commit

Permalink
MDL-75608 Behat: Expand all fieldsets step fails with single fieldset
Browse files Browse the repository at this point in the history
  • Loading branch information
sammarshallou committed Aug 30, 2022
1 parent 952d9e9 commit 49b4ff0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/tests/behat/behat_forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,14 @@ protected function expand_all_fields() {
$expandallxpath = "//div[@class='collapsible-actions']" .
"//a[contains(concat(' ', @class, ' '), ' collapsed ')]" .
"//span[contains(concat(' ', @class, ' '), ' expandall ')]";
// Else, look for the first expand fieldset link.
$expandonlysection = "//legend[@class='ftoggler']" .
// Else, look for the first expand fieldset link (old theme structure).
$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 ')]" .
"//a[contains(concat(' ', @class, ' '), ' icons-collapse-expand ') and @aria-expanded = 'false']";

$collapseexpandlink = $this->find('xpath', $expandallxpath . '|' . $expandonlysection,
$collapseexpandlink = $this->find('xpath', $expandallxpath . '|' . $expandsectionold . '|' . $expandsectioncurrent,
false, false, behat_base::get_reduced_timeout());
$collapseexpandlink->click();
$this->wait_for_pending_js();
Expand Down

0 comments on commit 49b4ff0

Please sign in to comment.