The best way to control Claude Code, Codex and more from any computer or phone
| 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 | test( |
| 8 | "A copy that starts at a later list item and ends past the list keeps the shown numbers", |
| 9 | WEB, |
| 10 | async ({ t3, app, browser, screen }) => { |
| 11 | const project = await t3.project("demo"); |
| 12 | const thread = await t3.thread({ |
| 13 | project, |
| 14 | title: "Steps", |
| 15 | messages: ["Steps:\n\n1. Install\n2. Configure\n3. Deploy\n\nThen report back."], |
| 16 | }); |
| 17 | await t3.open(thread); |
| 18 | // A message sent through the CLI shows collapsed under its sender. |
| 19 | await screen.getByRole("button", /^Agent Steps/).tap(); |
| 20 | await expect(screen.getByText("Configure")).toBeVisible(); |
| 21 | |
| 22 | // Selects from a list item's text to the end of the paragraph after its list. |
| 23 | await browser.evaluate(() => { |
| 24 | const item = [...document.querySelectorAll("li")].find( |
| 25 | (candidate) => candidate.textContent === "Configure", |
| 26 | ); |
| 27 | const after = item?.closest("ol")?.nextElementSibling?.firstChild; |
| 28 | if (!item?.firstChild || !after) throw new Error("No rendered list item Configure"); |
| 29 | const range = document.createRange(); |
| 30 | range.setStart(item.firstChild, 0); |
| 31 | range.setEnd(after, after.textContent?.length ?? 0); |
| 32 | window.getSelection()?.removeAllRanges(); |
| 33 | window.getSelection()?.addRange(range); |
| 34 | return null; |
| 35 | }); |
| 36 | await browser.keyboard.press("ControlOrMeta+C"); |
| 37 | await screen.getByRole("textbox").tap(); |
| 38 | await browser.keyboard.press("ControlOrMeta+V"); |
| 39 | |
| 40 | // The composer parses the pasted Markdown, so the copied number becomes the list's start. |
| 41 | const pasted = browser.locator('[role="textbox"] ol'); |
| 42 | await expect(pasted).toHaveText(/Configure\s*Deploy/); |
| 43 | await app.screenshot("pasted"); |
| 44 | await expect(pasted).toHaveAttribute("start", "2"); |
| 45 | }, |
| 46 | ); |