import { test, expect } from "@playwright/test"; import { channelStage, generateReport, resetData, } from "./helpers"; test("shows the originating channel as a link on the jobs list and detail", async ({ page, }) => { await resetData("test-pipeline"); await generateReport(page, "test-pipeline"); await page.goto(channelStage("test-pipeline", "playlist")); await page.getByRole("button", { name: "Store playlist" }).click(); await expect(page.getByLabel("Store playlist output")).toContainText( "Wrote 5 URLs", { timeout: 20_000 }, ); await page.goto("/jobs"); const firstRow = page.getByRole("row").nth(1); // 0 is header const channelLink = firstRow.getByRole("link", { name: "test-pipeline" }); await expect(channelLink).toHaveAttribute("href", "/channels/test-pipeline"); // Click into the job detail page via its id link (first link in the row). await firstRow.getByRole("link").first().click(); await expect( page.getByRole("link", { name: "test-pipeline" }), ).toHaveAttribute("href", "/channels/test-pipeline"); }); test("auto-refreshes the jobs list when a job is running", async ({ page }) => { await resetData("slow-pipeline-channel"); await generateReport(page, "slow-channel"); await page.goto(channelStage("slow-channel", "playlist")); await page.getByRole("button", { name: "Sync" }).click(); await expect(page.getByLabel("Sync output")).toContainText("test-slow", { timeout: 15_000, }); // Switch to the jobs list and don't manually reload. The status should // start as "running" and flip to "cancelled" within ~10s after we cancel. await page.goto("/jobs"); const slowRow = page .getByRole("row") .filter({ hasText: "slow-channel" }) .first(); await expect(slowRow).toContainText("running"); await slowRow.getByRole("button", { name: /^Cancel$/ }).click(); // Don't navigate again — auto-refresh should pick up the status change. await expect(slowRow).toContainText("cancelled", { timeout: 10_000 }); });