README.md
yukey-testkit๐
A dependency-free CDP client for driving a page with trusted input, and reading its state between steps.
It exists because synthetic DOM events can't drive real focus traversal:
a KeyboardEvent dispatched from JavaScript won't move focus on Tab,
won't type into an input, and won't trigger hover.
Trusted input (Input.dispatchKeyEvent and friends over the Chrome DevTools Protocol)
is what a real keyboard and mouse produce, so a test built on it exercises the same paths a user does.
That's the only kind of test that can prove a keyboard-first UI actually works from the keyboard.
Node 22+, using its built-in WebSocket. Nothing else.
What's in it๐
yukey-testkit/cdp: theCdpclass.Cdp.connect(wsUrl)to a page target; thenkey,click,mouseMove,wheelfor trusted input,js(expr)for state reads,screenshot(), andcmdfor any other protocol method.yukey-testkit/checks: theCheckscollector (a PASS/FAIL line protocol with a summary), theScenarioandScenarioContextshapes a suite runner can share, andshotfor optional screenshot evidence (written only whenYUKEY_E2E_SHOTS_DIRis set).yukey-testkit/sleep: a promise-returning sleep for polling loops.
Launching Chrome and serving your page are yours to do; they vary too much per app to belong here.
Yukey's own packages/e2e/harness.ts is one worked example (static files on an ephemeral port, a headless Chrome with a throwaway profile).
License๐
SPDX-License-Identifier: Apache-2.0 OR MIT
packages/yukey-testkit/README.md ยท 1.5 KiB ยท 1cd98c6430