diff --git a/src/testing/services/behat-dom.ts b/src/testing/services/behat-dom.ts index 0c70025b9..5cba89ad5 100644 --- a/src/testing/services/behat-dom.ts +++ b/src/testing/services/behat-dom.ts @@ -46,6 +46,7 @@ export class TestingBehatDomUtilsService { isElementVisible(element: HTMLElement, container?: HTMLElement): boolean { if (element.getAttribute('aria-hidden') === 'true') { if ( + element.tagName === 'ION-ROUTER-OUTLET' && element === document.body.querySelector('ion-app > ion-router-outlet') && (document.body.querySelector('ion-toast.hydrated:not(.overlay-hidden)') || !document.body.querySelector( @@ -430,15 +431,13 @@ export class TestingBehatDomUtilsService { if (!container.classList.contains('ion-page')) { return false; } + if (container.closest('ion-router-outlet.content-outlet')) { + splitViewContainer = container; - const pageContainers = Array.from(container.querySelectorAll('.ion-page:not(.ion-page-hidden)')); - const topContainer = pageContainers.find((page) => !page.closest('.ion-page.ion-page-hidden')) ?? null; + return true; + } - splitViewContainer = (topContainer || container).querySelector( - 'core-split-view ion-router-outlet', - ); - - return !!splitViewContainer; + return false; }); return splitViewContainer ? [splitViewContainer] : [];