The best way to control Claude Code, Codex and more from any computer or phone

main
ts 39 lines 1.52 KB
Raw
1 import { expect } from "e2e";
2
3 import { test, WEB } from "./t3.ts";
4
5 test("Find highlights a row with 200,000 matches", WEB, async ({ t3, app, screen, browser }) => {
6 const project = await t3.project("find-proof");
7 await t3.thread({ project, title: "Large row proof", messages: ["go"] });
8 await t3.open();
9 const thread = screen.getByRole("button", /^Large row proof,/);
10 await expect(thread).toBeVisible({ timeout: 120_000 });
11 await thread.tap();
12 await expect(screen.getByText("first fixture turn complete", { exact: false })).toBeVisible();
13 await browser.keyboard.press("Control+f");
14 const find = screen.getByRole("searchbox", "Find in thread");
15 await expect(find).toBeVisible();
16 // A DOM fixture reaches the real highlight effect without a giant replay recording.
17 await browser.evaluate(`(() => {
18 const scope = [...document.querySelectorAll("[data-thread-find-text]")].find((element) =>
19 element.textContent.includes("first fixture turn complete"),
20 );
21 if (!scope) throw new Error("The replayed response is not mounted");
22 scope.textContent = "e x".repeat(200_000);
23 Object.assign(scope.style, { maxHeight: "180px", overflow: "hidden" });
24 return true;
25 })()`);
26 await find.fill("e");
27 try {
28 await expect
29 .poll(() =>
30 browser.evaluate<number>(
31 `(CSS.highlights.get("t3-thread-find")?.size ?? 0) +
32 (CSS.highlights.get("t3-thread-find-active")?.size ?? 0)`,
33 ),
34 )
35 .toBe(200_000);
36 } finally {
37 await app.screenshot("large-row-find");
38 }
39 });