form-tester 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -45,6 +45,7 @@ Notes:
45
45
  - Use `--help` or `-h` to print the command list without starting the prompt.
46
46
  - Playwright CLI commands are available from this skill when needed.
47
47
  - 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: `playwright-cli screenshot --filename "..." --full-page`
48
+ - 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).
48
49
 
49
50
  Test flow (when /test is triggered):
50
51
  IMPORTANT: Each prompt below MUST be asked as a separate message to the user. Wait for the user's response before proceeding to the next step. Do NOT combine multiple prompts into one message.
@@ -63,7 +64,8 @@ Dokumenter verification (only when modal confirms storage):
63
64
  1. Navigate to `/dokumenter?pnr={PNR}` and select the same person used during form fill.
64
65
  2. The document list loads sorted newest first. The first entry should match the form title.
65
66
  3. Click "Se detaljer" on the first document, then click "Åpne dokumentet".
66
- 4. If the document opens in a new tab as HTML: switch to that tab, take a full-page screenshot (`--full-page`), save snapshot and raw HTML.
67
- 5. If the document opens as a PDF viewer: download the PDF instead of screenshotting. Use `playwright-cli pdf --filename "$OUTPUT_DIR/document.pdf"` or save it via the download.
68
- 6. If the document does NOT open (XML format, no new tab, or other): note the document type in test_results.txt and skip the screenshot/download.
69
- 7. Include the document verification results in test_results.txt (document title, whether it matched the form h1, document type: HTML/PDF/XML).
67
+ 4. IMPORTANT - document capture depends on format:
68
+ - PDF documents: DOWNLOAD the file. Use `playwright-cli pdf --filename "$OUTPUT_DIR/document.pdf"` or save via browser download. Do NOT screenshot PDFs.
69
+ - HTML documents: Take a FULL-PAGE screenshot of the ENTIRE document (`playwright-cli 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.
70
+ - XML/other formats: Note the document type in test_results.txt and skip capture.
71
+ 5. Include the document verification results in test_results.txt (document title, whether it matched the form h1, document type: HTML/PDF/XML).
@@ -62,11 +62,17 @@ When `/test` is triggered:
62
62
 
63
63
  - Provide a full /skjemautfyller URL. If `pnr` is missing, the CLI will prompt.
64
64
  - All screenshots MUST use `--full-page` to capture the entire page.
65
+ - Take a full-page screenshot EVERY TIME the page changes: after clicking action buttons (Neste, Forrige, Send inn), after step/page transitions, after validation errors, after modals, and after submission.
65
66
  - Use `/save {label}` to capture additional snapshots into the output folder.
66
67
  - If an error modal appears on submit, open DevTools -> Network, retry once, and capture the Correlation ID header.
67
68
 
68
69
  ## Post-Submit Verification
69
70
 
70
71
  After submission, read the modal text:
71
- - If it mentions Dokumenter storage -> navigate to `/dokumenter?pnr={PNR}`, verify the document appears, and capture it (screenshot for HTML, download for PDF).
72
+ - If it mentions Dokumenter storage -> navigate to `/dokumenter?pnr={PNR}`, verify the document appears.
72
73
  - If it does NOT mention Dokumenter -> skip verification, note in test_results.txt.
74
+
75
+ Document capture depends on format:
76
+ - **PDF documents**: download the file (`playwright-cli pdf --filename "..." `). Do NOT screenshot PDFs.
77
+ - **HTML documents**: take a full-page screenshot of the ENTIRE document (`playwright-cli screenshot --filename "..." --full-page`). HTML documents cannot be downloaded, so the screenshot is the primary artifact.
78
+ - **XML/other**: note the type in test_results.txt and skip capture.
package/README.md CHANGED
@@ -112,6 +112,13 @@ Test runs are saved to `output/{form-id}/{timestamp}/` with:
112
112
  - Screenshots (PNG, full-page)
113
113
  - `test_results.txt`
114
114
 
115
+ ### Dokumenter verification
116
+
117
+ After form submission, some forms store a copy in Dokumenter. The document type determines how to capture it:
118
+
119
+ - **PDF documents** — download the file directly (`playwright-cli pdf` or via browser download)
120
+ - **HTML documents** — take a full-page screenshot of the entire document (`playwright-cli screenshot --filename "..." --full-page`). HTML documents cannot be downloaded as-is, so the screenshot is the primary artifact.
121
+
115
122
  ## Update
116
123
 
117
124
  ```bash
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.5.0";
9
+ const LOCAL_VERSION = "0.5.1";
10
10
  const RECOMMENDED_PERSON = "Uromantisk Direktør";
11
11
 
12
12
  const PERSONAS = [
@@ -884,10 +884,10 @@ async function handleTestAuto(url, config, flags) {
884
884
  const log = (msg) => { if (v !== "silent") console.log(msg); };
885
885
  const verbose = (msg) => { if (v === "verbose") console.log(msg); };
886
886
 
887
- // Resolve PNR
888
- const pnr = flags.pnr || config.pnr;
887
+ // Resolve PNR — check URL first, then flag, then config
888
+ const pnr = extractPnrFromUrl(url) || flags.pnr || config.pnr;
889
889
  if (!pnr) {
890
- console.error("No PNR available. Pass --pnr <value> or set it in form-tester.config.json");
890
+ console.error("No PNR available. Pass --pnr <value>, include pnr= in the URL, or set it in form-tester.config.json");
891
891
  process.exit(1);
892
892
  }
893
893
  const fullUrl = extractPnrFromUrl(url) ? url : setPnrOnUrl(url, pnr);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "form-tester",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "AI-powered form testing skill for /skjemautfyller forms using Playwright CLI. Works with Claude Code and GitHub Copilot.",
5
5
  "main": "form-tester.js",
6
6
  "bin": {