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

test("Restart toast says the conversation is kept in Simplified Chinese", WEB, async ({ t3, app, browser, screen }) => {
  const project = await t3.project("demo");
  const thread = await t3.thread({ project, title: "Restart session", messages: ["Start"] });
  await t3.open("/settings/general");
  await screen.getByLabel("Language", { exact: true }).tap();
  await screen.getByText("中文（简体）", { exact: true }).tap();
  await screen.getByLabel("语言", { exact: true }).waitFor();
  await t3.open(thread);
  await screen.getByText("fixture turn complete", { exact: false }).waitFor();
  await browser.keyboard.press("Control+k");
  await screen.getByRole("combobox").fill("重启");
  await screen.getByRole("option", "重启智能体会话", { exact: false }).tap();
  await screen.getByText("智能体会话将重启", { exact: true }).waitFor();
  await browser.evaluate(async () => {
    await Promise.all(document.getAnimations().filter((animation) => animation.effect?.getComputedTiming().iterations !== Infinity).map((animation) => animation.finished.catch(() => undefined)));
    return null;
  });
  await app.screenshot("restart-toast-chinese");
  await expect(screen.getByText("你的下一条消息将重启智能体，当前对话会保留。", { exact: true })).toBeVisible();
});
