Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
fix(tests): switch to main frame before navigating away in hangup() (#17681)
Дамян Минков0fe35a7a7563
diff --git a/tests/helpers/Participant.ts b/tests/helpers/Participant.tsindex 30b2003d81..a8a230885a 100644--- a/tests/helpers/Participant.ts+++ b/tests/helpers/Participant.ts@@ -792,6 +792,12 @@ export class Participant {);console.log(`Hung up (${this.name})`);+ // If the driver is currently focused on an iframe (iFrameApi mode), switch back to the+ // top-level context before navigating away. Otherwise driver.url() targets the iframe+ // browsing context instead of the outer page, which leaves the outer page still at the+ // conference URL and puts the driver in a broken state for any subsequent ensureOneParticipant call.+ await this.switchToMainFrame();+await this.driver.url('/base.html')// This was fixed in wdio v9.9.1, we can drop once we update to that versiondiff --git a/tests/helpers/participants.ts b/tests/helpers/participants.tsindex ba733e02b5..5125764a36 100644--- a/tests/helpers/participants.ts+++ b/tests/helpers/participants.ts@@ -212,21 +212,27 @@ async function joinParticipant( // eslint-disable-line max-paramsconst p = ctx[participantOptions.name] as Participant;if (p) {- if (participantOptions.iFrameApi) {- await p.switchToIFrame();+ // Skip the isInMuc check (and the iframe context switch it requires) when the participant+ // is already on base.html — they cannot be in the MUC and there is no iframe to switch into.+ const alreadyOnBasePage = (await p.driver.getUrl()).endsWith('/base.html');++ if (!alreadyOnBasePage) {+ if (participantOptions.iFrameApi) {+ await p.switchToIFrame();+ }++ if (await p.isInMuc()) {+ return p;+ }++ if (participantOptions.iFrameApi) {+ // when loading url make sure we are on the top page context or strange errors may occur+ await p.switchToMainFrame();+ }++ // Change the page so we can reload same url if we need to, base.html is supposed to be empty or close to empty+ await p.driver.url('/base.html');}-- if (await p.isInMuc()) {- return p;- }-- if (participantOptions.iFrameApi) {- // when loading url make sure we are on the top page context or strange errors may occur- await p.switchToMainFrame();- }-- // Change the page so we can reload same url if we need to, base.html is supposed to be empty or close to empty- await p.driver.url('/base.html');}const newParticipant = new Participant(participantOptions);