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

test("Linked pull requests heading uses the selected language", IOS, async ({ t3, app, screen, device }) => {
  const project = await t3.project("Translation demo");
  await t3.thread({ project, title: "Linked request translation", messages: ["hello"] });
  await t3.open();
  await screen.getByRole("button", "Settings").tap();
  await screen.getByText("General", { exact: true }).tap();
  await screen.getByText("Language", { exact: true }).tap();
  await screen.getByText("Deutsch", { exact: true }).tap();
  await device.back();
  await device.back();
  await device.back();
  await screen.getByText("Linked request translation", { exact: false }).first().tap();
  await screen.getByRole("button", "Git-Steuerung").tap();
  await screen.getByText("Mehr", { exact: true }).tap();
  await screen.getByText("Pull Request verknüpfen", { exact: true }).tap();
  await screen.getByRole("textbox").fill("https://github.com/pingdotgg/t3code/pull/45990");
  await screen.getByText("Verknüpfen", { exact: true }).tap();
  await app.screenshot("german-linked-pull-requests");
  await expect(screen.getByText("Verknüpfte Pull Requests", { exact: true })).toBeVisible();
});
