MOBILE-3947 behat: Fix backdrop selector

Co-authored-by: NoelDeMartin <noel@moodle.com>
main
Pau Ferrer Ocaña 2023-12-15 16:09:40 +01:00
parent c5c0a57113
commit efee601918
2 changed files with 7 additions and 5 deletions

View File

@ -186,17 +186,20 @@ export class TestingBehatRuntimeService {
closePopup(): string { closePopup(): string {
this.log('Action - Close popup'); this.log('Action - Close popup');
let backdrops = Array.from(document.querySelectorAll('ion-backdrop')); const backdrops = Array
backdrops = backdrops.filter((backdrop) => !!backdrop.offsetParent); .from(document.querySelectorAll('ion-popover, ion-modal'))
.map(popover => popover.shadowRoot?.querySelector('ion-backdrop'))
.filter(backdrop => !!backdrop);
if (!backdrops.length) { if (!backdrops.length) {
return 'ERROR: Could not find backdrop'; return 'ERROR: Could not find backdrop';
} }
if (backdrops.length > 1) { if (backdrops.length > 1) {
return 'ERROR: Found too many backdrops ('+backdrops.length+')'; return 'ERROR: Found too many backdrops ('+backdrops.length+')';
} }
const backdrop = backdrops[0];
backdrop.click(); backdrops[0]?.click();
// Mark busy until the click finishes processing. // Mark busy until the click finishes processing.
TestingBehatBlocking.delay(); TestingBehatBlocking.delay();

View File

@ -18,7 +18,6 @@ Feature: It opens external links properly.
| forum | user | name | message | | forum | user | name | message |
| Test forum | student1 | Forum topic | See <a href="https://moodle.org/">moodle.org external link</a> | | Test forum | student1 | Forum topic | See <a href="https://moodle.org/">moodle.org external link</a> |
@ionic7_failure
Scenario: Click an external link Scenario: Click an external link
Given I entered the forum activity "Test forum" on course "Course 1" as "student1" in the app 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 When I press "Forum topic" in the app