form-tester 0.4.2 → 0.4.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.
- package/README.md +15 -3
- package/form-tester.js +18 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,7 +32,9 @@ Edit `form-tester.config.json` and set your `pnr`.
|
|
|
32
32
|
|
|
33
33
|
## Usage
|
|
34
34
|
|
|
35
|
-
###
|
|
35
|
+
### Default: non-interactive (`--auto`)
|
|
36
|
+
|
|
37
|
+
AI agents (Claude Code, Copilot) will use `--auto` mode by default. No prompts, just runs the test:
|
|
36
38
|
|
|
37
39
|
```bash
|
|
38
40
|
form-tester test <url> --auto
|
|
@@ -43,6 +45,8 @@ Persona IDs: `ung-mann`, `gravid-kvinne`, `eldre-kvinne`, `kronisk-syk-mann`
|
|
|
43
45
|
|
|
44
46
|
### Interactive CLI
|
|
45
47
|
|
|
48
|
+
For manual use without an AI agent:
|
|
49
|
+
|
|
46
50
|
```bash
|
|
47
51
|
form-tester
|
|
48
52
|
```
|
|
@@ -51,11 +55,19 @@ Commands: `/setup`, `/update`, `/version`, `/people`, `/test {url}`, `/save {lab
|
|
|
51
55
|
|
|
52
56
|
### Claude Code
|
|
53
57
|
|
|
54
|
-
|
|
58
|
+
After `form-tester install`, the skill is automatically detected. Use the `/form-tester` skill or just ask Claude to test a form.
|
|
59
|
+
|
|
60
|
+
If the skill isn't showing up:
|
|
61
|
+
1. Make sure `.claude/skills/form-tester/` exists in your project (run `form-tester install`)
|
|
62
|
+
2. Restart Claude Code or start a new conversation
|
|
55
63
|
|
|
56
64
|
### GitHub Copilot
|
|
57
65
|
|
|
58
|
-
Copilot reads
|
|
66
|
+
After `form-tester install`, Copilot reads `.github/copilot-instructions.md` and `.claude/skills/` automatically.
|
|
67
|
+
|
|
68
|
+
If Copilot doesn't recognize the skill:
|
|
69
|
+
1. Make sure `.claude/skills/form-tester/` exists in your project (run `form-tester install`)
|
|
70
|
+
2. Run `/skills` in the Copilot CLI to reload skills, or restart the session
|
|
59
71
|
|
|
60
72
|
## Test Output
|
|
61
73
|
|
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.4.
|
|
9
|
+
const LOCAL_VERSION = "0.4.3";
|
|
10
10
|
const RECOMMENDED_PERSON = "Uromantisk Direktør";
|
|
11
11
|
|
|
12
12
|
const PERSONAS = [
|
|
@@ -430,7 +430,7 @@ function printNextSteps(outputDir, dokumenterUrl) {
|
|
|
430
430
|
);
|
|
431
431
|
console.log(`- Or use: /save step`);
|
|
432
432
|
console.log(
|
|
433
|
-
`- Screenshot before submit: playwright-cli screenshot --filename "${path.join(outputDir, "before_submit.png")}"`,
|
|
433
|
+
`- Screenshot before submit: playwright-cli screenshot --filename "${path.join(outputDir, "before_submit.png")}" --full-page`,
|
|
434
434
|
);
|
|
435
435
|
console.log("- Submit only when validation errors are cleared.");
|
|
436
436
|
console.log(
|
|
@@ -702,8 +702,8 @@ async function saveArtifacts(config, label) {
|
|
|
702
702
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
703
703
|
const base = path.join(config.lastRunDir, `${safeLabel}_${timestamp}`);
|
|
704
704
|
await runPlaywrightCli(["snapshot", "--filename", `${base}.yml`]);
|
|
705
|
-
await runPlaywrightCli(["screenshot", "--filename", `${base}.png
|
|
706
|
-
console.log(`Saved: ${base}.yml and ${base}.png`);
|
|
705
|
+
await runPlaywrightCli(["screenshot", "--filename", `${base}.png`, "--full-page"]);
|
|
706
|
+
console.log(`Saved: ${base}.yml and ${base}.png (full-page)`);
|
|
707
707
|
}
|
|
708
708
|
|
|
709
709
|
async function handleSetup() {
|
|
@@ -862,6 +862,7 @@ async function handleTest(url, config) {
|
|
|
862
862
|
"screenshot",
|
|
863
863
|
"--filename",
|
|
864
864
|
path.join(outputDir, "page_open.png"),
|
|
865
|
+
"--full-page",
|
|
865
866
|
]);
|
|
866
867
|
|
|
867
868
|
await promptPersonSelection(config);
|
|
@@ -932,11 +933,12 @@ async function handleTestAuto(url, config, flags) {
|
|
|
932
933
|
}
|
|
933
934
|
fs.writeFileSync(path.join(outputDir, "scenario.json"), JSON.stringify(scenarioChoice, null, 2));
|
|
934
935
|
|
|
935
|
-
// Open and
|
|
936
|
+
// Open and take initial full-page screenshot
|
|
936
937
|
console.log("Opening form with Playwright CLI...");
|
|
937
938
|
await runPlaywrightCli(["open", fullUrl]);
|
|
938
939
|
await runPlaywrightCli(["snapshot", "--filename", path.join(outputDir, "page_open.yml")]);
|
|
939
|
-
await runPlaywrightCli(["screenshot", "--filename", path.join(outputDir, "page_open.png")]);
|
|
940
|
+
await runPlaywrightCli(["screenshot", "--filename", path.join(outputDir, "page_open.png"), "--full-page"]);
|
|
941
|
+
console.log("Saved: page_open.yml + page_open.png (full-page)");
|
|
940
942
|
|
|
941
943
|
// Auto-select person (try recommended, then first available)
|
|
942
944
|
let options = extractPersonsFromSnapshotFile(path.join(outputDir, "page_open.yml"));
|
|
@@ -955,11 +957,20 @@ async function handleTestAuto(url, config, flags) {
|
|
|
955
957
|
saveConfig(config);
|
|
956
958
|
}
|
|
957
959
|
|
|
960
|
+
// Take form loaded screenshot after person selection
|
|
961
|
+
await runPlaywrightCli(["snapshot", "--filename", path.join(outputDir, "form_loaded.yml")]);
|
|
962
|
+
await runPlaywrightCli(["screenshot", "--filename", path.join(outputDir, "form_loaded.png"), "--full-page"]);
|
|
963
|
+
console.log("Saved: form_loaded.yml + form_loaded.png (full-page)");
|
|
964
|
+
|
|
958
965
|
const dokumenterUrl = resolveDokumenterUrl(config);
|
|
959
|
-
console.log(
|
|
966
|
+
console.log(`\nOutput folder: ${outputDir}`);
|
|
960
967
|
if (dokumenterUrl) {
|
|
961
968
|
console.log(`Dokumenter URL: ${dokumenterUrl}`);
|
|
962
969
|
}
|
|
970
|
+
console.log("");
|
|
971
|
+
console.log("IMPORTANT: All screenshots MUST use --full-page to capture the entire page.");
|
|
972
|
+
console.log("Example: playwright-cli screenshot --filename \"path/to/file.png\" --full-page");
|
|
973
|
+
console.log("");
|
|
963
974
|
printNextSteps(outputDir, dokumenterUrl || "/dokumenter?pnr={PNR}");
|
|
964
975
|
}
|
|
965
976
|
|
package/package.json
CHANGED