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
| 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 LINES = ["Plan", " Step one", " Step two", " Detail a", " Detail b"]; |
| 8 | |
| 9 | test( |
| 10 | "A sent message shows the spaces typed at the start of its lines", |
| 11 | WEB, |
| 12 | async ({ t3, app, browser, screen }) => { |
| 13 | const project = await t3.project("demo"); |
| 14 | const thread = await t3.thread({ project, title: "Outline", messages: ["Start"] }); |
| 15 | await t3.open(thread); |
| 16 | |
| 17 | const composer = screen.getByRole("textbox"); |
| 18 | for (const [index, line] of LINES.entries()) { |
| 19 | if (index > 0) await composer.press("Shift+Enter"); |
| 20 | await composer.pressSequentially(line); |
| 21 | } |
| 22 | await composer.press("Enter"); |
| 23 | await expect(screen.getByText("second fixture turn complete", { exact: false })).toBeVisible(); |
| 24 | await app.screenshot("sent"); |
| 25 | |
| 26 | // The visible text, which keeps whitespace only where the page shows it. |
| 27 | const shown = await browser.evaluate( |
| 28 | () => |
| 29 | [...document.querySelectorAll<HTMLElement>("[data-user-message-body]")] |
| 30 | .map((body) => body.innerText) |
| 31 | .find((text) => text.includes("Detail b")) ?? null, |
| 32 | ); |
| 33 | expect(shown).toBe(LINES.join("\n")); |
| 34 | }, |
| 35 | ); |