@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 41 lines 1.62 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 = "Type \\*word\\* and \\[label](https://example.com) literally.";
8 const SHOWN = "Type *word* and [label](https://example.com) literally.";
9
10 test(
11 "A copied message with literal Markdown characters sends as it was shown",
12 WEB,
13 async ({ t3, app, browser, screen }) => {
14 const project = await t3.project("demo");
15 const thread = await t3.thread({ project, title: "Literal", messages: [MESSAGE] });
16 await t3.open(thread);
17 // A message sent through the CLI shows collapsed under its sender.
18 await screen.getByRole("button", /^Agent Type/).tap();
19 await expect(screen.getByText(SHOWN)).toBeVisible();
20
21 // Select the rendered paragraph as a drag across it would.
22 await browser.evaluate(() => {
23 const paragraph = document.querySelector("[data-user-message-body] p");
24 if (!paragraph) throw new Error("No rendered user message");
25 const range = document.createRange();
26 range.selectNodeContents(paragraph);
27 window.getSelection()?.removeAllRanges();
28 window.getSelection()?.addRange(range);
29 return null;
30 });
31 await browser.keyboard.press("ControlOrMeta+C");
32
33 const composer = screen.getByRole("textbox");
34 await composer.tap();
35 await browser.keyboard.press("ControlOrMeta+V");
36 await browser.keyboard.press("Enter");
37 await expect(screen.getByText("second fixture turn complete")).toBeVisible();
38 await app.screenshot("sent");
39 await expect(screen.getByText(SHOWN)).toHaveCount(2);
40 },
41 );