form-tester 0.8.0 → 0.8.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.
@@ -16,14 +16,23 @@ Test modes:
16
16
  form-tester test <url> --auto
17
17
  form-tester test <url> --auto --pnr 12345 --persona ung-mann
18
18
 
19
- # Human mode — prompts for persona, scenario, person selection:
19
+ # Human mode — user chooses persona and scenario:
20
+ # Step 1: Run without flags to see available personas:
20
21
  form-tester test <url> --human
22
+ # Step 2: Ask the user which persona and scenario they want.
23
+ # Step 3: Re-run with their choices:
24
+ form-tester test <url> --human --persona ung-mann --scenario "test validation"
21
25
 
22
26
  # Full interactive CLI:
23
27
  form-tester
24
28
  ```
25
29
 
26
- When the user asks for human/interactive mode, use `--human`. Otherwise default to `--auto`.
30
+ When the user asks for human/interactive mode, use `--human`:
31
+ 1. First run `form-tester test <url> --human` (no flags) to get the persona list.
32
+ 2. Show the personas to the user and ask them to choose.
33
+ 3. Ask the user for a test scenario (or use "" for standard).
34
+ 4. Re-run with their choices: `form-tester test <url> --human --persona <id> --scenario "<text>"`
35
+ Otherwise default to `--auto`.
27
36
 
28
37
  Commands:
29
38
  ```
@@ -20,8 +20,9 @@ form-tester install --global # or install to ~/.claude/skills/
20
20
  form-tester test <url> --auto
21
21
  form-tester test <url> --auto --pnr 12345 --persona ung-mann --scenario "test validation"
22
22
 
23
- # Interactive mode (prompts for persona, scenario, etc.):
24
- form-tester test <url> --human
23
+ # Human mode (user picks persona and scenario):
24
+ form-tester test <url> --human # lists personas, ask user
25
+ form-tester test <url> --human --persona ung-mann --scenario "test X" # run with user's choices
25
26
 
26
27
  # Full interactive CLI:
27
28
  form-tester
@@ -17,8 +17,9 @@ form-tester install
17
17
  form-tester test <url> --auto
18
18
  form-tester test <url> --auto --pnr 12345 --persona ung-mann --scenario "test validation"
19
19
 
20
- # Human mode — prompts for persona, scenario, person selection:
21
- form-tester test <url> --human
20
+ # Human mode — user chooses persona and scenario:
21
+ form-tester test <url> --human # lists personas
22
+ form-tester test <url> --human --persona ung-mann --scenario "test X" # run with choices
22
23
 
23
24
  # Full interactive CLI:
24
25
  form-tester
@@ -26,7 +27,11 @@ form-tester
26
27
 
27
28
  Persona IDs: `ung-mann`, `gravid-kvinne`, `eldre-kvinne`, `kronisk-syk-mann`. Defaults to "noen" if omitted.
28
29
 
29
- When the user asks for `--human` mode, use that flag. Otherwise default to `--auto`.
30
+ When the user asks for `--human` mode:
31
+ 1. Run `form-tester test <url> --human` to get persona list.
32
+ 2. Ask the user to pick a persona and scenario.
33
+ 3. Re-run: `form-tester test <url> --human --persona <id> --scenario "<text>"` (use `""` for standard test).
34
+ Otherwise default to `--auto`.
30
35
 
31
36
  ## Commands
32
37
 
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.8.0";
9
+ const LOCAL_VERSION = "0.8.2";
10
10
  const RECOMMENDED_PERSON = "Uromantisk Direktør";
11
11
 
12
12
  // Recording — persisted to disk so `form-tester exec` can append across processes
@@ -466,18 +466,26 @@ function clearConsole() {
466
466
  function printHelp() {
467
467
  console.log(
468
468
  [
469
- "Commands:",
470
- " /setup Install Playwright CLI + skills if missing",
471
- " /update Update repo (if git), Playwright CLI, and skills",
472
- " /version Show local skill version",
469
+ "",
470
+ "Subcommands (run directly):",
471
+ " form-tester install [--global] Install skill files into project or ~/.claude/skills/",
472
+ " form-tester test <url> --auto Non-interactive test (for AI agents)",
473
+ " form-tester test <url> --human Interactive test with prompts",
474
+ " form-tester exec <command> [args] Run playwright-cli command (recorded)",
475
+ " form-tester replay <recording.json> Replay a recorded test run",
476
+ "",
477
+ "Interactive commands:",
478
+ " /test {url} Open form URL and start test",
479
+ " /save {label} Save snapshot + screenshot to output folder",
473
480
  " /people Scan visible person list and prompt selection",
474
481
  " /persona List available personas",
475
- " /test {url} Open form URL with Playwright CLI and save initial artifacts",
476
- " /save {label} Save snapshot + screenshot to last output folder",
482
+ " /recording Show active recording status",
483
+ " /setup Install Playwright CLI + skills if missing",
484
+ " /update Update Playwright CLI and skills",
485
+ " /version Show version",
477
486
  " /clear Clear the console",
478
487
  " /help Show this help",
479
- " /exit Exit the app",
480
- " /quit Exit the app",
488
+ " /quit Exit",
481
489
  ].join("\n"),
482
490
  );
483
491
  }
@@ -1137,6 +1145,18 @@ async function handleCommand(line, config) {
1137
1145
  await saveArtifacts(config, label);
1138
1146
  break;
1139
1147
  }
1148
+ case "/recording": {
1149
+ const rec = config.activeRecording;
1150
+ if (rec && fs.existsSync(rec)) {
1151
+ const data = JSON.parse(fs.readFileSync(rec, "utf8"));
1152
+ console.log(`Active recording: ${rec}`);
1153
+ console.log(`Commands recorded: ${data.commandCount}`);
1154
+ console.log(`Started: ${data.startedAt}`);
1155
+ } else {
1156
+ console.log("No active recording. Start a test with /test to begin recording.");
1157
+ }
1158
+ break;
1159
+ }
1140
1160
  case "/clear":
1141
1161
  case "/cls":
1142
1162
  clearConsole();
@@ -1301,10 +1321,31 @@ async function main() {
1301
1321
  const config = loadConfig();
1302
1322
  const url = args.find((a) => a.startsWith("http"));
1303
1323
  if (!url) {
1304
- console.error("Usage: form-tester test <url> --human");
1324
+ console.error("Usage: form-tester test <url> --human --persona <id> --scenario \"<text>\"");
1305
1325
  process.exit(1);
1306
1326
  }
1307
- await handleTest(url, config);
1327
+ const flagVal = (flag) => args.includes(flag) ? args[args.indexOf(flag) + 1] : undefined;
1328
+ const personaFlag = flagVal("--persona");
1329
+ const scenarioFlag = flagVal("--scenario");
1330
+
1331
+ // If persona or scenario missing, print choices and exit so the AI can ask the user
1332
+ if (!personaFlag || scenarioFlag === undefined) {
1333
+ console.log("HUMAN MODE: Ask the user to choose persona and scenario, then re-run with flags.\n");
1334
+ console.log("Available personas:");
1335
+ console.log(formatPersonaList());
1336
+ console.log("\nPersona IDs: ung-mann, gravid-kvinne, eldre-kvinne, kronisk-syk-mann, noen");
1337
+ console.log("\nRe-run with: form-tester test <url> --human --persona <id> --scenario \"<description>\"");
1338
+ console.log("Use --scenario \"\" for standard test.");
1339
+ process.exit(0);
1340
+ }
1341
+
1342
+ // Run with user's choices
1343
+ await handleTestAuto(url, config, {
1344
+ pnr: flagVal("--pnr"),
1345
+ persona: personaFlag,
1346
+ scenario: scenarioFlag || undefined,
1347
+ verbosity: "normal",
1348
+ });
1308
1349
  process.exit(0);
1309
1350
  }
1310
1351
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "form-tester",
3
- "version": "0.8.0",
3
+ "version": "0.8.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": {