ccqa 0.8.3 → 0.10.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccqa",
3
- "version": "0.8.3",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "description": "Browser test recorder powered by Claude Code and agent-browser",
6
6
  "repository": {
@@ -3,6 +3,13 @@ declare function __setCurrentStep(stepId: string, source: string): void;
3
3
  declare function ab(...args: string[]): void;
4
4
  /** Wait for element/text with an explicit timeout so long-running async ops don't hang. */
5
5
  declare function abWait(selector: string, timeoutMs?: number): void;
6
+ /**
7
+ * Upload one or more files to a file input via `agent-browser upload`.
8
+ * Relative paths resolve against the test's cwd. We pre-check existence
9
+ * locally so a typo in a fixture path surfaces as a clear error before
10
+ * agent-browser exits with an opaque non-zero status.
11
+ */
12
+ declare function abUpload(selector: string, ...files: string[]): void;
6
13
  /** Assert stable text is visible on page (via wait --text). */
7
14
  declare function abAssertTextVisible(text: string, timeoutMs?: number): void;
8
15
  /** Assert element is visible (polls `get count`; never uses the blocking `wait <selector>`). */
@@ -29,4 +36,4 @@ declare function abAssertUnchecked(selector: string): void;
29
36
  */
30
37
  declare function abStepEvidence(stepId: string, source: string): void;
31
38
  //#endregion
32
- export { __setCurrentStep, ab, abAssertChecked, abAssertDisabled, abAssertEnabled, abAssertNotVisible, abAssertTextVisible, abAssertUnchecked, abAssertUrl, abAssertVisible, abStepEvidence, abWait };
39
+ export { __setCurrentStep, ab, abAssertChecked, abAssertDisabled, abAssertEnabled, abAssertNotVisible, abAssertTextVisible, abAssertUnchecked, abAssertUrl, abAssertVisible, abStepEvidence, abUpload, abWait };
@@ -1,6 +1,6 @@
1
1
  import { i as FAILURE_STEP_ID, n as spawnAB, r as FAILURE_SOURCE, t as sleepSync } from "../spawn-ab-Ja8NRRab.mjs";
2
- import { mkdirSync, writeFileSync } from "node:fs";
3
- import { dirname, join } from "node:path";
2
+ import { existsSync, mkdirSync, writeFileSync } from "node:fs";
3
+ import { dirname, isAbsolute, join, resolve } from "node:path";
4
4
  //#region src/runtime/test-helpers.ts
5
5
  const POST_OPEN_SETTLE_MS = 600;
6
6
  function logStep(action, args) {
@@ -100,6 +100,31 @@ function abWait(selector, timeoutMs = 3e4) {
100
100
  stderr: ""
101
101
  });
102
102
  }
103
+ /**
104
+ * Upload one or more files to a file input via `agent-browser upload`.
105
+ * Relative paths resolve against the test's cwd. We pre-check existence
106
+ * locally so a typo in a fixture path surfaces as a clear error before
107
+ * agent-browser exits with an opaque non-zero status.
108
+ */
109
+ function abUpload(selector, ...files) {
110
+ logStep("upload", [selector, ...files]);
111
+ const resolved = [];
112
+ for (const file of files) {
113
+ const abs = isAbsolute(file) ? file : resolve(process.cwd(), file);
114
+ if (!existsSync(abs)) fail(`abUpload: file not found (${file} → ${abs})`, {
115
+ status: 1,
116
+ stdout: "",
117
+ stderr: ""
118
+ });
119
+ resolved.push(abs);
120
+ }
121
+ const result = spawnAB([
122
+ "upload",
123
+ selector,
124
+ ...resolved
125
+ ]);
126
+ if (result.status !== 0) fail(`agent-browser upload failed (exit ${result.status})`, result);
127
+ }
103
128
  /** Assert stable text is visible on page (via wait --text). */
104
129
  function abAssertTextVisible(text, timeoutMs = 3e4) {
105
130
  logStep("assert.text", [text]);
@@ -289,4 +314,4 @@ function warnEvidence(msg) {
289
314
  process.stderr.write(`[ccqa] evidence: ${msg}\n`);
290
315
  }
291
316
  //#endregion
292
- export { __setCurrentStep, ab, abAssertChecked, abAssertDisabled, abAssertEnabled, abAssertNotVisible, abAssertTextVisible, abAssertUnchecked, abAssertUrl, abAssertVisible, abStepEvidence, abWait };
317
+ export { __setCurrentStep, ab, abAssertChecked, abAssertDisabled, abAssertEnabled, abAssertNotVisible, abAssertTextVisible, abAssertUnchecked, abAssertUrl, abAssertVisible, abStepEvidence, abUpload, abWait };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccqa",
3
- "version": "0.8.3",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "description": "Browser test recorder powered by Claude Code and agent-browser",
6
6
  "repository": {