From 34503872770053da5f2baf90be089e58155477fa Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Mon, 29 Jun 2020 11:27:05 +0800 Subject: [PATCH] MDL-69136 behat: Support find on a NodeElement --- lib/behat/behat_base.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/behat/behat_base.php b/lib/behat/behat_base.php index 729ac1eff9b..c97f492b696 100644 --- a/lib/behat/behat_base.php +++ b/lib/behat/behat_base.php @@ -119,6 +119,11 @@ class behat_base extends Behat\MinkExtension\Context\RawMinkContext { * @return NodeElement */ protected function find($selector, $locator, $exception = false, $node = false, $timeout = false) { + if ($selector === 'NodeElement' && is_a($locator, NodeElement::class)) { + // Support a NodeElement being passed in for use in step chaining. + return $locator; + } + // Returns the first match. $items = $this->find_all($selector, $locator, $exception, $node, $timeout); return count($items) ? reset($items) : null; -- 2.43.0