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

test("The scheduled task Delete action follows German", WEB, async ({ t3, app, screen }) => {
  const project = await t3.project("demo");
  await t3.thread({ project, title: "Earlier work", messages: ["Start"] });
  await t3.open("/settings/general");
  await screen.getByLabel("Language", { exact: true }).tap();
  await screen.getByText("Deutsch", { exact: true }).tap();
  await screen.getByLabel("Sprache", { exact: true }).waitFor();
  await t3.open("/settings/scheduled-tasks");
  await screen.getByRole("button", "Neue Aufgabe").tap();
  await screen.getByRole("textbox", "Name", { exact: true }).fill("Review issues");
  await screen.getByRole("textbox", "Prompt", { exact: true }).fill("Summarize open issues.");
  await screen.getByRole("button", "Aufgabe erstellen").tap();
  await screen.getByRole("button", "Aktionen für Review issues").tap();
  await screen.getByRole("menuitem", "Bearbeiten", { exact: true }).waitFor();
  await app.screenshot("german-scheduled-task-menu");
  await expect(screen.getByRole("menuitem", "Löschen", { exact: true })).toBeVisible();
});
