The best way to control Claude Code, Codex and more from any computer or phone
| 1 | /// <reference lib="dom" /> |
| 2 | import { expect } from "e2e"; |
| 3 | |
| 4 | import { test, WEB } from "./t3.ts"; |
| 5 | |
| 6 | const MATCH = "quartzneedle"; |
| 7 | const columns = Array.from({ length: 16 }, (_, index) => `DiagnosticsColumn${index + 1}`); |
| 8 | const row = (cells: string[]) => `| ${cells.join(" | ")} |`; |
| 9 | const TABLE = [ |
| 10 | row(columns), |
| 11 | row(columns.map(() => "---")), |
| 12 | row([...columns.slice(0, -1).map(() => "pending"), MATCH]), |
| 13 | ].join("\n"); |
| 14 | |
| 15 | test( |
| 16 | "Find reveals a match in the last column of a wide table", |
| 17 | WEB, |
| 18 | async ({ t3, app, screen, browser }) => { |
| 19 | const project = await t3.project("wide-table"); |
| 20 | const thread = await t3.thread({ project, title: "Diagnostics table", messages: [TABLE] }); |
| 21 | await t3.open(thread); |
| 22 | await screen.getByText("first fixture turn complete", { exact: false }).waitFor({ |
| 23 | timeout: 120_000, |
| 24 | }); |
| 25 | |
| 26 | await browser.keyboard.press("Control+f"); |
| 27 | const find = screen.getByRole("searchbox", "Find in thread"); |
| 28 | await find.fill(MATCH); |
| 29 | |
| 30 | try { |
| 31 | await expect |
| 32 | .poll( |
| 33 | () => |
| 34 | browser.evaluate((query) => { |
| 35 | const active = CSS.highlights.get("t3-thread-find-active"); |
| 36 | const match = |
| 37 | active && |
| 38 | [...active].find((range) => range instanceof Range && range.toString() === query); |
| 39 | const viewport = match?.startContainer.parentElement?.closest( |
| 40 | '.chat-markdown-table-container [data-slot="scroll-area-viewport"]', |
| 41 | ); |
| 42 | if (!(match instanceof Range) || !viewport) |
| 43 | return "Table match has no active highlight"; |
| 44 | const rect = match.getBoundingClientRect(); |
| 45 | const clip = viewport.getBoundingClientRect(); |
| 46 | return rect.height > 0 && rect.left >= clip.left - 1 && rect.right <= clip.right + 1 |
| 47 | ? "Selected table match is inside the horizontal viewport" |
| 48 | : "Selected table match is clipped horizontally"; |
| 49 | }, MATCH), |
| 50 | { timeout: 20_000 }, |
| 51 | ) |
| 52 | .toBe("Selected table match is inside the horizontal viewport"); |
| 53 | } finally { |
| 54 | await app.screenshot("selected-table-match"); |
| 55 | } |
| 56 | }, |
| 57 | ); |