form-tester 0.11.1 → 0.11.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.
@@ -153,7 +153,7 @@ Step 9 — Dokumenter verification (only when modal confirms storage):
153
153
  ```
154
154
  form-tester documents
155
155
  ```
156
- This handles the full flow: navigate to Dokumenter, find latest doc, detect format, download PDF or screenshot HTML.
156
+ This handles the full flow: navigate to Dokumenter, select person if needed, find latest doc, detect format, download PDF or screenshot HTML.
157
157
 
158
158
  If `form-tester documents` fails (logged as issues), fall back to manual steps:
159
159
  1. Navigate to `/dokumenter?pnr={PNR}` and select the same person.
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.11.1";
10
+ const LOCAL_VERSION = "0.11.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
@@ -167,13 +167,26 @@ async function handleDocuments(config, flags = {}) {
167
167
  }
168
168
  await sleep(2000);
169
169
 
170
- // Step 2: Take snapshot of document list
170
+ // Step 2: Check if person selection is needed (same page as form)
171
+ const checkSnapshot = path.join(outputDir, "dokumenter_check.yml");
172
+ await runPlaywrightCli(["snapshot", "--filename", checkSnapshot]);
173
+ if (fs.existsSync(checkSnapshot)) {
174
+ const checkText = fs.readFileSync(checkSnapshot, "utf8");
175
+ if (checkText.includes("Hvem vil du bruke Helsenorge") || checkText.includes("personliste")) {
176
+ log("Person selection detected on Dokumenter page. Selecting person...");
177
+ await handleSelectPerson(config, config.lastPerson || config.person || null);
178
+ await sleep(2000);
179
+ }
180
+ try { fs.unlinkSync(checkSnapshot); } catch (e) {}
181
+ }
182
+
183
+ // Step 3: Take snapshot of document list
171
184
  const docListSnapshot = path.join(outputDir, "dokumenter.yml");
172
185
  await runPlaywrightCli(["snapshot", "--filename", docListSnapshot]);
173
186
  await runPlaywrightCli(["screenshot", "--filename", path.join(outputDir, "dokumenter.png"), "--full-page"]);
174
187
  log("Saved: dokumenter.yml + dokumenter.png");
175
188
 
176
- // Step 3: Click first document's "Se detaljer"
189
+ // Step 4: Click first document's "Se detaljer"
177
190
  log("Looking for first document...");
178
191
  const clickResult = await runPlaywrightCliCapture(["eval", '() => { const link = document.querySelector("a[href*=\\"detaljer\\"], button:has-text(\\"Se detaljer\\"), a:has-text(\\"Se detaljer\\")"); if (link) { link.click(); return "clicked"; } return "not-found"; }']);
179
192
  if (clickResult.stdout.includes("not-found")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "form-tester",
3
- "version": "0.11.1",
3
+ "version": "0.11.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": {