Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Fixes connectivity tests (#17509)

Дамян Минков1191fe516cb4
diff --git a/tests/helpers/expectations.ts b/tests/helpers/expectations.ts
index 69f9d1948d..74b7c7a833 100644
--- a/tests/helpers/expectations.ts
+++ b/tests/helpers/expectations.ts
@@ -59,7 +59,7 @@ const defaultExpectations = {
turn: true
},
p2p: {
- direct: true,
+ direct: false,
turn: true
}
},
diff --git a/tests/specs/misc/connectivity.spec.ts b/tests/specs/misc/connectivity.spec.ts
index ec4c4e9d41..e345ebf3f1 100644
--- a/tests/specs/misc/connectivity.spec.ts
+++ b/tests/specs/misc/connectivity.spec.ts
@@ -90,8 +90,10 @@ describe('Connectivity - JVB + TURN', () => {
});
it('uses TURN', async () => {
- expect(t1?.localCandidateUrl).toContain('turn:');
- expect(t2?.localCandidateUrl).toContain('turn:');
+ // Check the candidate type rather than the URL: Firefox does not populate the `url` field on candidate
+ // stats, while `candidateType: 'relay'` (only ever produced by a TURN allocation) is set by both browsers.
+ expect(t1?.localCandidateType).toBe('relay');
+ expect(t2?.localCandidateType).toBe('relay');
});
it('both clients connect to the same JVB port', async () => {
@@ -224,11 +226,16 @@ async function getProtocol(participant: Participant, p2p: boolean): Promise<stri
return (await getActiveCandidatePair(participant, p2p))?.type?.toLowerCase();
}
-/** Returns true if the active candidate pair uses a TURN relay (url starts with "turn:"). */
+/**
+ * Returns true if the active candidate pair uses a TURN relay. We check the local candidate type rather than its
+ * URL because Firefox does not populate the `url` field on candidate stats, while `candidateType: 'relay'` is set by
+ * both Chrome and Firefox. A `relay` candidate is only ever allocated through a TURN server, so this is equivalent to
+ * checking for a `turn:` URL but works across browsers.
+ */
async function isUsingTurn(participant: Participant, p2p: boolean): Promise<boolean> {
const pair = await getActiveCandidatePair(participant, p2p);
- return pair?.localCandidateUrl?.startsWith('turn:') === true;
+ return pair?.localCandidateType === 'relay';
}
async function isP2PActive(participant: Participant): Promise<boolean> {