fix(web): repair E2E Smoke — Playwright getByPlaceholder, not Testing-Library getByDisplayValue#171
Merged
Merged
Conversation
…pairs red main CI) advanced-draft-persistence.spec.ts called page.getByDisplayValue(), a Testing-Library API that does not exist on Playwright's Page — every smoke run threw "TypeError: page.getByDisplayValue is not a function", failing the E2E Smoke (Demo Mode) + Quality Gate jobs and reddening main since 93cb6b2 (#142). Locate the single entity-name input by its placeholder ("EntityName") and assert state with toHaveValue, matching how the RTL component test already queries it. Unblocks Dependabot #169/#170.
beforeEach used page.addInitScript(() => localStorage.clear()), which re-runs on EVERY navigation — including the page.reload() the persistence tests depend on — wiping the saved draft mid-test. So even after the getByDisplayValue fix, the "survives a reload" assertion could never pass (input reverted to default). Clear storage once after landing on the origin instead. Verified locally against a demo-mode server: all 3 advanced-draft smoke tests pass.
The "Tab stays trapped" smoke test compared the focused element's innerText (CSS text-transform: uppercase -> "✦ HELP ME WRITE THIS") against the dialog's textContent (raw "✦ Help me write this") via toContainText, which is case- sensitive — so it never matched once focus reached the uppercased CTA button. Assert dialog.contains(activeElement) directly, which is what the focus trap actually guarantees. Verified locally: all personalization + advanced-draft smoke tests pass.
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.
Problem
mainCI has been red since 2026-06-20 (E2E Smoke (Playwright, Demo Mode)+Quality Gate). Not the Dependabot bumps (#169 lucide / #170 @types/node can not affect a Playwright run) — a real test bug.Root cause
e2e/smoke/advanced-draft-persistence.spec.tsusedpage.getByDisplayValue(...). That is a Testing-Library API; Playwright'sPagehas no such method, so every run threw:Introduced by
93cb6b25(feat(web): wizard draft persistence … #142). The RTL component test (__tests__/components/AdvancedWizard.test.tsx) correctly usesscreen.getByDisplayValue— the idiom was copied into a Playwright spec where it is invalid.Fix
The entity-name input (
step-entities.tsx) hasplaceholder="EntityName"andDEFAULT_ENTITIESis a single{ name: "Product" }, sogetByPlaceholder("EntityName")is unique. Replaced all 4getByDisplayValuecalls withgetByPlaceholder+toHaveValue.Verification
npx playwright test … --listparses clean; full chromium smoke run in progress locally. CI will run the real suite here.Unblocks Dependabot #169 / #170 (they will go green once main is repaired).