import { test, expect } from "./fixtures/console-gate";

test.describe("Schedule", () => {
  test("/ru/schedule renders the start page", async ({ page, consoleMessages }) => {
    await page.goto("/ru/schedule");
    await page.waitForLoadState("domcontentloaded");

    // The ScheduleStartPage should render
    await expect(page.locator('[data-testid="schedule-start"]')).toBeVisible({
      timeout: 10000,
    });

    // The search form should be present
    await expect(
      page.locator('[data-testid="schedule-search-form"]'),
    ).toBeVisible();
  });

  test("/ru/schedule/route/SVO-LED-20260415 renders the search page", async ({
    page,
    consoleMessages,
  }) => {
    await page.goto("/ru/schedule/route/SVO-LED-20260415");
    await page.waitForLoadState("domcontentloaded");

    expect(page.url()).toContain("/ru/schedule/route/SVO-LED-20260415");

    // Page should render something (search results, loading, or error)
    await expect(page.locator("body")).not.toBeEmpty();
  });
});
