form-tester 0.4.0 → 0.4.2

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.
@@ -1,13 +1,24 @@
1
1
  # Form Tester Skill Instructions
2
2
 
3
- Setup (run once):
3
+ Install (user runs once):
4
4
  ```
5
- npx form-tester install
5
+ npm install -g form-tester
6
+ ```
7
+
8
+ Install skill files:
9
+ ```
10
+ form-tester install
6
11
  ```
7
12
 
8
13
  Run the CLI:
9
14
  ```
10
- npx form-tester
15
+ form-tester
16
+ ```
17
+
18
+ Non-interactive mode (best for AI agents):
19
+ ```
20
+ form-tester test <url> --auto
21
+ form-tester test <url> --auto --pnr 12345 --persona ung-mann
11
22
  ```
12
23
 
13
24
  Commands:
@@ -23,7 +34,7 @@ Commands:
23
34
  ```
24
35
 
25
36
  Notes:
26
- - New users: place this skill under .claude/skills/form-tester/ in your repo, then run /skills to scan/reload (or /restart).
37
+ - New users: run `npm install -g form-tester` then `form-tester install` in your project.
27
38
  - Provide a full /skjemautfyller URL. If `pnr` is missing, the CLI will prompt.
28
39
  - The CLI opens the form with Playwright CLI, saves an initial snapshot + screenshot, and prints next-step commands.
29
40
  - Use `/save {label}` to capture additional snapshots + screenshots into the same output folder.
@@ -56,4 +67,3 @@ Dokumenter verification (only when modal confirms storage):
56
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.
57
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.
58
69
  7. Include the document verification results in test_results.txt (document title, whether it matched the form h1, document type: HTML/PDF/XML).
59
-
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: form-tester
3
3
  description: Runs the form-tester CLI to test /skjemautfyller forms via Playwright CLI and exposes playwright-cli commands.
4
- allowed-tools: Bash(powershell:*), Bash(playwright-cli:*), Bash(npx form-tester:*)
4
+ allowed-tools: Bash(powershell:*), Bash(playwright-cli:*), Bash(form-tester:*)
5
5
  ---
6
6
 
7
7
  # Form Tester CLI
@@ -9,12 +9,19 @@ allowed-tools: Bash(powershell:*), Bash(playwright-cli:*), Bash(npx form-tester:
9
9
  ## Quick start
10
10
 
11
11
  ```bash
12
- npx form-tester install # one-time setup
13
- npx form-tester # interactive CLI
12
+ # One-time install (user runs this manually):
13
+ npm install -g form-tester
14
+
15
+ # Install skill files into project:
16
+ form-tester install
17
+ form-tester install --global # or install to ~/.claude/skills/
14
18
 
15
19
  # Non-interactive mode (no prompts, best for AI agents):
16
- npx form-tester test <url> --auto
17
- npx form-tester test <url> --auto --pnr 12345 --persona ung-mann --scenario "test validation"
20
+ form-tester test <url> --auto
21
+ form-tester test <url> --auto --pnr 12345 --persona ung-mann --scenario "test validation"
22
+
23
+ # Interactive CLI:
24
+ form-tester
18
25
  ```
19
26
 
20
27
  Persona IDs: `ung-mann`, `gravid-kvinne`, `eldre-kvinne`, `kronisk-syk-mann`. Defaults to "noen" (neutral answers) if omitted.
@@ -43,4 +50,3 @@ Use `/people` to rescan the visible person list and get a numbered selection pro
43
50
  ## Playwright CLI
44
51
 
45
52
  You can also run `playwright-cli` commands directly when needed.
46
-
@@ -1,23 +1,28 @@
1
1
  # Form Tester — Copilot Instructions
2
2
 
3
- You have access to a form-testing CLI tool (`form-tester.js`) that automates testing of /skjemautfyller forms using Playwright CLI.
3
+ You have access to a form-testing CLI tool (`form-tester`) that automates testing of /skjemautfyller forms using Playwright CLI.
4
4
 
5
5
  ## Setup
6
6
 
7
+ User must install globally first:
7
8
  ```bash
8
- npx form-tester install
9
+ npm install -g form-tester
10
+ form-tester install
9
11
  ```
10
12
 
11
13
  ## Running the CLI
12
14
 
13
15
  ```bash
14
- # macOS/Linux
15
- node form-tester.js
16
+ # Interactive
17
+ form-tester
16
18
 
17
- # Windows (PowerShell)
18
- node .\form-tester.js
19
+ # Non-interactive (best for AI agents)
20
+ form-tester test <url> --auto
21
+ form-tester test <url> --auto --pnr 12345 --persona ung-mann --scenario "test validation"
19
22
  ```
20
23
 
24
+ Persona IDs: `ung-mann`, `gravid-kvinne`, `eldre-kvinne`, `kronisk-syk-mann`. Defaults to "noen" if omitted.
25
+
21
26
  ## Commands
22
27
 
23
28
  | Command | Description |
@@ -58,10 +63,10 @@ When `/test` is triggered:
58
63
  - Provide a full /skjemautfyller URL. If `pnr` is missing, the CLI will prompt.
59
64
  - All screenshots MUST use `--full-page` to capture the entire page.
60
65
  - Use `/save {label}` to capture additional snapshots into the output folder.
61
- - If an error modal appears on submit, open DevTools Network, retry once, and capture the Correlation ID header.
66
+ - If an error modal appears on submit, open DevTools -> Network, retry once, and capture the Correlation ID header.
62
67
 
63
68
  ## Post-Submit Verification
64
69
 
65
70
  After submission, read the modal text:
66
- - If it mentions Dokumenter storage navigate to `/dokumenter?pnr={PNR}`, verify the document appears, and capture it (screenshot for HTML, download for PDF).
67
- - If it does NOT mention Dokumenter skip verification, note in test_results.txt.
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 does NOT mention Dokumenter -> skip verification, note in test_results.txt.
package/README.md CHANGED
@@ -2,23 +2,25 @@
2
2
 
3
3
  AI-powered testing skill for `/skjemautfyller` forms using [Playwright CLI](https://www.npmjs.com/package/@playwright/cli). Works with **Claude Code** and **GitHub Copilot**.
4
4
 
5
- ## Quick Install
5
+ ## Install
6
6
 
7
7
  ```bash
8
- npx form-tester install
8
+ npm install -g form-tester
9
9
  ```
10
10
 
11
- This installs skill files into your project:
11
+ Then in your project:
12
+
13
+ ```bash
14
+ form-tester install # project-level (commits to repo)
15
+ form-tester install --global # personal (~/.claude/skills/)
16
+ ```
17
+
18
+ This installs:
12
19
  - `.claude/skills/form-tester/` — Claude Code skill
13
20
  - `.claude/skills/playwright-cli/` — Playwright CLI skill
14
21
  - `.github/copilot-instructions.md` — GitHub Copilot instructions
15
22
  - `form-tester.config.example.json` — Config template
16
-
17
- ## Prerequisites
18
-
19
- - Node.js 18+
20
-
21
- Playwright CLI is included as a dependency — no separate install needed.
23
+ - `playwright-cli` globally (if not already installed)
22
24
 
23
25
  ## Configuration
24
26
 
@@ -30,27 +32,30 @@ Edit `form-tester.config.json` and set your `pnr`.
30
32
 
31
33
  ## Usage
32
34
 
33
- ### Claude Code
34
-
35
- The skill is automatically detected when you open the project in Claude Code. Use the `/form-tester` skill or run:
35
+ ### Non-interactive (recommended for AI agents)
36
36
 
37
37
  ```bash
38
- npx form-tester
38
+ form-tester test <url> --auto
39
+ form-tester test <url> --auto --pnr 12345 --persona ung-mann --scenario "test validation"
39
40
  ```
40
41
 
41
- ### GitHub Copilot
42
-
43
- Copilot reads instructions from `.github/copilot-instructions.md` automatically. Open the project in VS Code with Copilot enabled.
42
+ Persona IDs: `ung-mann`, `gravid-kvinne`, `eldre-kvinne`, `kronisk-syk-mann`
44
43
 
45
- ### Standalone CLI
44
+ ### Interactive CLI
46
45
 
47
46
  ```bash
48
- npx form-tester
47
+ form-tester
49
48
  ```
50
49
 
51
50
  Commands: `/setup`, `/update`, `/version`, `/people`, `/test {url}`, `/save {label}`, `/clear`, `/quit`
52
51
 
53
- Use `--help` for the full command list.
52
+ ### Claude Code
53
+
54
+ The skill is automatically detected when you open the project. Use the `/form-tester` skill.
55
+
56
+ ### GitHub Copilot
57
+
58
+ Copilot reads instructions from `.github/copilot-instructions.md` automatically.
54
59
 
55
60
  ## Test Output
56
61
 
@@ -59,6 +64,12 @@ Test runs are saved to `output/{form-id}/{timestamp}/` with:
59
64
  - Screenshots (PNG, full-page)
60
65
  - `test_results.txt`
61
66
 
67
+ ## Update
68
+
69
+ ```bash
70
+ npm update -g form-tester
71
+ ```
72
+
62
73
  ## Development
63
74
 
64
75
  ```bash
package/form-tester.js CHANGED
@@ -4,9 +4,9 @@ const path = require("path");
4
4
  const readline = require("readline");
5
5
  const { spawn, execSync } = require("child_process");
6
6
 
7
- const CONFIG_PATH = path.join(__dirname, "form-tester.config.json");
8
- const OUTPUT_BASE = path.resolve(__dirname, "output");
9
- const LOCAL_VERSION = "0.4.0";
7
+ const CONFIG_PATH = path.join(process.cwd(), "form-tester.config.json");
8
+ const OUTPUT_BASE = path.resolve(process.cwd(), "output");
9
+ const LOCAL_VERSION = "0.4.2";
10
10
  const RECOMMENDED_PERSON = "Uromantisk Direktør";
11
11
 
12
12
  const PERSONAS = [
@@ -1093,7 +1093,7 @@ function install(targetDir, isGlobal) {
1093
1093
  console.log("\nDone! Next steps:");
1094
1094
  console.log(" 1. cp form-tester.config.example.json form-tester.config.json");
1095
1095
  console.log(' 2. Edit form-tester.config.json and set your "pnr"');
1096
- console.log(" 3. Run: npx form-tester");
1096
+ console.log(" 3. Run: form-tester");
1097
1097
  }
1098
1098
 
1099
1099
  async function main() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "form-tester",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
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": {