test(browser): select a bounded service-worker setup deadline (#6186)

This commit is contained in:
gensokyo-dev authored and GitHub committed 2026-10-22 08:16:34 +08:00
1 parent cdd718ffb0
commit 18669641e9
1 file changed
+9 -1
@@ -142,6 +142,9 @@ export const verifyScenarioPolicySetup = async (
page,
) => {
const result = {};
// Exercise a caller-selected handshake deadline within the existing teardown
// guard; the default command deadline may legitimately outlast that guard.
const setupCommandTimeoutMs = 2_000;
for (const mode of ["http-websocket", "http-discovery", "deadline"]) {
const proxy = await startProxy(endpoint, mode);
const provider = createBrowserScenarioProvider(process.env);
@@ -152,6 +155,9 @@ export const verifyScenarioPolicySetup = async (
target_id: targetId,
},
start_url: { url: origin },
...(mode === "deadline"
? { command_timeout_ms: setupCommandTimeoutMs }
: {}),
environment: { service_workers: "block" },
actions: [
{ step_id: "settle", action: "wait_for_timeout", duration_ms: 1 },
@@ -189,7 +195,9 @@ export const verifyScenarioPolicySetup = async (
if (!next.ok) throw next.error;
assert.equal(next.value.browser.cleanup, "disconnected-external");
result[mode] = {
...(mode === "deadline" ? { timed_out: true } : { cancelled: true }),
...(mode === "deadline"
? { timed_out: true, command_timeout_ms: setupCommandTimeoutMs }
: { cancelled: true }),
socket_closed: true,
target_reused: true,
};