form-tester 0.10.1 → 0.10.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,3 +1,5 @@
1
1
  {
2
- "pnr": "YOUR_PNR_HERE"
2
+ "pnr": "YOUR_PNR_HERE",
3
+ "person": "",
4
+ "baseUrl": ""
3
5
  }
package/form-tester.js CHANGED
@@ -7,7 +7,7 @@ const { spawn, execSync } = require("child_process");
7
7
  const CONFIG_PATH = path.join(process.cwd(), "form-tester.config.json");
8
8
  const OUTPUT_BASE = path.resolve(process.cwd(), "output");
9
9
  const ISSUES_PATH = path.join(OUTPUT_BASE, "issues.jsonl");
10
- const LOCAL_VERSION = "0.10.1";
10
+ const LOCAL_VERSION = "0.10.2";
11
11
  const RECOMMENDED_PERSON = "Uromantisk Direktør";
12
12
 
13
13
  // Recording — persisted to disk so `form-tester exec` can append across processes
@@ -300,6 +300,12 @@ async function handleSelectPerson(config, targetName) {
300
300
  const v = "normal";
301
301
  const log = (msg) => console.log(msg);
302
302
 
303
+ // Use config.person as default if no target specified
304
+ if (!targetName && config.person) {
305
+ targetName = config.person;
306
+ log(`Using configured person: ${targetName}`);
307
+ }
308
+
303
309
  // Step 1: Try to find person list from current page snapshot
304
310
  const tmpSnapshot = path.join(
305
311
  config.lastRunDir || OUTPUT_BASE,
@@ -651,6 +657,8 @@ async function promptPersona(config) {
651
657
  }
652
658
  const DEFAULT_CONFIG = {
653
659
  pnr: "",
660
+ person: "",
661
+ baseUrl: "",
654
662
  dokumenterUrlTemplate: "/dokumenter?pnr={PNR}",
655
663
  lastTestUrl: "",
656
664
  lastRunDir: "",
@@ -673,11 +681,17 @@ function saveConfig(config) {
673
681
 
674
682
  function resolveDokumenterUrl(config) {
675
683
  if (!config.dokumenterUrlTemplate) return "";
676
- if (config.dokumenterUrlTemplate.includes("{PNR}")) {
684
+ let url = config.dokumenterUrlTemplate;
685
+ if (url.includes("{PNR}")) {
677
686
  if (!config.pnr) return "";
678
- return config.dokumenterUrlTemplate.replace("{PNR}", config.pnr);
687
+ url = url.replace("{PNR}", config.pnr);
688
+ }
689
+ // If the URL is a relative path, prepend the base URL
690
+ if (url.startsWith("/")) {
691
+ const base = config.baseUrl || (config.lastTestUrl ? (() => { try { return new URL(config.lastTestUrl).origin; } catch (e) { return ""; } })() : "");
692
+ if (base) url = `${base}${url}`;
679
693
  }
680
- return config.dokumenterUrlTemplate;
694
+ return url;
681
695
  }
682
696
 
683
697
  function extractPnrFromUrl(url) {
@@ -1346,6 +1360,7 @@ async function handleTest(url, config) {
1346
1360
 
1347
1361
  config.lastTestUrl = updated.url;
1348
1362
  config.lastRunDir = outputDir;
1363
+ try { config.baseUrl = new URL(updated.url).origin; } catch (e) {}
1349
1364
  saveConfig(config);
1350
1365
 
1351
1366
  // Start recording and persist path to config for `exec`
@@ -1463,6 +1478,7 @@ async function handleTestAuto(url, config, flags) {
1463
1478
 
1464
1479
  config.lastTestUrl = fullUrl;
1465
1480
  config.lastRunDir = outputDir;
1481
+ try { config.baseUrl = new URL(fullUrl).origin; } catch (e) {}
1466
1482
  saveConfig(config);
1467
1483
 
1468
1484
  // Start recording and persist path to config for `exec`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "form-tester",
3
- "version": "0.10.1",
3
+ "version": "0.10.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": {