@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/dist/parts.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export type Part = {
|
|
2
|
+
name: string;
|
|
3
|
+
suite: string;
|
|
4
|
+
side: string;
|
|
5
|
+
tags: string[];
|
|
6
|
+
needs: string[];
|
|
7
|
+
};
|
|
8
|
+
export type Snap = {
|
|
9
|
+
snapshot: string;
|
|
10
|
+
untracked: string[];
|
|
11
|
+
};
|
|
12
|
+
export type State = {
|
|
13
|
+
parts: Record<string, Snap>;
|
|
14
|
+
reset?: Snap;
|
|
15
|
+
};
|
|
16
|
+
/** Every part in run order: code (when there is any), then by side its suites and its flows (`part` is a flow's part name). */
|
|
17
|
+
export declare const build: (sides: string[], extra?: {
|
|
18
|
+
code?: boolean;
|
|
19
|
+
flows?: {
|
|
20
|
+
part: string;
|
|
21
|
+
side: string;
|
|
22
|
+
}[];
|
|
23
|
+
}) => Part[];
|
|
24
|
+
/** The suite name a part's findings carry: its suite, or for a flow its own name (so one flow failing doesn't fail the others). */
|
|
25
|
+
export declare const findingSuite: (p: Part) => string;
|
|
26
|
+
export declare const list: (v?: string) => string[];
|
|
27
|
+
/** The parts ONLY names (all when empty) without the ones SKIP names. A key is a part name, a tag, or a name prefix ending in *. */
|
|
28
|
+
export declare function select(parts: Part[], only: string[], skip: string[]): Part[];
|
|
29
|
+
/** `chosen` plus the parts they need, in run order. */
|
|
30
|
+
export declare const withNeeds: (parts: Part[], chosen: Part[]) => Part[];
|
|
31
|
+
/**
|
|
32
|
+
* Runs `run` on each item, at most `n` at a time, starting them in order. An item `alone` says is alone waits for the
|
|
33
|
+
* running ones to end and ends before the next starts. Once `stopped()` is true no more start. `run` must not reject.
|
|
34
|
+
*/
|
|
35
|
+
export declare function pool<T>(items: T[], n: number, alone: (x: T) => boolean, run: (x: T) => Promise<void>, stopped?: () => boolean): Promise<void>;
|
|
36
|
+
/** The code as it is now (uncommitted work included), or null when this isn't a git repository with a commit. */
|
|
37
|
+
export declare function snapshot(cwd?: string): Snap | null;
|
|
38
|
+
/**
|
|
39
|
+
* app.resetWhen: why the app's data should be reset before this run, or null when it needn't be. It is due on first use
|
|
40
|
+
* and when a file matching one of `globs` (paths from the git root) changed since the last reset (`state.reset`).
|
|
41
|
+
* Call it only where snapshot() works (a git repository with a commit).
|
|
42
|
+
*/
|
|
43
|
+
export declare function resetDue(state: State, globs: string[], cwd?: string): string | null;
|
|
44
|
+
/**
|
|
45
|
+
* CHANGED=1: of `chosen`, the parts whose files changed since each last passed. With `at.base` (CHANGED=<git ref>), the
|
|
46
|
+
* files changed since the branch point with that ref instead, the same for every part and with no state needed: a pull
|
|
47
|
+
* request's own changes, committed or not. `changes` maps a part name, a suite or "*" to the globs it depends on; a
|
|
48
|
+
* part's own name wins over its suite, "*" adds to both, a part with none reruns on any change, and a change to the
|
|
49
|
+
* `config` file reruns everything. Files under `out` (tapcheck's own output) never count. `config` and `out` are paths from `cwd`.
|
|
50
|
+
*/
|
|
51
|
+
export declare function changedParts(chosen: Part[], state: State, changes: Record<string, string[]>, at: {
|
|
52
|
+
config: string;
|
|
53
|
+
out: string;
|
|
54
|
+
cwd?: string;
|
|
55
|
+
base?: string;
|
|
56
|
+
}): Part[];
|
|
57
|
+
/**
|
|
58
|
+
* Which of the parts that ran passed: a part passes when it has no failing finding of its own (its suite, or its flow, on its side).
|
|
59
|
+
* Only a passing part is recorded in `state` (at `snap`), so CHANGED=1 runs a failing part again until it passes.
|
|
60
|
+
*/
|
|
61
|
+
export declare function mark(state: State, ran: Part[], findings: {
|
|
62
|
+
suite: string;
|
|
63
|
+
side: string;
|
|
64
|
+
status: string;
|
|
65
|
+
}[], snap: Snap | null): Record<string, boolean>;
|
package/dist/parts.js
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Parts: every suite on every side is one part, named <suite>-<side>; the code gates are one part with no side, `code`;
|
|
3
|
+
* every custom flow is a part on its side, flow-<name>. Here: build them, pick some by name or tag (ONLY, SKIP), find the
|
|
4
|
+
* ones whose files changed since they last passed (CHANGED=1) or since a git ref (CHANGED=<ref>), and record the ones that passed.
|
|
5
|
+
*/
|
|
6
|
+
import { execFileSync } from 'node:child_process';
|
|
7
|
+
import { matchesGlob, posix, relative, resolve } from 'node:path';
|
|
8
|
+
import { SUITES } from './config.js';
|
|
9
|
+
const JEV = ['ux', 'usability']; // the suites Jev judges
|
|
10
|
+
const NEEDS_CRAWL = ['contract', 'security', 'interact']; // they read the crawl's records
|
|
11
|
+
/** Every part in run order: code (when there is any), then by side its suites and its flows (`part` is a flow's part name). */
|
|
12
|
+
export const build = (sides, extra = {}) => [
|
|
13
|
+
...(extra.code ? [{ name: 'code', suite: 'code', side: '', tags: ['code', 'measured'], needs: [] }] : []),
|
|
14
|
+
...sides.flatMap((side) => [
|
|
15
|
+
...SUITES.map((suite) => ({ name: `${suite}-${side}`, suite, side, tags: [suite, side, JEV.includes(suite) ? 'jev' : 'measured'],
|
|
16
|
+
needs: NEEDS_CRAWL.includes(suite) ? [`crawl-${side}`] : [] })),
|
|
17
|
+
...(extra.flows ?? []).filter((f) => f.side === side).map((f) => ({ name: f.part, suite: 'flow', side, tags: ['flow', side, 'measured'], needs: [] })),
|
|
18
|
+
]),
|
|
19
|
+
];
|
|
20
|
+
/** The suite name a part's findings carry: its suite, or for a flow its own name (so one flow failing doesn't fail the others). */
|
|
21
|
+
export const findingSuite = (p) => (p.suite === 'flow' ? p.name : p.suite);
|
|
22
|
+
export const list = (v) => (v ?? '').split(',').map((s) => s.trim()).filter(Boolean);
|
|
23
|
+
const hit = (p, keys) => keys.some((k) => (k.endsWith('*') ? p.name.startsWith(k.slice(0, -1)) : p.name === k || p.tags.includes(k)));
|
|
24
|
+
/** The parts ONLY names (all when empty) without the ones SKIP names. A key is a part name, a tag, or a name prefix ending in *. */
|
|
25
|
+
export function select(parts, only, skip) {
|
|
26
|
+
const unknown = [...only, ...skip].filter((k) => !parts.some((p) => hit(p, [k])));
|
|
27
|
+
if (unknown.length)
|
|
28
|
+
throw new Error(`No part or tag called ${unknown.join(', ')}. Run with LIST=1 to see them.`);
|
|
29
|
+
return parts.filter((p) => (!only.length || hit(p, only)) && !hit(p, skip));
|
|
30
|
+
}
|
|
31
|
+
/** `chosen` plus the parts they need, in run order. */
|
|
32
|
+
export const withNeeds = (parts, chosen) => {
|
|
33
|
+
const names = new Set(chosen.flatMap((p) => [p.name, ...p.needs]));
|
|
34
|
+
return parts.filter((p) => names.has(p.name));
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Runs `run` on each item, at most `n` at a time, starting them in order. An item `alone` says is alone waits for the
|
|
38
|
+
* running ones to end and ends before the next starts. Once `stopped()` is true no more start. `run` must not reject.
|
|
39
|
+
*/
|
|
40
|
+
export async function pool(items, n, alone, run, stopped = () => false) {
|
|
41
|
+
const running = new Set();
|
|
42
|
+
for (const x of items) {
|
|
43
|
+
if (alone(x))
|
|
44
|
+
await Promise.all(running);
|
|
45
|
+
while (running.size >= n)
|
|
46
|
+
await Promise.race(running);
|
|
47
|
+
if (stopped())
|
|
48
|
+
break;
|
|
49
|
+
const p = run(x).finally(() => running.delete(p));
|
|
50
|
+
running.add(p);
|
|
51
|
+
if (alone(x))
|
|
52
|
+
await p;
|
|
53
|
+
}
|
|
54
|
+
await Promise.all(running);
|
|
55
|
+
}
|
|
56
|
+
// ── git: the only place it is called ──
|
|
57
|
+
const git = (cwd, ...a) => execFileSync('git', a, { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim();
|
|
58
|
+
const untracked = (cwd) => git(cwd, 'ls-files', '--others', '--exclude-standard', '--full-name', '--', ':/').split('\n').filter(Boolean);
|
|
59
|
+
/** The code as it is now (uncommitted work included), or null when this isn't a git repository with a commit. */
|
|
60
|
+
export function snapshot(cwd = process.cwd()) {
|
|
61
|
+
// `stash create` writes a commit, which git refuses without an author; a container or a CI runner has none set.
|
|
62
|
+
const stash = ['-c', 'user.name=tapcheck', '-c', 'user.email=tapcheck@example.invalid', 'stash', 'create'];
|
|
63
|
+
try {
|
|
64
|
+
return { snapshot: git(cwd, ...stash) || git(cwd, 'rev-parse', 'HEAD'), untracked: untracked(cwd) };
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/** Tracked files changed since the snapshot, as paths from the git root; null when the snapshot is gone (garbage-collected). */
|
|
71
|
+
function diff(cwd, snap) {
|
|
72
|
+
try {
|
|
73
|
+
return git(cwd, 'diff', '--name-only', snap).split('\n').filter(Boolean);
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* app.resetWhen: why the app's data should be reset before this run, or null when it needn't be. It is due on first use
|
|
81
|
+
* and when a file matching one of `globs` (paths from the git root) changed since the last reset (`state.reset`).
|
|
82
|
+
* Call it only where snapshot() works (a git repository with a commit).
|
|
83
|
+
*/
|
|
84
|
+
export function resetDue(state, globs, cwd = process.cwd()) {
|
|
85
|
+
const s = state.reset;
|
|
86
|
+
if (!s)
|
|
87
|
+
return 'first use';
|
|
88
|
+
const tracked = diff(cwd, s.snapshot);
|
|
89
|
+
if (!tracked)
|
|
90
|
+
return 'the snapshot of the last reset is gone';
|
|
91
|
+
const file = [...tracked, ...untracked(cwd).filter((f) => !s.untracked.includes(f))].find((f) => globs.some((g) => matchesGlob(f, g)));
|
|
92
|
+
return file ? `${file} changed since the last reset` : null;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* CHANGED=1: of `chosen`, the parts whose files changed since each last passed. With `at.base` (CHANGED=<git ref>), the
|
|
96
|
+
* files changed since the branch point with that ref instead, the same for every part and with no state needed: a pull
|
|
97
|
+
* request's own changes, committed or not. `changes` maps a part name, a suite or "*" to the globs it depends on; a
|
|
98
|
+
* part's own name wins over its suite, "*" adds to both, a part with none reruns on any change, and a change to the
|
|
99
|
+
* `config` file reruns everything. Files under `out` (tapcheck's own output) never count. `config` and `out` are paths from `cwd`.
|
|
100
|
+
*/
|
|
101
|
+
export function changedParts(chosen, state, changes, at) {
|
|
102
|
+
const cwd = at.cwd ?? process.cwd();
|
|
103
|
+
let prefix;
|
|
104
|
+
try {
|
|
105
|
+
git(cwd, 'rev-parse', 'HEAD');
|
|
106
|
+
prefix = git(cwd, 'rev-parse', '--show-prefix');
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
throw new Error(`CHANGED=${at.base ?? 1} needs a git repository with at least one commit here: it compares files with ${at.base ? 'that ref' : 'the last passing run'}.`);
|
|
110
|
+
}
|
|
111
|
+
const fromRoot = (file) => posix.normalize(prefix + relative(cwd, resolve(cwd, file)));
|
|
112
|
+
const config = fromRoot(at.config), out = fromRoot(at.out) + '/';
|
|
113
|
+
const now = untracked(cwd), diffs = new Map(); // parts that passed together share a snapshot
|
|
114
|
+
let sinceBase;
|
|
115
|
+
if (at.base) {
|
|
116
|
+
let fork;
|
|
117
|
+
try {
|
|
118
|
+
fork = git(cwd, 'merge-base', at.base, 'HEAD');
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
throw new Error(`CHANGED=${at.base}: git finds no commit shared by ${at.base} and HEAD. Fetch it first (git fetch origin <branch>); in CI, check out with full history (fetch-depth: 0).`);
|
|
122
|
+
}
|
|
123
|
+
sinceBase = [...(diff(cwd, fork) ?? []), ...now];
|
|
124
|
+
}
|
|
125
|
+
return chosen.filter((p) => {
|
|
126
|
+
let files = sinceBase;
|
|
127
|
+
if (!files) {
|
|
128
|
+
const s = state.parts[p.name]; // none: it never passed
|
|
129
|
+
if (s && !diffs.has(s.snapshot))
|
|
130
|
+
diffs.set(s.snapshot, diff(cwd, s.snapshot));
|
|
131
|
+
const tracked = s && diffs.get(s.snapshot);
|
|
132
|
+
if (!s || !tracked)
|
|
133
|
+
return true;
|
|
134
|
+
// ponytail: an untracked file edited again since the snapshot isn't seen (only new ones are); hash them if that bites.
|
|
135
|
+
files = [...tracked, ...now.filter((f) => !s.untracked.includes(f))];
|
|
136
|
+
}
|
|
137
|
+
files = files.filter((f) => !f.startsWith(out));
|
|
138
|
+
if (files.includes(config))
|
|
139
|
+
return true;
|
|
140
|
+
const globs = [...(changes[p.name] ?? changes[p.suite] ?? []), ...(changes['*'] ?? [])];
|
|
141
|
+
return globs.length ? files.some((f) => globs.some((g) => matchesGlob(f, g))) : files.length > 0;
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Which of the parts that ran passed: a part passes when it has no failing finding of its own (its suite, or its flow, on its side).
|
|
146
|
+
* Only a passing part is recorded in `state` (at `snap`), so CHANGED=1 runs a failing part again until it passes.
|
|
147
|
+
*/
|
|
148
|
+
export function mark(state, ran, findings, snap) {
|
|
149
|
+
return Object.fromEntries(ran.map((p) => {
|
|
150
|
+
const ok = !findings.some((f) => f.suite === findingSuite(p) && f.side === p.side && f.status === 'fail');
|
|
151
|
+
if (ok && snap)
|
|
152
|
+
state.parts[p.name] = snap;
|
|
153
|
+
else
|
|
154
|
+
delete state.parts[p.name];
|
|
155
|
+
return [p.name, ok];
|
|
156
|
+
}));
|
|
157
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { Task } from './config.ts';
|
|
2
|
+
export declare const VISUAL: {
|
|
3
|
+
loaded: import("@typesafe-ai/sdk").NoulQuestion;
|
|
4
|
+
error_shown: import("@typesafe-ai/sdk").NoulQuestion;
|
|
5
|
+
overlap: import("@typesafe-ai/sdk").NoulQuestion;
|
|
6
|
+
clipped: import("@typesafe-ai/sdk").NoulQuestion;
|
|
7
|
+
raw_key: import("@typesafe-ai/sdk").NoulQuestion;
|
|
8
|
+
misaligned: import("@typesafe-ai/sdk").NoulQuestion;
|
|
9
|
+
};
|
|
10
|
+
export declare const EMAIL: {
|
|
11
|
+
rendered: import("@typesafe-ai/sdk").NoulQuestion;
|
|
12
|
+
unfilled_placeholder: import("@typesafe-ai/sdk").NoulQuestion;
|
|
13
|
+
actions_visible: import("@typesafe-ai/sdk").NoulQuestion;
|
|
14
|
+
mobile_readable: import("@typesafe-ai/sdk").NoulQuestion;
|
|
15
|
+
};
|
|
16
|
+
/** The yes-or-no questions above where yes is a defect. For every other one, yes is the good answer. */
|
|
17
|
+
export declare const YES_IS_DEFECT: string[];
|
|
18
|
+
export declare const DESIGN: {
|
|
19
|
+
cta: import("@typesafe-ai/sdk").ScoreQuestion<readonly ["There is no visible main action, or several actions look equally important.", "A main action exists but is easy to miss.", "The main action is visible but competes with other actions.", "The main action is clear, with a little competition.", "One main action clearly stands out, and its label says what it does."]>;
|
|
20
|
+
cta_label: import("@typesafe-ai/sdk").ScoreQuestion<readonly ["The label is vague, such as \"Submit\", \"OK\" or an icon with no words.", "The label hints at the result but could mean several things.", "The label names the action but not what it acts on.", "The label names the action and its object, a little loosely.", "The label says exactly what happens, such as \"Add to basket\"."]>;
|
|
21
|
+
negative_space: import("@typesafe-ai/sdk").ScoreQuestion<readonly ["Everything is crammed together, or space is scattered so groups cannot be told apart.", "Some groups run into each other; space does little to separate them.", "Groups are mostly separated, but some areas feel cramped or oddly empty.", "Space groups and separates content well, with one or two cramped or loose spots.", "Empty space alone makes every group and its boundaries obvious, and the screen feels calm."]>;
|
|
22
|
+
density: import("@typesafe-ai/sdk").ChoiceQuestion<{
|
|
23
|
+
readonly too_sparse: "Large empty areas with little content; a person has to scroll or hunt for anything useful.";
|
|
24
|
+
readonly balanced: "Enough content to be useful at a glance, with room to breathe.";
|
|
25
|
+
readonly too_dense: "So much text, data or controls that it is hard to know where to look.";
|
|
26
|
+
}>;
|
|
27
|
+
hierarchy: import("@typesafe-ai/sdk").ScoreQuestion<readonly ["Nothing stands out: headings, content and actions all look equally important.", "Some headings stand out, but the main content and the actions are hard to tell apart.", "The page title is clear, but secondary parts compete with the main content.", "The title, main content and actions are clearly ranked, with a few minor distractions.", "At a glance a person can tell what the screen is, what matters most and what to do."]>;
|
|
28
|
+
legibility: import("@typesafe-ai/sdk").ScoreQuestion<readonly ["Much of the text is too faint, too small or too low in contrast to read.", "Several labels or paragraphs are hard to read.", "Most text is readable, but some secondary text is faint or tiny.", "Nearly all text is easy to read; one or two small labels are a little faint.", "All text is crisp, well sized and in strong contrast with its background."]>;
|
|
29
|
+
spacing: import("@typesafe-ai/sdk").ScoreQuestion<readonly ["Elements are crammed together or scattered with no visible rhythm.", "Spacing varies noticeably between elements of the same kind.", "Spacing is mostly regular, with some cramped or loose areas.", "Spacing is regular, with one or two small inconsistencies.", "Spacing between and around every group is even and deliberate."]>;
|
|
30
|
+
};
|
|
31
|
+
export declare const HEURISTICS: (audience: string) => {
|
|
32
|
+
h1_status: import("@typesafe-ai/sdk").ScoreQuestion<readonly ["Nothing tells the person where they are or what state things are in.", "The current page is hard to make out and states are not shown.", "The current page is shown, but states such as saved, draft or loading are unclear.", "The current page and most states are clear.", "The current page, item states and any progress are all plain to see."]>;
|
|
33
|
+
h2_language: import("@typesafe-ai/sdk").ScoreQuestion<readonly ["Much of the wording is technical jargon, codes or internal names.", "Several labels use jargon or words that reader would not use.", "Mostly plain, with a few technical terms left unexplained.", "Plain everyday wording, with one or two technical terms.", "Every label and message reads as a person would say it."]>;
|
|
34
|
+
h4_consistency: import("@typesafe-ai/sdk").ScoreQuestion<readonly ["Things that do the same job look different everywhere.", "Several buttons or links of the same kind look different.", "Mostly consistent, with a few odd ones out.", "Consistent, with one small exception.", "Every control of a kind looks and behaves the same way."]>;
|
|
35
|
+
h6_recognition: import("@typesafe-ai/sdk").ScoreQuestion<readonly ["The options are hidden; a person must know where to go or what to type.", "Most options are behind menus or icons with no labels.", "The main options are visible, but some are hidden behind unlabelled icons.", "Options are visible and labelled, with a few behind a menu.", "Every option the person needs here is visible and labelled."]>;
|
|
36
|
+
h8_minimalist: import("@typesafe-ai/sdk").ScoreQuestion<readonly ["Most of what is shown is decoration, repetition or unrelated content.", "Several parts add nothing and compete for attention.", "Some parts could go without loss.", "Almost everything shown is useful.", "Everything shown helps with the screen's job and nothing else is there."]>;
|
|
37
|
+
h10_help: import("@typesafe-ai/sdk").NoulQuestion;
|
|
38
|
+
};
|
|
39
|
+
export declare const guerrilla: (purpose: string, others: string[]) => {
|
|
40
|
+
purpose_clear: import("@typesafe-ai/sdk").NoulQuestion;
|
|
41
|
+
purpose_pick: import("@typesafe-ai/sdk").ChoiceQuestion<{
|
|
42
|
+
[k: string]: string;
|
|
43
|
+
}>;
|
|
44
|
+
trust: import("@typesafe-ai/sdk").ScoreQuestion<readonly ["It looks broken, unfinished or like a scam.", "It looks rough: mismatched styles or obvious glitches.", "It looks acceptable but plain or a little dated.", "It looks polished, with a small rough edge.", "It looks polished and trustworthy throughout."]>;
|
|
45
|
+
};
|
|
46
|
+
export declare const purposeKey: (p: string) => string;
|
|
47
|
+
export declare const ATTENTION_MODEL = "jev-preview";
|
|
48
|
+
export declare const ATTENTION: {
|
|
49
|
+
look_1: import("@typesafe-ai/sdk").BoxQuestion;
|
|
50
|
+
look_2: import("@typesafe-ai/sdk").BoxQuestion;
|
|
51
|
+
look_3: import("@typesafe-ai/sdk").BoxQuestion;
|
|
52
|
+
main_cta: import("@typesafe-ai/sdk").BoxQuestion;
|
|
53
|
+
};
|
|
54
|
+
export declare const ATTENTION_CHECK: {
|
|
55
|
+
has_cta: import("@typesafe-ai/sdk").NoulQuestion;
|
|
56
|
+
};
|
|
57
|
+
export declare const TASK_Q: {
|
|
58
|
+
arrived: (t: Task) => import("@typesafe-ai/sdk").NoulQuestion;
|
|
59
|
+
can_progress: import("@typesafe-ai/sdk").NoulQuestion;
|
|
60
|
+
pick: (options: Record<string, string>) => import("@typesafe-ai/sdk").ChoiceQuestion<Record<string, string>>;
|
|
61
|
+
hesitation: import("@typesafe-ai/sdk").NoulQuestion;
|
|
62
|
+
error: import("@typesafe-ai/sdk").NoulQuestion;
|
|
63
|
+
irreversible: import("@typesafe-ai/sdk").NoulQuestion;
|
|
64
|
+
};
|
|
65
|
+
export declare const SCROLL = "scroll_down_to_see_more";
|
|
66
|
+
export declare const MAX_STEPS = 5;
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The questions Jev answers in the ux and usability suites. Each asks one judgment a person could make at a glance from
|
|
3
|
+
* the screenshots; code (src/jev.ts and the suites) turns the answers into verdicts. The screens and tasks they are
|
|
4
|
+
* asked about come from tapcheck.yml.
|
|
5
|
+
*/
|
|
6
|
+
import { box, choice, noul, score } from '@typesafe-ai/sdk';
|
|
7
|
+
// ───────────────────────────── VISUAL QA (functional verification of the rendered screen) ─────────────────────────────
|
|
8
|
+
export const VISUAL = {
|
|
9
|
+
loaded: noul("Do `screenshots` show the screen's main content, fully loaded?", {
|
|
10
|
+
true: "The screen's own content is visible: the text, data or controls it exists to show.",
|
|
11
|
+
false: 'The screen is blank, still shows a loading spinner or grey placeholder blocks, or shows only a header and menu.',
|
|
12
|
+
}),
|
|
13
|
+
error_shown: noul('Do `screenshots` show an error message?', {
|
|
14
|
+
true: "A message says something went wrong, a request failed, a page wasn't found, or the server had an error.",
|
|
15
|
+
false: 'No error message is shown. An empty state such as "Nothing here yet", a hint under a field, or a notice about the data (a check that found nothing yet, a limit nearly reached) is not an error.',
|
|
16
|
+
}),
|
|
17
|
+
overlap: noul('In `screenshots`, do any texts or controls overlap each other?', {
|
|
18
|
+
true: 'Two pieces of text, or text and a control, are drawn on top of each other so part of one is hidden or hard to read.',
|
|
19
|
+
false: 'Every piece of text and every control has its own space. A menu or dialog shown on purpose above the page is not overlap.',
|
|
20
|
+
}),
|
|
21
|
+
clipped: noul('In `screenshots`, is any text or control cut off?', {
|
|
22
|
+
true: "A word, label, button or field is cut off by the side of the screen or by its own box, so part of it can't be seen.",
|
|
23
|
+
false: 'All text and controls are fully visible. Content running past the bottom of one slice into the next is not cut off.',
|
|
24
|
+
}),
|
|
25
|
+
raw_key: noul('Do `screenshots` show a raw translation key or placeholder instead of words, such as "settings.profile.title", "validation.required" or ":count items"?', {
|
|
26
|
+
true: 'Some label, button or message shows a dotted code-like key or an unfilled :placeholder instead of normal words.',
|
|
27
|
+
false: 'Every label and message reads as normal words. Web addresses, email addresses and file names are not keys.',
|
|
28
|
+
}),
|
|
29
|
+
misaligned: noul('In `screenshots`, are items that belong in one row or column visibly out of line?', {
|
|
30
|
+
true: 'Cards, fields, labels or buttons meant to line up start or end at slightly different places, or sit at different heights.',
|
|
31
|
+
false: 'Items in each row and column line up along their edges or centres.',
|
|
32
|
+
}),
|
|
33
|
+
};
|
|
34
|
+
// ───────────────────────────── EMAIL (t.mail.judge in flows) ─────────────────────────────
|
|
35
|
+
// `screenshot` is the email as a mail program on a computer shows it, `screenshot_mobile` the same email at a phone's width.
|
|
36
|
+
export const EMAIL = {
|
|
37
|
+
rendered: noul('Does `screenshot` show a properly laid-out email?', {
|
|
38
|
+
true: 'The email shows formatted text, and any images, buttons or columns sit where a designer would put them.',
|
|
39
|
+
false: 'The email shows raw HTML or code, broken image boxes, or a jumbled layout.',
|
|
40
|
+
}),
|
|
41
|
+
unfilled_placeholder: noul('Does `screenshot` show a placeholder that was not replaced with real data?', {
|
|
42
|
+
true: 'Text such as {{first_name}}, {first_name}, [FNAME] or %name% appears in the email.',
|
|
43
|
+
false: 'Every name, date and link reads as real content.',
|
|
44
|
+
}),
|
|
45
|
+
actions_visible: noul('In `screenshot`, is every link and button easy to see and tell apart from plain text?', {
|
|
46
|
+
true: 'Each link is underlined or coloured, and each button looks like a button with a readable label. An email with no links or buttons at all also counts.',
|
|
47
|
+
false: 'A link looks like plain text, a button has no visible label, or a link or button is too faint to notice.',
|
|
48
|
+
}),
|
|
49
|
+
mobile_readable: noul('Can the email in `screenshot_mobile` be read on a phone without zooming or scrolling sideways?', {
|
|
50
|
+
true: 'The text fits the width of the screen and is large enough to read.',
|
|
51
|
+
false: 'Text or images are cut off at the side, the layout is wider than the screen, or the text is too small to read.',
|
|
52
|
+
}),
|
|
53
|
+
};
|
|
54
|
+
/** The yes-or-no questions above where yes is a defect. For every other one, yes is the good answer. */
|
|
55
|
+
export const YES_IS_DEFECT = ['error_shown', 'overlap', 'clipped', 'raw_key', 'misaligned', 'unfilled_placeholder'];
|
|
56
|
+
// ───────────────────────────── VISUAL DESIGN (CTA, negative space, hierarchy, legibility) ─────────────────────────────
|
|
57
|
+
export const DESIGN = {
|
|
58
|
+
cta: score('How clear is the main action a person can take in `screenshots`?', [
|
|
59
|
+
'There is no visible main action, or several actions look equally important.',
|
|
60
|
+
'A main action exists but is easy to miss.',
|
|
61
|
+
'The main action is visible but competes with other actions.',
|
|
62
|
+
'The main action is clear, with a little competition.',
|
|
63
|
+
'One main action clearly stands out, and its label says what it does.',
|
|
64
|
+
]),
|
|
65
|
+
cta_label: score('How well does the label of the most prominent button in `screenshots` say what will happen when it is clicked?', [
|
|
66
|
+
'The label is vague, such as "Submit", "OK" or an icon with no words.',
|
|
67
|
+
'The label hints at the result but could mean several things.',
|
|
68
|
+
'The label names the action but not what it acts on.',
|
|
69
|
+
'The label names the action and its object, a little loosely.',
|
|
70
|
+
'The label says exactly what happens, such as "Add to basket".',
|
|
71
|
+
]),
|
|
72
|
+
negative_space: score('How well does the empty space in `screenshots` group related things and separate unrelated ones?', [
|
|
73
|
+
'Everything is crammed together, or space is scattered so groups cannot be told apart.',
|
|
74
|
+
'Some groups run into each other; space does little to separate them.',
|
|
75
|
+
'Groups are mostly separated, but some areas feel cramped or oddly empty.',
|
|
76
|
+
'Space groups and separates content well, with one or two cramped or loose spots.',
|
|
77
|
+
'Empty space alone makes every group and its boundaries obvious, and the screen feels calm.',
|
|
78
|
+
]),
|
|
79
|
+
density: choice('How much is packed into the first screen of `screenshots`?', {
|
|
80
|
+
too_sparse: 'Large empty areas with little content; a person has to scroll or hunt for anything useful.',
|
|
81
|
+
balanced: 'Enough content to be useful at a glance, with room to breathe.',
|
|
82
|
+
too_dense: 'So much text, data or controls that it is hard to know where to look.',
|
|
83
|
+
}),
|
|
84
|
+
hierarchy: score('How clear is the visual hierarchy in `screenshots`?', [
|
|
85
|
+
'Nothing stands out: headings, content and actions all look equally important.',
|
|
86
|
+
'Some headings stand out, but the main content and the actions are hard to tell apart.',
|
|
87
|
+
'The page title is clear, but secondary parts compete with the main content.',
|
|
88
|
+
'The title, main content and actions are clearly ranked, with a few minor distractions.',
|
|
89
|
+
'At a glance a person can tell what the screen is, what matters most and what to do.',
|
|
90
|
+
]),
|
|
91
|
+
legibility: score('How easy is the text in `screenshots` to read?', [
|
|
92
|
+
'Much of the text is too faint, too small or too low in contrast to read.',
|
|
93
|
+
'Several labels or paragraphs are hard to read.',
|
|
94
|
+
'Most text is readable, but some secondary text is faint or tiny.',
|
|
95
|
+
'Nearly all text is easy to read; one or two small labels are a little faint.',
|
|
96
|
+
'All text is crisp, well sized and in strong contrast with its background.',
|
|
97
|
+
]),
|
|
98
|
+
spacing: score('How consistent is the spacing in `screenshots`?', [
|
|
99
|
+
'Elements are crammed together or scattered with no visible rhythm.',
|
|
100
|
+
'Spacing varies noticeably between elements of the same kind.',
|
|
101
|
+
'Spacing is mostly regular, with some cramped or loose areas.',
|
|
102
|
+
'Spacing is regular, with one or two small inconsistencies.',
|
|
103
|
+
'Spacing between and around every group is even and deliberate.',
|
|
104
|
+
]),
|
|
105
|
+
};
|
|
106
|
+
// ───────────────────────────── HEURISTIC EVALUATION (the usability heuristics a screenshot can show) ─────────────────────────────
|
|
107
|
+
// Error recovery, undo and shortcuts for experts need interaction, so the usability suite covers them, not these.
|
|
108
|
+
// `audience` is tapcheck.yml's audience: who the app is for, so plain wording is judged for that reader.
|
|
109
|
+
export const HEURISTICS = (audience) => ({
|
|
110
|
+
h1_status: score('How well do `screenshots` show where the person is and the state of things (current page, saved or not, loading, counts)?', [
|
|
111
|
+
'Nothing tells the person where they are or what state things are in.',
|
|
112
|
+
'The current page is hard to make out and states are not shown.',
|
|
113
|
+
'The current page is shown, but states such as saved, draft or loading are unclear.',
|
|
114
|
+
'The current page and most states are clear.',
|
|
115
|
+
'The current page, item states and any progress are all plain to see.',
|
|
116
|
+
]),
|
|
117
|
+
h2_language: score(`How well does the wording in \`screenshots\` use everyday words ${audience} would use?`, [
|
|
118
|
+
'Much of the wording is technical jargon, codes or internal names.',
|
|
119
|
+
'Several labels use jargon or words that reader would not use.',
|
|
120
|
+
'Mostly plain, with a few technical terms left unexplained.',
|
|
121
|
+
'Plain everyday wording, with one or two technical terms.',
|
|
122
|
+
'Every label and message reads as a person would say it.',
|
|
123
|
+
]),
|
|
124
|
+
h4_consistency: score('How consistent do buttons, links, icons and headings look across `screenshots`?', [
|
|
125
|
+
'Things that do the same job look different everywhere.',
|
|
126
|
+
'Several buttons or links of the same kind look different.',
|
|
127
|
+
'Mostly consistent, with a few odd ones out.',
|
|
128
|
+
'Consistent, with one small exception.',
|
|
129
|
+
'Every control of a kind looks and behaves the same way.',
|
|
130
|
+
]),
|
|
131
|
+
h6_recognition: score('How well do `screenshots` let a person see their options instead of having to remember them?', [
|
|
132
|
+
'The options are hidden; a person must know where to go or what to type.',
|
|
133
|
+
'Most options are behind menus or icons with no labels.',
|
|
134
|
+
'The main options are visible, but some are hidden behind unlabelled icons.',
|
|
135
|
+
'Options are visible and labelled, with a few behind a menu.',
|
|
136
|
+
'Every option the person needs here is visible and labelled.',
|
|
137
|
+
]),
|
|
138
|
+
h8_minimalist: score('How free are `screenshots` of things that do not help the person with this screen?', [
|
|
139
|
+
'Most of what is shown is decoration, repetition or unrelated content.',
|
|
140
|
+
'Several parts add nothing and compete for attention.',
|
|
141
|
+
'Some parts could go without loss.',
|
|
142
|
+
'Almost everything shown is useful.',
|
|
143
|
+
"Everything shown helps with the screen's job and nothing else is there.",
|
|
144
|
+
]),
|
|
145
|
+
h10_help: noul('Do `screenshots` show help for a person who gets stuck, such as a help link, an explanation or an example?', {
|
|
146
|
+
true: 'A help link, a hint, a short explanation or an example is visible where a person might get stuck.',
|
|
147
|
+
false: 'No help, hint or explanation is visible anywhere on the screen.',
|
|
148
|
+
}),
|
|
149
|
+
});
|
|
150
|
+
// ───────────────────────────── GUERRILLA TEST (the five-second test a passer-by would take) ─────────────────────────────
|
|
151
|
+
// The screen's real purpose is one option among the other screens' purposes, so a wrong pick means the screen misleads.
|
|
152
|
+
export const guerrilla = (purpose, others) => ({
|
|
153
|
+
purpose_clear: noul(`Could a first-time visitor shown \`screenshot\` for five seconds tell that this screen is for this: ${purpose}?`, {
|
|
154
|
+
true: "The title, main content and main action make the screen's job plain at a glance.",
|
|
155
|
+
false: "The screen could be for several things, or its job is hidden below the fold or behind jargon.",
|
|
156
|
+
}),
|
|
157
|
+
purpose_pick: choice('Which job is the screen in `screenshot` for?', Object.fromEntries([purpose, ...others].map((p) => [purposeKey(p), p]))),
|
|
158
|
+
trust: score('How trustworthy and professional does `screenshot` look to a first-time visitor?', [
|
|
159
|
+
'It looks broken, unfinished or like a scam.',
|
|
160
|
+
'It looks rough: mismatched styles or obvious glitches.',
|
|
161
|
+
'It looks acceptable but plain or a little dated.',
|
|
162
|
+
'It looks polished, with a small rough edge.',
|
|
163
|
+
'It looks polished and trustworthy throughout.',
|
|
164
|
+
]),
|
|
165
|
+
});
|
|
166
|
+
export const purposeKey = (p) => p.toLowerCase().replace(/[^a-z]+/g, '_').replace(/^_|_$/g, '').slice(0, 40);
|
|
167
|
+
// ───────────────────────────── ATTENTION (predicted eye tracking; Box questions on jev-preview) ─────────────────────────────
|
|
168
|
+
// These predict where people look; they are not eye-tracking data. Each is answered on its own, so each names its rank.
|
|
169
|
+
export const ATTENTION_MODEL = 'jev-preview';
|
|
170
|
+
export const ATTENTION = {
|
|
171
|
+
look_1: box('The single element on this screen that a first-time visitor looks at first.'),
|
|
172
|
+
look_2: box('The element a first-time visitor looks at second, after the most eye-catching one.'),
|
|
173
|
+
look_3: box('The element a first-time visitor looks at third.'),
|
|
174
|
+
main_cta: box('The main button or link a person would click to do what this screen is for.'),
|
|
175
|
+
};
|
|
176
|
+
export const ATTENTION_CHECK = {
|
|
177
|
+
has_cta: noul("Is there a button or link in `screenshot` that does the main job of this screen?", {
|
|
178
|
+
true: 'A visible button or link starts the screen\'s main task, such as "Get started" or "Sign up".',
|
|
179
|
+
false: 'No such button or link is visible; the screen only shows information or navigation.',
|
|
180
|
+
}),
|
|
181
|
+
};
|
|
182
|
+
// ───────────────────────────── USABILITY TASKS (Jev picks as a first-time user would) ─────────────────────────────
|
|
183
|
+
// A task's `done` describes the screen that means it is reached. tapcheck only navigates: it never submits or saves.
|
|
184
|
+
export const TASK_Q = {
|
|
185
|
+
arrived: (t) => noul(`Does \`screenshot\` show this: ${t.done}`, { true: t.done, false: t.notDone }),
|
|
186
|
+
can_progress: noul('Does `screenshot` show a control that would move a person toward `goal`?', {
|
|
187
|
+
true: 'One of the controls in `controls` leads toward the goal, or opens the place where it starts.',
|
|
188
|
+
false: 'None of the controls in `controls` leads toward the goal.',
|
|
189
|
+
}),
|
|
190
|
+
pick: (options) => choice('Which control in `controls` would a first-time user click next to reach `goal`, after `already_clicked`?', options),
|
|
191
|
+
hesitation: noul('Would a first-time user looking at `screenshot` be unsure what to click next to reach `goal`?', {
|
|
192
|
+
true: 'Several controls look equally likely, or none is labelled in a way that matches the goal.',
|
|
193
|
+
false: 'One control plainly matches the goal.',
|
|
194
|
+
}),
|
|
195
|
+
error: noul('Does `screenshot` show an error message?'),
|
|
196
|
+
// Asked about the one control about to be clicked, before the click.
|
|
197
|
+
irreversible: noul('Would clicking `control` on `screenshot` delete, send, publish, pay, sign out or change saved data in a way that cannot simply be undone?', {
|
|
198
|
+
true: 'The click itself would remove, send, publish, charge, sign out, or save a change for real.',
|
|
199
|
+
false: 'The click only opens a page, menu, tab, dialog or form, or changes a filter or view.',
|
|
200
|
+
}),
|
|
201
|
+
};
|
|
202
|
+
export const SCROLL = 'scroll_down_to_see_more';
|
|
203
|
+
export const MAX_STEPS = 5;
|
package/dist/report.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Recording } from './browser.ts';
|
|
2
|
+
export type Finding = {
|
|
3
|
+
suite: string;
|
|
4
|
+
side: string;
|
|
5
|
+
where: string;
|
|
6
|
+
check: string;
|
|
7
|
+
status: 'pass' | 'fail' | 'warn' | 'info';
|
|
8
|
+
detail?: string;
|
|
9
|
+
evidence?: string[];
|
|
10
|
+
};
|
|
11
|
+
export declare const findings: Finding[];
|
|
12
|
+
export declare const record: (f: Finding) => void;
|
|
13
|
+
/** Writes the three reports into `dir`; returns the per-suite counts and the number of failures. */
|
|
14
|
+
export declare function write(dir: string, meta: {
|
|
15
|
+
base: string;
|
|
16
|
+
started: number;
|
|
17
|
+
note?: string;
|
|
18
|
+
recordings?: Recording[];
|
|
19
|
+
}): {
|
|
20
|
+
bySuite: {
|
|
21
|
+
s: string;
|
|
22
|
+
pass: number;
|
|
23
|
+
fail: number;
|
|
24
|
+
warn: number;
|
|
25
|
+
total: number;
|
|
26
|
+
skipped: boolean;
|
|
27
|
+
}[];
|
|
28
|
+
fails: number;
|
|
29
|
+
};
|
package/dist/report.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The evidence report: report.html (failures first, with evidence thumbnails and links), REPORT.md (for a PR or a
|
|
3
|
+
* ticket) and findings.json, all in the run's folder next to the screenshots and JSON evidence they point to. A run with
|
|
4
|
+
* RECORD=1 also lists its videos and Playwright traces, per side and part.
|
|
5
|
+
*/
|
|
6
|
+
import { writeFileSync } from 'node:fs';
|
|
7
|
+
export const findings = [];
|
|
8
|
+
export const record = (f) => { findings.push(f); };
|
|
9
|
+
const esc = (s) => s.replace(/[&<>"]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"' })[c]);
|
|
10
|
+
const ORDER = { fail: 0, warn: 1, info: 2, pass: 3 };
|
|
11
|
+
/** Writes the three reports into `dir`; returns the per-suite counts and the number of failures. */
|
|
12
|
+
export function write(dir, meta) {
|
|
13
|
+
const rel = (p) => (p.startsWith(`${dir}/`) ? p.slice(dir.length + 1) : p);
|
|
14
|
+
writeFileSync(`${dir}/findings.json`, JSON.stringify(findings, null, 2));
|
|
15
|
+
const many = new Set(findings.map((f) => f.side).filter(Boolean)).size > 1; // the code part has no side
|
|
16
|
+
const key = (f) => (many && f.side ? `${f.suite} · ${f.side}` : f.suite);
|
|
17
|
+
const bySuite = [...new Set(findings.map(key))].map((s) => {
|
|
18
|
+
const f = findings.filter((x) => key(x) === s);
|
|
19
|
+
const n = (st) => f.filter((x) => x.status === st).length;
|
|
20
|
+
return { s, pass: n('pass'), fail: n('fail'), warn: n('warn'), total: f.length, skipped: f.every((x) => x.status === 'info' && x.check === 'part ran') };
|
|
21
|
+
});
|
|
22
|
+
const sorted = [...findings].sort((a, b) => ORDER[a.status] - ORDER[b.status] || key(a).localeCompare(key(b)) || a.where.localeCompare(b.where));
|
|
23
|
+
const mins = ((Date.now() - meta.started) / 60000).toFixed(1);
|
|
24
|
+
const when = new Date().toISOString();
|
|
25
|
+
const ev = (e) => (/\.png$/.test(e)
|
|
26
|
+
? ` <a href="${esc(rel(e))}" target="_blank" rel="noopener"><img src="${esc(rel(e))}" alt="evidence" loading="lazy"></a>`
|
|
27
|
+
: ` <a href="${esc(rel(e))}">${esc(rel(e))}</a>`);
|
|
28
|
+
const row = (f) => `<tr class="${f.status}"><td><span class="tag ${f.status}">${f.status}</span></td><td>${esc(key(f))}</td><td>${esc(f.where)}</td>`
|
|
29
|
+
+ `<td>${esc(f.check)}</td><td>${esc(f.detail ?? '')}${(f.evidence ?? []).map(ev).join('')}</td></tr>`;
|
|
30
|
+
const recs = (meta.recordings ?? []).filter((r) => r.videos.length || r.trace);
|
|
31
|
+
const recorded = recs.length ? `<h2>Recordings</h2><p class="meta">A video per browser page, and a trace of every action with the page as it was: open one with the command next to it.</p><ul>${recs.map((r) => `<li>${esc(r.side)} · ${esc(r.label)}${r.videos.map((v, i) => ` · <a href="${esc(rel(v))}">video${r.videos.length > 1 ? ` ${i + 1}` : ''}</a>`).join('')}`
|
|
32
|
+
+ `${r.trace ? ` · <a href="${esc(rel(r.trace))}">trace</a> <code>npx playwright show-trace ${esc(r.trace)}</code>` : ''}</li>`).join('')}</ul>` : '';
|
|
33
|
+
const html = `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>tapcheck report</title><style>
|
|
34
|
+
:root{--bg:#fff;--fg:#1f2937;--mut:#6b7280;--line:#e5e7eb;--fail:#b91c1c;--warn:#b45309;--pass:#15803d;--info:#1d4ed8}
|
|
35
|
+
@media (prefers-color-scheme:dark){:root{--bg:#111827;--fg:#e5e7eb;--mut:#9ca3af;--line:#374151;--fail:#f87171;--warn:#fbbf24;--pass:#4ade80;--info:#93c5fd}}
|
|
36
|
+
body{margin:0;padding:24px 16px;background:var(--bg);color:var(--fg);font:14px/1.5 system-ui,sans-serif}main{max-width:1280px;margin:0 auto}
|
|
37
|
+
h1{margin:0 0 4px;font-size:22px}h2{margin:28px 0 4px;font-size:16px}li{margin:4px 0}code{font-size:12px;color:var(--mut)}p.meta{color:var(--mut);margin:0 0 20px}.cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:12px;margin-bottom:24px}
|
|
38
|
+
.card{border:1px solid var(--line);border-radius:10px;padding:12px}.card b{display:block;text-transform:uppercase;font-size:12px;color:var(--mut);letter-spacing:.04em}
|
|
39
|
+
.card span{font-size:13px}.n{font-size:20px;font-weight:700}.f{color:var(--fail)}.w{color:var(--warn)}.p{color:var(--pass)}
|
|
40
|
+
.filters{margin:0 0 12px;display:flex;gap:8px;flex-wrap:wrap}.filters label{border:1px solid var(--line);border-radius:999px;padding:4px 10px;cursor:pointer}
|
|
41
|
+
.wrap{overflow-x:auto}table{border-collapse:collapse;width:100%}th,td{text-align:left;vertical-align:top;padding:8px;border-bottom:1px solid var(--line)}th{font-size:12px;color:var(--mut);text-transform:uppercase}
|
|
42
|
+
td img{max-width:120px;max-height:80px;border:1px solid var(--line);border-radius:4px;vertical-align:middle;margin:2px}
|
|
43
|
+
.tag{font-size:11px;font-weight:700;text-transform:uppercase;padding:2px 6px;border-radius:4px;border:1px solid currentColor}.tag.fail{color:var(--fail)}.tag.warn{color:var(--warn)}.tag.pass{color:var(--pass)}.tag.info{color:var(--info)}
|
|
44
|
+
body:has(#hp:not(:checked)) tr.pass{display:none}body:has(#hw:not(:checked)) tr.warn{display:none}body:has(#hi:not(:checked)) tr.info{display:none}
|
|
45
|
+
</style></head><body><main><h1>tapcheck report</h1><p class="meta">${esc(meta.base)} · ${when} · ${mins} min${meta.note ? ` · ${esc(meta.note)}` : ''}</p>
|
|
46
|
+
<div class="cards">${bySuite.map((b) => `<div class="card"><b>${esc(b.s)}</b><span class="n ${b.fail ? 'f' : b.skipped ? 'w' : 'p'}">${b.fail ? `${b.fail} failing` : b.skipped ? 'skipped' : 'clean'}</span><br><span><span class="w">${b.warn} warn</span> · <span class="p">${b.pass} pass</span> · ${b.total} checks</span></div>`).join('')}</div>
|
|
47
|
+
<div class="filters"><label><input type="checkbox" id="hw" checked> warnings</label><label><input type="checkbox" id="hi" checked> info</label><label><input type="checkbox" id="hp"> passes</label></div>
|
|
48
|
+
<div class="wrap"><table><thead><tr><th>Status</th><th>Suite</th><th>Where</th><th>Check</th><th>Detail and evidence</th></tr></thead><tbody>${sorted.map(row).join('')}</tbody></table></div>${recorded}
|
|
49
|
+
<p class="meta">Raw evidence: findings.json, payloads.json (every Jev request), code.json (the gates' output), and per side crawl.json, network.json, missed-routes.json, axe.json, interact.json, audit.json, clickstream.json and hits.json (what each part reached, for COVERAGE=1).</p></main></body></html>`;
|
|
50
|
+
writeFileSync(`${dir}/report.html`, html);
|
|
51
|
+
const line = (f) => `- **${key(f)}** · ${f.where} · ${f.check}${f.detail ? `: ${f.detail}` : ''}`;
|
|
52
|
+
const md = [`# tapcheck · ${meta.base}`, '', `${when} · ${mins} min${meta.note ? ` · ${meta.note}` : ''}`, '',
|
|
53
|
+
'| Suite | Failing | Warnings | Passing |', '|---|---|---|---|', ...bySuite.map((b) => `| ${b.s} | ${b.fail} | ${b.warn} | ${b.pass} |`), '',
|
|
54
|
+
'## Failing', '', ...sorted.filter((f) => f.status === 'fail').map(line), '', '## Warnings', '', ...sorted.filter((f) => f.status === 'warn').map(line), '',
|
|
55
|
+
...(sorted.some((f) => f.check === 'part ran' && f.status === 'info') ? ['## Skipped', '', ...sorted.filter((f) => f.check === 'part ran' && f.status === 'info').map(line), ''] : []),
|
|
56
|
+
...(recs.length ? ['## Recordings', '', ...recs.map((r) => `- ${r.side} · ${r.label}: ${[...r.videos.map(rel), ...(r.trace ? [`\`npx playwright show-trace ${r.trace}\``] : [])].join(' · ')}`), ''] : [])].join('\n');
|
|
57
|
+
writeFileSync(`${dir}/REPORT.md`, md);
|
|
58
|
+
return { bySuite, fails: findings.filter((f) => f.status === 'fail').length };
|
|
59
|
+
}
|
package/dist/routes.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Config } from './config.ts';
|
|
2
|
+
export type Route = {
|
|
3
|
+
method: string;
|
|
4
|
+
path: string;
|
|
5
|
+
auth?: boolean;
|
|
6
|
+
};
|
|
7
|
+
/** A route path as a regular expression on a URL path: parameters match one segment, splats the rest, (groups) are optional. */
|
|
8
|
+
export declare function matcher(path: string): RegExp;
|
|
9
|
+
export declare const hasParams: (path: string) => boolean;
|
|
10
|
+
/** What the routes command printed, one route per method (GET|HEAD becomes GET), paths with a leading slash. */
|
|
11
|
+
export declare function parse(out: string): Route[];
|
|
12
|
+
/** The app's routes: the command runs once per run, from the config file's folder. Empty when no command is configured. */
|
|
13
|
+
export declare function routes(cfg: Config): Route[];
|
|
14
|
+
/** Of the GET routes, the ones no reached URL path matches. */
|
|
15
|
+
export declare function coverage(list: Route[], reached: string[]): {
|
|
16
|
+
total: number;
|
|
17
|
+
missed: string[];
|
|
18
|
+
};
|