fix(e2e): repair 4 drifts + re-enable PR triggers#2
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Repairs the 4 pre-existing E2E drifts documented in
e2e.ymland re-enables thepush/pull_requesttriggers (workflow_dispatch-only since the A.7 PR'sdbae026revert). 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 setsHMM_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:DatasetPreviewCard→ "24 rows" missing (golden-path)data_3state.csvpolluted the warehouse → 4 CSV badges vs 3 (warehouse)Fix:
data-testid="dataset-upload-input"on the DataDropZone input +getByTestId.2.
page.goto()dropped the in-memory dataset —datasetStoreisn't persisted to localStorage (onlytopologyStoreis), so a full-reload navigation cleared the dataset. Fix: client-side nav viagetByRole("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 testlocally → 21/21 passed (golden-path 4.3s, tour 23.4s, warehouse ×4, academy, a11y, topology-editor)data-testidattribute🤖 Generated with Claude Code