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

test("Ctrl+Enter sends a new draft in the foreground", WEB, async ({ t3, app, screen, browser }) => {
  await t3.project("Shortcut demo");
  await t3.open();
  await screen.getByTestId("composer-editor").tap();
  await app.open("/settings/chat");
  await screen.getByRole("combobox", "Send shortcut").tap();
  await screen.getByRole("option", "Ctrl + Enter always").tap();
  await app.open("/");
  const composer = screen.getByRole("textbox");
  await composer.fill("second repro prompt");
  await browser.keyboard.press("Control+Enter");
  await expect(composer).toHaveValue("");
  try {
    await expect(screen.getByRole("region", "Conversation").getByText("second repro prompt", { exact: true })).toBeVisible();
  } finally {
    await app.screenshot("ctrl-enter-result");
  }
});
