form-tester 0.2.3 → 0.3.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.
- package/README.md +17 -22
- package/form-tester.js +61 -2
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -2,30 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
AI-powered testing skill for `/skjemautfyller` forms using [Playwright CLI](https://www.npmjs.com/package/@playwright/cli). Works with **Claude Code** and **GitHub Copilot**.
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
- Node.js 18+
|
|
8
|
-
- [Playwright CLI](https://www.npmjs.com/package/@playwright/cli)
|
|
9
|
-
|
|
10
|
-
## Installation
|
|
11
|
-
|
|
12
|
-
### 1. Clone the repo
|
|
5
|
+
## Quick Install
|
|
13
6
|
|
|
14
7
|
```bash
|
|
15
|
-
|
|
16
|
-
cd form-tester
|
|
8
|
+
npx form-tester install
|
|
17
9
|
```
|
|
18
10
|
|
|
19
|
-
|
|
11
|
+
This installs skill files into your project:
|
|
12
|
+
- `.claude/skills/form-tester/` — Claude Code skill
|
|
13
|
+
- `.claude/skills/playwright-cli/` — Playwright CLI skill
|
|
14
|
+
- `.github/copilot-instructions.md` — GitHub Copilot instructions
|
|
15
|
+
- `form-tester.config.example.json` — Config template
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
```
|
|
17
|
+
## Prerequisites
|
|
18
|
+
|
|
19
|
+
- Node.js 18+
|
|
20
|
+
|
|
21
|
+
Playwright CLI is included as a dependency — no separate install needed.
|
|
27
22
|
|
|
28
|
-
|
|
23
|
+
## Configuration
|
|
29
24
|
|
|
30
25
|
```bash
|
|
31
26
|
cp form-tester.config.example.json form-tester.config.json
|
|
@@ -37,20 +32,20 @@ Edit `form-tester.config.json` and set your `pnr`.
|
|
|
37
32
|
|
|
38
33
|
### Claude Code
|
|
39
34
|
|
|
40
|
-
The skill is automatically detected when you open
|
|
35
|
+
The skill is automatically detected when you open the project in Claude Code. Use the `/form-tester` skill or run:
|
|
41
36
|
|
|
42
37
|
```bash
|
|
43
|
-
|
|
38
|
+
npx form-tester
|
|
44
39
|
```
|
|
45
40
|
|
|
46
41
|
### GitHub Copilot
|
|
47
42
|
|
|
48
|
-
Copilot reads instructions from `.github/copilot-instructions.md` automatically. Open
|
|
43
|
+
Copilot reads instructions from `.github/copilot-instructions.md` automatically. Open the project in VS Code with Copilot enabled.
|
|
49
44
|
|
|
50
45
|
### Standalone CLI
|
|
51
46
|
|
|
52
47
|
```bash
|
|
53
|
-
|
|
48
|
+
npx form-tester
|
|
54
49
|
```
|
|
55
50
|
|
|
56
51
|
Commands: `/setup`, `/update`, `/version`, `/people`, `/test {url}`, `/save {label}`, `/clear`, `/quit`
|
package/form-tester.js
CHANGED
|
@@ -6,7 +6,7 @@ const { spawn, execSync } = require("child_process");
|
|
|
6
6
|
|
|
7
7
|
const CONFIG_PATH = path.join(__dirname, "form-tester.config.json");
|
|
8
8
|
const OUTPUT_BASE = path.resolve(__dirname, "output");
|
|
9
|
-
const LOCAL_VERSION = "0.
|
|
9
|
+
const LOCAL_VERSION = "0.3.1";
|
|
10
10
|
const RECOMMENDED_PERSON = "Uromantisk Direktør";
|
|
11
11
|
|
|
12
12
|
const PERSONAS = [
|
|
@@ -934,11 +934,70 @@ async function handleCommand(line, config) {
|
|
|
934
934
|
}
|
|
935
935
|
}
|
|
936
936
|
|
|
937
|
+
function copyDirSync(src, dest) {
|
|
938
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
939
|
+
for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
|
|
940
|
+
const srcPath = path.join(src, entry.name);
|
|
941
|
+
const destPath = path.join(dest, entry.name);
|
|
942
|
+
if (entry.isDirectory()) {
|
|
943
|
+
copyDirSync(srcPath, destPath);
|
|
944
|
+
} else {
|
|
945
|
+
fs.copyFileSync(srcPath, destPath);
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
function install(targetDir) {
|
|
951
|
+
const pkgDir = __dirname;
|
|
952
|
+
const skillsSrc = path.join(pkgDir, ".claude", "skills");
|
|
953
|
+
const copilotSrc = path.join(pkgDir, ".github", "copilot-instructions.md");
|
|
954
|
+
const configSrc = path.join(pkgDir, "form-tester.config.example.json");
|
|
955
|
+
|
|
956
|
+
// Copy Claude Code skills
|
|
957
|
+
const skillsDest = path.join(targetDir, ".claude", "skills");
|
|
958
|
+
for (const skill of ["form-tester", "playwright-cli"]) {
|
|
959
|
+
const src = path.join(skillsSrc, skill);
|
|
960
|
+
if (fs.existsSync(src)) {
|
|
961
|
+
const dest = path.join(skillsDest, skill);
|
|
962
|
+
copyDirSync(src, dest);
|
|
963
|
+
console.log(` Installed .claude/skills/${skill}/`);
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
// Copy Copilot instructions
|
|
968
|
+
if (fs.existsSync(copilotSrc)) {
|
|
969
|
+
const copilotDest = path.join(targetDir, ".github", "copilot-instructions.md");
|
|
970
|
+
fs.mkdirSync(path.dirname(copilotDest), { recursive: true });
|
|
971
|
+
fs.copyFileSync(copilotSrc, copilotDest);
|
|
972
|
+
console.log(" Installed .github/copilot-instructions.md");
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
// Copy config example
|
|
976
|
+
if (fs.existsSync(configSrc)) {
|
|
977
|
+
const configDest = path.join(targetDir, "form-tester.config.example.json");
|
|
978
|
+
fs.copyFileSync(configSrc, configDest);
|
|
979
|
+
console.log(" Installed form-tester.config.example.json");
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
console.log("\nDone! Next steps:");
|
|
983
|
+
console.log(" 1. cp form-tester.config.example.json form-tester.config.json");
|
|
984
|
+
console.log(' 2. Edit form-tester.config.json and set your "pnr"');
|
|
985
|
+
console.log(" 3. Run: npx form-tester");
|
|
986
|
+
}
|
|
987
|
+
|
|
937
988
|
async function main() {
|
|
989
|
+
const args = process.argv.slice(2);
|
|
990
|
+
|
|
991
|
+
if (args[0] === "install") {
|
|
992
|
+
const targetDir = args[1] ? path.resolve(args[1]) : process.cwd();
|
|
993
|
+
console.log(`Installing form-tester skills to ${targetDir} ...\n`);
|
|
994
|
+
install(targetDir);
|
|
995
|
+
process.exit(0);
|
|
996
|
+
}
|
|
997
|
+
|
|
938
998
|
const config = loadConfig();
|
|
939
999
|
await handleVersionMismatch(config);
|
|
940
1000
|
|
|
941
|
-
const args = process.argv.slice(2);
|
|
942
1001
|
if (args.includes("--help") || args.includes("-h")) {
|
|
943
1002
|
printHelp();
|
|
944
1003
|
process.exit(0);
|
package/package.json
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "form-tester",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
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": {
|
|
7
7
|
"form-tester": "./form-tester.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"test": "node --test tests/form-tester.test.js"
|
|
11
|
-
|
|
10
|
+
"test": "node --test tests/form-tester.test.js"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@playwright/cli": "^0.1.1"
|
|
12
14
|
},
|
|
13
15
|
"keywords": [
|
|
14
16
|
"form-testing",
|