const { chromium } = require("C:/Users/ramez/AppData/Roaming/npm/node_modules/playwright");

(async () => {
  console.log("Launching browser for interactive test on port 3005...");
  const browser = await chromium.launch({ headless: true });
  const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });

  console.log("Navigating to http://localhost:3005 ...");
  await page.goto("http://localhost:3005", { waitUntil: "domcontentloaded" });

  console.log("Waiting for UI element...");
  await page.waitForSelector("button:has-text('Bibliothèque')", { timeout: 15000 });

  console.log("Clicking Bibliothèque tab...");
  await page.click("button:has-text('Bibliothèque')");
  await page.waitForTimeout(1000);

  const screenshotPath = "C:/Users/ramez/.gemini/antigravity-ide/brain/e16f5552-47ce-4483-9b25-8266bb395491/entropyk_ui_interactive.png";
  await page.screenshot({ path: screenshotPath });
  console.log(`Interactive screenshot saved to ${screenshotPath}`);
  await browser.close();
})();
