MDL-50516 core_behat: added ability to go back, forward and reload the browser

This commit is contained in:
Mark Nelson 2015-08-10 16:45:38 -07:00 committed by Andrew Nicols
parent 139645d4a7
commit 051b45f864

View File

@ -1413,4 +1413,25 @@ class behat_general extends behat_base {
fwrite(STDOUT, "\033[2A\033[u\033[2B");
}
}
/**
* Presses a given button in the browser.
*
* @Then /^I press the "(back|forward|reload)" button in the browser$/
* @param string $button the button to press.
* @throws ExpectationException
*/
public function i_press_in_the_browser($button) {
$session = $this->getSession();
if ($button == 'back') {
$session->back();
} else if ($button == 'forward') {
$session->forward();
} else if ($button == 'reload') {
$session->reload();
} else {
throw new ExpectationException('Unknown browser button.', $session);
}
}
}