@nhonh/qabot 0.6.1 → 1.0.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/bin/qabot.js +82 -13
- package/package.json +1 -1
- package/src/cli/commands/test.js +229 -230
- package/src/cli/interactive.js +211 -0
- package/src/core/constants.js +1 -1
- package/src/core/logger.js +147 -45
- package/src/e2e/e2e-prompts.js +45 -44
- package/src/reporter/html-builder.js +250 -91
package/bin/qabot.js
CHANGED
|
@@ -9,20 +9,89 @@ import { registerGenerateCommand } from "../src/cli/commands/generate.js";
|
|
|
9
9
|
import { registerReportCommand } from "../src/cli/commands/report.js";
|
|
10
10
|
import { registerAuthCommand } from "../src/cli/commands/auth.js";
|
|
11
11
|
import { registerTestCommand } from "../src/cli/commands/test.js";
|
|
12
|
+
import { runInteractive } from "../src/cli/interactive.js";
|
|
12
13
|
|
|
13
|
-
const
|
|
14
|
+
const hasSubcommand =
|
|
15
|
+
process.argv.length > 2 && !process.argv[2].startsWith("-");
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
.
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
if (!hasSubcommand) {
|
|
18
|
+
runInteractive(process.cwd())
|
|
19
|
+
.then(async (result) => {
|
|
20
|
+
if (!result) process.exit(0);
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
switch (result.action) {
|
|
23
|
+
case "init": {
|
|
24
|
+
const { runInit } = await import("../src/cli/commands/init.js");
|
|
25
|
+
if (typeof runInit === "function")
|
|
26
|
+
await runInit({ yes: true, dir: process.cwd() });
|
|
27
|
+
else process.argv.push("init", "-y");
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
case "report": {
|
|
31
|
+
process.argv.push("report");
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
case "auth": {
|
|
35
|
+
process.argv.push("auth");
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
case "e2e": {
|
|
39
|
+
const args = ["test"];
|
|
40
|
+
if (result.feature) args.push(result.feature);
|
|
41
|
+
if (result.url) args.push("--url", result.url);
|
|
42
|
+
if (result.headed) args.push("--headed");
|
|
43
|
+
process.argv.push(...args);
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
case "unit": {
|
|
47
|
+
const args = ["run"];
|
|
48
|
+
if (result.feature) args.push(result.feature);
|
|
49
|
+
args.push("--layer", "unit");
|
|
50
|
+
process.argv.push(...args);
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
case "generate": {
|
|
54
|
+
const args = ["generate"];
|
|
55
|
+
if (result.feature) args.push(result.feature);
|
|
56
|
+
process.argv.push(...args);
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
case "full": {
|
|
60
|
+
const args = ["run"];
|
|
61
|
+
if (result.feature) args.push(result.feature);
|
|
62
|
+
process.argv.push(...args);
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
27
66
|
|
|
28
|
-
|
|
67
|
+
if (process.argv.length > 2) {
|
|
68
|
+
const program = buildProgram();
|
|
69
|
+
program.parse();
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
.catch((err) => {
|
|
73
|
+
console.error(err.message);
|
|
74
|
+
process.exit(1);
|
|
75
|
+
});
|
|
76
|
+
} else {
|
|
77
|
+
const program = buildProgram();
|
|
78
|
+
program.parse();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function buildProgram() {
|
|
82
|
+
const program = new Command();
|
|
83
|
+
program
|
|
84
|
+
.name(TOOL_NAME)
|
|
85
|
+
.description("AI-powered universal QA automation tool")
|
|
86
|
+
.version(VERSION);
|
|
87
|
+
|
|
88
|
+
registerInitCommand(program);
|
|
89
|
+
registerRunCommand(program);
|
|
90
|
+
registerTestCommand(program);
|
|
91
|
+
registerListCommand(program);
|
|
92
|
+
registerGenerateCommand(program);
|
|
93
|
+
registerReportCommand(program);
|
|
94
|
+
registerAuthCommand(program);
|
|
95
|
+
|
|
96
|
+
return program;
|
|
97
|
+
}
|