@test-lab-ai/cli 0.2.15 → 0.2.16
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/testlab.mjs +21 -8
- package/lib/config.mjs +2 -4
- package/package.json +1 -1
package/bin/testlab.mjs
CHANGED
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
* testlab import <path> [--dry-run] Import a plan file or a directory of *.json
|
|
14
14
|
*
|
|
15
15
|
* Auth: --key -> $TESTLAB_API_KEY -> ~/.test-lab/config.json
|
|
16
|
-
* API: https://www.test-lab.ai (fixed)
|
|
17
16
|
*/
|
|
18
17
|
import { parseArgs } from "node:util"
|
|
19
18
|
import fs from "node:fs"
|
|
@@ -45,7 +44,7 @@ Usage:
|
|
|
45
44
|
testlab credentials set <key> --value <value> Set a credential ({{credentials.<key>}})
|
|
46
45
|
testlab credentials list List credential keys (values never shown)
|
|
47
46
|
testlab labels list List your labels
|
|
48
|
-
testlab data list List
|
|
47
|
+
testlab data list List data fixtures + built-in file fixtures
|
|
49
48
|
testlab data create -f fixture.json Create a data fixture ({{data.<fixture>.<field>}})
|
|
50
49
|
testlab scripts upload <file> --plan <id> Upload a local Playwright script for a plan
|
|
51
50
|
(skips paid AI generation; --device optional)
|
|
@@ -338,13 +337,27 @@ async function cmdDataList(flags) {
|
|
|
338
337
|
const fixtures = r.json?.fixtures || []
|
|
339
338
|
if (fixtures.length === 0) {
|
|
340
339
|
log("No data fixtures yet.")
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
340
|
+
} else {
|
|
341
|
+
log("Data fixtures (reference as {{data.<fixture>.<field>}}):")
|
|
342
|
+
for (const fx of fixtures) {
|
|
343
|
+
const fields = (fx.fields || []).map((f) => f.key).join(", ")
|
|
344
|
+
log(` ${fx.key}${fx.label ? ` (${fx.label})` : ""}${fields ? ` - ${fields}` : ""}`)
|
|
345
|
+
}
|
|
346
|
+
log(` ${fixtures.length} data fixture(s)`)
|
|
347
|
+
}
|
|
348
|
+
// Built-in upload-file fixtures (reference in an upload step as {{file.<name>}}).
|
|
349
|
+
const files = r.json?.files || []
|
|
350
|
+
if (files.length > 0) {
|
|
351
|
+
log("\nFile fixtures (reference in an upload step as {{file.<name>}}):")
|
|
352
|
+
const byCat = {}
|
|
353
|
+
for (const f of files) (byCat[f.category] ||= []).push(f)
|
|
354
|
+
for (const cat of Object.keys(byCat).sort()) {
|
|
355
|
+
const defaults = byCat[cat].filter((f) => f.default).map((f) => `{{${f.token}}}`)
|
|
356
|
+
const shown = defaults.length ? defaults : byCat[cat].map((f) => `{{${f.token}}}`)
|
|
357
|
+
log(` ${cat}: ${shown.join(" ")}`)
|
|
358
|
+
}
|
|
359
|
+
log(` ${files.length} file fixture(s) (append a size, e.g. {{file.pdf.25mb}})`)
|
|
346
360
|
}
|
|
347
|
-
log(`\n${fixtures.length} fixture(s)`)
|
|
348
361
|
}
|
|
349
362
|
|
|
350
363
|
async function cmdDataCreate(flags) {
|
package/lib/config.mjs
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Config + auth resolution for the testlab CLI.
|
|
3
3
|
*
|
|
4
4
|
* API key: --key flag -> $TESTLAB_API_KEY -> ~/.test-lab/config.json
|
|
5
|
-
* API base: always https://www.test-lab.ai (not configurable)
|
|
6
5
|
*/
|
|
7
6
|
import fs from "node:fs"
|
|
8
7
|
import os from "node:os"
|
|
@@ -35,8 +34,7 @@ export function saveConfig(cfg) {
|
|
|
35
34
|
export function resolveAuth(flags) {
|
|
36
35
|
const cfg = loadConfig()
|
|
37
36
|
const apiKey = flags.key || process.env.TESTLAB_API_KEY || cfg.apiKey || null
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
// never sent to an arbitrary host.
|
|
37
|
+
// The base URL used to be overridable (--api-url / TESTLAB_API_URL / config);
|
|
38
|
+
// removed so an API key can't be sent to an arbitrary host.
|
|
41
39
|
return { apiKey, apiUrl: DEFAULT_API_URL }
|
|
42
40
|
}
|