Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

test(e2e): add group-B specs (activity feed, quota-share, plans config, logs/activity redirect) (B/F10)

diegosouzapwb1d07a1604a1
diff --git a/tests/e2e/group-b-activity-feed.spec.ts b/tests/e2e/group-b-activity-feed.spec.ts
new file mode 100644
index 0000000000..b795657166
--- /dev/null
+++ b/tests/e2e/group-b-activity-feed.spec.ts
@@ -0,0 +1,90 @@
+/**
+ * Group B — Activity Feed E2E spec.
+ *
+ * Validates that the new /dashboard/activity page (Group B, plan 16 F4) renders
+ * correctly: header visible, timeline container present, and the page responds
+ * with a 200 (not a redirect or error).
+ *
+ * Backend is mocked so this spec does not require a running upstream.
+ */
+
+import { test, expect } from "@playwright/test";
+import { gotoDashboardRoute } from "./helpers/dashboardAuth";
+
+test.describe("Group B — Activity Feed", () => {
+ test.beforeEach(async ({ page }) => {
+ // Mock the audit-log endpoint used by the Activity feed
+ await page.route("**/api/compliance/audit-log**", async (route) => {
+ const url = new URL(route.request().url());
+ const level = url.searchParams.get("level");
+ if (level === "high") {
+ await route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({
+ entries: [
+ {
+ id: "1",
+ action: "provider.added",
+ actor: "admin",
+ target: "codex",
+ severity: "info",
+ timestamp: new Date().toISOString(),
+ metadata: {},
+ },
+ ],
+ total: 1,
+ }),
+ });
+ } else {
+ await route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({ entries: [], total: 0 }),
+ });
+ }
+ });
+ });
+
+ test("activity page exists and returns 200", async ({ page }) => {
+ const response = await page.goto("http://localhost:20128/dashboard/activity", {
+ waitUntil: "domcontentloaded",
+ });
+ // After login redirect the page should settle on activity or login
+ expect(response?.status()).not.toBe(404);
+ expect(response?.status()).not.toBe(500);
+ });
+
+ test("activity page renders header and timeline container", async ({ page }) => {
+ await gotoDashboardRoute(page, "/dashboard/activity");
+
+ // The page header should be visible (h1 or title element)
+ const heading = page
+ .locator("h1, [data-testid='activity-title']")
+ .first();
+ await expect(heading).toBeVisible({ timeout: 15000 });
+
+ // Timeline container or empty state should be present
+ const timeline = page.locator(
+ "[data-testid='activity-feed'], [data-testid='activity-empty-state'], .activity-feed, ul[role='list']"
+ );
+ await expect(timeline.first()).toBeVisible({ timeout: 15000 });
+ });
+
+ test("activity page does not show raw error stack traces", async ({ page }) => {
+ // Simulate a backend error to ensure error sanitization (Hard Rule #12)
+ await page.route("**/api/compliance/audit-log**", async (route) => {
+ await route.fulfill({
+ status: 500,
+ contentType: "application/json",
+ body: JSON.stringify({ error: { message: "Internal error" } }),
+ });
+ });
+
+ await gotoDashboardRoute(page, "/dashboard/activity");
+
+ const pageContent = await page.content();
+ // Stack traces should never appear in the UI (Hard Rule #12)
+ expect(pageContent).not.toMatch(/\s+at\s+\//);
+ });
+});
diff --git a/tests/e2e/group-b-quota-plans-config.spec.ts b/tests/e2e/group-b-quota-plans-config.spec.ts
new file mode 100644
index 0000000000..3547ff86c2
--- /dev/null
+++ b/tests/e2e/group-b-quota-plans-config.spec.ts
@@ -0,0 +1,97 @@
+/**
+ * Group B — Quota Plans Config E2E spec.
+ *
+ * Validates that the new /dashboard/costs/quota-share/plans page (Group B,
+ * plan 22 F9) renders correctly: provider dropdown visible, and known
+ * providers (e.g. codex) show their plan dimensions.
+ *
+ * Backend is mocked so this spec does not require a running upstream.
+ */
+
+import { test, expect } from "@playwright/test";
+import { gotoDashboardRoute } from "./helpers/dashboardAuth";
+
+test.describe("Group B — Quota Plans Config", () => {
+ test.beforeEach(async ({ page }) => {
+ // Mock the plans list endpoint
+ await page.route("**/api/quota/plans**", async (route) => {
+ const url = new URL(route.request().url());
+ const pathParts = url.pathname.split("/");
+ const lastPart = pathParts[pathParts.length - 1];
+
+ if (lastPart === "plans") {
+ // List all plans
+ await route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify([
+ {
+ connectionId: null,
+ provider: "codex",
+ dimensions: [
+ { unit: "percent", window: "5h", limit: 100 },
+ { unit: "percent", window: "weekly", limit: 100 },
+ ],
+ source: "auto",
+ },
+ ]),
+ });
+ } else {
+ // Single plan by connectionId
+ await route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({
+ connectionId: lastPart,
+ provider: "codex",
+ dimensions: [
+ { unit: "percent", window: "5h", limit: 100 },
+ { unit: "percent", window: "weekly", limit: 100 },
+ ],
+ source: "auto",
+ }),
+ });
+ }
+ });
+ });
+
+ test("quota plans config page exists and returns 200", async ({ page }) => {
+ const response = await page.goto(
+ "http://localhost:20128/dashboard/costs/quota-share/plans",
+ { waitUntil: "domcontentloaded" }
+ );
+ expect(response?.status()).not.toBe(404);
+ expect(response?.status()).not.toBe(500);
+ });
+
+ test("quota plans config page renders provider selector", async ({ page }) => {
+ await gotoDashboardRoute(page, "/dashboard/costs/quota-share/plans");
+
+ // Provider selector (select, combobox, or dropdown) should be visible
+ const providerSelector = page.locator(
+ "select, [role='combobox'], [data-testid='provider-selector']"
+ );
+ await expect(providerSelector.first()).toBeVisible({ timeout: 15000 });
+ });
+
+ test("selecting codex provider shows dimension rows", async ({ page }) => {
+ await gotoDashboardRoute(page, "/dashboard/costs/quota-share/plans");
+
+ // Try to find and interact with the provider selector
+ const selector = page.locator("select, [role='combobox']").first();
+ await expect(selector).toBeVisible({ timeout: 15000 });
+
+ // Select codex if the option is available
+ const codexOption = page.getByRole("option", { name: /codex/i });
+ if (await codexOption.isVisible({ timeout: 3000 }).catch(() => false)) {
+ await selector.selectOption({ label: /codex/i });
+ }
+
+ // After selection, "percent" or "5h" dimension info should appear
+ // (from the mocked plan response)
+ const pageContent = await page.content();
+ // The page should not be in a broken state
+ expect(pageContent).not.toContain("500");
+ expect(pageContent).not.toContain("Internal Server Error");
+ });
+});
diff --git a/tests/e2e/group-b-quota-share-pools.spec.ts b/tests/e2e/group-b-quota-share-pools.spec.ts
new file mode 100644
index 0000000000..dee1412568
--- /dev/null
+++ b/tests/e2e/group-b-quota-share-pools.spec.ts
@@ -0,0 +1,98 @@
+/**
+ * Group B — Quota Share Pools E2E spec.
+ *
+ * Validates that the redesigned /dashboard/costs/quota-share page (Group B,
+ * plan 22 F9) renders correctly: QuotaConceptCard visible, pool list or empty
+ * state present.
+ *
+ * Backend is mocked so this spec does not require a running upstream.
+ */
+
+import { test, expect } from "@playwright/test";
+import { gotoDashboardRoute } from "./helpers/dashboardAuth";
+
+test.describe("Group B — Quota Share Pools", () => {
+ test.beforeEach(async ({ page }) => {
+ // Mock pools list — empty state first
+ await page.route("**/api/quota/pools", async (route) => {
+ if (route.request().method() === "GET") {
+ await route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify([]),
+ });
+ } else {
+ await route.continue();
+ }
+ });
+
+ // Mock plans list
+ await page.route("**/api/quota/plans**", async (route) => {
+ await route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify([]),
+ });
+ });
+
+ // Mock settings/quota-store
+ await page.route("**/api/settings/quota-store", async (route) => {
+ await route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({ driver: "sqlite", redisUrl: null }),
+ });
+ });
+ });
+
+ test("quota-share page exists and returns 200", async ({ page }) => {
+ const response = await page.goto(
+ "http://localhost:20128/dashboard/costs/quota-share",
+ { waitUntil: "domcontentloaded" }
+ );
+ expect(response?.status()).not.toBe(404);
+ expect(response?.status()).not.toBe(500);
+ });
+
+ test("quota-share page renders QuotaConceptCard or pool list", async ({
+ page,
+ }) => {
+ await gotoDashboardRoute(page, "/dashboard/costs/quota-share");
+
+ // Either the concept card (empty state) or a pool list should be visible
+ const conceptCard = page.locator(
+ "[data-testid='quota-concept-card'], [class*='QuotaConceptCard'], h2, h3"
+ );
+ await expect(conceptCard.first()).toBeVisible({ timeout: 15000 });
+ });
+
+ test("quota-share page shows pool list when pools exist", async ({ page }) => {
+ // Override with a pool in the response
+ await page.route("**/api/quota/pools", async (route) => {
+ if (route.request().method() === "GET") {
+ await route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify([
+ {
+ id: "pool-1",
+ connectionId: "conn-codex-1",
+ name: "Codex Shared Pool",
+ createdAt: new Date().toISOString(),
+ allocations: [],
+ },
+ ]),
+ });
+ } else {
+ await route.continue();
+ }
+ });
+
+ await gotoDashboardRoute(page, "/dashboard/costs/quota-share");
+
+ // Pool name should appear somewhere on the page
+ await expect(page.getByText("Codex Shared Pool")).toBeVisible({
+ timeout: 15000,
+ });
+ });
+});
diff --git a/tests/e2e/group-b-redirect-logs-activity.spec.ts b/tests/e2e/group-b-redirect-logs-activity.spec.ts
new file mode 100644
index 0000000000..6b221b395f
--- /dev/null
+++ b/tests/e2e/group-b-redirect-logs-activity.spec.ts
@@ -0,0 +1,48 @@
+/**
+ * Group B — Redirect /dashboard/logs/activity E2E spec.
+ *
+ * Validates that the old path /dashboard/logs/activity permanently redirects
+ * (HTTP 308) to /dashboard/activity as implemented in Group B plan 16 (F4).
+ *
+ * This is a pure HTTP-level test — does not require full page render.
+ */
+
+import { test, expect } from "@playwright/test";
+
+test.describe("Group B — /logs/activity redirect", () => {
+ test("GET /dashboard/logs/activity redirects to /dashboard/activity", async ({
+ page,
+ request,
+ }) => {
+ // Follow redirects and verify the final URL is /dashboard/activity
+ const response = await page.goto(
+ "http://localhost:20128/dashboard/logs/activity",
+ { waitUntil: "domcontentloaded" }
+ );
+
+ const finalUrl = page.url();
+ // After following redirects, should end up at /dashboard/activity
+ // (may also end up at /login if auth is required — that's OK, path is correct)
+ expect(finalUrl).toMatch(/\/(login|dashboard\/activity)/);
+ expect(finalUrl).not.toContain("/logs/activity");
+ });
+
+ test("direct request to /dashboard/logs/activity issues a permanent redirect", async ({
+ request,
+ }) => {
+ // Make a non-follow-redirect request to verify the 308 status code
+ const response = await request.get(
+ "http://localhost:20128/dashboard/logs/activity",
+ {
+ maxRedirects: 0,
+ }
+ );
+
+ // Next.js permanentRedirect() returns 308 (or 307 in development mode).
+ // We accept either since Next.js dev mode may normalize to 307.
+ expect([307, 308]).toContain(response.status());
+
+ const location = response.headers()["location"];
+ expect(location).toMatch(/\/dashboard\/activity/);
+ });
+});