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 { T3_HOME } from "../e2e.config.ts"; |
| 5 | import { makeState, runPromise, test, WEB } from "./t3.ts"; |
| 6 | |
| 7 | const FILE = "quarterly-handoff.txt"; |
| 8 | const CONTENT = "Handoff notes from the shared file"; |
| 9 | |
| 10 | test( |
| 11 | "A citation finds one file listed by two overlapping projects", |
| 12 | WEB, |
| 13 | async ({ t3, app, browser, screen }) => { |
| 14 | const repository = await t3.project("reports", { [`docs/${FILE}`]: CONTENT }); |
| 15 | const nested = `${repository}/docs`; |
| 16 | const project = await t3.project("planning"); |
| 17 | const thread = await t3.thread({ |
| 18 | project, |
| 19 | title: "Find the report", |
| 20 | messages: [`See :codex-file-citation{path="${FILE}" line_range_start="1"}`], |
| 21 | }); |
| 22 | const { cli } = makeState(T3_HOME); |
| 23 | await runPromise(cli(["project", "add", nested, "--title", "Report docs"])); |
| 24 | try { |
| 25 | await t3.open(thread); |
| 26 | await screen.getByRole("button", /^Agent See/).tap(); |
| 27 | await screen.getByRole("link", /^quarterly-handoff\.txt/).tap(); |
| 28 | |
| 29 | try { |
| 30 | await expect |
| 31 | .poll(() => |
| 32 | browser.evaluate(() => { |
| 33 | const panel = document.querySelector("[data-right-panel-surface-content]"); |
| 34 | for (const host of panel?.querySelectorAll("*") ?? []) { |
| 35 | const content = host.shadowRoot?.querySelector("[data-content]"); |
| 36 | if (content) return content.textContent ?? ""; |
| 37 | } |
| 38 | return panel?.textContent ?? ""; |
| 39 | }), |
| 40 | ) |
| 41 | .toContain(CONTENT); |
| 42 | } finally { |
| 43 | await app.screenshot("citation-in-overlapping-projects"); |
| 44 | } |
| 45 | } finally { |
| 46 | await runPromise(cli(["project", "remove", nested])); |
| 47 | } |
| 48 | }, |
| 49 | ); |