Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): preview navigation waits for the busy script to stop #30670

ClosedElliotDrel(GitHub profile, opens in a new tab)wants to merge 2 commits intofix/issue-28141 fromrefs/pull/30670/headopened View on GitHub

Showing 2 changed files with 75 additions and 14 deletions.

x
0 of 2 viewed, 2 left
45 additions and 2 deletionsapps/server/src/preview/ServerBrowser.test.tsModified
View file
@@ -27,8 +27,8 @@
import * as Queue from "effect/Queue";
import * as Stream from "effect/Stream";
import * as TestClock from "effect/testing/TestClock";
-import type { BrowserContext, Page } from "playwright-core";
-import { beforeEach, expect, vi } from "vite-plus/test";
+import type { BrowserContext, CDPSession, Page } from "playwright-core";
+import { beforeEach, expect, it as test, vi } from "vite-plus/test";
​
import * as ServerConfig from "../config.ts";
import * as ServerEnvironment from "../environment/ServerEnvironment.ts";
@@ -37,6 +37,7 @@
import * as Manager from "./Manager.ts";
import * as PreviewAgentActivity from "./PreviewAgentActivity.ts";
import * as ServerBrowser from "./ServerBrowser.ts";
+import * as ServerBrowserPage from "./ServerBrowserPage.ts";
import * as PreviewBrowser from "./PreviewBrowser.ts";
​
vi.mock("./ServerBrowserContexts.ts", () => ({
@@ -761,6 +762,48 @@
).pipe(Effect.provide(layer)),
​
+test.each([
+ { case: "acknowledged", budgetMs: 5_000, acknowledge: true },
+ { case: "never acknowledged", budgetMs: 5_000, acknowledge: false },
+ { case: "never acknowledged, short budget", budgetMs: 1_200, acknowledge: false },
+])("waits for script termination within its budget ($case)", async ({ budgetMs, acknowledge }) => {