MDL-69136 behat: Support find on a NodeElement

This commit is contained in:
Andrew Nicols
2020-06-29 11:36:30 +08:00
parent 89ce4db476
commit 6f78024717
+5
View File
@@ -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;