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

main
ts 87 lines 3.14 KB
Raw
1 /// <reference lib="dom" />
2 import type { IssueDetail, IssueRef } from "@t3tools/contracts";
3 import { expect } from "e2e";
4
5 import { test, WEB } from "./t3.ts";
6
7 test(
8 "The issue link picker finds a thread title without its accent",
9 WEB,
10 async ({ t3, app, browser, screen }) => {
11 const project = await t3.project("demo");
12 await t3.thread({ project, title: "Café planning", messages: ["first"] });
13 await browser.addInitScript(() => {
14 const send = WebSocket.prototype.send;
15 WebSocket.prototype.send = function (data) {
16 const request: { _tag: string; id: string; tag: string; payload: IssueRef } | null =
17 typeof data === "string" ? JSON.parse(data) : null;
18 if (request?._tag !== "Request" || request.tag !== "issues.detail")
19 return send.call(this, data);
20 const reply = (exit: unknown) =>
21 this.dispatchEvent(
22 new MessageEvent("message", {
23 data: JSON.stringify({ _tag: "Exit", requestId: request.id, exit }),
24 }),
25 );
26 const { projectId, tracker, scope, key } = request.payload;
27 const detail: IssueDetail = {
28 projectId,
29 tracker,
30 scope,
31 key,
32 host: "github.com",
33 displayKey: "#42",
34 projectTitle: "demo",
35 title: "Publish the release notes",
36 body: "Check the release notes.",
37 url: "https://github.com/example/demo/issues/42",
38 author: null,
39 state: { category: "open", name: "Open" },
40 createdAt: "2026-10-01T00:00:00.000Z",
41 updatedAt: "2026-10-01T00:00:00.000Z",
42 closedAt: null,
43 assignees: [],
44 labels: [],
45 commentCount: 0,
46 writable: false,
47 capabilities: {
48 create: false,
49 edit: false,
50 comment: false,
51 labels: false,
52 assignees: false,
53 reactions: false,
54 templates: false,
55 linkedPullRequests: false,
56 events: false,
57 search: true,
58 },
59 viewerPermissions: {
60 setState: false,
61 comment: false,
62 edit: false,
63 assignees: false,
64 labels: false,
65 },
66 states: [],
67 viewer: null,
68 comments: [],
69 commentsCursor: null,
70 events: [],
71 linkedPullRequests: [],
72 };
73 queueMicrotask(() => reply({ _tag: "Success", value: detail }));
74 };
75 });
76
77 await t3.open("/issues?selectedProjectId=demo&tracker=github&scope=example/demo&key=42");
78 await screen.getByText("Publish the release notes", { exact: true }).waitFor();
79 await screen.getByRole("button", "Link to thread", { exact: true }).tap();
80 const dialog = screen.getByRole("dialog", "Link issue to a thread");
81 const thread = dialog.getByText("Café planning", { exact: true });
82 await thread.waitFor();
83 await dialog.getByPlaceholder("Search threads or projects...").fill("cafe");
84 await app.screenshot("issue-link-thread-search");
85 expect(await thread.isVisible(), "Searching for cafe keeps Café planning available").toBe(true);
86 },
87 );