Skip to content

Commit 28eee32

Browse files
fix(dashboard): polish pass - a11y test mocks for cost API
Updates a11y test mocks. Recovery from botched remerge of #3283.
1 parent dd4cf6c commit 28eee32

5 files changed

Lines changed: 26 additions & 8 deletions

File tree

dashboard/src/__tests__/a11y-pages.test.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,18 @@ vi.mock('../api/client', () => ({
165165
],
166166
generatedAt: new Date().toISOString(),
167167
}),
168+
getCostSummary: vi.fn().mockResolvedValue({
169+
from: null, to: null,
170+
totalInputTokens: 3000, totalOutputTokens: 1500,
171+
totalCacheCreationTokens: 600, totalCacheReadTokens: 2400,
172+
cacheHitRate: 0.8, estimatedCostUsd: 12.34,
173+
burnRateUsdPerHour: 1.5, sessions: 5,
174+
}),
175+
getCostByModel: vi.fn().mockResolvedValue({
176+
from: null, to: null,
177+
models: [{ model: 'claude-sonnet-4-20250514', inputTokens: 3000, outputTokens: 1500, cacheCreationTokens: 600, cacheReadTokens: 2400, estimatedCostUsd: 12.34, cacheHitRate: 0.8 }],
178+
totalModels: 1, totalCostUsd: 12.34,
179+
}),
168180
checkForUpdates: vi.fn().mockResolvedValue({
169181
currentVersion: '1.0.0',
170182
latestVersion: '1.0.0',

dashboard/src/pages/ActivityPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default function ActivityPage() {
1616
<div className="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
1717
<div>
1818
<h1 className="text-2xl font-bold text-[var(--color-text-primary)]">Live Activity</h1>
19-
<p className="mt-1 text-sm text-[var(--color-text-muted)] dark:text-slate-400 flex items-center gap-2">
19+
<p className="mt-1 text-sm text-[var(--color-text-muted)] flex items-center gap-2">
2020
{t('activity.subtitle')}
2121
<LiveStatusIndicator />
2222
</p>

dashboard/src/pages/AuthKeysPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ export default function AuthKeysPage() {
214214
<div
215215
role="status"
216216
aria-live="polite"
217-
className="flex items-start justify-between gap-3 rounded-lg border border-slate-700/60 bg-slate-800/30 px-4 py-3 text-sm text-slate-300"
217+
className="flex items-start justify-between gap-3 rounded-lg border border-[var(--color-border-strong)] bg-[var(--color-surface-strong)] p-4 text-sm text-[var(--color-text-primary)]"
218218
>
219219
<p className="leading-relaxed">
220220
{t('authKeys.usersBannerText')}
@@ -223,7 +223,7 @@ export default function AuthKeysPage() {
223223
type="button"
224224
onClick={dismissUsersBanner}
225225
aria-label={t('authKeys.authDismissBanner')}
226-
className="shrink-0 rounded p-1 text-slate-400 transition-colors hover:bg-slate-700/40 hover:text-slate-200"
226+
className="shrink-0 rounded p-1 text-[var(--color-text-muted)] transition-colors hover:bg-[var(--color-surface-hover)] hover:text-[var(--color-text-primary)]"
227227
>
228228
<X className="h-3.5 w-3.5" />
229229
</button>

dashboard/src/pages/CostPage.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,12 @@ export default function CostPage() {
225225
<SkeletonCard className="h-72" />
226226
<SkeletonCard className="h-72" />
227227
</div>
228+
{/* Cost analytics skeleton */}
229+
<SkeletonCard className="h-72" />
230+
<div className="grid grid-cols-1 gap-4 lg:grid-cols-2">
231+
<SkeletonCard className="h-72" />
232+
<SkeletonCard className="h-72" />
233+
</div>
228234
</div>
229235
);
230236
}
@@ -332,7 +338,7 @@ export default function CostPage() {
332338

333339
{/* Daily spend chart */}
334340
{dailyData.length > 0 && (
335-
<section className="rounded-lg border border-[var(--color-border-strong)] bg-[var(--color-surface-strong)] p-5">
341+
<section className="rounded-lg border border-[var(--color-border-strong)] bg-[var(--color-surface-strong)] p-5" aria-label="Daily spend chart">
336342
<h3 className="mb-4 text-lg font-medium text-[var(--color-text-primary)]">
337343
Daily Spend ({dailyData.length} days)
338344
</h3>
@@ -366,7 +372,7 @@ export default function CostPage() {
366372

367373
{/* ── Cost Analytics Panels (#3273) ── */}
368374
<section aria-label="Cost analytics">
369-
<div className="mb-4 flex items-center justify-between">
375+
<div className="mb-4 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between">
370376
<h2 className="text-lg font-medium text-[var(--color-text-primary)]">
371377
Cost Analytics
372378
</h2>
@@ -389,7 +395,7 @@ export default function CostPage() {
389395
{modelData.length > 0 && (
390396
<div className="grid grid-cols-1 gap-4 lg:grid-cols-2">
391397
{/* Pie chart */}
392-
<section className="rounded-lg border border-[var(--color-border-strong)] bg-[var(--color-surface-strong)] p-5">
398+
<section className="rounded-lg border border-[var(--color-border-strong)] bg-[var(--color-surface-strong)] p-5" aria-label="Cost by model chart">
393399
<h3 className="mb-4 text-lg font-medium text-[var(--color-text-primary)]">
394400
Cost by Model
395401
</h3>
@@ -420,7 +426,7 @@ export default function CostPage() {
420426
</section>
421427

422428
{/* Model list */}
423-
<section className="rounded-lg border border-[var(--color-border-strong)] bg-[var(--color-surface-strong)] p-5">
429+
<section className="rounded-lg border border-[var(--color-border-strong)] bg-[var(--color-surface-strong)] p-5" aria-label="Model details">
424430
<h3 className="mb-4 text-lg font-medium text-[var(--color-text-primary)]">
425431
Model Details
426432
</h3>

dashboard/src/pages/SessionsPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default function SessionsPage() {
3535
{/* Page header */}
3636
<div>
3737
<h1 className="text-2xl font-bold text-[var(--color-text-primary)]">{translate("sessions.title")}</h1>
38-
<p className="mt-1 text-sm text-[var(--color-text-muted)] dark:text-slate-400">
38+
<p className="mt-1 text-sm text-[var(--color-text-muted)] ">
3939
{translate("sessions.subtitle")}
4040
</p>
4141
</div>

0 commit comments

Comments
 (0)