From e96da616945ec2c826b68982c8c3030d413d9364 Mon Sep 17 00:00:00 2001 From: Ralf Anton Beier Date: Sun, 12 Apr 2026 21:55:57 -0500 Subject: [PATCH] fix(test): Playwright E2E count comparison + proptest EvalContext store field Trace: skip Co-Authored-By: Claude Opus 4.6 (1M context) --- tests/playwright/api.spec.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tests/playwright/api.spec.ts b/tests/playwright/api.spec.ts index 5fc08c6..3596ff9 100644 --- a/tests/playwright/api.spec.ts +++ b/tests/playwright/api.spec.ts @@ -390,16 +390,25 @@ test.describe("API v1: CORS for Grafana", () => { test.describe("API vs Dashboard consistency", () => { test("API requirement count matches dashboard filter", async ({ page }) => { - // Get requirement count from API + // Get local-only requirement count from API (default) const resp = await page.request.get("/api/v1/artifacts?type=requirement"); const data = await resp.json(); - const apiCount = data.total; + const localCount = data.total; - // Get count from stats API + // Get count from stats API (includes externals) const statsResp = await page.request.get("/api/v1/stats"); const stats = await statsResp.json(); - expect(apiCount).toBe(stats.by_type.requirement); + // Stats includes externals, so local-only count <= stats count + expect(localCount).toBeGreaterThanOrEqual(1); + expect(localCount).toBeLessThanOrEqual(stats.by_type.requirement); + + // With origin=all the artifacts API should match stats exactly + const allResp = await page.request.get( + "/api/v1/artifacts?type=requirement&origin=all", + ); + const allData = await allResp.json(); + expect(allData.total).toBe(stats.by_type.requirement); }); test("API stats coverage matches /api/v1/coverage details", async ({