@dev-blinq/bvt-playwright-js 1.0.0-dev.4.staging.166.1 → 1.0.0-dev.4.staging.176.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/index.d.mts CHANGED
@@ -9308,6 +9308,19 @@ type TesterSession = {
9308
9308
  */
9309
9309
  screenshots?: {
9310
9310
  enabled: boolean;
9311
+ /**
9312
+ * "upload" (default): Tester requests presigned URLs and uploads the
9313
+ * captured JPEGs to S3 itself at the end of the testcase.
9314
+ * "local": Tester captures JPEGs to `outputDir` and leaves them on disk
9315
+ * for an out-of-band uploader (mirrors the local-trace mode used by the
9316
+ * execution worker, which has no presigned-URL API client).
9317
+ */
9318
+ mode?: "upload" | "local";
9319
+ /**
9320
+ * Local-mode capture directory. When omitted a per-testcase /tmp dir is
9321
+ * used. Ignored in "upload" mode.
9322
+ */
9323
+ outputDir?: string;
9311
9324
  };
9312
9325
  deterministicRecoveryMode?: "new-tour-maintenance";
9313
9326
  };
package/index.mjs CHANGED
@@ -26460,7 +26460,7 @@ var Tester = class {
26460
26460
  return `${this.dataContext?.projectId ?? ""}/${session.reportId}/testcases/${session.testCaseId}/resources/screenshots/${stepId}-${commandId}-${phase}.jpg`;
26461
26461
  }
26462
26462
  getScreenshotTempDir(session) {
26463
- if (!this.tempPathForAssets) this.tempPathForAssets = join("/tmp", `blinq-screenshots-${session.reportId}-${session.testCaseId}`);
26463
+ if (!this.tempPathForAssets) this.tempPathForAssets = session.screenshots?.outputDir ?? join("/tmp", `blinq-screenshots-${session.reportId}-${session.testCaseId}`);
26464
26464
  return this.tempPathForAssets;
26465
26465
  }
26466
26466
  /**
@@ -27050,6 +27050,16 @@ var Tester = class {
27050
27050
  });
27051
27051
  return false;
27052
27052
  }
27053
+ if (session.screenshots?.mode === "local") {
27054
+ this.obs.logger.log("Screenshots captured in local mode; leaving files for out-of-band upload", {
27055
+ reportId: session.reportId,
27056
+ testCaseId: session.testCaseId,
27057
+ capturedCount,
27058
+ dir: this.tempPathForAssets
27059
+ });
27060
+ this.capturedScreenshots = [];
27061
+ return capturedCount > 0;
27062
+ }
27053
27063
  if (!session.token) {
27054
27064
  this.obs.metrics.count("bvt_agent.screenshots.upload.skipped.total", 1, { reason: "no-session-token" });
27055
27065
  this.obs.logger.warn(`Screenshot upload skipped because no session token was provided for reportId: ${session.reportId}, testCaseId: ${session.testCaseId}.`);
@@ -28080,7 +28090,9 @@ var Tester = class {
28080
28090
  const frame = await this.getFrameObjectFromFrameScope(frameScope);
28081
28091
  this.obs.logger.info(`Checking for absence of element with text ${value} using "${locator.first()?._selector}" `);
28082
28092
  this.obs.logger.info(`Waiting for page to load and stabilize before checking for absence of text to reduce flakiness...`);
28083
- await frame.waitForLoadState("networkidle", { timeout: 3e4 });
28093
+ await frame.waitForLoadState("networkidle", { timeout: 3e4 }).catch((error) => {
28094
+ this.obs.logger.error(`Frame load timeout, the page may not be in the desired state yet`, error);
28095
+ });
28084
28096
  this.obs.logger.info(`frame load detected. Waiting an additional 500ms for stabilization...`);
28085
28097
  await frame.waitForTimeout(500);
28086
28098
  this.obs.logger.info(`Checking for element with text "${value}" after page load and stabilization delay...`);