@ashishjain15491/tapcheck 0.0.0-stage → 0.1.0
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 +75 -0
- package/LICENSE +21 -0
- package/README.md +243 -2
- package/dist/auth.d.ts +5 -0
- package/dist/auth.js +100 -0
- package/dist/browser.d.ts +143 -0
- package/dist/browser.js +237 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +321 -0
- package/dist/config.d.ts +169 -0
- package/dist/config.js +369 -0
- package/dist/coverage.d.ts +17 -0
- package/dist/coverage.js +56 -0
- package/dist/flow.d.ts +193 -0
- package/dist/flow.js +512 -0
- package/dist/jev.d.ts +48 -0
- package/dist/jev.js +89 -0
- package/dist/parts.d.ts +65 -0
- package/dist/parts.js +157 -0
- package/dist/questions.d.ts +66 -0
- package/dist/questions.js +203 -0
- package/dist/report.d.ts +29 -0
- package/dist/report.js +59 -0
- package/dist/routes.d.ts +18 -0
- package/dist/routes.js +54 -0
- package/dist/stub.d.ts +51 -0
- package/dist/stub.js +244 -0
- package/dist/suites/a11y.d.ts +3 -0
- package/dist/suites/a11y.js +73 -0
- package/dist/suites/audit.d.ts +2 -0
- package/dist/suites/audit.js +440 -0
- package/dist/suites/code.d.ts +10 -0
- package/dist/suites/code.js +48 -0
- package/dist/suites/contract.d.ts +5 -0
- package/dist/suites/contract.js +79 -0
- package/dist/suites/crawl.d.ts +2 -0
- package/dist/suites/crawl.js +135 -0
- package/dist/suites/interact.d.ts +2 -0
- package/dist/suites/interact.js +319 -0
- package/dist/suites/security.d.ts +12 -0
- package/dist/suites/security.js +134 -0
- package/dist/suites/usability.d.ts +3 -0
- package/dist/suites/usability.js +205 -0
- package/dist/suites/ux.d.ts +6 -0
- package/dist/suites/ux.js +183 -0
- package/package.json +61 -5
- package/schema/tapcheck.schema.json +368 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0 (2026-11-25)
|
|
4
|
+
|
|
5
|
+
The first release: on npm as `@ashishjain15491/tapcheck` (the CLI is still `tapcheck`), and as the GitHub Action `ashishjain15491/tapcheck@v0.1.0`.
|
|
6
|
+
|
|
7
|
+
- **Core harness.** One `tapcheck.yml` describes the app: how to start, stop and reset it, its sides and how each
|
|
8
|
+
signs in (`none`, `manual`, `form` with optional TOTP, `command`), screens, tasks and viewports. `$NAME` values come
|
|
9
|
+
from the environment. One run writes `report.html`, `REPORT.md`, `findings.json` and the evidence. Parts that were
|
|
10
|
+
skipped or couldn't run (no Jev key, budget reached, sign-in failed, session expired) get a "part ran" finding each,
|
|
11
|
+
so the report says which and why.
|
|
12
|
+
- **Measured suites.** `crawl` (page status, load time, console errors, broken images and links, unlabelled fields),
|
|
13
|
+
`contract` (API status, JSON that parses, latency, response shape against a saved baseline), `security` (headers,
|
|
14
|
+
cookie flags, pages that need sign-in, CSRF, served secrets, third-party requests) and `a11y` (axe-core WCAG 2.2
|
|
15
|
+
A/AA, keyboard focus, page language).
|
|
16
|
+
- **Interaction and UI audit suites.** `interact` clicks every safe control on the crawled
|
|
17
|
+
screens and reports page errors, 5xx answers, native dialogs and controls that do nothing; checks each dialog it
|
|
18
|
+
opens (accessible name, focus, Escape, an error state for invalid input) and each table's sorting, search, paging
|
|
19
|
+
and row menu; and writes `interact.json`. `audit` is the full UI audit per screen: desktop light and dark, tablet
|
|
20
|
+
and phone, opened menus and dialogs, component and label-case consistency across screens, optional design-token
|
|
21
|
+
adherence, and Jev's look when Jev is on; it writes `audit.json`. New keys: `interact: {max, submit}`,
|
|
22
|
+
`audit: {max, skip}`, `design: {colors, fonts, radii, spacing}`. `interact.submit: true` changes data and is for a
|
|
23
|
+
throwaway database only.
|
|
24
|
+
- **Run-level additions.** `HEADED=1`, `SLOWMO=<ms>` and `START_DELAY=<s>` for watching a run;
|
|
25
|
+
`RECORD=1` for a video and a Playwright trace of every browser context, linked from the report. Flows get
|
|
26
|
+
`t.jev(label, questions?)` (Jev's look at the current page) and `t.mail.judge(mail, questions?)` (at an email), both
|
|
27
|
+
skipped cleanly with `JEV=off`. Every run writes `hits.json` per side, and `COVERAGE=1` merges all runs into
|
|
28
|
+
`COVERAGE.md`: each route with the part that reached it or GAP (`coverage: {file, reasons}`). `app.resetWhen` runs
|
|
29
|
+
`app.reset` by itself when matching files changed since the last reset. `stub.dns` answers DNS over UDP
|
|
30
|
+
(`TAPCHECK_DNS`), with overrides through the control API and `t.stub.dns()`.
|
|
31
|
+
- **Jev suites.** `ux` (visual QA, design, heuristics, a five-second test, predicted attention) and `usability` (a
|
|
32
|
+
simulated first-time user attempting each task, with a clickstream), with a per-run budget, a memo, and a log of
|
|
33
|
+
every request. Unsure answers are warnings.
|
|
34
|
+
- **Parts.** Every suite on every side is a part; `ONLY` and `SKIP` pick them by name or tag, `LIST=1` prints them,
|
|
35
|
+
`CHANGED=1` runs only the parts whose files changed since each last passed. `CHANGED=<git ref>` (the Action's
|
|
36
|
+
`changed: base`) is QA for a pull request: the parts whose files changed since the branch point with that ref, with
|
|
37
|
+
no state needed. `changes:` also keys on a part name, so each flow can depend on its own files. `parallel: <n>`
|
|
38
|
+
(or `PARALLEL=<n>`) runs that many of a side's flows at once; a flow with `serial: true` runs alone.
|
|
39
|
+
- **Your own checks.** `gates` (the project's linters and audits, as the part `code`), `routes` (route coverage and
|
|
40
|
+
writing routes without sign-in), `stub` (a stand-in for outside services, with a control API) and `flows` (custom
|
|
41
|
+
journeys with `t.step`, `t.stub`, `t.mail`).
|
|
42
|
+
- **Plugin.** A Claude Code and Codex plugin with three skills: `tapcheck-setup`, `tapcheck-run`, `tapcheck-fix`,
|
|
43
|
+
and recipes for Laravel, Django, Rails, Express and Next.js, Go and static sites.
|
|
44
|
+
- **Shipping.** A compiled npm package (`dist/`, Node.js 22.18 or newer) with types for flows; a JSON Schema for
|
|
45
|
+
`tapcheck.yml`; a Docker image on the official Playwright image; a GitHub Action that runs tapcheck, writes the
|
|
46
|
+
job summary and uploads the run folder; CI with a type check. A missing Chromium is now one line naming the
|
|
47
|
+
command that installs it, and `CHANGED=1` works where git has no author configured (containers, CI runners).
|
|
48
|
+
- **Fixes from the first real project.** The crawl follows the links it finds before the route list, and
|
|
49
|
+
only pages it actually crawled count toward `crawl.max` (a long route list used to crowd the links out). The
|
|
50
|
+
signed-out check follows redirects, so `/` → `/admin` → `/login` counts as refused. A CSRF token cookie
|
|
51
|
+
(`XSRF-TOKEN`, `csrftoken`) may be readable by script. The CSRF probe goes to the sides that sign in (every side
|
|
52
|
+
when none does), and a side can have its own `csrf`. Flows get `t.note(name, detail, 'warn' | 'info')` and a `timeout` (default 3600 s), so a flow that hangs fails instead
|
|
53
|
+
of stalling the run. A step that returns `{ warn: '…' }` is recorded as a warning, and `t.mail` has `count()` and
|
|
54
|
+
`all()`, with each message's `id` and `headers` (for checks such as List-Unsubscribe on every email of a send).
|
|
55
|
+
`t.jev()` waits for the page to settle and looks again when the page reloads under it. The crawl takes a link to a
|
|
56
|
+
file (a PDF download) for what it is, not a page that answered 0, and a signed-out side skips the routes the list
|
|
57
|
+
marks `auth`. Stopping the app stops what `app.start` left running in the background too, and `app.stop` runs only
|
|
58
|
+
when tapcheck started the app. The setup skill has a step for what the app needs around it: outside services,
|
|
59
|
+
background work, build and seed. A page load that fails (a timeout on a busy app, an aborted
|
|
60
|
+
navigation) is tried once more before it counts. Flows: a flow past its timeout records nothing more, `t.signal` is
|
|
61
|
+
aborted and `t.cleanup(fn)` callbacks run; each step prints a line as it ends; `t.ask` (Jev about text, on the
|
|
62
|
+
budget), `t.reach`, `t.page({ fresh: true })`, `t.dir` and a failing `t.note`; `t.goto` notices an ended session;
|
|
63
|
+
`VISUAL` and `EMAIL` are exported; a Jev request is capped at 120 s and retried once, and an outage is a warning;
|
|
64
|
+
with a dialog open `t.jev` looks at the screen only; failure screenshots are numbered so long names can't overwrite
|
|
65
|
+
each other. The visual "error shown" question no longer counts a notice about the data as an error.
|
|
66
|
+
Past its timeout a flow's pages are closed before its cleanups run, and only the cleanups' own `t.*` calls still
|
|
67
|
+
work (the abandoned run() stops at its next one); `t.use(page)` makes a page current again; `t.reach` takes the
|
|
68
|
+
answer's status and skips refused ones; Mailpit and stub calls give up after 30 s or at the timeout;
|
|
69
|
+
`t.mail.all({ limit })`; a form POST with `_method` is reached as that method.
|
|
70
|
+
`browser.args` passes extra switches to the run's Chromium (an app on localhost whose sandboxed preview frames load
|
|
71
|
+
its own files needs `--disable-features=LocalNetworkAccessChecks`). A side whose sign-in fails says so in the terminal, not only in the report.
|
|
72
|
+
Waiting for a page to settle is capped outside the page, so a page whose own timers never fire (one
|
|
73
|
+
sandboxed by its CSP without `allow-scripts`, such as an email preview) can't hang the run.
|
|
74
|
+
`t.page({ viewport: 'mobile' })` hands a flow a page at any of the config's viewports (the first one by default), so
|
|
75
|
+
a flow can check a journey at a phone's width and have Jev look at it.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ashishjain15491
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,244 @@
|
|
|
1
|
-
#
|
|
1
|
+
# tapcheck
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
End-to-end and UI audit harness for any web app, whatever its language or stack. It drives the running app in a real
|
|
4
|
+
browser, measures what code can measure, and asks Jev to judge what needs a human eye. One file, `tapcheck.yml`,
|
|
5
|
+
describes the app; one run writes one report.
|
|
6
|
+
|
|
7
|
+
Status: **0.1.0.** It runs from a checkout, as a plugin, from npm (`npx @ashishjain15491/tapcheck@0.1.0`), as the GitHub Action
|
|
8
|
+
(`ashishjain15491/tapcheck@v0.1.0`) and as a Docker image you build from the checkout.
|
|
9
|
+
|
|
10
|
+
## What it checks
|
|
11
|
+
|
|
12
|
+
Every suite runs once per side (each kind of person who sees a different app: `public`, `customer`, `admin`).
|
|
13
|
+
|
|
14
|
+
| Suite | Judged by | What it reports |
|
|
15
|
+
|---|---|---|
|
|
16
|
+
| `crawl` | code | pages that answer 4xx/5xx or load slowly, console errors, broken images and links, unlabelled form fields, route coverage |
|
|
17
|
+
| `contract` | code | API calls answering 4xx/5xx, HTML or unparsable JSON sent to a script, slow calls, a response that lost a key since the saved baseline |
|
|
18
|
+
| `security` | code | missing security headers, weak session-cookie flags, pages open when signed out, CSRF not refused, secrets in served HTML or scripts, third-party requests |
|
|
19
|
+
| `a11y` | code | axe-core WCAG 2.2 A/AA violations per screen and viewport, keyboard focus that doesn't move or can't be seen, a missing page language |
|
|
20
|
+
| `interact` | code | every safe control on the crawled screens clicked: page errors, 5xx, native `alert`/`confirm`, controls that do nothing; dialogs without a name, that Escape doesn't close or that take invalid input silently; table sorting, search, paging and row menus that change nothing |
|
|
21
|
+
| `audit` | code, plus Jev's look | the full UI audit per screen: desktop (cut-off text, overlap, small targets, leaked placeholders, headings, alt text, focus ring, opened menus and dialogs), dark mode (contrast, backgrounds left white), tablet and phone (sideways scroll, cut-off text, small targets); across screens, buttons and fields that come in several looks, mixed label case, and styles outside your design tokens |
|
|
22
|
+
| `code` | code | your own linters, type checks and audits (`gates:`), and writing routes that need no sign-in |
|
|
23
|
+
| `flow-<name>` | code | your own journeys (`flows:`), one finding per step |
|
|
24
|
+
| `ux` | Jev | visual QA (overlap, clipping, errors on screen), design (main action, hierarchy, legibility, spacing), usability heuristics, a five-second test, predicted attention |
|
|
25
|
+
| `usability` | Jev | a simulated first-time user tries each task by clicking: reached or not, extra clicks, hesitation, dead clicks |
|
|
26
|
+
|
|
27
|
+
Jev answers with probabilities and code decides: a clear answer passes or fails, an unsure one is a warning for a
|
|
28
|
+
person to look at, never a pass. Without a Jev key the two Jev suites and `audit`'s Jev look are skipped and
|
|
29
|
+
everything else runs.
|
|
30
|
+
|
|
31
|
+
## Four ways to run it
|
|
32
|
+
|
|
33
|
+
All four run the same CLI from the folder that holds `tapcheck.yml`, and take the same options as environment
|
|
34
|
+
variables (`ONLY=a11y`, `SKIP=jev`, `CHANGED=1`, `CHANGED=origin/main`, `PARALLEL=4`, `JEV=off`, `LIST=1`; the full list is in
|
|
35
|
+
[CONFIG.md](skills/tapcheck-setup/references/CONFIG.md#environment-variables-for-a-run)).
|
|
36
|
+
|
|
37
|
+
### 1. As a plugin for Claude Code and Codex
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
/plugin install tapcheck --marketplace ashishjain15491/tapcheck # Claude Code
|
|
41
|
+
codex plugin marketplace add ashishjain15491/tapcheck && codex plugin add tapcheck@tapcheck # Codex
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Three skills do the work: **tapcheck-setup** detects your stack, writes `tapcheck.yml` and gets a first run through
|
|
45
|
+
("Set up tapcheck for this app"); **tapcheck-run** picks the parts, runs them and reports ("Run tapcheck on what I
|
|
46
|
+
changed"); **tapcheck-fix** fixes failing findings in your code and reruns each part until it passes, without
|
|
47
|
+
loosening any check ("Fix the tapcheck failures"). They call `bin/tapcheck` in the plugin's own folder (Node.js 23.6
|
|
48
|
+
or newer; the first run installs its dependencies and Chromium). Any other agent can follow the same files: see
|
|
49
|
+
[AGENTS.md](AGENTS.md).
|
|
50
|
+
|
|
51
|
+
### 2. From npm
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npm install --save-dev tapcheck@npm:@ashishjain15491/tapcheck # Node.js 22.18 or newer; installs as tapcheck
|
|
55
|
+
npx playwright install chromium # once; the browser tapcheck drives
|
|
56
|
+
npx tapcheck # in the folder with tapcheck.yml
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 3. With Docker
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
git clone https://github.com/ashishjain15491/tapcheck && docker build -t tapcheck tapcheck
|
|
63
|
+
docker run --rm --ipc=host -v "$PWD:/work" -w /work tapcheck
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The image holds Node.js, Chromium, git, Python 3 and tapcheck: not your app's runtime. Three setups:
|
|
67
|
+
|
|
68
|
+
- **The app runs on the same machine, Linux:** add `--network host` and keep `baseUrl: http://127.0.0.1:<port>`.
|
|
69
|
+
- **The app runs on the same machine, macOS or Windows:** `--network host` doesn't reach the host there. Use
|
|
70
|
+
`baseUrl: http://host.docker.internal:<port>` and no `--network` flag.
|
|
71
|
+
- **The app starts inside the container:** only when `app.start` needs nothing but Node.js or Python 3 (a static
|
|
72
|
+
site, as in `examples/static-site`).
|
|
73
|
+
|
|
74
|
+
In the first two, leave `app.start` out (or start the app before the container: tapcheck skips `app.start` when the
|
|
75
|
+
app already answers). A `stub:` listens inside the container, so an app on the host reaches it only with
|
|
76
|
+
`--network host`. Options go in with `-e`: `docker run --rm -e ONLY=a11y -e TYPESAFE_API_KEY …`.
|
|
77
|
+
|
|
78
|
+
### 4. As a GitHub Action
|
|
79
|
+
|
|
80
|
+
```yaml
|
|
81
|
+
jobs:
|
|
82
|
+
tapcheck:
|
|
83
|
+
runs-on: ubuntu-latest
|
|
84
|
+
steps:
|
|
85
|
+
- uses: actions/checkout@v4
|
|
86
|
+
# …install what app.start needs (your language, dependencies, a test database)…
|
|
87
|
+
- uses: ashishjain15491/tapcheck@v0.1.0
|
|
88
|
+
with:
|
|
89
|
+
skip: flow # optional; also: config, only, changed, jev-budget, working-directory, node-version
|
|
90
|
+
env:
|
|
91
|
+
TYPESAFE_API_KEY: ${{ secrets.TYPESAFE_API_KEY }} # optional; without it the Jev suites are skipped
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The action installs tapcheck and Chromium, runs it, adds `REPORT.md` to the job summary, uploads the run folder as
|
|
95
|
+
the artifact `tapcheck-report`, and fails the step when a check fails. It doesn't comment on the pull request: that
|
|
96
|
+
needs write permissions, and the summary and artifact need none. `changed: true` needs `.tapcheck/state.json` from
|
|
97
|
+
an earlier run (restore it with `actions/cache`) and a checkout with history. `changed: base` is QA for one pull
|
|
98
|
+
request: it runs only the parts whose files (by `changes:` in `tapcheck.yml`) the pull request changed, compared with
|
|
99
|
+
its base branch, and needs `actions/checkout` with `fetch-depth: 0`. Locally the same is
|
|
100
|
+
`gh pr checkout <number> && CHANGED=origin/main tapcheck`. Inputs are described in [action.yml](action.yml).
|
|
101
|
+
|
|
102
|
+
## A minimal tapcheck.yml
|
|
103
|
+
|
|
104
|
+
```yaml
|
|
105
|
+
# yaml-language-server: $schema=https://raw.githubusercontent.com/ashishjain15491/tapcheck/main/schema/tapcheck.schema.json
|
|
106
|
+
baseUrl: http://127.0.0.1:8000
|
|
107
|
+
app:
|
|
108
|
+
start: npm start # skipped when the app already answers; stopped after the run
|
|
109
|
+
audience: a shop owner who is not technical
|
|
110
|
+
screens:
|
|
111
|
+
- { name: Home, path: /, purpose: see what the shop sells }
|
|
112
|
+
tasks:
|
|
113
|
+
- name: Find the opening hours
|
|
114
|
+
from: /
|
|
115
|
+
goal: Find when the shop is open on Saturday.
|
|
116
|
+
done: A page showing the opening hours is open.
|
|
117
|
+
notDone: It shows the home page, another page, or an error.
|
|
118
|
+
optimal: 1
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Only `baseUrl` is required. The first line gives editors with the YAML language server completion and checking from
|
|
122
|
+
[the JSON Schema](schema/tapcheck.schema.json) (installed from npm, it is also at
|
|
123
|
+
`./node_modules/tapcheck/schema/tapcheck.schema.json`). The CLI ignores a key it doesn't know; the schema is where a
|
|
124
|
+
misspelt one shows up.
|
|
125
|
+
|
|
126
|
+
- Every key: [CONFIG.md](skills/tapcheck-setup/references/CONFIG.md).
|
|
127
|
+
- Recipes per stack (start command, sign-in, route lister, gates):
|
|
128
|
+
[Laravel](skills/tapcheck-setup/references/stacks/LARAVEL.md),
|
|
129
|
+
[Django](skills/tapcheck-setup/references/stacks/DJANGO.md),
|
|
130
|
+
[Rails](skills/tapcheck-setup/references/stacks/RAILS.md),
|
|
131
|
+
[Express and Next.js](skills/tapcheck-setup/references/stacks/EXPRESS-NEXT.md),
|
|
132
|
+
[Go](skills/tapcheck-setup/references/stacks/GO.md),
|
|
133
|
+
[static sites](skills/tapcheck-setup/references/stacks/STATIC.md).
|
|
134
|
+
- A working example with gates, routes, a stub and a flow: [examples/static-site](examples/static-site).
|
|
135
|
+
|
|
136
|
+
Secrets never go in the file: write `$NAME` and export the variable; a missing one stops the load.
|
|
137
|
+
|
|
138
|
+
## Output
|
|
139
|
+
|
|
140
|
+
Each run writes `<out>/run-<time>/` (`out` is `.tapcheck` by default; git-ignore it): `report.html` to open,
|
|
141
|
+
`REPORT.md` to paste into a pull request, `findings.json` for tools and agents, and the evidence (screenshots,
|
|
142
|
+
`crawl.json`, `network.json`, `axe.json`, `interact.json`, `audit.json`, `clickstream.json`, `hits.json`, `payloads.json`). Exit code 0: no failing check; 1: at
|
|
143
|
+
least one; 2: the run couldn't start (a config mistake, the app not answering, Chromium missing).
|
|
144
|
+
|
|
145
|
+
Watching and recording a run, and coverage across runs:
|
|
146
|
+
|
|
147
|
+
- `HEADED=1` shows the browser, `SLOWMO=150` slows it by that many milliseconds per action, and `START_DELAY=10`
|
|
148
|
+
counts down before the first action. The run still ends by itself.
|
|
149
|
+
- `RECORD=1` keeps a video and a Playwright trace of every browser context (suites and flows) under the side's
|
|
150
|
+
`videos/` and `traces/`; the report links them. Open a trace with `npx playwright show-trace <file>`. Off by default,
|
|
151
|
+
to keep runs light.
|
|
152
|
+
- `COVERAGE=1 tapcheck` runs nothing: it merges the `hits.json` of every run so far into `COVERAGE.md` next to
|
|
153
|
+
`tapcheck.yml` (`coverage.file`), each route of `routes:` with the part or flow step that reached it or **GAP**, plus
|
|
154
|
+
the dialogs and table controls seen. `coverage.reasons: [{match, why}]` marks the gaps that are there on purpose.
|
|
155
|
+
|
|
156
|
+
## Beyond the built-in suites
|
|
157
|
+
|
|
158
|
+
```yaml
|
|
159
|
+
# Gates: commands from your own toolchain. Exit 0 passes; the last lines of output are the evidence.
|
|
160
|
+
gates:
|
|
161
|
+
- { name: lint, run: ruff check . }
|
|
162
|
+
- { name: dependency advisories, run: npm audit --audit-level=high, warn: true, timeout: 120 }
|
|
163
|
+
|
|
164
|
+
# Routes: any command printing JSON [{method, path, auth?}]. Parameters in any common style:
|
|
165
|
+
# {id} {id?} <int:pk> <pk> :id (.:format) *splat
|
|
166
|
+
routes: ./bin/routes-json
|
|
167
|
+
|
|
168
|
+
# Stub: a stand-in for the outside services the app calls. First matching rule answers; anything else gets 200 {}.
|
|
169
|
+
stub:
|
|
170
|
+
port: 8766
|
|
171
|
+
rules:
|
|
172
|
+
- { host: api.example.com, method: POST, path: /v1/charges, status: 201, json: { id: ch_1, paid: true } }
|
|
173
|
+
dns: # optional: answer DNS over UDP too, at TAPCHECK_DNS (127.0.0.1:8767)
|
|
174
|
+
records: [{ name: shop.example.com, type: TXT, values: ["v=spf1 -all"] }]
|
|
175
|
+
|
|
176
|
+
# Flows: your own journeys, one part each.
|
|
177
|
+
flows: tests/tapcheck/*.ts
|
|
178
|
+
mail: { mailpit: http://127.0.0.1:8025 } # for t.mail in flows
|
|
179
|
+
|
|
180
|
+
# Interact and audit: how far they go, and the design tokens the audit holds computed styles to.
|
|
181
|
+
interact: { max: 40, submit: false } # submit: true also sends valid input in dialog forms: throwaway database only
|
|
182
|
+
audit: { max: 0, skip: "/(editor|canvas)(/|$)" } # max: crawled pages audited on top of the screens
|
|
183
|
+
design: { colors: ["#1f2937", "#ffffff"], fonts: [Inter], radii: [0, 4, 8], spacing: [4, 8, 16, 24] }
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
- **Gates** run as the part `code`, which has no side: `ONLY=code tapcheck` starts neither the app nor a browser.
|
|
187
|
+
- **Routes** feed the crawl (parameterless GET routes fill what the links leave of `crawl.max`; "route coverage" says how many were reached) and
|
|
188
|
+
let `code` list writing routes with `auth: false` as a warning.
|
|
189
|
+
- **Stub**: tapcheck starts it before `app.start` and sets `TAPCHECK_STUB_URL`. Point each provider's base URL at
|
|
190
|
+
`${TAPCHECK_STUB_URL}/<its host>`, for example
|
|
191
|
+
`app.start: PAYMENTS_BASE_URL=${TAPCHECK_STUB_URL}/api.example.com npm start`, and the app never reaches the real
|
|
192
|
+
service. Flows read what the stub saw and switch failures on through `t.stub`. With `stub.dns` it also answers
|
|
193
|
+
DNS questions (A, AAAA, MX, TXT, CNAME, NS) for an app that looks up domains; `t.stub.dns()` changes an answer.
|
|
194
|
+
- **Flows** are files with `export default { name, side?, run: async (t) => {…} }`; `import type { Flow } from
|
|
195
|
+
'tapcheck'` types them. Each `t.step(name, fn)` is a finding; a failed step keeps a screenshot and the flow carries
|
|
196
|
+
on. The helpers (`t.goto`, `t.page`, `t.expect`, `t.jev`, `t.stub`, `t.routeOutside`, `t.mail`) are described in
|
|
197
|
+
[src/flow.ts](src/flow.ts). `t.jev(label)` has Jev look at the current page and `t.mail.judge(mail)` at an email;
|
|
198
|
+
both are skipped (and say so) with `JEV=off` or no key. `t.page({ viewport: 'mobile' })` is a page at another of the
|
|
199
|
+
config's viewports (the first one by default); the page handed out last is the one `t.goto` and `t.jev` act on.
|
|
200
|
+
- **Interact** needs its side's crawl (it clicks through the screens the crawl reached, `interact.max` at most) and
|
|
201
|
+
writes `interact.json`: the controls, dialogs and table controls it exercised.
|
|
202
|
+
- **Audit** checks the configured screens. With `design:`, a computed colour, font, radius or spacing that isn't one
|
|
203
|
+
of the tokens is a warning, the most used first; a list you leave out isn't checked.
|
|
204
|
+
|
|
205
|
+
## Jev: the key, the budget, and what is sent
|
|
206
|
+
|
|
207
|
+
`ux` and `usability` ask Jev, a paid model from TypeSafe, and `audit` asks it to look at each screen and each menu
|
|
208
|
+
or dialog it opens. Put `TYPESAFE_API_KEY` in the environment, or in a `.env` file next to `tapcheck.yml`
|
|
209
|
+
(git-ignored). `JEV=off`, or no key, skips both suites and `audit`'s looks (its measured checks still run).
|
|
210
|
+
|
|
211
|
+
- **Budget:** a run stops asking once it has spent `jev.budget` US dollars (default 1); `JEV_BUDGET=0.25` sets it
|
|
212
|
+
for one run. The part that reaches it stops with a failing "suite ran to the end" finding, the Jev parts after it
|
|
213
|
+
are listed as skipped in the report, and the run exits 1, since not every check ran; the measured parts still run.
|
|
214
|
+
The budget is checked before each request, so a run can go over it by the cost of one request. The spend is
|
|
215
|
+
printed at the end.
|
|
216
|
+
- **What goes to TypeSafe:** screenshots of the screens and task steps you configured and of the menus and dialogs
|
|
217
|
+
`audit` opens on them, and with them the text of the
|
|
218
|
+
questions: the screen's name and `purpose`, your `audience`, each task's `goal`, `done` and `notDone`, and the
|
|
219
|
+
labels of the controls visible on the page. Nothing else: no page source, cookies, sessions, request bodies or
|
|
220
|
+
environment variables. `payloads.json` in the run folder holds every request as sent (images as file paths).
|
|
221
|
+
- Screenshots show whatever the signed-in test user sees, so run against test data, not real customers' data.
|
|
222
|
+
|
|
223
|
+
## Safety
|
|
224
|
+
|
|
225
|
+
- The built-in suites only read: they never submit a form or follow a delete, send or sign-out link. The usability
|
|
226
|
+
suite clicks only what Jev clearly judges changes nothing, and never a submit button.
|
|
227
|
+
- **`interact` clicks.** It never clicks a control labelled delete, remove, send, publish, pay, cancel, sign out and
|
|
228
|
+
the like, a link matching `crawl.skip`, or the submit button of a form that POSTs, and it dismisses native
|
|
229
|
+
confirms. A button that saves through script alone looks like any other button and is clicked, so run it against
|
|
230
|
+
test data. `interact.submit: true` goes further: dialog forms are submitted with invalid and then valid input,
|
|
231
|
+
which changes data. Like `app.reset` it is for a throwaway database, and it is ignored unless the app is local
|
|
232
|
+
(or `app.allowRemoteReset` is set).
|
|
233
|
+
- **Flows may change data.** They are your code and click what you tell them to: run them against a copy you can
|
|
234
|
+
reset, or leave them out with `SKIP=flow`.
|
|
235
|
+
- `RESET=1` runs `app.reset` first, and refuses unless `baseUrl` is `localhost`, `127.0.0.1`, `*.localhost` or
|
|
236
|
+
`*.test` (`app.allowRemoteReset: true` lifts that, for a remote throwaway copy only). With
|
|
237
|
+
`app.resetWhen: ["database/**"]` the reset also runs by itself, under the same rule, when a matching file changed
|
|
238
|
+
since the last reset (and on first use); it needs git.
|
|
239
|
+
- `RECORD=1` videos and traces show everything on screen, test data included: share them as carefully as screenshots.
|
|
240
|
+
- Signed-in sessions are saved under `out`; keep that folder out of git and out of artifacts you share.
|
|
241
|
+
|
|
242
|
+
## Contributing
|
|
243
|
+
|
|
244
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) and [CHANGELOG.md](CHANGELOG.md). MIT licensed.
|
package/dist/auth.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Config, Side } from './config.ts';
|
|
2
|
+
/** RFC 6238 time-based one-time code (SHA-1, 30 s, 6 digits) from a base32 secret. */
|
|
3
|
+
export declare function totp(secret: string, at?: number): string;
|
|
4
|
+
/** The side's saved session file, signing in first when needed; undefined for a side that doesn't sign in. */
|
|
5
|
+
export declare function signIn(cfg: Config, side: Side): Promise<string | undefined>;
|
package/dist/auth.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Signing in, per side, saved as a Playwright storageState under the out folder (git-ignored) that every suite reuses:
|
|
3
|
+
* none no session (a public site)
|
|
4
|
+
* manual a visible browser on the sign-in page; a person signs in (and passes 2FA); kept until LOGIN=1 or it expires
|
|
5
|
+
* form fills the named fields, submits, and fills a TOTP code if the app asks for one; every run
|
|
6
|
+
* command any program that prints a storageState JSON (for apps whose sign-in is easier to script in their own stack)
|
|
7
|
+
*/
|
|
8
|
+
import { createHmac } from 'node:crypto';
|
|
9
|
+
import { execSync } from 'node:child_process';
|
|
10
|
+
import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
11
|
+
import { chromium } from 'playwright';
|
|
12
|
+
/** RFC 6238 time-based one-time code (SHA-1, 30 s, 6 digits) from a base32 secret. */
|
|
13
|
+
export function totp(secret, at = Date.now()) {
|
|
14
|
+
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
|
|
15
|
+
let bits = '';
|
|
16
|
+
for (const c of secret.replace(/=+$/, '').toUpperCase().replace(/\s/g, '')) {
|
|
17
|
+
const i = alphabet.indexOf(c);
|
|
18
|
+
if (i < 0)
|
|
19
|
+
throw new Error('The TOTP secret is not base32.');
|
|
20
|
+
bits += i.toString(2).padStart(5, '0');
|
|
21
|
+
}
|
|
22
|
+
const key = Buffer.from(bits.match(/.{8}/g).map((b) => parseInt(b, 2)));
|
|
23
|
+
const counter = Buffer.alloc(8);
|
|
24
|
+
counter.writeBigUInt64BE(BigInt(Math.floor(at / 1000 / 30)));
|
|
25
|
+
const h = createHmac('sha1', key).update(counter).digest();
|
|
26
|
+
const o = h[h.length - 1] & 0xf;
|
|
27
|
+
return String((h.readUInt32BE(o) & 0x7fffffff) % 1_000_000).padStart(6, '0');
|
|
28
|
+
}
|
|
29
|
+
/** A field by CSS selector, else by name attribute, else by its label text. */
|
|
30
|
+
async function field(page, key) {
|
|
31
|
+
if (/^[#.[]|[\s=>]/.test(key))
|
|
32
|
+
return page.locator(key).first();
|
|
33
|
+
const byName = page.locator(`[name="${key.replace(/"/g, '\\"')}"]`);
|
|
34
|
+
return (await byName.count()) ? byName.first() : page.getByLabel(key, { exact: false }).first();
|
|
35
|
+
}
|
|
36
|
+
const off = (cfg, u) => !cfg.loginPaths.test(new URL(u).pathname);
|
|
37
|
+
/** The side's saved session file, signing in first when needed; undefined for a side that doesn't sign in. */
|
|
38
|
+
export async function signIn(cfg, side) {
|
|
39
|
+
const l = side.login;
|
|
40
|
+
if ('none' in l)
|
|
41
|
+
return undefined;
|
|
42
|
+
mkdirSync(cfg.out, { recursive: true });
|
|
43
|
+
const file = `${cfg.out}/auth-${side.name}.json`;
|
|
44
|
+
const at = (p) => (/^https?:\/\//.test(p) ? p : side.baseUrl + p);
|
|
45
|
+
if ('command' in l) {
|
|
46
|
+
const out = execSync(l.command, { encoding: 'utf8', stdio: ['ignore', 'pipe', 'inherit'], shell: '/bin/sh' });
|
|
47
|
+
let state;
|
|
48
|
+
try {
|
|
49
|
+
state = JSON.parse(out);
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
throw new Error(`sides.${side.name}.login.command did not print JSON (a Playwright storageState).`);
|
|
53
|
+
}
|
|
54
|
+
if (!Array.isArray(state?.cookies))
|
|
55
|
+
throw new Error(`sides.${side.name}.login.command printed JSON without a cookies list.`);
|
|
56
|
+
writeFileSync(file, JSON.stringify(state));
|
|
57
|
+
return file;
|
|
58
|
+
}
|
|
59
|
+
if ('manual' in l) {
|
|
60
|
+
if (existsSync(file) && process.env.LOGIN !== '1')
|
|
61
|
+
return file;
|
|
62
|
+
const browser = await chromium.launch({ headless: false });
|
|
63
|
+
const ctx = await browser.newContext({ viewport: { width: 1280, height: 860 } });
|
|
64
|
+
const page = await ctx.newPage();
|
|
65
|
+
await page.goto(at(l.manual));
|
|
66
|
+
console.log(`Sign in as ${side.name} in the browser window. Waiting up to 10 minutes…`);
|
|
67
|
+
await page.waitForURL((u) => off(cfg, u.href), { timeout: 600_000 });
|
|
68
|
+
await page.waitForLoadState('networkidle').catch(() => { });
|
|
69
|
+
await ctx.storageState({ path: file });
|
|
70
|
+
await browser.close();
|
|
71
|
+
return file;
|
|
72
|
+
}
|
|
73
|
+
const f = l.form;
|
|
74
|
+
const browser = await chromium.launch();
|
|
75
|
+
try {
|
|
76
|
+
const ctx = await browser.newContext();
|
|
77
|
+
const page = await ctx.newPage();
|
|
78
|
+
await page.goto(at(f.url), { waitUntil: 'domcontentloaded' });
|
|
79
|
+
for (const [k, v] of Object.entries(f.fields))
|
|
80
|
+
await (await field(page, k)).fill(v);
|
|
81
|
+
const submit = () => page.locator(f.submit ?? 'button[type=submit], input[type=submit]').first().click();
|
|
82
|
+
await submit();
|
|
83
|
+
await page.waitForLoadState('networkidle', { timeout: 15_000 }).catch(() => { });
|
|
84
|
+
if (f.totp && !off(cfg, page.url())) {
|
|
85
|
+
await (await field(page, f.totp.field)).fill(totp(f.totp.secret));
|
|
86
|
+
await submit();
|
|
87
|
+
}
|
|
88
|
+
await page.waitForURL((u) => off(cfg, u.href), { timeout: 30_000 }).catch(() => { });
|
|
89
|
+
if (!off(cfg, page.url())) {
|
|
90
|
+
const shot = `${cfg.out}/login-${side.name}-failed.png`;
|
|
91
|
+
await page.screenshot({ path: shot }).catch(() => { });
|
|
92
|
+
throw new Error(`Signing in as ${side.name} left the browser on ${page.url()} (see ${shot}). Check sides.${side.name}.login.form.`);
|
|
93
|
+
}
|
|
94
|
+
await ctx.storageState({ path: file });
|
|
95
|
+
return file;
|
|
96
|
+
}
|
|
97
|
+
finally {
|
|
98
|
+
await browser.close();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { type Browser, type BrowserContext, type BrowserContextOptions, type Page } from 'playwright';
|
|
2
|
+
import type { Config, Screen, Side } from './config.ts';
|
|
3
|
+
import type { Finding } from './report.ts';
|
|
4
|
+
export type Viewport = Config['viewports'][number];
|
|
5
|
+
export type Hit = {
|
|
6
|
+
url: string;
|
|
7
|
+
method: string;
|
|
8
|
+
type: string;
|
|
9
|
+
status: number;
|
|
10
|
+
contentType: string;
|
|
11
|
+
ms: number;
|
|
12
|
+
bytes: number;
|
|
13
|
+
page: string;
|
|
14
|
+
json?: 'ok' | 'invalid';
|
|
15
|
+
body?: string;
|
|
16
|
+
};
|
|
17
|
+
export type Visited = {
|
|
18
|
+
path: string;
|
|
19
|
+
status: number;
|
|
20
|
+
finalPath: string;
|
|
21
|
+
ms: number;
|
|
22
|
+
errors: string[];
|
|
23
|
+
links: string[];
|
|
24
|
+
};
|
|
25
|
+
/** One side's run: its config, where its evidence goes, its saved session, and what its crawl found (contract and security read it). */
|
|
26
|
+
export type Run = {
|
|
27
|
+
cfg: Config;
|
|
28
|
+
side: Side;
|
|
29
|
+
dir: string;
|
|
30
|
+
auth?: string;
|
|
31
|
+
record: (f: Omit<Finding, 'side'>) => void;
|
|
32
|
+
crawl: {
|
|
33
|
+
pages: Visited[];
|
|
34
|
+
hits: Hit[];
|
|
35
|
+
done: boolean;
|
|
36
|
+
};
|
|
37
|
+
part?: string;
|
|
38
|
+
step?: string;
|
|
39
|
+
reached?: Reach[];
|
|
40
|
+
prefix?: string;
|
|
41
|
+
};
|
|
42
|
+
/** One thing a part touched: "GET /orders", "dialog <name>", "table <headers>: sort". */
|
|
43
|
+
export type Reach = {
|
|
44
|
+
part: string;
|
|
45
|
+
step?: string;
|
|
46
|
+
what: string;
|
|
47
|
+
};
|
|
48
|
+
export type Recording = {
|
|
49
|
+
side: string;
|
|
50
|
+
part: string;
|
|
51
|
+
label: string;
|
|
52
|
+
videos: string[];
|
|
53
|
+
trace?: string;
|
|
54
|
+
};
|
|
55
|
+
/** Every recording of the run (RECORD=1), for the report. */
|
|
56
|
+
export declare const recordings: Recording[];
|
|
57
|
+
/** How the run's browser starts: HEADED=1 shows it, SLOWMO=<ms> waits that long between its actions; `args` are the config's browser.args. */
|
|
58
|
+
export declare const launchOptions: (env?: NodeJS.ProcessEnv, args?: string[]) => {
|
|
59
|
+
headless: boolean;
|
|
60
|
+
slowMo: number;
|
|
61
|
+
args?: string[] | undefined;
|
|
62
|
+
};
|
|
63
|
+
/** START_DELAY=<s>: seconds to count down before the first action (time to start a screen recording). */
|
|
64
|
+
export declare const startDelay: (env?: NodeJS.ProcessEnv) => number;
|
|
65
|
+
/** The run's one Chromium; `args` (browser.args) count on the call that starts it. */
|
|
66
|
+
export declare function launch(args?: string[]): Promise<Browser>;
|
|
67
|
+
/** Closes the browser. A recorded context a suite left open is closed first, so its video and trace are still written. */
|
|
68
|
+
export declare const closeBrowser: () => Promise<void>;
|
|
69
|
+
/** Counts down START_DELAY seconds, in the terminal and (headed) in the browser window. */
|
|
70
|
+
export declare function countdown(s?: number): Promise<void>;
|
|
71
|
+
/** Files `what` under the part (and flow step) running now, once. */
|
|
72
|
+
export declare function reach(r: Run, what: string, step?: string | undefined): void;
|
|
73
|
+
/** Answers that mean the app refused the request or has no such route: not reached. */
|
|
74
|
+
export declare const REFUSED: number[];
|
|
75
|
+
/** The method the app routes a request by: a form POST that says `_method` (Laravel, Rails, Symfony) or an override header is that method. */
|
|
76
|
+
export declare function routedMethod(q: {
|
|
77
|
+
method(): string;
|
|
78
|
+
url(): string;
|
|
79
|
+
headers(): Record<string, string>;
|
|
80
|
+
postData(): string | null;
|
|
81
|
+
}): string;
|
|
82
|
+
/** A screen's address: a path on the side's base URL, or a full URL as given. */
|
|
83
|
+
export declare const abs: (r: Run, path: string) => string;
|
|
84
|
+
export declare const host: (u: string) => string;
|
|
85
|
+
export declare const slug: (s: string) => string;
|
|
86
|
+
/**
|
|
87
|
+
* A context at this viewport: signed in with the side's session unless auth is false. Every suite and flow gets its
|
|
88
|
+
* contexts here, so two things hold for all of them: each answered request to the side's own host is filed for the
|
|
89
|
+
* coverage map, and with RECORD=1 the context records a video per page (<side dir>/videos/) and a Playwright trace
|
|
90
|
+
* (<side dir>/traces/), written when the context closes.
|
|
91
|
+
*/
|
|
92
|
+
export declare function context(r: Run, vp: Viewport, auth?: boolean, bypassCSP?: boolean, more?: BrowserContextOptions): Promise<BrowserContext>;
|
|
93
|
+
/** Console errors and uncaught page errors, collected from now on. */
|
|
94
|
+
export declare function watch(page: Page): string[];
|
|
95
|
+
/**
|
|
96
|
+
* Network idle, then the DOM quiet for 500 ms (at most 5 s more), so late-rendering widgets are judged as people see them.
|
|
97
|
+
* page.evaluate has no timeout, and a page's own timers never fire when its CSP sandboxes it without allow-scripts (an
|
|
98
|
+
* email preview, say) or its main thread never yields, so the 6 s cap is kept here, outside the page.
|
|
99
|
+
*/
|
|
100
|
+
export declare function settle(page: Page): Promise<void>;
|
|
101
|
+
export declare class SessionExpired extends Error {
|
|
102
|
+
}
|
|
103
|
+
/** Being sent to a sign-in page on a side that signs in means the session is gone: stop rather than audit the login page. */
|
|
104
|
+
export declare function guard(r: Run, requested: string, landed: string): void;
|
|
105
|
+
/** Opens a page of the app and waits for it to settle. A load that fails (a timeout on a busy app, a navigation
|
|
106
|
+
* aborted or cut short by another) is tried once more before the error counts; a download is not a page and isn't. */
|
|
107
|
+
export declare function open(r: Run, page: Page, path: string): Promise<import("playwright").Response | null>;
|
|
108
|
+
/** A screen's path: given directly, or the first link on `from` whose path matches `link`. Null when no link matches. */
|
|
109
|
+
export declare function resolve(r: Run, page: Page, s: Screen): Promise<string | null>;
|
|
110
|
+
/** The screen as up to `max` viewport-sized slices, top to bottom, saved as <run dir>/shots/<key>-<n>.png (Jev takes images 280–1568 px a side). */
|
|
111
|
+
export declare function slices(r: Run, page: Page, key: string, height: number, vh: number, max?: number): Promise<string[]>;
|
|
112
|
+
export type Control = {
|
|
113
|
+
tag: string;
|
|
114
|
+
role: string;
|
|
115
|
+
label: string;
|
|
116
|
+
x: number;
|
|
117
|
+
y: number;
|
|
118
|
+
w: number;
|
|
119
|
+
h: number;
|
|
120
|
+
href?: string;
|
|
121
|
+
};
|
|
122
|
+
/** What code measures exactly: sideways scroll, broken images, off-screen and small controls, text coverage, headings. */
|
|
123
|
+
export declare function facts(page: Page): Promise<{
|
|
124
|
+
title: string;
|
|
125
|
+
lang: string;
|
|
126
|
+
overflowX: boolean;
|
|
127
|
+
brokenImages: string[];
|
|
128
|
+
offscreen: number;
|
|
129
|
+
controls: {
|
|
130
|
+
tag: string;
|
|
131
|
+
role: string;
|
|
132
|
+
label: string;
|
|
133
|
+
x: number;
|
|
134
|
+
y: number;
|
|
135
|
+
w: number;
|
|
136
|
+
h: number;
|
|
137
|
+
href: string | undefined;
|
|
138
|
+
}[];
|
|
139
|
+
height: number;
|
|
140
|
+
textCoverage: number;
|
|
141
|
+
smallTargets: string[];
|
|
142
|
+
h1: number;
|
|
143
|
+
}>;
|