Skip to content

fix(web): repair E2E Smoke — Playwright getByPlaceholder, not Testing-Library getByDisplayValue#171

Merged
stevenfackley merged 3 commits into
mainfrom
fix/e2e-smoke-getbyplaceholder
Jun 22, 2026
Merged

fix(web): repair E2E Smoke — Playwright getByPlaceholder, not Testing-Library getByDisplayValue#171
stevenfackley merged 3 commits into
mainfrom
fix/e2e-smoke-getbyplaceholder

Conversation

@stevenfackley

Copy link
Copy Markdown
Owner

Problem

main CI 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.ts used page.getByDisplayValue(...). That is a Testing-Library API; Playwright's Page has no such method, so every run threw:

TypeError: page.getByDisplayValue is not a function

Introduced by 93cb6b25 (feat(web): wizard draft persistence … #142). The RTL component test (__tests__/components/AdvancedWizard.test.tsx) correctly uses screen.getByDisplayValue — the idiom was copied into a Playwright spec where it is invalid.

Fix

The entity-name input (step-entities.tsx) has placeholder="EntityName" and DEFAULT_ENTITIES is a single { name: "Product" }, so getByPlaceholder("EntityName") is unique. Replaced all 4 getByDisplayValue calls with getByPlaceholder + toHaveValue.

Verification

npx playwright test … --list parses 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).

…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.
@stevenfackley stevenfackley merged commit 3a2bbed into main Jun 22, 2026
14 checks passed
@stevenfackley stevenfackley deleted the fix/e2e-smoke-getbyplaceholder branch June 22, 2026 19: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