@dloizides/game-e2e 1.6.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,89 +1,97 @@
1
- # Changelog
2
-
3
- All notable changes to `@dloizides/game-e2e` are documented here.
4
-
5
- ## 1.6.0
6
-
7
- GAME-INPUT-PROMPTS-1 "Every action bound, with device labels":
8
-
9
- - `expectActionsBound(page, bindings, options?)`, `measureActionBinding`, `readActionElements`, `toActionReading`,
10
- `summariseActionBinding`, `actionBindingFindings`: fails when a visible clickable has no `data-gi-action`, a tagged
11
- action has no key or pad binding, a visible `data-gi-prompt` shows a label other than the current binding, or zero
12
- elements were read. Bindings are an input (`ActionBindings`), so the gate does not depend on a game-input release.
13
-
14
- ## 1.5.0
15
-
16
- TEXT-FIT-1 "UI text never overflows its box at 360x640 or desktop, in every state":
17
-
18
- - `expectTextFits(page, selector?, options?)`, `measureTextFit`, `readTextBoxes`, `summariseTextFit`, `textFitFindings`:
19
- fails when visible text is wider/taller than its box or spills its parent, across named UI states. Trigger: Surge's
20
- "Daily run" button with the "Completed today" badge ran past the button edge at 360x640 and 1280.
21
-
22
- ## 1.4.0
23
-
24
- GAME-E2E-PRESS-1 "Faster pad presses in game-e2e walks":
25
-
26
- - `stubGamepad().press` holds the button for exactly one sampled frame and resolves once a reader has seen it
27
- released (`navigator.getGamepads()` calls latched to `document.timeline.currentTime`), instead of 3+3 fixed
28
- `requestAnimationFrame` ticks. Under CPU load the old hold outlasted the 380 ms pad repeat delay and moved focus
29
- twice, so the walk skipped rows. `STUB_FRAMES` is now 1; `PRESS_WAIT_FRAMES` (240) caps the wait when no reader polls.
30
-
31
- ## 1.3.0
32
-
33
- NAV-1 "Every game menu works with arrow keys and controller", phase 4 (canvas menus):
34
-
35
- - `expectHookMenuWalkable(page, { screens, open, via?, sizes? })` / `walkHookMenus`: walks menus drawn on a canvas
36
- (Phaser, Babylon GUI) through the `window.__menuWalk` hook (`MenuWalkHook` from `@dloizides/game-input` 1.6.0).
37
- Per screen, at phone (360x640) and desktop (1280x720) viewports, by arrow keys and the stubbed pad: learns every
38
- focus transition until no direction is left untried, fails naming each unreached item. `activates: { item, to }`
39
- checks Enter / A opens a screen; Escape / B must leave the screen unless `leaves: false`.
40
- - Arrow/pad driver moved to `menu-walk-driver.ts`, shared by the DOM and hook walkers (adds Enter / A `activate`).
41
-
42
- ## 1.2.1
43
-
44
- - Listener lookup is one `Runtime.evaluate` (DevTools `getEventListeners`) instead of two CDP calls per element. The
45
- per-element calls slowed the walk enough that a screen re-rendering on a late fetch (Surge `stagePreview`) went red.
46
-
47
- ## 1.2.0
48
-
49
- NAV-1 "Every game menu works with arrow keys and controller", walker gap:
50
-
51
- - The walker now finds pointer-only items whose click / pointerdown / pointerup handler is set as a property
52
- (`el.onclick = ...`) or added with `addEventListener`, not only the `[onclick]` attribute. A visible element
53
- with such a handler that is not focusable is reported `unreached`.
54
- - Listeners are read through CDP `DOMDebugger.getEventListeners` (Chromium). Without CDP (Firefox, WebKit) only
55
- the attribute and properties are checked, and each result carries a `notes` line saying so.
56
- - Delegation: an element that contains a walk control, or sits inside one, is never flagged, so a listener on a
57
- menu container does not flag the container or its children. When nested elements are both flagged, only the
58
- innermost is reported.
59
- - `WalkResult.notes` (new, printed as `note:` by `renderWalk`).
60
-
61
- ## 1.1.0
62
-
63
- NAV-1 "Every game menu works with arrow keys and controller", phase 1:
64
-
65
- - `walkMenus()` / `expectMenuWalkable()`: open each screen, walk every focusable control by arrow keys and
66
- by a stubbed gamepad (breadth-first from the focused control), report unreached controls, a dialog that
67
- opens without focus inside it, sliders that ignore Left/Right, and Escape / B that does not close a dialog.
68
- Exemptions take a selector and a printed reason.
69
- - `stubGamepad()`: a `navigator.getGamepads()` stand-in driven from the test (`PadDriver.press`).
70
- - `renderWalk()`, `walkFailed()`, `WALK_INPUTS`.
71
- - Depends on `@dloizides/game-input` ^1.5.1 for the shared focusable and dialog selectors.
72
-
73
- ## 1.0.0
74
-
75
- First release. Playwright helpers that Aurora, Surge and Morphe each carried a copy of, unified on the
76
- strictest behaviour of the three:
77
-
78
- - `phone()` / `desktop()` / `gameProjects()`: Galaxy S5 and Desktop Chrome device descriptors (touch,
79
- mobile UA, isMobile on the phone), resized; never a bare viewport.
80
- - `armVisibleHeight()` / `shrinkVisibleHeight()`: a simulated browser toolbar. `relayoutGlobal` waits for
81
- every active Phaser scene to re-create and throws when the global is missing.
82
- - `expectFitTo()`, `expectCanvasHeight()`, `expectCanvasInside()`: game-shell fit assertions with a
83
- configurable canvas selector.
84
- - `domControls()`, `overlaps()`, `findOverlaps()`, `findOverlapsWithin()`, `canvasBoxToPage()`.
85
- - `diffPngs()` / `regionDiff()` / `countDiff()`: exact by default (tolerance 0, sizes must match);
86
- `ANTI_ALIAS_TOLERANCE` (48) and `width`/`height` opt into Surge's tolerant, scaled comparison.
87
- - `auditTouchTargets()` + `expectTouchTargets(AcrossRoutes)()`: the 44x44 hit-box gate.
88
- - `readHorizontalOverflow()` + `expectNoHorizontalOverflow(AcrossRoutes)()`: the no-horizontal-scroll
89
- gate, measured against the narrower of visualViewport width and clientWidth.
1
+ # Changelog
2
+
3
+ All notable changes to `@dloizides/game-e2e` are documented here.
4
+
5
+ ## 1.6.1
6
+
7
+ GAME-INPUT-PROMPTS-1 "Every action bound, with device labels", D-GIP-9 "Widen AC-GIP-5":
8
+
9
+ - `actionBindingFindings` reports `prompt missing` when a bound action's binding carries a prompt label but no visible
10
+ `data-gi-prompt` shows it (absent, hidden or zero-size chip). Before, such a chip passed. On touch the caller passes
11
+ bindings with `prompt: null`, so hidden chips still pass (AC-GIP-9).
12
+
13
+ ## 1.6.0
14
+
15
+ GAME-INPUT-PROMPTS-1 "Every action bound, with device labels":
16
+
17
+ - `expectActionsBound(page, bindings, options?)`, `measureActionBinding`, `readActionElements`, `toActionReading`,
18
+ `summariseActionBinding`, `actionBindingFindings`: fails when a visible clickable has no `data-gi-action`, a tagged
19
+ action has no key or pad binding, a visible `data-gi-prompt` shows a label other than the current binding, or zero
20
+ elements were read. Bindings are an input (`ActionBindings`), so the gate does not depend on a game-input release.
21
+
22
+ ## 1.5.0
23
+
24
+ TEXT-FIT-1 "UI text never overflows its box at 360x640 or desktop, in every state":
25
+
26
+ - `expectTextFits(page, selector?, options?)`, `measureTextFit`, `readTextBoxes`, `summariseTextFit`, `textFitFindings`:
27
+ fails when visible text is wider/taller than its box or spills its parent, across named UI states. Trigger: Surge's
28
+ "Daily run" button with the "Completed today" badge ran past the button edge at 360x640 and 1280.
29
+
30
+ ## 1.4.0
31
+
32
+ GAME-E2E-PRESS-1 "Faster pad presses in game-e2e walks":
33
+
34
+ - `stubGamepad().press` holds the button for exactly one sampled frame and resolves once a reader has seen it
35
+ released (`navigator.getGamepads()` calls latched to `document.timeline.currentTime`), instead of 3+3 fixed
36
+ `requestAnimationFrame` ticks. Under CPU load the old hold outlasted the 380 ms pad repeat delay and moved focus
37
+ twice, so the walk skipped rows. `STUB_FRAMES` is now 1; `PRESS_WAIT_FRAMES` (240) caps the wait when no reader polls.
38
+
39
+ ## 1.3.0
40
+
41
+ NAV-1 "Every game menu works with arrow keys and controller", phase 4 (canvas menus):
42
+
43
+ - `expectHookMenuWalkable(page, { screens, open, via?, sizes? })` / `walkHookMenus`: walks menus drawn on a canvas
44
+ (Phaser, Babylon GUI) through the `window.__menuWalk` hook (`MenuWalkHook` from `@dloizides/game-input` 1.6.0).
45
+ Per screen, at phone (360x640) and desktop (1280x720) viewports, by arrow keys and the stubbed pad: learns every
46
+ focus transition until no direction is left untried, fails naming each unreached item. `activates: { item, to }`
47
+ checks Enter / A opens a screen; Escape / B must leave the screen unless `leaves: false`.
48
+ - Arrow/pad driver moved to `menu-walk-driver.ts`, shared by the DOM and hook walkers (adds Enter / A `activate`).
49
+
50
+ ## 1.2.1
51
+
52
+ - Listener lookup is one `Runtime.evaluate` (DevTools `getEventListeners`) instead of two CDP calls per element. The
53
+ per-element calls slowed the walk enough that a screen re-rendering on a late fetch (Surge `stagePreview`) went red.
54
+
55
+ ## 1.2.0
56
+
57
+ NAV-1 "Every game menu works with arrow keys and controller", walker gap:
58
+
59
+ - The walker now finds pointer-only items whose click / pointerdown / pointerup handler is set as a property
60
+ (`el.onclick = ...`) or added with `addEventListener`, not only the `[onclick]` attribute. A visible element
61
+ with such a handler that is not focusable is reported `unreached`.
62
+ - Listeners are read through CDP `DOMDebugger.getEventListeners` (Chromium). Without CDP (Firefox, WebKit) only
63
+ the attribute and properties are checked, and each result carries a `notes` line saying so.
64
+ - Delegation: an element that contains a walk control, or sits inside one, is never flagged, so a listener on a
65
+ menu container does not flag the container or its children. When nested elements are both flagged, only the
66
+ innermost is reported.
67
+ - `WalkResult.notes` (new, printed as `note:` by `renderWalk`).
68
+
69
+ ## 1.1.0
70
+
71
+ NAV-1 "Every game menu works with arrow keys and controller", phase 1:
72
+
73
+ - `walkMenus()` / `expectMenuWalkable()`: open each screen, walk every focusable control by arrow keys and
74
+ by a stubbed gamepad (breadth-first from the focused control), report unreached controls, a dialog that
75
+ opens without focus inside it, sliders that ignore Left/Right, and Escape / B that does not close a dialog.
76
+ Exemptions take a selector and a printed reason.
77
+ - `stubGamepad()`: a `navigator.getGamepads()` stand-in driven from the test (`PadDriver.press`).
78
+ - `renderWalk()`, `walkFailed()`, `WALK_INPUTS`.
79
+ - Depends on `@dloizides/game-input` ^1.5.1 for the shared focusable and dialog selectors.
80
+
81
+ ## 1.0.0
82
+
83
+ First release. Playwright helpers that Aurora, Surge and Morphe each carried a copy of, unified on the
84
+ strictest behaviour of the three:
85
+
86
+ - `phone()` / `desktop()` / `gameProjects()`: Galaxy S5 and Desktop Chrome device descriptors (touch,
87
+ mobile UA, isMobile on the phone), resized; never a bare viewport.
88
+ - `armVisibleHeight()` / `shrinkVisibleHeight()`: a simulated browser toolbar. `relayoutGlobal` waits for
89
+ every active Phaser scene to re-create and throws when the global is missing.
90
+ - `expectFitTo()`, `expectCanvasHeight()`, `expectCanvasInside()`: game-shell fit assertions with a
91
+ configurable canvas selector.
92
+ - `domControls()`, `overlaps()`, `findOverlaps()`, `findOverlapsWithin()`, `canvasBoxToPage()`.
93
+ - `diffPngs()` / `regionDiff()` / `countDiff()`: exact by default (tolerance 0, sizes must match);
94
+ `ANTI_ALIAS_TOLERANCE` (48) and `width`/`height` opt into Surge's tolerant, scaled comparison.
95
+ - `auditTouchTargets()` + `expectTouchTargets(AcrossRoutes)()`: the 44x44 hit-box gate.
96
+ - `readHorizontalOverflow()` + `expectNoHorizontalOverflow(AcrossRoutes)()`: the no-horizontal-scroll
97
+ gate, measured against the narrower of visualViewport width and clientWidth.
package/dist/index.d.mts CHANGED
@@ -350,7 +350,7 @@ interface ActionBindingFinding {
350
350
  name: string;
351
351
  why: string;
352
352
  }
353
- /** Every way one element breaks "every action bound": untagged, no key, no pad button, stale prompt. */
353
+ /** Every way one element breaks "every action bound": untagged, no key, no pad button, stale or missing prompt. */
354
354
  declare function actionBindingFindings(r: ActionReading): ActionBindingFinding[];
355
355
  /** Folds every reading into one tally; zero readings is a blind probe and counts as a problem. */
356
356
  declare function summariseActionBinding(readings: readonly ActionReading[], where: string): GateSummary;
package/dist/index.d.ts CHANGED
@@ -350,7 +350,7 @@ interface ActionBindingFinding {
350
350
  name: string;
351
351
  why: string;
352
352
  }
353
- /** Every way one element breaks "every action bound": untagged, no key, no pad button, stale prompt. */
353
+ /** Every way one element breaks "every action bound": untagged, no key, no pad button, stale or missing prompt. */
354
354
  declare function actionBindingFindings(r: ActionReading): ActionBindingFinding[];
355
355
  /** Folds every reading into one tally; zero readings is a blind probe and counts as a problem. */
356
356
  declare function summariseActionBinding(readings: readonly ActionReading[], where: string): GateSummary;
package/dist/index.js CHANGED
@@ -1027,10 +1027,12 @@ function bindingFindings(r, action) {
1027
1027
  return found;
1028
1028
  }
1029
1029
  function promptFinding(r) {
1030
- const comparable = r.promptText !== null && r.expectedPromptText !== null;
1031
- if (!comparable || r.promptText === r.expectedPromptText) {
1030
+ if (r.expectedPromptText === null || r.promptText === r.expectedPromptText) {
1032
1031
  return null;
1033
1032
  }
1033
+ if (r.promptText === null) {
1034
+ return { name: r.name, why: `prompt missing: the current binding is "${r.expectedPromptText}" but no visible data-gi-prompt shows it` };
1035
+ }
1034
1036
  return { name: r.name, why: `prompt shows "${String(r.promptText)}" but the current binding is "${String(r.expectedPromptText)}"` };
1035
1037
  }
1036
1038
  function actionBindingFindings(r) {