diff --git a/src/testing/services/behat-runtime.ts b/src/testing/services/behat-runtime.ts index bb0bd4740..0b938c175 100644 --- a/src/testing/services/behat-runtime.ts +++ b/src/testing/services/behat-runtime.ts @@ -186,17 +186,20 @@ export class TestingBehatRuntimeService { closePopup(): string { this.log('Action - Close popup'); - let backdrops = Array.from(document.querySelectorAll('ion-backdrop')); - backdrops = backdrops.filter((backdrop) => !!backdrop.offsetParent); + const backdrops = Array + .from(document.querySelectorAll('ion-popover, ion-modal')) + .map(popover => popover.shadowRoot?.querySelector('ion-backdrop')) + .filter(backdrop => !!backdrop); if (!backdrops.length) { return 'ERROR: Could not find backdrop'; } + if (backdrops.length > 1) { return 'ERROR: Found too many backdrops ('+backdrops.length+')'; } - const backdrop = backdrops[0]; - backdrop.click(); + + backdrops[0]?.click(); // Mark busy until the click finishes processing. TestingBehatBlocking.delay(); diff --git a/src/tests/behat/navigation_externallinks.feature b/src/tests/behat/navigation_externallinks.feature index 3b4c497d0..b68264704 100644 --- a/src/tests/behat/navigation_externallinks.feature +++ b/src/tests/behat/navigation_externallinks.feature @@ -18,7 +18,6 @@ Feature: It opens external links properly. | forum | user | name | message | | Test forum | student1 | Forum topic | See moodle.org external link | - @ionic7_failure Scenario: Click an external link Given I entered the forum activity "Test forum" on course "Course 1" as "student1" in the app When I press "Forum topic" in the app