import { expect } from "e2e";
import { test, WEB } from "./t3.ts";

test("Ctrl+S stashes a prompt from the side chat composer", WEB, async ({ t3, app, screen, browser }) => {
  const project = await t3.project("demo");
  const thread = await t3.thread({ project, title: "Side chat stash", messages: ["Start"], model: "showcase" });
  await browser.setViewport({ width: 1440, height: 1000 });
  await t3.open(thread);
  const main = screen.getByTestId("composer-editor");
  await main.fill("/side what is clamp?");
  await main.press("Enter");
  const side = browser.locator('[data-side-chat-pane] [data-testid="composer-editor"]');
  await side.waitFor();
  await browser.locator("[data-side-chat-pane]").getByText("This turn is a replay.", { exact: false }).waitFor();
  await side.fill("side draft to stash");
  await app.screenshot("side-draft-before-shortcut");
  await side.press("Control+s");
  await app.screenshot("side-draft-after-shortcut");
  await expect(side).toHaveText("");
  await expect(browser.locator("[data-side-chat-pane]").getByRole("button", "Stashed prompts: 1. Open stash.")).toBeVisible();
});
