Skip to content

Add data-testid attributes to Dashboard tabs for E2E testing #84

@frankbria

Description

@frankbria

Problem

E2E Playwright tests are failing because Dashboard tab buttons lack data-testid attributes. Tests expect to click tabs to navigate to different sections, but cannot locate them.

Current State

Dashboard has 2 tabs (Overview, Context) at web-ui/src/components/Dashboard.tsx:295-320:

  • Overview tab (line 295): No data-testid
  • Context tab (line 308): No data-testid

Expected Behavior

Tests expect the following data-testid values:

  • checkpoint-tab - To navigate to checkpoint section
  • metrics-tab - To navigate to metrics section

Issue

Current design has only 2 tabs (Overview/Context), but tests expect separate tabs for each feature section (Checkpoints, Metrics). All feature panels (Checkpoints, Metrics, Quality Gates) are currently stacked on the Overview tab.

Impact

Blocks 11/12 failed E2E tests:

  • 8 checkpoint UI tests (test_checkpoint_ui.spec.ts)
  • 3 metrics UI tests (test_metrics_ui.spec.ts)

Solution Options

Option A: Add data-testid to existing tabs (Quick - 5 minutes)

// Line 295
<button
  data-testid="overview-tab"
  role="tab"
  ...
>
  Overview
</button>

// Line 308
<button
  data-testid="context-tab"
  role="tab"
  ...
>
  Context
</button>

Then update tests to use overview-tab instead of checkpoint-tab and metrics-tab.

Option B: Add separate tabs for features (Recommended - 1-2 hours)

Create dedicated tabs:

  • Overview (existing)
  • Checkpoints (new - contains CheckpointList)
  • Metrics (new - contains CostDashboard)
  • Quality Gates (new - contains QualityGatesPanel)
  • Context (existing)

Each tab shows only its relevant content.

Recommendation

Option B - Better UX, cleaner navigation, matches test expectations without modifying tests.

Files to Modify

  • web-ui/src/components/Dashboard.tsx:295-320 - Add new tabs
  • web-ui/src/types/dashboard.ts - Update DashboardTab type
  • Tests: No changes needed if Option B

Acceptance Criteria

  • Dashboard tabs have data-testid attributes
  • Tests can locate and click tabs
  • Checkpoint panel visible after clicking checkpoint tab
  • Metrics panel visible after clicking metrics tab
  • All 11 blocked E2E tests pass

Related Files

  • web-ui/src/components/Dashboard.tsx:53 - activeTab state
  • web-ui/src/components/Dashboard.tsx:295-320 - Tab buttons
  • web-ui/src/components/Dashboard.tsx:327-559 - Tab panels
  • tests/e2e/test_checkpoint_ui.spec.ts:29 - Expects checkpoint-tab
  • tests/e2e/test_metrics_ui.spec.ts:32 - Expects metrics-tab

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions