mirror of
https://github.com/moodle/moodle.git
synced 2025-03-19 15:10:05 +01:00
MDL-50516 core_behat: added ability to go back, forward and reload the browser
This commit is contained in:
parent
139645d4a7
commit
051b45f864
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user