@devries-cameron20 / t3code Mirror · read-only
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 03:37 UTC

main
ts 38 lines 1.44 KB
Raw
1 /// <reference lib="dom" />
2 // The DOM lib types the function this scenario runs in the page.
3 import { expect } from "e2e";
4
5 import { test, WEB } from "./t3.ts";
6
7 const MESSAGE = "Contact [Support](mailto:support@example.com?subject=Help) for help.";
8
9 test(
10 "A copied message pastes its labelled email link with the address",
11 WEB,
12 async ({ t3, app, browser, screen }) => {
13 const project = await t3.project("demo");
14 const thread = await t3.thread({ project, title: "Support", messages: [MESSAGE] });
15 await t3.open(thread);
16 // A message sent through the CLI shows collapsed under its sender.
17 await screen.getByRole("button", /^Agent Contact/).tap();
18 await expect(screen.getByRole("link", "Support")).toBeVisible();
19
20 // Select the rendered paragraph as a drag across it would.
21 await browser.evaluate(() => {
22 const paragraph = document.querySelector('a[href^="mailto:"]')?.closest("p");
23 if (!paragraph) throw new Error("No rendered email link");
24 const range = document.createRange();
25 range.selectNodeContents(paragraph);
26 window.getSelection()?.removeAllRanges();
27 window.getSelection()?.addRange(range);
28 return null;
29 });
30 await browser.keyboard.press("ControlOrMeta+C");
31
32 const composer = screen.getByRole("textbox");
33 await composer.tap();
34 await browser.keyboard.press("ControlOrMeta+V");
35 await app.screenshot("pasted");
36 await expect(composer).toContainText(MESSAGE);
37 },
38 );