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

test("true condition retains shortcut conflict warnings", WEB, async ({ t3, app, screen, browser }) => {
  const project = await t3.project("shortcut-demo");
  const thread = await t3.thread({ project, title: "Shortcut demo", messages: ["Hello"] });
  await t3.open(thread);
  await t3.open("/settings/keybindings");
  await screen.getByRole("button", "Add keybinding", { exact: true }).tap();
  await screen.getByRole("option", /^Chat: New Ctrl/).tap();
  await screen.getByRole("textbox", "Keybinding for Chat: New", { exact: true }).tap();
  await browser.keyboard.press("Control+n");
  await browser.keyboard.press("Tab");
  await app.screenshot("empty-condition-conflicts");
  await screen.getByRole("button", "Edit when clause for Chat: New", { exact: true }).first().tap();
  await screen.getByRole("textbox", "When expression", { exact: true }).fill("true");
  await browser.keyboard.press("Enter");
  await browser.keyboard.press("Escape");
  await browser.locator('[aria-label="When expression"]').waitFor({ state: "hidden" });
  await app.screenshot("true-condition-conflicts");
  await expect(browser.locator('[aria-label="Conflicts with Chat: New, Terminal: New."]')).toBeVisible();
});
