diff --git a/lib/tests/behat/behat_general.php b/lib/tests/behat/behat_general.php index 711a910dea4..39731ea3dc8 100644 --- a/lib/tests/behat/behat_general.php +++ b/lib/tests/behat/behat_general.php @@ -1833,4 +1833,16 @@ EOF; $node = $this->get_selected_node($selectortype, $element); $this->js_trigger_click($node); } + + /** + * Visit a local URL relative to the behat root. + * + * @When I visit :localurl + * + * @param string|moodle_url $localurl The URL relative to the behat_wwwroot to visit. + */ + public function i_visit($localurl): void { + $localurl = new moodle_url($localurl); + $this->getSession()->visit($this->locate_path($localurl->out_as_local_url(false))); + } }