From ab0cff0b6cb5929d350a53f236f5ca7e961c3981 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Mon, 22 Jan 2024 13:19:39 +0100 Subject: [PATCH] MOBILE-3947 behat: Fix close popup step This step was also working for other elements such as ion-alert before upgrading to ionic 7, so we should keep the same behaviour. --- src/testing/services/behat-runtime.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/testing/services/behat-runtime.ts b/src/testing/services/behat-runtime.ts index e7813e513..a55962086 100644 --- a/src/testing/services/behat-runtime.ts +++ b/src/testing/services/behat-runtime.ts @@ -190,10 +190,15 @@ export class TestingBehatRuntimeService { closePopup(): string { this.log('Action - Close popup'); - const backdrops = Array - .from(document.querySelectorAll('ion-popover, ion-modal')) - .map(popover => popover.shadowRoot?.querySelector('ion-backdrop')) - .filter(backdrop => !!backdrop); + const backdrops = [ + ...Array + .from(document.querySelectorAll('ion-popover, ion-modal')) + .map(popover => popover.shadowRoot?.querySelector('ion-backdrop')) + .filter(backdrop => !!backdrop), + ...Array + .from(document.querySelectorAll('ion-backdrop')) + .filter(backdrop => !!backdrop.offsetParent), + ]; if (!backdrops.length) { return 'ERROR: Could not find backdrop';