diff --git a/playwright/errors.spec.ts b/playwright/errors.spec.ts index 0d36f7ab..c954ccb9 100644 --- a/playwright/errors.spec.ts +++ b/playwright/errors.spec.ts @@ -6,6 +6,7 @@ Please see LICENSE in the repository root for full details. */ import { expect, test } from "@playwright/test"; +import { createJTWToken } from "./fixtures/jwt-token"; test("Should show error screen if fails to get JWT token", async ({ page }) => { await page.goto("/"); @@ -93,7 +94,7 @@ test("Should show error screen if call creation is restricted", async ({ contentType: "application/json", body: JSON.stringify({ url: "wss://badurltotricktest/livekit/sfu", - jwt: "FAKE", + jwt: createJTWToken("@fake:user", "!fake:room"), }), }), ); diff --git a/playwright/fixtures/jwt-token.ts b/playwright/fixtures/jwt-token.ts new file mode 100644 index 00000000..8b93abc3 --- /dev/null +++ b/playwright/fixtures/jwt-token.ts @@ -0,0 +1,15 @@ +export function createJTWToken(sub: string, room: string) { + return [ + {}, // header + { + // payload + sub, + video: { + room, + }, + }, + {}, // signature + ] + .map((d) => global.btoa(JSON.stringify(d))) + .join("."); +} diff --git a/playwright/sfu-reconnect-bug.spec.ts b/playwright/sfu-reconnect-bug.spec.ts index 6138eb78..9f666f0f 100644 --- a/playwright/sfu-reconnect-bug.spec.ts +++ b/playwright/sfu-reconnect-bug.spec.ts @@ -68,11 +68,6 @@ test("When creator left, avoid reconnect to the same SFU", async ({ reducedMotion: "reduce", }); const guestCPage = await guestC.newPage(); - let sfuGetCallCount = 0; - await guestCPage.route("**/livekit/jwt/sfu/get", async (route) => { - sfuGetCallCount++; - await route.continue(); - }); // Track WebSocket connections let wsConnectionCount = 0; await guestCPage.routeWebSocket("**", (ws) => { @@ -100,5 +95,4 @@ test("When creator left, avoid reconnect to the same SFU", async ({ // https://github.com/element-hq/element-call/issues/3344 // The app used to request a new jwt token then to reconnect to the SFU expect(wsConnectionCount).toBe(1); - expect(sfuGetCallCount).toBe(2 /* the first one is for the warmup */); });