diff --git a/e2e/dashboard-widgets.spec.js b/e2e/dashboard-widgets.spec.js index 0730f81e3..6fe6b3aa4 100644 --- a/e2e/dashboard-widgets.spec.js +++ b/e2e/dashboard-widgets.spec.js @@ -229,14 +229,14 @@ test("dashboard widgets render with mocked metrics", async ({ page }) => { await expect( page.getByRole("heading", { name: "Dashboard", exact: true }) ).toBeVisible({ timeout: 30000 }); - await expect(page.getByRole("heading", { name: "Your Commits" })).toBeVisible( + await expect(page.getByRole("heading", { name: "Your Commits" }).first()).toBeVisible( { timeout: 10000 } ); await expect(page.getByRole("heading", { name: "PR Analytics" }).first()).toBeVisible( { timeout: 10000 } ); await expect( - page.getByRole("heading", { name: "Goals", exact: true }) + page.getByRole("heading", { name: "Goals", exact: true }).first() ).toBeVisible({ timeout: 10000 }); await expect(page.getByText("Make 10 commits")).toBeVisible({ timeout: 10000, diff --git a/e2e/notifications.spec.js b/e2e/notifications.spec.js index dbd0ddf38..514469871 100644 --- a/e2e/notifications.spec.js +++ b/e2e/notifications.spec.js @@ -340,7 +340,7 @@ test("notification bell opens and closes drawer", async ({ page }) => { await expect(page.getByRole("heading", { name: "Dashboard", exact: true })).toBeVisible({ timeout: 30000 }); // Find and click the notification bell - const bellButton = page.getByRole("button", { name: /Notifications/ }); + const bellButton = page.getByRole("button", { name: /Notifications/ }).first(); await expect(bellButton).toBeVisible({ timeout: 10000 }); await bellButton.click(); diff --git a/src/app/api/metrics/achievement-progress/route.ts b/src/app/api/metrics/achievement-progress/route.ts index 7dd2d6153..1911e1b86 100644 --- a/src/app/api/metrics/achievement-progress/route.ts +++ b/src/app/api/metrics/achievement-progress/route.ts @@ -1,4 +1,4 @@ -import { getServerSession } from "next-auth"; +import { getServerSession } from "next-auth"; import { NextRequest } from "next/server"; import { authOptions } from "@/lib/auth"; import { GitHubAuthError, githubAuthErrorResponse } from "@/lib/github-fetch"; diff --git a/src/lib/metrics-cache.ts b/src/lib/metrics-cache.ts index 161767fc9..a24e6a687 100644 --- a/src/lib/metrics-cache.ts +++ b/src/lib/metrics-cache.ts @@ -20,7 +20,8 @@ export const METRICS_CACHE_TTL_SECONDS = { compare: 30 * 60, "weekly-summary": 30 * 60, "commit-times": 30 * 60, - "achievement-progress": 10 * 60, + // 2 hours TTL for historical achievements because they do not require real-time updates + "achievement-progress": 2 * 60 * 60, } as const; type MetricsCacheEndpoint = keyof typeof METRICS_CACHE_TTL_SECONDS;