From 80a26121fdc479b5f0447bff8c977fd98e9be0d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Mon, 2 Sep 2024 16:14:11 +0200 Subject: [PATCH] MOBILE-4616 behat: Fix go to parent element in closest matching --- src/testing/services/behat-dom.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/testing/services/behat-dom.ts b/src/testing/services/behat-dom.ts index 5cba89ad5..73b812e74 100644 --- a/src/testing/services/behat-dom.ts +++ b/src/testing/services/behat-dom.ts @@ -375,11 +375,12 @@ export class TestingBehatDomUtilsService { return element; } - if (element === container || !element.parentElement) { + const parent = this.getParentElement(element); + if (element === container || !parent) { return null; } - return this.getClosestMatching(element.parentElement, selector, container); + return this.getClosestMatching(parent, selector, container); } /**