form-tester 0.7.1 → 0.7.3
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.
|
@@ -10,17 +10,21 @@ Install skill files:
|
|
|
10
10
|
form-tester install
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
```
|
|
15
|
-
form-tester
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
Non-interactive mode (best for AI agents):
|
|
13
|
+
Test modes:
|
|
19
14
|
```
|
|
15
|
+
# AI mode (default) — no prompts:
|
|
20
16
|
form-tester test <url> --auto
|
|
21
17
|
form-tester test <url> --auto --pnr 12345 --persona ung-mann
|
|
18
|
+
|
|
19
|
+
# Human mode — prompts for persona, scenario, person selection:
|
|
20
|
+
form-tester test <url> --human
|
|
21
|
+
|
|
22
|
+
# Full interactive CLI:
|
|
23
|
+
form-tester
|
|
22
24
|
```
|
|
23
25
|
|
|
26
|
+
When the user asks for human/interactive mode, use `--human`. Otherwise default to `--auto`.
|
|
27
|
+
|
|
24
28
|
Commands:
|
|
25
29
|
```
|
|
26
30
|
/setup
|
|
@@ -43,8 +47,9 @@ Notes:
|
|
|
43
47
|
- Use the next-step checklist printed by the CLI (cookies, person selection, validation fix, Dokumenter verification, save HTML/PDF).
|
|
44
48
|
- If the error modal appears on save or submit ("Det skjedde en feil under innsending av skjema. Prøv igjen senere."), open DevTools -> Network before retrying. Then try resubmitting once. If it persists, find the failed request and capture the Correlation ID header in test_results.txt.
|
|
45
49
|
- Use `--help` or `-h` to print the command list without starting the prompt.
|
|
46
|
-
-
|
|
47
|
-
-
|
|
50
|
+
- IMPORTANT: Always use `form-tester exec` instead of `playwright-cli` directly. This records all commands for replay. Same syntax: `form-tester exec fill e1 "value"`, `form-tester exec click e3`, `form-tester exec close` (finalizes recording).
|
|
51
|
+
- Replay a previous run: `form-tester replay output/form-id/timestamp/recording.json`
|
|
52
|
+
- IMPORTANT: All screenshots taken during a test run MUST use `--full-page` to capture the entire page, not just the viewport. This applies to every screenshot command: `form-tester exec screenshot --filename "..." --full-page`
|
|
48
53
|
- IMPORTANT: Take a full-page screenshot EVERY TIME the page changes. This includes: after clicking any action button (Neste, Forrige, Send inn, etc.), after a step/page transition, after form validation errors appear, after modals open, and after submission. Name screenshots descriptively (e.g., step1_filled.png, step2_before_submit.png, submit_result.png).
|
|
49
54
|
|
|
50
55
|
Test flow (when /test is triggered):
|
|
@@ -65,7 +70,21 @@ Dokumenter verification (only when modal confirms storage):
|
|
|
65
70
|
2. The document list loads sorted newest first. The first entry should match the form title.
|
|
66
71
|
3. Click "Se detaljer" on the first document, then click "Åpne dokumentet".
|
|
67
72
|
4. IMPORTANT - document capture depends on format:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
|
|
74
|
+
PDF documents (shown in a PDF viewer/modal/iframe):
|
|
75
|
+
Do NOT screenshot PDFs. Instead, download the actual PDF file:
|
|
76
|
+
a. Take a snapshot to find the PDF viewer element: `form-tester exec snapshot`
|
|
77
|
+
b. Find the iframe or embed/object element that displays the PDF. Look for src attributes containing .pdf or blob: URLs.
|
|
78
|
+
c. Extract the PDF URL: `form-tester exec eval "document.querySelector('iframe')?.src || document.querySelector('embed')?.src || document.querySelector('object')?.data"`
|
|
79
|
+
d. If the URL is a blob: URL or direct PDF link, download it: `form-tester exec eval "async () => { const r = await fetch(document.querySelector('iframe')?.src); const b = await r.blob(); return URL.createObjectURL(b); }"`
|
|
80
|
+
e. Or use the download button if the PDF viewer has one — look for a download icon/button in the snapshot and click it.
|
|
81
|
+
f. Save the PDF: `form-tester exec pdf --filename "$OUTPUT_DIR/document.pdf"`
|
|
82
|
+
g. If all else fails, right-click save or use: `form-tester exec run-code "async page => { const frame = page.frameLocator('iframe').first(); /* extract content */ }"`
|
|
83
|
+
|
|
84
|
+
HTML documents (opens in a new tab or renders in page):
|
|
85
|
+
Take a FULL-PAGE screenshot of the ENTIRE document (`form-tester exec screenshot --filename "$OUTPUT_DIR/document_screenshot.png" --full-page`). HTML documents cannot be downloaded as files, so the full-page screenshot is the primary artifact. Also save the snapshot and raw HTML with:
|
|
86
|
+
`form-tester exec eval "document.documentElement.outerHTML"` and save to document.html.
|
|
87
|
+
|
|
88
|
+
XML/other formats: Note the document type in test_results.txt and skip capture.
|
|
89
|
+
|
|
71
90
|
5. Include the document verification results in test_results.txt (document title, whether it matched the form h1, document type: HTML/PDF/XML).
|
|
@@ -13,16 +13,21 @@ form-tester install
|
|
|
13
13
|
## Running the CLI
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
#
|
|
17
|
-
form-tester
|
|
18
|
-
|
|
19
|
-
# Non-interactive (best for AI agents)
|
|
16
|
+
# AI mode (default) — no prompts:
|
|
20
17
|
form-tester test <url> --auto
|
|
21
18
|
form-tester test <url> --auto --pnr 12345 --persona ung-mann --scenario "test validation"
|
|
19
|
+
|
|
20
|
+
# Human mode — prompts for persona, scenario, person selection:
|
|
21
|
+
form-tester test <url> --human
|
|
22
|
+
|
|
23
|
+
# Full interactive CLI:
|
|
24
|
+
form-tester
|
|
22
25
|
```
|
|
23
26
|
|
|
24
27
|
Persona IDs: `ung-mann`, `gravid-kvinne`, `eldre-kvinne`, `kronisk-syk-mann`. Defaults to "noen" if omitted.
|
|
25
28
|
|
|
29
|
+
When the user asks for `--human` mode, use that flag. Otherwise default to `--auto`.
|
|
30
|
+
|
|
26
31
|
## Commands
|
|
27
32
|
|
|
28
33
|
| Command | Description |
|
|
@@ -36,17 +41,22 @@ Persona IDs: `ung-mann`, `gravid-kvinne`, `eldre-kvinne`, `kronisk-syk-mann`. De
|
|
|
36
41
|
| `/clear` | Clear session |
|
|
37
42
|
| `/quit` | Exit CLI |
|
|
38
43
|
|
|
39
|
-
## Playwright CLI
|
|
44
|
+
## Playwright CLI (use via form-tester exec)
|
|
40
45
|
|
|
41
|
-
|
|
46
|
+
IMPORTANT: Always use `form-tester exec` instead of `playwright-cli` directly. This records all commands for replay.
|
|
42
47
|
|
|
43
48
|
```bash
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
form-tester exec open https://example.com
|
|
50
|
+
form-tester exec snapshot
|
|
51
|
+
form-tester exec fill e1 "value"
|
|
52
|
+
form-tester exec click e3
|
|
53
|
+
form-tester exec screenshot --filename=page.png --full-page
|
|
54
|
+
form-tester exec close # finalizes recording
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Replay a previous run:
|
|
58
|
+
```bash
|
|
59
|
+
form-tester replay output/form-id/timestamp/recording.json
|
|
50
60
|
```
|
|
51
61
|
|
|
52
62
|
## Test Flow
|
|
@@ -73,6 +83,12 @@ After submission, read the modal text:
|
|
|
73
83
|
- If it does NOT mention Dokumenter -> skip verification, note in test_results.txt.
|
|
74
84
|
|
|
75
85
|
Document capture depends on format:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
86
|
+
|
|
87
|
+
**PDF documents** (shown in PDF viewer/modal/iframe): Do NOT screenshot PDFs. Download the file instead:
|
|
88
|
+
1. Take a snapshot to find the PDF viewer: `form-tester exec snapshot`
|
|
89
|
+
2. Extract the PDF URL from the iframe/embed: `form-tester exec eval "document.querySelector('iframe')?.src || document.querySelector('embed')?.src || document.querySelector('object')?.data"`
|
|
90
|
+
3. Download via: `form-tester exec pdf --filename "$OUTPUT_DIR/document.pdf"` or click the download button in the PDF viewer if available.
|
|
91
|
+
|
|
92
|
+
**HTML documents**: take a full-page screenshot of the ENTIRE document (`form-tester exec screenshot --filename "..." --full-page`). Also save raw HTML with `form-tester exec eval "document.documentElement.outerHTML"`.
|
|
93
|
+
|
|
94
|
+
**XML/other**: note the type in test_results.txt and skip capture.
|
package/README.md
CHANGED
|
@@ -32,20 +32,41 @@ Edit `form-tester.config.json` and set your `pnr`.
|
|
|
32
32
|
|
|
33
33
|
## Usage
|
|
34
34
|
|
|
35
|
-
###
|
|
36
|
-
|
|
37
|
-
AI agents (Claude Code, Copilot) will use `--auto` mode by default. No prompts, just runs the test:
|
|
35
|
+
### Test modes
|
|
38
36
|
|
|
39
37
|
```bash
|
|
38
|
+
# AI mode (default) — no prompts, uses defaults:
|
|
40
39
|
form-tester test <url> --auto
|
|
41
40
|
form-tester test <url> --auto --pnr 12345 --persona ung-mann --scenario "test validation"
|
|
41
|
+
|
|
42
|
+
# Human mode — prompts for persona, scenario, person selection:
|
|
43
|
+
form-tester test <url> --human
|
|
44
|
+
|
|
45
|
+
# Full interactive CLI:
|
|
46
|
+
form-tester
|
|
42
47
|
```
|
|
43
48
|
|
|
44
49
|
Persona IDs: `ung-mann`, `gravid-kvinne`, `eldre-kvinne`, `kronisk-syk-mann`
|
|
45
50
|
|
|
51
|
+
### Recording & Replay
|
|
52
|
+
|
|
53
|
+
Every test run records all commands to `recording.json`. Use `form-tester exec` instead of `playwright-cli` to ensure all commands are recorded:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
form-tester exec fill e1 "value"
|
|
57
|
+
form-tester exec click e3
|
|
58
|
+
form-tester exec screenshot --filename "page.png" --full-page
|
|
59
|
+
form-tester exec close # finalizes recording
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Replay a previous run:
|
|
63
|
+
```bash
|
|
64
|
+
form-tester replay output/form-id/timestamp/recording.json
|
|
65
|
+
```
|
|
66
|
+
|
|
46
67
|
### Interactive CLI
|
|
47
68
|
|
|
48
|
-
|
|
69
|
+
Full interactive CLI with all commands:
|
|
49
70
|
|
|
50
71
|
```bash
|
|
51
72
|
form-tester
|
package/form-tester.js
CHANGED
|
@@ -6,7 +6,7 @@ const { spawn, execSync } = require("child_process");
|
|
|
6
6
|
|
|
7
7
|
const CONFIG_PATH = path.join(process.cwd(), "form-tester.config.json");
|
|
8
8
|
const OUTPUT_BASE = path.resolve(process.cwd(), "output");
|
|
9
|
-
const LOCAL_VERSION = "0.7.
|
|
9
|
+
const LOCAL_VERSION = "0.7.3";
|
|
10
10
|
const RECOMMENDED_PERSON = "Uromantisk Direktør";
|
|
11
11
|
|
|
12
12
|
// Recording — persisted to disk so `form-tester exec` can append across processes
|
package/package.json
CHANGED