* Click on an entry in the user menu.
* @Given /^I follow "(?P<nodetext_string>(?:[^"]|\\")*)" in the user menu$/
*
- * @throws ExpectationException
* @param string $nodetext
* @return bool|void
*/
public function i_follow_in_the_user_menu($nodetext) {
+ $steps = array();
- // The user menu is broken without javascript.
- if (!$this->running_javascript()) {
- throw new DriverException('I follow in the user menu step is not available with Javascript disabled');
+ if ($this->running_javascript()) {
+ // The user menu must be expanded when JS is enabled.
+ $xpath = "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]";
+ $steps[] = new When('I click on "'.$xpath.'" "xpath_element"');
}
- $steps = array();
-
- $xpath = "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]";
+ // Now select the link.
+ // The CSS path is always present, with or without JS.
$csspath = ".usermenu [data-rel='menu-content']";
-
- $steps[] = new When('I click on "'.$xpath.'" "xpath_element"');
$steps[] = new When('I click on "'.$nodetext.'" "link" in the "'.$csspath.'" "css_element"');
return $steps;
-
}
/**