@hasna/testers 0.0.25 → 0.0.27
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/dist/cli/index.js +117 -13
- package/dist/mcp/index.js +16 -103
- package/dist/server/index.js +19 -0
- package/package.json +2 -2
package/dist/cli/index.js
CHANGED
|
@@ -27119,7 +27119,7 @@ import chalk6 from "chalk";
|
|
|
27119
27119
|
// package.json
|
|
27120
27120
|
var package_default = {
|
|
27121
27121
|
name: "@hasna/testers",
|
|
27122
|
-
version: "0.0.
|
|
27122
|
+
version: "0.0.27",
|
|
27123
27123
|
description: "AI-powered QA testing CLI \u2014 spawns cheap AI agents to test web apps with headless browsers",
|
|
27124
27124
|
type: "module",
|
|
27125
27125
|
main: "dist/index.js",
|
|
@@ -29607,12 +29607,48 @@ program2.command("results <run-id>").description("Show results for a test run").
|
|
|
29607
29607
|
process.exit(1);
|
|
29608
29608
|
}
|
|
29609
29609
|
});
|
|
29610
|
-
program2.command("screenshots <id>").description("List screenshots for a run or result").action((id) => {
|
|
29610
|
+
program2.command("screenshots <id>").description("List screenshots for a run or result").option("--json", "Output as JSON", false).option("-l, --limit <n>", "Limit results", "200").option("--offset <n>", "Skip first N results", "0").action((id, opts) => {
|
|
29611
29611
|
try {
|
|
29612
|
+
const limit = Math.max(1, parseInt(opts.limit, 10) || 200);
|
|
29613
|
+
const offset = Math.max(0, parseInt(opts.offset, 10) || 0);
|
|
29612
29614
|
const run = getRun(id);
|
|
29613
29615
|
if (run) {
|
|
29614
29616
|
const results = getResultsByRun(run.id);
|
|
29615
|
-
|
|
29617
|
+
const flattened = [];
|
|
29618
|
+
for (const result of results) {
|
|
29619
|
+
const screenshots2 = listScreenshots(result.id);
|
|
29620
|
+
const scenario = getScenario(result.scenarioId);
|
|
29621
|
+
for (const ss of screenshots2) {
|
|
29622
|
+
flattened.push({
|
|
29623
|
+
screenshotId: ss.id,
|
|
29624
|
+
resultId: result.id,
|
|
29625
|
+
scenarioId: result.scenarioId,
|
|
29626
|
+
scenarioShortId: scenario?.shortId ?? null,
|
|
29627
|
+
scenarioName: scenario?.name ?? null,
|
|
29628
|
+
stepNumber: ss.stepNumber,
|
|
29629
|
+
action: ss.action,
|
|
29630
|
+
filePath: ss.filePath,
|
|
29631
|
+
timestamp: ss.timestamp,
|
|
29632
|
+
width: ss.width,
|
|
29633
|
+
height: ss.height
|
|
29634
|
+
});
|
|
29635
|
+
}
|
|
29636
|
+
}
|
|
29637
|
+
const paged2 = flattened.slice(offset, offset + limit);
|
|
29638
|
+
if (opts.json) {
|
|
29639
|
+
log(JSON.stringify({
|
|
29640
|
+
input: id,
|
|
29641
|
+
type: "run",
|
|
29642
|
+
runId: run.id,
|
|
29643
|
+
total: flattened.length,
|
|
29644
|
+
limit,
|
|
29645
|
+
offset,
|
|
29646
|
+
items: paged2
|
|
29647
|
+
}, null, 2));
|
|
29648
|
+
return;
|
|
29649
|
+
}
|
|
29650
|
+
let seen = 0;
|
|
29651
|
+
let shown = 0;
|
|
29616
29652
|
log("");
|
|
29617
29653
|
log(chalk6.bold(` Screenshots for run ${run.id.slice(0, 8)}`));
|
|
29618
29654
|
log("");
|
|
@@ -29621,28 +29657,70 @@ program2.command("screenshots <id>").description("List screenshots for a run or
|
|
|
29621
29657
|
if (screenshots2.length > 0) {
|
|
29622
29658
|
const scenario = getScenario(result.scenarioId);
|
|
29623
29659
|
const label = scenario ? `${scenario.shortId}: ${scenario.name}` : result.scenarioId.slice(0, 8);
|
|
29624
|
-
|
|
29660
|
+
let sectionPrinted = false;
|
|
29625
29661
|
for (const ss of screenshots2) {
|
|
29662
|
+
if (seen < offset) {
|
|
29663
|
+
seen++;
|
|
29664
|
+
continue;
|
|
29665
|
+
}
|
|
29666
|
+
if (shown >= limit)
|
|
29667
|
+
break;
|
|
29668
|
+
if (!sectionPrinted) {
|
|
29669
|
+
log(chalk6.bold(` ${label}`));
|
|
29670
|
+
sectionPrinted = true;
|
|
29671
|
+
}
|
|
29626
29672
|
log(` ${chalk6.dim(String(ss.stepNumber).padStart(3, "0"))} ${ss.action} \u2014 ${chalk6.dim(ss.filePath)}`);
|
|
29627
|
-
|
|
29673
|
+
seen++;
|
|
29674
|
+
shown++;
|
|
29628
29675
|
}
|
|
29629
|
-
|
|
29676
|
+
if (sectionPrinted)
|
|
29677
|
+
log("");
|
|
29678
|
+
if (shown >= limit)
|
|
29679
|
+
break;
|
|
29630
29680
|
}
|
|
29631
29681
|
}
|
|
29632
|
-
if (
|
|
29682
|
+
if (flattened.length === 0 || shown === 0) {
|
|
29633
29683
|
log(chalk6.dim(" No screenshots found."));
|
|
29634
29684
|
log("");
|
|
29685
|
+
} else if (offset + shown < flattened.length) {
|
|
29686
|
+
log(chalk6.dim(` Showing ${shown} of ${flattened.length} screenshots (use --limit/--offset to paginate)`));
|
|
29687
|
+
log("");
|
|
29635
29688
|
}
|
|
29636
29689
|
return;
|
|
29637
29690
|
}
|
|
29638
29691
|
const screenshots = listScreenshots(id);
|
|
29692
|
+
const paged = screenshots.slice(offset, offset + limit);
|
|
29693
|
+
if (opts.json) {
|
|
29694
|
+
log(JSON.stringify({
|
|
29695
|
+
input: id,
|
|
29696
|
+
type: "result",
|
|
29697
|
+
resultId: id,
|
|
29698
|
+
total: screenshots.length,
|
|
29699
|
+
limit,
|
|
29700
|
+
offset,
|
|
29701
|
+
items: paged.map((ss) => ({
|
|
29702
|
+
screenshotId: ss.id,
|
|
29703
|
+
stepNumber: ss.stepNumber,
|
|
29704
|
+
action: ss.action,
|
|
29705
|
+
filePath: ss.filePath,
|
|
29706
|
+
timestamp: ss.timestamp,
|
|
29707
|
+
width: ss.width,
|
|
29708
|
+
height: ss.height
|
|
29709
|
+
}))
|
|
29710
|
+
}, null, 2));
|
|
29711
|
+
return;
|
|
29712
|
+
}
|
|
29639
29713
|
if (screenshots.length > 0) {
|
|
29640
29714
|
log("");
|
|
29641
29715
|
log(chalk6.bold(` Screenshots for result ${id.slice(0, 8)}`));
|
|
29642
29716
|
log("");
|
|
29643
|
-
for (const ss of
|
|
29717
|
+
for (const ss of paged) {
|
|
29644
29718
|
log(` ${chalk6.dim(String(ss.stepNumber).padStart(3, "0"))} ${ss.action} \u2014 ${chalk6.dim(ss.filePath)}`);
|
|
29645
29719
|
}
|
|
29720
|
+
if (paged.length < screenshots.length) {
|
|
29721
|
+
log("");
|
|
29722
|
+
log(chalk6.dim(` Showing ${paged.length} of ${screenshots.length} screenshots (use --limit/--offset to paginate)`));
|
|
29723
|
+
}
|
|
29646
29724
|
log("");
|
|
29647
29725
|
return;
|
|
29648
29726
|
}
|
|
@@ -29821,10 +29899,28 @@ projectCmd.command("create <name>").description("Create a new project").option("
|
|
|
29821
29899
|
process.exit(1);
|
|
29822
29900
|
}
|
|
29823
29901
|
});
|
|
29824
|
-
projectCmd.command("list").description("List all projects").action(() => {
|
|
29902
|
+
projectCmd.command("list").description("List all projects").option("--json", "Output as JSON", false).option("--search <text>", "Filter by project name/path (case-insensitive substring)").option("-l, --limit <n>", "Limit results", "100").option("--offset <n>", "Skip first N results", "0").action((opts) => {
|
|
29825
29903
|
try {
|
|
29826
|
-
const
|
|
29827
|
-
|
|
29904
|
+
const limit = Math.max(1, parseInt(opts.limit, 10) || 100);
|
|
29905
|
+
const offset = Math.max(0, parseInt(opts.offset, 10) || 0);
|
|
29906
|
+
const search = typeof opts.search === "string" && opts.search.trim().length > 0 ? opts.search.trim().toLowerCase() : null;
|
|
29907
|
+
const allProjects = listProjects();
|
|
29908
|
+
const filtered = search ? allProjects.filter((p) => {
|
|
29909
|
+
const name = p.name.toLowerCase();
|
|
29910
|
+
const path = (p.path ?? "").toLowerCase();
|
|
29911
|
+
return name.includes(search) || path.includes(search);
|
|
29912
|
+
}) : allProjects;
|
|
29913
|
+
const paged = filtered.slice(offset, offset + limit);
|
|
29914
|
+
if (opts.json) {
|
|
29915
|
+
log(JSON.stringify({
|
|
29916
|
+
total: filtered.length,
|
|
29917
|
+
limit,
|
|
29918
|
+
offset,
|
|
29919
|
+
items: paged
|
|
29920
|
+
}, null, 2));
|
|
29921
|
+
return;
|
|
29922
|
+
}
|
|
29923
|
+
if (filtered.length === 0) {
|
|
29828
29924
|
log(chalk6.dim("No projects found."));
|
|
29829
29925
|
return;
|
|
29830
29926
|
}
|
|
@@ -29833,9 +29929,13 @@ projectCmd.command("list").description("List all projects").action(() => {
|
|
|
29833
29929
|
log("");
|
|
29834
29930
|
log(` ${"ID".padEnd(38)} ${"Name".padEnd(24)} ${"Path".padEnd(30)} Created`);
|
|
29835
29931
|
log(` ${"\u2500".repeat(38)} ${"\u2500".repeat(24)} ${"\u2500".repeat(30)} ${"\u2500".repeat(20)}`);
|
|
29836
|
-
for (const p of
|
|
29932
|
+
for (const p of paged) {
|
|
29837
29933
|
log(` ${p.id.padEnd(38)} ${p.name.padEnd(24)} ${(p.path ?? chalk6.dim("\u2014")).toString().padEnd(30)} ${p.createdAt}`);
|
|
29838
29934
|
}
|
|
29935
|
+
if (offset + paged.length < filtered.length) {
|
|
29936
|
+
log("");
|
|
29937
|
+
log(chalk6.dim(` Showing ${paged.length} of ${filtered.length} projects (use --limit/--offset to paginate)`));
|
|
29938
|
+
}
|
|
29839
29939
|
log("");
|
|
29840
29940
|
} catch (error) {
|
|
29841
29941
|
logError(chalk6.red(`Error: ${error instanceof Error ? error.message : String(error)}`));
|
|
@@ -30615,9 +30715,13 @@ envCmd.command("add <name>").description("Add a named environment").requiredOpti
|
|
|
30615
30715
|
process.exit(1);
|
|
30616
30716
|
}
|
|
30617
30717
|
});
|
|
30618
|
-
envCmd.command("list").description("List all environments").option("--project <id>", "Filter by project ID").action((opts) => {
|
|
30718
|
+
envCmd.command("list").description("List all environments").option("--project <id>", "Filter by project ID").option("--json", "Output as JSON", false).action((opts) => {
|
|
30619
30719
|
try {
|
|
30620
30720
|
const envs = listEnvironments(opts.project);
|
|
30721
|
+
if (opts.json) {
|
|
30722
|
+
log(JSON.stringify({ total: envs.length, items: envs }, null, 2));
|
|
30723
|
+
return;
|
|
30724
|
+
}
|
|
30621
30725
|
if (envs.length === 0) {
|
|
30622
30726
|
log(chalk6.dim("No environments configured. Add one with: testers env add <name> --url <url>"));
|
|
30623
30727
|
return;
|
package/dist/mcp/index.js
CHANGED
|
@@ -22994,6 +22994,22 @@ async function runApiChecksByFilter(filter) {
|
|
|
22994
22994
|
// src/mcp/index.ts
|
|
22995
22995
|
init_personas();
|
|
22996
22996
|
init_paths();
|
|
22997
|
+
var cliArgs = new Set(process.argv.slice(2));
|
|
22998
|
+
if (cliArgs.has("--help") || cliArgs.has("-h")) {
|
|
22999
|
+
console.log(`Usage: testers-mcp [options]
|
|
23000
|
+
|
|
23001
|
+
Open Testers MCP server (stdio transport)
|
|
23002
|
+
|
|
23003
|
+
Options:
|
|
23004
|
+
-h, --help Show this help message
|
|
23005
|
+
-V, --version Show version
|
|
23006
|
+
`);
|
|
23007
|
+
process.exit(0);
|
|
23008
|
+
}
|
|
23009
|
+
if (cliArgs.has("--version") || cliArgs.has("-V")) {
|
|
23010
|
+
console.log("0.0.1");
|
|
23011
|
+
process.exit(0);
|
|
23012
|
+
}
|
|
22997
23013
|
function json(data) {
|
|
22998
23014
|
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
22999
23015
|
}
|
|
@@ -23285,18 +23301,6 @@ server.tool("list_agents", "List all registered agents", {}, async () => {
|
|
|
23285
23301
|
return errorResponse(error);
|
|
23286
23302
|
}
|
|
23287
23303
|
});
|
|
23288
|
-
server.tool("import_from_todos", "Import test scenarios from the todos database", {
|
|
23289
|
-
projectName: exports_external.string().optional().describe("Todos project name to filter by"),
|
|
23290
|
-
tags: exports_external.array(exports_external.string()).optional().describe("Tags to filter todos tasks"),
|
|
23291
|
-
projectId: exports_external.string().optional().describe("Target project ID for imported scenarios")
|
|
23292
|
-
}, async ({ projectName, tags, projectId }) => {
|
|
23293
|
-
try {
|
|
23294
|
-
const result = importFromTodos({ projectName, tags, projectId });
|
|
23295
|
-
return json(result);
|
|
23296
|
-
} catch (error) {
|
|
23297
|
-
return errorResponse(error);
|
|
23298
|
-
}
|
|
23299
|
-
});
|
|
23300
23304
|
server.tool("get_status", "Get system status: DB path, API key, scenario and run counts", {}, async () => {
|
|
23301
23305
|
try {
|
|
23302
23306
|
const config = loadConfig();
|
|
@@ -23327,97 +23331,6 @@ server.tool("scenario_exists", "Check whether a scenario with the given name exi
|
|
|
23327
23331
|
return errorResponse(error);
|
|
23328
23332
|
}
|
|
23329
23333
|
});
|
|
23330
|
-
server.tool("create_schedule", {
|
|
23331
|
-
name: exports_external.string().describe("Schedule name"),
|
|
23332
|
-
cronExpression: exports_external.string().describe("Cron expression (5-field)"),
|
|
23333
|
-
url: exports_external.string().describe("Target URL to test"),
|
|
23334
|
-
tags: exports_external.array(exports_external.string()).optional().describe("Filter scenarios by tags"),
|
|
23335
|
-
priority: exports_external.string().optional().describe("Filter scenarios by priority"),
|
|
23336
|
-
model: exports_external.string().optional().describe(MODEL_DESC),
|
|
23337
|
-
headed: exports_external.boolean().optional().describe("Run headed"),
|
|
23338
|
-
parallel: exports_external.number().optional().describe("Parallel count"),
|
|
23339
|
-
projectId: exports_external.string().optional().describe("Project ID")
|
|
23340
|
-
}, async (params) => {
|
|
23341
|
-
try {
|
|
23342
|
-
const schedule = createSchedule({
|
|
23343
|
-
name: params.name,
|
|
23344
|
-
cronExpression: params.cronExpression,
|
|
23345
|
-
url: params.url,
|
|
23346
|
-
scenarioFilter: { tags: params.tags, priority: params.priority },
|
|
23347
|
-
model: params.model,
|
|
23348
|
-
headed: params.headed,
|
|
23349
|
-
parallel: params.parallel,
|
|
23350
|
-
projectId: params.projectId
|
|
23351
|
-
});
|
|
23352
|
-
const nextRun = getNextRunTime(schedule.cronExpression);
|
|
23353
|
-
return json({ ...schedule, nextRunAt: nextRun.toISOString() });
|
|
23354
|
-
} catch (e) {
|
|
23355
|
-
return errorResponse(e);
|
|
23356
|
-
}
|
|
23357
|
-
});
|
|
23358
|
-
server.tool("list_schedules", {
|
|
23359
|
-
projectId: exports_external.string().optional(),
|
|
23360
|
-
enabled: exports_external.boolean().optional(),
|
|
23361
|
-
limit: exports_external.number().optional()
|
|
23362
|
-
}, async (params) => {
|
|
23363
|
-
try {
|
|
23364
|
-
const schedules = listSchedules({ projectId: params.projectId, enabled: params.enabled, limit: params.limit });
|
|
23365
|
-
return json({ items: schedules, total: schedules.length });
|
|
23366
|
-
} catch (e) {
|
|
23367
|
-
return errorResponse(e);
|
|
23368
|
-
}
|
|
23369
|
-
});
|
|
23370
|
-
server.tool("enable_schedule", { id: exports_external.string().describe("Schedule ID") }, async (params) => {
|
|
23371
|
-
try {
|
|
23372
|
-
const schedule = updateSchedule(params.id, { enabled: true });
|
|
23373
|
-
return json(schedule);
|
|
23374
|
-
} catch (e) {
|
|
23375
|
-
return errorResponse(e);
|
|
23376
|
-
}
|
|
23377
|
-
});
|
|
23378
|
-
server.tool("disable_schedule", { id: exports_external.string().describe("Schedule ID") }, async (params) => {
|
|
23379
|
-
try {
|
|
23380
|
-
const schedule = updateSchedule(params.id, { enabled: false });
|
|
23381
|
-
return json(schedule);
|
|
23382
|
-
} catch (e) {
|
|
23383
|
-
return errorResponse(e);
|
|
23384
|
-
}
|
|
23385
|
-
});
|
|
23386
|
-
server.tool("delete_schedule", { id: exports_external.string().describe("Schedule ID") }, async (params) => {
|
|
23387
|
-
try {
|
|
23388
|
-
const deleted = deleteSchedule(params.id);
|
|
23389
|
-
if (!deleted)
|
|
23390
|
-
return errorResponse(notFoundErr(params.id, "Schedule"));
|
|
23391
|
-
return json({ deleted: true, id: params.id });
|
|
23392
|
-
} catch (e) {
|
|
23393
|
-
return errorResponse(e);
|
|
23394
|
-
}
|
|
23395
|
-
});
|
|
23396
|
-
server.tool("wait_for_run", "Poll a run until it reaches a terminal status (passed, failed, error, or cancelled). Blocks until done or timeout.", {
|
|
23397
|
-
runId: exports_external.string().describe("Run ID to wait for"),
|
|
23398
|
-
timeoutMs: exports_external.number().optional().describe("Max wait time in ms (default 300000)"),
|
|
23399
|
-
pollIntervalMs: exports_external.number().optional().describe("Poll interval in ms (default 3000)")
|
|
23400
|
-
}, async ({ runId, timeoutMs = 300000, pollIntervalMs = 3000 }) => {
|
|
23401
|
-
try {
|
|
23402
|
-
const terminalStatuses = new Set(["passed", "failed", "error", "cancelled"]);
|
|
23403
|
-
const deadline = Date.now() + timeoutMs;
|
|
23404
|
-
while (Date.now() < deadline) {
|
|
23405
|
-
const run = getRun(runId);
|
|
23406
|
-
if (!run)
|
|
23407
|
-
return errorResponse(notFoundErr(runId, "Run"));
|
|
23408
|
-
if (terminalStatuses.has(run.status)) {
|
|
23409
|
-
const results = getResultsByRun(runId);
|
|
23410
|
-
const passed = results.filter((r) => r.status === "passed").length;
|
|
23411
|
-
const failed = results.filter((r) => r.status === "failed" || r.status === "error").length;
|
|
23412
|
-
return json({ ...run, passedCount: passed, failedCount: failed });
|
|
23413
|
-
}
|
|
23414
|
-
await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
|
|
23415
|
-
}
|
|
23416
|
-
return errorResponse(Object.assign(new Error(`Run ${runId} did not complete within ${timeoutMs}ms`), { name: "TimeoutError" }));
|
|
23417
|
-
} catch (error) {
|
|
23418
|
-
return errorResponse(error);
|
|
23419
|
-
}
|
|
23420
|
-
});
|
|
23421
23334
|
server.tool("get_run_stats", "Get aggregate statistics for a run: pass rate, cost, token usage, duration", {
|
|
23422
23335
|
runId: exports_external.string().describe("Run ID")
|
|
23423
23336
|
}, async ({ runId }) => {
|
package/dist/server/index.js
CHANGED
|
@@ -20020,6 +20020,25 @@ function listEnvironments(projectId) {
|
|
|
20020
20020
|
|
|
20021
20021
|
// src/server/index.ts
|
|
20022
20022
|
init_types();
|
|
20023
|
+
var cliArgs = new Set(process.argv.slice(2));
|
|
20024
|
+
if (cliArgs.has("--help") || cliArgs.has("-h")) {
|
|
20025
|
+
console.log(`Usage: testers-serve [options]
|
|
20026
|
+
|
|
20027
|
+
Open Testers HTTP server
|
|
20028
|
+
|
|
20029
|
+
Options:
|
|
20030
|
+
-h, --help Show this help message
|
|
20031
|
+
-V, --version Show version
|
|
20032
|
+
|
|
20033
|
+
Environment:
|
|
20034
|
+
TESTERS_PORT Port to bind (default: 19450)
|
|
20035
|
+
`);
|
|
20036
|
+
process.exit(0);
|
|
20037
|
+
}
|
|
20038
|
+
if (cliArgs.has("--version") || cliArgs.has("-V")) {
|
|
20039
|
+
console.log("0.0.1");
|
|
20040
|
+
process.exit(0);
|
|
20041
|
+
}
|
|
20023
20042
|
function parseUrl(req) {
|
|
20024
20043
|
const url = new URL(req.url);
|
|
20025
20044
|
return { pathname: url.pathname, searchParams: url.searchParams };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hasna/testers",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.27",
|
|
4
4
|
"description": "AI-powered QA testing CLI — spawns cheap AI agents to test web apps with headless browsers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -79,4 +79,4 @@
|
|
|
79
79
|
"cli",
|
|
80
80
|
"mcp"
|
|
81
81
|
]
|
|
82
|
-
}
|
|
82
|
+
}
|