import { test, expect } from "@playwright/test"; import { WARM_TIMEOUT, warm } from "./warm"; // --------------------------------------------------------------------------- // /articles//compare?a=&b= (release 27 S8): two iterations side by side — // each one's report (sections, findings; what the other side lacks marked), // the ops applied and refused, the failed checks, and both cuts when both // have a project. Over zeta (e2e/fixtures/iterations-fixture.mjs), read-only. // --------------------------------------------------------------------------- test.beforeAll(async ({ playwright }) => { test.setTimeout(WARM_TIMEOUT); await warm(playwright, ["/articles/zeta/compare?a=1&b=2", "/articles/zeta?tab=iterations"]); }); test("a report revision beside its parent: ops applied and refused, the failed check, the section it added", async ({ page }) => { const res = await page.goto("/articles/zeta/compare?a=1&b=2"); expect(res?.status()).toBe(200); const a = page.locator("[data-side='1']"); const b = page.locator("[data-side='2']"); await expect(a.getByRole("heading", { name: "i1" })).toBeVisible(); await expect(b.getByRole("heading", { name: "i2" })).toBeVisible(); await expect(a.locator("[data-ops-applied]")).toHaveAttribute("data-ops-applied", "0"); await expect(b.locator("[data-ops-applied]")).toHaveAttribute("data-ops-applied", "2"); await expect(b.locator("[data-ops-refused]")).toHaveAttribute("data-ops-refused", "1"); await expect(b.locator("[data-op='refused']")).toContainText("no finding f7"); await expect(b.locator("[data-failed-checks]")).toContainText("a quote not found within ±90 s"); await expect(a.locator("[data-failed-checks]")).toHaveCount(0); // The section only the revision has, and the finding it reworded. await expect(b.locator("[data-section='Later']")).toHaveAttribute("data-only", "here"); await expect(a.locator("[data-section='The claim'] [data-finding]")).toHaveAttribute("data-changed", "yes"); await expect(b.locator("[data-section='Coverage'] [data-finding]")).not.toHaveAttribute("data-changed", "yes"); // Only one side has a project: no cuts. await expect(page.locator("[data-cut]")).toHaveCount(0); }); test("a video revision beside its parent: the same report, both cuts, the narration it changed", async ({ page }) => { await page.goto("/articles/zeta/compare?a=1&b=3"); const b = page.locator("[data-side='3']"); await expect(b).toContainText("report of i1"); await expect(page.locator("[data-cut]")).toHaveCount(2); await expect(b.locator("[data-cut-entry='t0']")).toHaveAttribute("data-changed", "yes"); await expect(b.locator("[data-cut-entry='t0']")).toContainText("The vote, in her words."); await expect(b.locator("[data-cut-entry='a1']")).not.toHaveAttribute("data-changed", "yes"); }); test("the Iterations tab's compare boxes open the page; an unknown iteration is named", async ({ page }) => { await page.goto("/articles/zeta?tab=iterations"); await page.getByRole("checkbox", { name: "compare i1" }).check(); await page.getByRole("checkbox", { name: "compare i2" }).check(); await page.getByRole("link", { name: "Compare i1 and i2" }).click(); await expect(page).toHaveURL(/\/articles\/zeta\/compare\?a=1&b=2$/); await expect(page.locator("[data-side]")).toHaveCount(2); await page.goto("/articles/zeta/compare?a=1&b=9"); await expect(page.getByRole("main").getByRole("alert")).toContainText("no iteration i9"); });