Skip to content

fix(e2e): repair 4 drifts + re-enable PR triggers#2

Merged
RoJLD merged 1 commit into
mainfrom
fix/e2e-drifts
May 28, 2026
Merged

fix(e2e): repair 4 drifts + re-enable PR triggers#2
RoJLD merged 1 commit into
mainfrom
fix/e2e-drifts

Conversation

@RoJLD
Copy link
Copy Markdown
Owner

@RoJLD RoJLD commented May 28, 2026

Summary

Repairs the 4 pre-existing E2E drifts documented in e2e.yml and re-enables the push/pull_request triggers (workflow_dispatch-only since the A.7 PR's dbae026 revert). 21/21 Playwright tests pass locally against a freshly-built studio.

Two shared root causes

1. input[type=file].first() mis-routed uploads — with a warehouse configured (CI sets HMM_STUDIO_WAREHOUSE_PATH), the sidebar's upload input is first in the DOM, so .first() sent the file into the warehouse. This cascaded into 3 of the 4 drifts:

  • no DatasetPreviewCard → "24 rows" missing (golden-path)
  • data_3state.csv polluted the warehouse → 4 CSV badges vs 3 (warehouse)
  • Fit page had no dataset → "Launch fit" disabled (tour-recording)

Fix: data-testid="dataset-upload-input" on the DataDropZone input + getByTestId.

2. page.goto() dropped the in-memory datasetdatasetStore isn't persisted to localStorage (only topologyStore is), so a full-reload navigation cleared the dataset. Fix: client-side nav via getByRole("link", ...).click(), matching real user behaviour.

Drift 1 (academy h1) and a status-label ambiguity were fixed with heading-role / exact locators.

Test plan

  • npx playwright test locally → 21/21 passed (golden-path 4.3s, tour 23.4s, warehouse ×4, academy, a11y, topology-editor)
  • No app behaviour change beyond the test-only data-testid attribute
  • CI E2E job runs green on this PR (now that triggers are re-enabled)

🤖 Generated with Claude Code

Verified locally against a freshly-built studio: 21/21 Playwright tests pass.
Re-enables the `push`/`pull_request` triggers in e2e.yml (workflow_dispatch-
only since the dbae026 revert).

The 4 documented drifts shared two root causes:

### Root cause 1 — `input[type=file].first()` mis-routes the upload

golden-path and tour-recording uploaded via `page.locator('input[type=file]')
.first()`. With a warehouse configured (HMM_STUDIO_WAREHOUSE_PATH, as in CI),
the sidebar's "Upload to warehouse" input is first in the DOM, so `.first()`
sent the file into the warehouse instead of the local dataset flow. Effects:
  * `current` never set → no DatasetPreviewCard → "24 rows" not found (drift 2)
  * the upload wrote data_3state.csv into the warehouse dir → the warehouse
    spec saw 4 CSV badges instead of 3 (drift 3)
  * the Fit page had no dataset → "Launch fit" stayed disabled (drift 4)

Fix: add `data-testid="dataset-upload-input"` to the DataDropZone input and
target it with `getByTestId(...)`. One stable hook, layout-independent.

### Root cause 2 — page.goto() drops the in-memory dataset

Even targeting the right input, both workflow tests navigated with
`page.goto("/topology")` / `page.goto("/fit")` — a full reload. topologyStore
persists to localStorage but datasetStore does NOT, so the reload cleared the
dataset and re-disabled "Launch fit". Real users navigate client-side (nav
links), which preserves the store.

Fix: navigate via `getByRole("link", { name: ... }).click()` after the upload.
This matches real user behaviour and keeps the dataset in memory.

### Drift 1 — academy h1 strict-mode

`locator('h1').toContainText("Markov chains")` resolved to 2 elements (sidebar
"hmm-studio" <h1> + lesson title <h1>). Fixed to
`getByRole("heading", { level: 1, name: /Markov chains/i })`. Also switched the
lesson-list assertions (line 14-20) to heading-role locators in the prior
hardening commit; this finishes the file.

### Drift 2b — ambiguous status-label locator

golden-path `getByText(/Topology/i)` matched 3 elements (nav link, page
description, status label). Scoped to `getByText("Topology", { exact: true })`.

No app behaviour changed beyond the test-only `data-testid` attribute.
@RoJLD RoJLD merged commit a8eeb44 into main May 28, 2026
7 checks passed
@RoJLD RoJLD deleted the fix/e2e-drifts branch May 28, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant