From 97abfe31ccef1144decb256100f40efc7fedc72d Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Thu, 25 Jun 2020 14:38:26 +0800 Subject: [PATCH] MDL-69138 behat: Add "I visit :localurl" step --- lib/tests/behat/behat_general.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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))); + } }