The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { expect } from "e2e"; |
| 2 | |
| 3 | import { |
| 4 | finishImageCompression, |
| 5 | holdImageCompression, |
| 6 | pasteWideScreenshot, |
| 7 | } from "./image-compression-hold.ts"; |
| 8 | import { test, WEB } from "./t3.ts"; |
| 9 | |
| 10 | test( |
| 11 | "A thread draft discarded while its pasted image compresses stays discarded and can be restored", |
| 12 | WEB, |
| 13 | async ({ t3, app, browser, screen }) => { |
| 14 | await holdImageCompression(browser); |
| 15 | const project = await t3.project("demo"); |
| 16 | const source = await t3.thread({ project, title: "Screenshot work", messages: ["first"] }); |
| 17 | await t3.thread({ project, title: "Other work", messages: ["first"] }); |
| 18 | await t3.open(source); |
| 19 | await expect(screen.getByText("first fixture turn complete", { exact: false })).toBeVisible(); |
| 20 | |
| 21 | const composer = screen.getByRole("textbox"); |
| 22 | await composer.fill("Half-written prompt"); |
| 23 | await pasteWideScreenshot(browser); |
| 24 | // The sidebar offers a thread's discard only once that thread is no longer open. |
| 25 | await screen.getByRole("button", "Other work", { exact: false }).tap(); |
| 26 | // The row's controls show on hover, over its labels. |
| 27 | await screen.getByRole("button", "Screenshot work", { exact: false }).hover(); |
| 28 | await screen.getByRole("button", "Discard draft").tap(); |
| 29 | await finishImageCompression(browser); |
| 30 | await app.screenshot("after-compression"); |
| 31 | await expect(screen.getByRole("img", "Unsent draft")).toBeHidden(); |
| 32 | |
| 33 | await screen.getByRole("button", "undo", { exact: false }).tap(); |
| 34 | await screen.getByRole("button", "Screenshot work", { exact: false }).tap(); |
| 35 | await app.screenshot("after-undo"); |
| 36 | await expect(composer).toContainText("Half-written prompt"); |
| 37 | }, |
| 38 | ); |