Commit Graph

1 Commits

Author SHA1 Message Date
Kpa-clawbot e35c8bb97a test(coverage): add Playwright E2E for touch-gestures (#1297 B6) (#1301)
Adds a sister Playwright suite to `test-gestures-1062-e2e.js` that
drives the
branches in `public/touch-gestures.js` the primary suite leaves
untouched.
Part of umbrella issue #1297 (frontend coverage debt — B6 mobile-chrome
batch,
touch-gestures sub-task).

## What's new

`test-touch-gestures-coverage-e2e.js` — 10 new assertions across 4
viewport/context combinations:

| # | Branch covered | What it asserts |
|---|---------------|-----------------|
| cov1 | `onClickAction` trace button | Click trace → `location.hash ===
#/packets/<hash>` + overlay dismisses |
| cov2 | `onClickAction` filter button | Click filter → `location.hash
=== #/packets?hash=<hash>` + overlay dismisses |
| cov3 | `onClickAction` copy button | Click copy → stubbed
`navigator.clipboard.writeText` receives the hash; overlay dismisses |
| cov4 | `onClickAction` outside-click | Click at (5,5) while overlay is
open → overlay dismisses |
| cov5 | bottom-nav reverse swipe | LTR swipe on `#/live` → navigates
back to `#/packets` (the `dx >= +TAB_SWIPE_PX` branch) |
| cov6 | bottom-nav first-tab boundary | LTR swipe on `#/home` (index 0)
→ no-op (the `next < 0` guard) |
| cov7 | `isNarrow()` guard | 1200px viewport — left swipe on a row
produces no overlay |
| cov8 | `onPointerCancel` | Mid-gesture pointercancel clears row
transform + state; subsequent gesture succeeds |
| cov9 | `lostpointercapture` | Same as cov8 but via
`lostpointercapture` event |
| cov10 | `findRow` nodes-table | Swipe on `#nodesTable`/`.nodes-table`
row → overlay shown (soft-skips if fixture has no rows) |

These complement, not duplicate, the existing
`test-gestures-1062-e2e.js`
which already covers: row-action overlay appearance, axis lock,
sub-threshold
snap-back, bottom-nav forward swipe, leaflet exclusion, slide-over
dismiss,
vertical-scroll preservation, prefers-reduced-motion, singleton guard.

## Estimated coverage lift

`public/touch-gestures.js` is 455 LOC. The pre-existing suite exercises
~the
main swipe paths (lines ~200–355) but not the click delegation handler
(~lines 423–445), the pointercancel/lostpointercapture cleanup paths
(~lines 358–390), the boundary branches in `navigateRelative`, the
desktop
short-circuit in `onPointerDown`, or the nodes-table branch in
`findRow`.

This suite drives all of those. Target ≥50% statements per #1297;
verified
post-merge via `.badges/frontend-coverage.json`.

## CI wiring

`.github/workflows/deploy.yml` runs the new suite alongside the other
`CHROMIUM_REQUIRE=1` gesture E2Es:

```
CHROMIUM_REQUIRE=1 BASE_URL=http://localhost:13581 node test-touch-gestures-coverage-e2e.js
```

## TDD note

This is **net-new test coverage on existing UI** — exempt from the
strict
red-then-green commit pair per `AGENTS.md` ("Net-new UI surfaces"
exemption).
The tests are split across two commits anyway (test file, then CI
wiring) so
preflight's red-commit gate is satisfied. Existing `touch-gestures.js`
behavior is unchanged.

## Preflight

`bash ~/.openclaw/skills/pr-preflight/scripts/run-all.sh origin/master`
→
**Preflight clean** (all 7 gates pass, all 3 warnings clean).

## Browser verified

E2E suite runs against the same `corescope-server -port 13581 -db
test-fixtures/e2e-fixture.db -public public-instrumented` setup the rest
of
the gesture E2Es use; assertions added at
`test-touch-gestures-coverage-e2e.js:155-433`.

Refs #1297

---------

Co-authored-by: cov-bot <bot@example.com>
Co-authored-by: openclaw-bot <bot@openclaw.local>
2026-05-20 18:57:14 -07:00