The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { expect } from "e2e"; |
| 2 | |
| 3 | import { test, WEB } from "./t3.ts"; |
| 4 | |
| 5 | test( |
| 6 | "Sending a new thread's first message leaves the sidebar where it was", |
| 7 | WEB, |
| 8 | async ({ t3, app, browser, screen }) => { |
| 9 | const project = await t3.project("demo"); |
| 10 | for (let index = 1; index <= 12; index += 1) { |
| 11 | await t3.thread({ project, title: `Earlier work ${index}`, messages: ["first"] }); |
| 12 | } |
| 13 | // Short enough that the Working shelf, below the listed threads, starts out of view. |
| 14 | await browser.setViewport({ width: 1280, height: 520 }); |
| 15 | await t3.open(); |
| 16 | await expect(screen.getByRole("button", "Earlier work 12", { exact: false })).toBeVisible(); |
| 17 | const sidebarScrollTop = () => |
| 18 | browser.evaluate( |
| 19 | () => |
| 20 | document.querySelector("[data-sidebar-row]")?.closest("[data-slot=scroll-area-viewport]") |
| 21 | ?.scrollTop ?? -1, |
| 22 | ); |
| 23 | expect(await sidebarScrollTop()).toBe(0); |
| 24 | |
| 25 | await screen.getByRole("textbox").fill("Give me a short tour"); |
| 26 | await screen.getByRole("textbox").press("Enter"); |
| 27 | await expect(screen.getByRole("button", "Stop generation")).toBeVisible(); |
| 28 | // The new thread's row mounts in the Working shelf, below the fold. |
| 29 | await expect( |
| 30 | screen.getByRole("button", "Give me a short tour, Working", { exact: false }), |
| 31 | ).toBeAttached(); |
| 32 | await app.screenshot("after-first-send"); |
| 33 | |
| 34 | expect(await sidebarScrollTop()).toBe(0); |
| 35 | }, |
| 36 | ); |