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

test("Repository lookup identifies the resolved owner and missing repository", WEB, async ({ t3, app, screen, browser }) => {
  await t3.project("demo");
  await browser.setViewport({ width: 1440, height: 1000 });
  await t3.open();
  await screen.getByRole("combobox", "Projects").tap();
  await screen.getByRole("option", "Add project").tap();
  await browser.locator('[role="option"]:has-text("GitHub repository"):not([aria-disabled="true"]):not([data-disabled])').tap();
  await screen.getByRole("button", "Lookup (Enter)").waitFor();
  await screen.getByRole("combobox").fill("missing31239");
  await browser.keyboard.press("Enter");
  await screen.getByText("Repository lookup failed", { exact: true }).waitFor();
  await screen.getByText("Repository lookup failed", { exact: true }).hover();
  await app.screenshot("repository-not-found");
  await expect(screen.getByText("Repository juliusmarminge/missing31239 was not found. Check the owner and name and try again.", { exact: false })).toBeVisible();
});
