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

test("Project monogram keeps the Javanese pangkon stack", WEB, async ({ t3, app, browser, screen }) => {
  await t3.project("ꦏ꧀ꦱ Alpha");
  await t3.open("/settings/projects");
  await screen.getByRole("button", "Project scope: All projects").tap();
  await screen.getByRole("menuitemradio").filter({ hasText: "ꦏ꧀ꦱ Alpha" }).tap();
  const monogram = browser.locator('[role="region"][aria-label="Settings content"] [data-slot="project-monogram"] text').first();
  await monogram.waitFor();
  // Hide synthetic workspace paths in public evidence; leave the monogram untouched.
  await browser.evaluate(() => {
    const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT);
    while (walker.nextNode()) {
      const node = walker.currentNode;
      if (node.textContent?.includes("/home/")) node.textContent = "[temporary project folder]";
    }
    for (const input of document.querySelectorAll("input")) {
      if (input.value.includes("/home/")) input.value = "[temporary project folder]";
    }
  });
  await app.screenshot("javanese-project-monogram");
  await expect(monogram).toHaveText("ꦏ꧀ꦱA");
});
