form-tester 0.3.1 → 0.3.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.
@@ -0,0 +1,59 @@
1
+ # Form Tester Skill Instructions
2
+
3
+ Setup (run once):
4
+ ```
5
+ npx form-tester install
6
+ ```
7
+
8
+ Run the CLI:
9
+ ```
10
+ npx form-tester
11
+ ```
12
+
13
+ Commands:
14
+ ```
15
+ /setup
16
+ /update
17
+ /version
18
+ /people
19
+ /test {url}
20
+ /save {label}
21
+ /clear
22
+ /quit
23
+ ```
24
+
25
+ Notes:
26
+ - New users: place this skill under .claude/skills/form-tester/ in your repo, then run /skills to scan/reload (or /restart).
27
+ - Provide a full /skjemautfyller URL. If `pnr` is missing, the CLI will prompt.
28
+ - The CLI opens the form with Playwright CLI, saves an initial snapshot + screenshot, and prints next-step commands.
29
+ - Use `/save {label}` to capture additional snapshots + screenshots into the same output folder.
30
+ - Use `/update` after changing the skill to update Playwright CLI + skills, then reload the skill in Copilot CLI with `/skills` (reload) or `/restart`.
31
+ - Use `/people` to rescan the visible person list and get a numbered selection prompt.
32
+ - Use the next-step checklist printed by the CLI (cookies, person selection, validation fix, Dokumenter verification, save HTML/PDF).
33
+ - 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.
34
+ - Use `--help` or `-h` to print the command list without starting the prompt.
35
+ - Playwright CLI commands are available from this skill when needed.
36
+ - 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`
37
+
38
+ Test flow (when /test is triggered):
39
+ 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.
40
+
41
+ 1. Prompt for PNR (if not in URL). Wait for response.
42
+ 2. Prompt for persona (1-6 selection). Show the numbered list and wait for the user's response.
43
+ 3. Prompt for test scenario in a NEW separate message. Ask: "Any specific test scenario? (describe what to test, or Enter for standard clean test)". Wait for the user's response. If the user says nothing specific or "default" or just presses Enter, use standard test. The scenario is saved to scenario.json in the output directory.
44
+ 4. Only after receiving answers to all prompts: open browser, fill form, submit, verify.
45
+
46
+ Post-submit verification:
47
+ After a successful submission, read the modal text carefully:
48
+ - If it says the form is stored in Dokumenter (e.g. "En kopi er også lagret i Dokumenter" or "Skjemaet er fullført og lagret i Dokumenter"), proceed with Dokumenter verification below.
49
+ - If the modal does NOT mention Dokumenter, or says the form will not be stored/you will not get a response, skip Dokumenter verification entirely. Record this in test_results.txt.
50
+
51
+ Dokumenter verification (only when modal confirms storage):
52
+ 1. Navigate to `/dokumenter?pnr={PNR}` and select the same person used during form fill.
53
+ 2. The document list loads sorted newest first. The first entry should match the form title.
54
+ 3. Click "Se detaljer" on the first document, then click "Åpne dokumentet".
55
+ 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.
56
+ 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
+ 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
+ 7. Include the document verification results in test_results.txt (document title, whether it matched the form h1, document type: HTML/PDF/XML).
59
+
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: form-tester
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:*)
5
+ ---
6
+
7
+ # Form Tester CLI
8
+
9
+ ## Quick start
10
+
11
+ ```bash
12
+ npx form-tester install # one-time setup
13
+ npx form-tester # run the CLI
14
+ ```
15
+
16
+ ## Commands
17
+
18
+ ```bash
19
+ /setup
20
+ /update
21
+ /version
22
+ /people
23
+ /test {url}
24
+ /save {label}
25
+ /clear
26
+ /quit
27
+ ```
28
+
29
+ The CLI expects a single form URL. If `pnr` is missing, it will prompt for it.
30
+
31
+ Use `--help` or `-h` to print the command list without starting the prompt.
32
+
33
+ Run `/update` when you change the skill to update Playwright CLI + skills, and then reload the skill in Copilot CLI with `/skills` (reload) or `/restart`.
34
+
35
+ Use `/people` to rescan the visible person list and get a numbered selection prompt.
36
+
37
+ ## Playwright CLI
38
+
39
+ You can also run `playwright-cli` commands directly when needed.
40
+
@@ -0,0 +1,67 @@
1
+ # Form Tester — Copilot Instructions
2
+
3
+ You have access to a form-testing CLI tool (`form-tester.js`) that automates testing of /skjemautfyller forms using Playwright CLI.
4
+
5
+ ## Setup
6
+
7
+ ```bash
8
+ npx form-tester install
9
+ ```
10
+
11
+ ## Running the CLI
12
+
13
+ ```bash
14
+ # macOS/Linux
15
+ node form-tester.js
16
+
17
+ # Windows (PowerShell)
18
+ node .\form-tester.js
19
+ ```
20
+
21
+ ## Commands
22
+
23
+ | Command | Description |
24
+ |---------|-------------|
25
+ | `/setup` | Initial setup |
26
+ | `/update` | Update Playwright CLI + skills |
27
+ | `/version` | Show version |
28
+ | `/people` | Rescan visible person list |
29
+ | `/test {url}` | Test a form URL |
30
+ | `/save {label}` | Save snapshot + screenshot |
31
+ | `/clear` | Clear session |
32
+ | `/quit` | Exit CLI |
33
+
34
+ ## Playwright CLI
35
+
36
+ You can also use `playwright-cli` commands directly for browser automation:
37
+
38
+ ```bash
39
+ playwright-cli open https://example.com
40
+ playwright-cli snapshot
41
+ playwright-cli fill e1 "value"
42
+ playwright-cli click e3
43
+ playwright-cli screenshot --filename=page.png --full-page
44
+ playwright-cli close
45
+ ```
46
+
47
+ ## Test Flow
48
+
49
+ When `/test` is triggered:
50
+
51
+ 1. Prompt for PNR if not in URL. Wait for response.
52
+ 2. Prompt for persona (numbered selection). Wait for response.
53
+ 3. Prompt for test scenario in a separate message. Wait for response.
54
+ 4. Only after all prompts answered: open browser, fill form, submit, verify.
55
+
56
+ ## Important Notes
57
+
58
+ - Provide a full /skjemautfyller URL. If `pnr` is missing, the CLI will prompt.
59
+ - All screenshots MUST use `--full-page` to capture the entire page.
60
+ - 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.
62
+
63
+ ## Post-Submit Verification
64
+
65
+ 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.
@@ -0,0 +1,25 @@
1
+ name: Publish to npm
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ push:
7
+ branches: [master]
8
+ paths:
9
+ - 'package.json'
10
+
11
+ jobs:
12
+ publish:
13
+ runs-on: ubuntu-latest
14
+ permissions:
15
+ contents: read
16
+ id-token: write
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - uses: actions/setup-node@v4
20
+ with:
21
+ node-version: 20
22
+ registry-url: https://registry.npmjs.org
23
+ - run: npm publish --provenance --access public
24
+ env:
25
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/form-tester.js CHANGED
@@ -6,7 +6,7 @@ const { spawn, execSync } = require("child_process");
6
6
 
7
7
  const CONFIG_PATH = path.join(__dirname, "form-tester.config.json");
8
8
  const OUTPUT_BASE = path.resolve(__dirname, "output");
9
- const LOCAL_VERSION = "0.3.1";
9
+ const LOCAL_VERSION = "0.3.2";
10
10
  const RECOMMENDED_PERSON = "Uromantisk Direktør";
11
11
 
12
12
  const PERSONAS = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "form-tester",
3
- "version": "0.3.1",
3
+ "version": "0.3.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": {