form-tester 0.9.0 → 0.9.1
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.
|
@@ -76,6 +76,39 @@ IMPORTANT: Each prompt below MUST be asked as a separate message to the user. Wa
|
|
|
76
76
|
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.
|
|
77
77
|
4. Only after receiving answers to all prompts: open browser, fill form, submit, verify.
|
|
78
78
|
|
|
79
|
+
Form filling strategy:
|
|
80
|
+
Before filling any fields, take a snapshot and study the FULL form structure:
|
|
81
|
+
1. Identify ALL sections, including collapsed/accordion sections (buttons with arrow icons).
|
|
82
|
+
2. Expand ALL collapsed sections FIRST by clicking their header buttons. Take a new snapshot after expanding.
|
|
83
|
+
3. Identify ALL required fields across all sections before starting to fill.
|
|
84
|
+
4. Fill fields section by section, top to bottom.
|
|
85
|
+
|
|
86
|
+
Autosuggest / search fields (e.g. "Søk opp et legemiddel"):
|
|
87
|
+
These fields show a dropdown with suggestions as you type. Do NOT use `fill` + `Enter` — the value won't commit.
|
|
88
|
+
Instead:
|
|
89
|
+
```
|
|
90
|
+
form-tester exec fill <ref> "search text"
|
|
91
|
+
```
|
|
92
|
+
Then wait for the dropdown to appear and take a snapshot to find the suggestion element:
|
|
93
|
+
```
|
|
94
|
+
form-tester exec snapshot
|
|
95
|
+
```
|
|
96
|
+
Then click the correct suggestion from the dropdown list. If no dropdown appears, try:
|
|
97
|
+
```
|
|
98
|
+
form-tester exec run-code "async page => { const input = page.locator('#fieldId'); await input.fill('search text'); await page.waitForTimeout(1000); const option = page.locator('[role=\"option\"]').first(); await option.click(); }"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Handling validation errors after submit:
|
|
102
|
+
CRITICAL RULES — follow these exactly:
|
|
103
|
+
1. MAXIMUM 3 submit attempts. If validation errors persist after 3 attempts, STOP. Log the remaining errors with `form-tester issue validation "..."` and note them in test_results.txt. Do NOT keep retrying.
|
|
104
|
+
2. After each failed submit, take a snapshot and READ the validation error list carefully.
|
|
105
|
+
3. Each validation error is a clickable link with an href like `#fieldId`. Click the error link to scroll to and focus the unfilled field. This is the ONLY reliable way to find the field.
|
|
106
|
+
4. After clicking the error link, take a snapshot to see the field in context and fill it.
|
|
107
|
+
5. Do NOT re-fill fields that are already filled. Only fix the fields listed in the validation errors.
|
|
108
|
+
6. Do NOT use JavaScript `dispatchEvent` hacks or `element.evaluate()` to set values — these bypass React's state and the form won't register the value. Always use Playwright's `fill`, `click`, `select` commands.
|
|
109
|
+
7. Before resubmitting, verify that the number of validation errors has decreased. If the same errors persist after you tried to fix them, the approach isn't working — try a different strategy (e.g., expand a collapsed section, use a different selector).
|
|
110
|
+
8. Some forms have accordion/collapsible sections. Validation errors inside collapsed sections cannot be filled until the section is expanded. Look for buttons near the error's field ID in the snapshot and click to expand.
|
|
111
|
+
|
|
79
112
|
Post-submit verification:
|
|
80
113
|
After a successful submission, read the modal text carefully:
|
|
81
114
|
- 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.
|
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.9.
|
|
10
|
+
const LOCAL_VERSION = "0.9.1";
|
|
11
11
|
const RECOMMENDED_PERSON = "Uromantisk Direktør";
|
|
12
12
|
|
|
13
13
|
// Recording — persisted to disk so `form-tester exec` can append across processes
|
package/package.json
CHANGED