|
| 1 | +import { |
| 2 | + cleanupFlowRuns, |
| 3 | + cleanupFlows, |
| 4 | + expect, |
| 5 | + runSimpleTask, |
| 6 | + test, |
| 7 | + waitForServerHealth, |
| 8 | +} from "../fixtures"; |
| 9 | + |
| 10 | +const TEST_PREFIX = "e2e-trun-detail-"; |
| 11 | + |
| 12 | +test.describe("Task Run Detail Page", () => { |
| 13 | + test.describe.configure({ mode: "serial" }); |
| 14 | + |
| 15 | + test.beforeAll(async ({ apiClient }) => { |
| 16 | + await waitForServerHealth(apiClient); |
| 17 | + }); |
| 18 | + |
| 19 | + test.beforeEach(async ({ apiClient }) => { |
| 20 | + try { |
| 21 | + await cleanupFlowRuns(apiClient, TEST_PREFIX); |
| 22 | + await cleanupFlows(apiClient, TEST_PREFIX); |
| 23 | + } catch { |
| 24 | + // Ignore cleanup errors |
| 25 | + } |
| 26 | + }); |
| 27 | + |
| 28 | + test.afterEach(async ({ apiClient }) => { |
| 29 | + try { |
| 30 | + await cleanupFlowRuns(apiClient, TEST_PREFIX); |
| 31 | + await cleanupFlows(apiClient, TEST_PREFIX); |
| 32 | + } catch { |
| 33 | + // Ignore cleanup errors |
| 34 | + } |
| 35 | + }); |
| 36 | + |
| 37 | + test("Navigate to task run detail by ID", async ({ page }) => { |
| 38 | + const result = runSimpleTask(TEST_PREFIX); |
| 39 | + const taskRunId = result.task_run_ids[0]; |
| 40 | + const taskRunName = result.task_run_names[0]; |
| 41 | + |
| 42 | + await page.goto(`/runs/task-run/${taskRunId}`); |
| 43 | + |
| 44 | + await expect( |
| 45 | + page.getByLabel("breadcrumb").getByText(taskRunName, { exact: true }), |
| 46 | + ).toBeVisible({ timeout: 15000 }); |
| 47 | + await expect(page).toHaveURL(new RegExp(`/runs/task-run/${taskRunId}`)); |
| 48 | + }); |
| 49 | + |
| 50 | + test("Task run metadata with parent flow run link", async ({ page }) => { |
| 51 | + const result = runSimpleTask(TEST_PREFIX); |
| 52 | + const taskRunId = result.task_run_ids[0]; |
| 53 | + |
| 54 | + await page.goto(`/runs/task-run/${taskRunId}`); |
| 55 | + |
| 56 | + await expect( |
| 57 | + page |
| 58 | + .getByLabel("breadcrumb") |
| 59 | + .getByText(result.task_run_names[0], { exact: true }), |
| 60 | + ).toBeVisible({ timeout: 15000 }); |
| 61 | + |
| 62 | + const badge = page.locator('[class*="bg-state-completed"]'); |
| 63 | + await expect(badge).toBeVisible({ timeout: 10000 }); |
| 64 | + await expect(badge.getByText("Completed")).toBeVisible(); |
| 65 | + |
| 66 | + const parentLink = page |
| 67 | + .getByLabel("breadcrumb") |
| 68 | + .getByRole("link", { name: result.flow_run_name }); |
| 69 | + await expect(parentLink).toBeVisible({ timeout: 10000 }); |
| 70 | + await parentLink.click(); |
| 71 | + |
| 72 | + await expect(page).toHaveURL( |
| 73 | + new RegExp(`/runs/flow-run/${result.flow_run_id}`), |
| 74 | + ); |
| 75 | + await expect( |
| 76 | + page |
| 77 | + .getByLabel("breadcrumb") |
| 78 | + .getByText(result.flow_run_name, { exact: true }), |
| 79 | + ).toBeVisible({ timeout: 10000 }); |
| 80 | + }); |
| 81 | + |
| 82 | + test("Task run detail sidebar shows metadata", async ({ page }) => { |
| 83 | + const result = runSimpleTask(TEST_PREFIX); |
| 84 | + const taskRunId = result.task_run_ids[0]; |
| 85 | + |
| 86 | + await page.goto(`/runs/task-run/${taskRunId}`); |
| 87 | + |
| 88 | + await expect( |
| 89 | + page |
| 90 | + .getByLabel("breadcrumb") |
| 91 | + .getByText(result.task_run_names[0], { exact: true }), |
| 92 | + ).toBeVisible({ timeout: 15000 }); |
| 93 | + |
| 94 | + await expect(page.getByText("Flow Run")).toBeVisible({ timeout: 10000 }); |
| 95 | + |
| 96 | + await expect(page.getByText("Start Time")).toBeVisible({ timeout: 10000 }); |
| 97 | + await expect(page.getByText("Duration")).toBeVisible({ timeout: 10000 }); |
| 98 | + }); |
| 99 | +}); |
0 commit comments