zerocheck 0.2.1 → 0.2.2

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 CHANGED
@@ -33,7 +33,7 @@ npx zerocheck login
33
33
  npx zerocheck run
34
34
  ```
35
35
 
36
- `login` prints a URL and a code for you to approve in your browser. `run` executes the tests in your configured test directory and prints each result with a link to the run. Open it to see the steps, screenshots and any recording. To run one test, use its path: `npx zerocheck run zerocheck/tests/discount-code.yaml`.
36
+ `login` prints a URL and a code for you to approve in your browser. `run` executes the tests in your configured test directory and prints each result with a link to the run. Open it to see the steps and screenshots, and the recording of each test that uses no configured secrets. To run one test, use its path: `npx zerocheck run zerocheck/tests/discount-code.yaml`.
37
37
 
38
38
  In CI, set `ZEROCHECK_API` and a project token from Settings as `ZEROCHECK_TOKEN` instead of signing in.
39
39
 
@@ -68,7 +68,7 @@ Your instance receives each secret's name, never its value. It does receive the
68
68
 
69
69
  ## Web app or CLI
70
70
 
71
- Tests you create in the web app run there in a hosted browser, with nothing to install. To bring one into your repository, use **Download YAML** and put the file in your test directory. That creates an independent copy, and edits don't sync.
71
+ Tests you create in the web app run there in a hosted browser, with nothing to install. To bring one into your repository, use **Download YAML** and put the file in your test directory. That is an independent copy: editing, renaming or deleting the file, or running it with the CLI, never changes the test in the web app. To update the web copy from a file, use **Upload YAML** in the web app; a file downloaded from there replaces its test only after you confirm.
72
72
 
73
73
  ## Documentation
74
74
 
package/dist/index.js CHANGED
@@ -4862,12 +4862,49 @@ async function installNavigationGuard(page, options) {
4862
4862
  }
4863
4863
 
4864
4864
  // ../../src/agent/browser-session.ts
4865
+ var RECORDING_FRAME_INTERVAL_MS = 1e3;
4866
+ function keepRecordingCurrent(page, intervalMs = RECORDING_FRAME_INTERVAL_MS) {
4867
+ let client, pending = false, stopped = false;
4868
+ const capture = async () => {
4869
+ if (!client) {
4870
+ const created = await page.context().newCDPSession(page);
4871
+ if (stopped) {
4872
+ await created.detach().catch(() => {
4873
+ });
4874
+ return;
4875
+ }
4876
+ client = created;
4877
+ }
4878
+ await client.send("Page.captureScreenshot", { format: "jpeg", quality: 1 });
4879
+ };
4880
+ const timer = setInterval(() => {
4881
+ if (pending || stopped) return;
4882
+ pending = true;
4883
+ void capture().catch(() => {
4884
+ }).finally(() => {
4885
+ pending = false;
4886
+ });
4887
+ }, intervalMs);
4888
+ timer.unref?.();
4889
+ const stop = () => {
4890
+ if (stopped) return;
4891
+ stopped = true;
4892
+ clearInterval(timer);
4893
+ page.off("close", stop);
4894
+ void client?.detach().catch(() => {
4895
+ });
4896
+ };
4897
+ page.once("close", stop);
4898
+ return stop;
4899
+ }
4865
4900
  var BrowserSession = class {
4866
4901
  context;
4867
4902
  page;
4868
4903
  releaseGuard;
4869
4904
  console = new ConsoleRecorder();
4870
4905
  stage = "new";
4906
+ recording = false;
4907
+ stopRecordingFrames;
4871
4908
  /** The latest refusal and guard failure, kept so a lost message cannot hide them. */
4872
4909
  denied;
4873
4910
  failure;
@@ -4914,6 +4951,7 @@ var BrowserSession = class {
4914
4951
  const video = options.recordVideo && !env.secrets.length;
4915
4952
  await this.setup("new", "opening", "context", async () => {
4916
4953
  this.context = await env.browser.newContext({ viewport, ...video ? { recordVideo: { dir: env.videoDir, size: viewport } } : {}, ...env.allowRequest ? { serviceWorkers: "block" } : {} });
4954
+ this.recording = video;
4917
4955
  });
4918
4956
  }
4919
4957
  async prepareContext(defaultTimeoutMs) {
@@ -4988,12 +5026,14 @@ var BrowserSession = class {
4988
5026
  });
4989
5027
  });
4990
5028
  this.console.attach(page);
5029
+ if (this.recording) this.stopRecordingFrames = keepRecordingCurrent(page);
4991
5030
  }
4992
5031
  drainConsole() {
4993
5032
  return redactConsoleLogs(this.console.drain(), this.env.secrets);
4994
5033
  }
4995
5034
  async closeContext() {
4996
5035
  this.stage = "closed";
5036
+ this.stopRecordingFrames?.();
4997
5037
  this.console.dispose();
4998
5038
  await this.context?.close();
4999
5039
  }
@@ -6413,7 +6453,7 @@ function unlinkQuietly(path) {
6413
6453
  }
6414
6454
 
6415
6455
  // package.json
6416
- var version = "0.2.1";
6456
+ var version = "0.2.2";
6417
6457
 
6418
6458
  // src/index.ts
6419
6459
  var program = new Command().name("zerocheck").version(version).description("Run Zerocheck browser tests on your own machine.").exitOverride();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zerocheck",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Zerocheck is an AI QA engineer that tests your app end to end. Run saved YAML tests with the CLI, on your machine or in CI.",
5
5
  "keywords": [
6
6
  "qa-agent",