Force undelegated mode in tests

This commit is contained in:
Johannes Marbach
2026-09-10 14:15:38 +02:00
parent 21d7f24f61
commit 344aac21f9
3 changed files with 38 additions and 1 deletions
+8
View File
@@ -7,6 +7,8 @@ Please see LICENSE in the repository root for full details.
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { SpaHelpers } from "./spa-helpers";
// Skip test for Firefox, due to page.keyboard.press("Tab") not reliable on headless mode // Skip test for Firefox, due to page.keyboard.press("Tab") not reliable on headless mode
test.skip( test.skip(
({ browserName }) => browserName === "firefox", ({ browserName }) => browserName === "firefox",
@@ -17,6 +19,12 @@ test("can only interact with header and footer while reconnecting", async ({
page, page,
}) => { }) => {
await page.goto("/"); await page.goto("/");
// The reconnecting state is entered via the probablyLeft timer, which
// mirrors the delayed leave event's timeout. With delegation that timeout
// is one hour, putting it out of reach of the clock fast-forward below.
// Keep the leave client-managed so its short timeout applies.
await SpaHelpers.disableLeaveDelegation(page);
await page.getByTestId("home_callName").click(); await page.getByTestId("home_callName").click();
await page.getByTestId("home_callName").fill("Test call"); await page.getByTestId("home_callName").fill("Test call");
await page.getByTestId("home_displayName").click(); await page.getByTestId("home_displayName").click();
+11 -1
View File
@@ -19,6 +19,7 @@ async function setupTwoUserSpaCall(
browser: Browser, browser: Browser,
page: Page, page: Page,
browserName: string, browserName: string,
opts: { disableGuestLeaveDelegation?: boolean } = {},
): Promise<{ guestPage: Page }> { ): Promise<{ guestPage: Page }> {
test.skip( test.skip(
browserName === "firefox", browserName === "firefox",
@@ -52,6 +53,9 @@ async function setupTwoUserSpaCall(
await guestPage.goto("/"); await guestPage.goto("/");
if (opts.disableGuestLeaveDelegation)
await SpaHelpers.disableLeaveDelegation(guestPage);
let pevaraHasSentStickyEvent = false; let pevaraHasSentStickyEvent = false;
const pevaraResolver = Promise.withResolvers<void>(); const pevaraResolver = Promise.withResolvers<void>();
@@ -102,7 +106,13 @@ test("One to One rejoin after improper leave does not crash EC", async ({
page, page,
browserName, browserName,
}) => { }) => {
const { guestPage } = await setupTwoUserSpaCall(browser, page, browserName); // With delegation, the backend sends the guest's delayed leave event within
// moments of the improper leave, so the stale membership this test needs
// would be cleaned up before the rejoin. Keep the guest's leave
// client-managed so the stale membership lingers.
const { guestPage } = await setupTwoUserSpaCall(browser, page, browserName, {
disableGuestLeaveDelegation: true,
});
await SpaHelpers.expectVideoTilesCount(page, 2); await SpaHelpers.expectVideoTilesCount(page, 2);
await SpaHelpers.expectVideoTilesCount(guestPage, 2); await SpaHelpers.expectVideoTilesCount(guestPage, 2);
+19
View File
@@ -111,6 +111,24 @@ async function setRtcModeFromSettings(
await page.getByTestId("modal_close").click(); await page.getByTestId("modal_close").click();
} }
/**
* Makes the delayed-leave delegation support probes fail so that the client
* manages its delayed leave event itself instead of delegating it to the
* backend.
*
* Must be installed before the page joins a call.
*/
async function disableLeaveDelegation(page: Page): Promise<void> {
// Covers both the transport probe (<livekit_service_url>/delegate_delayed_leave)
// and the homeserver probe (MSC4195, .../rtc/livekit/delegate_delayed_leave).
await page.route("**/delegate_delayed_leave", async (route) =>
route.fulfill({
status: 404,
headers: { "Access-Control-Allow-Origin": "*" },
}),
);
}
/** /**
* Expect a certain number of video tiles to be present and visible. * Expect a certain number of video tiles to be present and visible.
*/ */
@@ -133,5 +151,6 @@ export const SpaHelpers = {
createCall, createCall,
getCallInviteLink, getCallInviteLink,
joinCallFromInviteLink, joinCallFromInviteLink,
disableLeaveDelegation,
expectVideoTilesCount, expectVideoTilesCount,
}; };