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

test("Ctrl+F focuses Files search on an unsent draft", WEB, async ({ t3, app, screen, browser }) => {
  await t3.project("shortcut-demo", { "hello.txt": "Example file\n" });
  await t3.open();
  await screen.getByRole("button", "New thread", { exact: true }).tap();
  await screen.getByRole("button", "Toggle right panel", { exact: true }).tap();
  const add = screen.getByRole("button", "Add panel surface");
  await add.tap();
  await browser.keyboard.press("f");
  await add.tap();
  await browser.keyboard.press("Escape");
  await app.screenshot("before-shortcut");
  await browser.keyboard.press("Control+f");
  await app.screenshot("after-shortcut");
  await expect(screen.getByRole("searchbox", "Search shortcut-demo files")).toBeFocused();
});
