import { expect } from "e2e";
import { IOS, test } from "./t3-mobile.ts";

test("Legal content settles below the iOS header", { ...IOS, video: "off" }, async ({ t3, app, screen, device }) => {
  await device.setAppearance("light");
  await t3.project("Legal proof");
  await t3.open();
  await screen.getByText("Settings", { exact: true }).tap();
  await screen.getByRole("button", "General").boundingBox();
  await screen.swipe({ from: { x: 200, y: 700 }, to: { x: 200, y: 240 }, duration: 600 });
  await screen.getByRole("button", "About").tap();
  await screen.getByRole("button", "Legal").tap();
  const label = screen.getByText(/T3 Tools, Inc\. \/ Legal/i);
  await screen.getByRole("link", "Privacy Policy", { exact: true }).boundingBox();
  await app.startRecording({ name: "legal-interaction" });
  await app.screenshot("legal-open");
  await screen.swipe({ from: { x: 200, y: 260 }, to: { x: 200, y: 560 }, duration: 700 });
  await app.screenshot("legal-after-bounce");
  await screen.swipe({ from: { x: 200, y: 730 }, to: { x: 200, y: 200 }, duration: 500 });
  await screen.swipe({ from: { x: 200, y: 730 }, to: { x: 200, y: 200 }, duration: 500 });
  await app.screenshot("legal-footer");
  await screen.swipe({ from: { x: 200, y: 220 }, to: { x: 200, y: 760 }, duration: 500 });
  await screen.swipe({ from: { x: 200, y: 220 }, to: { x: 200, y: 760 }, duration: 500 });
  await app.screenshot("legal-returned-top");
  await app.stopRecording();
  await expect(label).toBeVisible();
  const bounds = await label.boundingBox();
  await expect(bounds?.y ?? -1).toBeGreaterThan(100);
});
