@dev-blinq/bvt-playwright-js 1.0.0-dev.4.latest.142.1 → 1.0.0-dev.4.latest.158.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
@@ -1344,6 +1344,7 @@ declare const CommandSchema: z.ZodDiscriminatedUnion<[
1344
1344
  ], "type">;
1345
1345
  target: z.ZodObject<{
1346
1346
  name: z.ZodString;
1347
+ isElementHidden: z.ZodOptional<z.ZodBoolean>;
1347
1348
  uniqueSelectors: z.ZodArray<z.ZodDiscriminatedUnion<[
1348
1349
  z.ZodObject<{
1349
1350
  type: z.ZodLiteral<"pw.selectorString">;
@@ -2112,6 +2113,7 @@ declare const CommandSchema: z.ZodDiscriminatedUnion<[
2112
2113
  ], "type">;
2113
2114
  target: z.ZodObject<{
2114
2115
  name: z.ZodString;
2116
+ isElementHidden: z.ZodOptional<z.ZodBoolean>;
2115
2117
  uniqueSelectors: z.ZodArray<z.ZodDiscriminatedUnion<[
2116
2118
  z.ZodObject<{
2117
2119
  type: z.ZodLiteral<"pw.selectorString">;
@@ -2756,6 +2758,7 @@ declare const CommandSchema: z.ZodDiscriminatedUnion<[
2756
2758
  ], "type">;
2757
2759
  target: z.ZodObject<{
2758
2760
  name: z.ZodString;
2761
+ isElementHidden: z.ZodOptional<z.ZodBoolean>;
2759
2762
  uniqueSelectors: z.ZodArray<z.ZodDiscriminatedUnion<[
2760
2763
  z.ZodObject<{
2761
2764
  type: z.ZodLiteral<"pw.selectorString">;
@@ -4351,6 +4354,7 @@ declare const StepDefinitionSchema: z.ZodObject<{
4351
4354
  ], "type">;
4352
4355
  target: z.ZodObject<{
4353
4356
  name: z.ZodString;
4357
+ isElementHidden: z.ZodOptional<z.ZodBoolean>;
4354
4358
  uniqueSelectors: z.ZodArray<z.ZodDiscriminatedUnion<[
4355
4359
  z.ZodObject<{
4356
4360
  type: z.ZodLiteral<"pw.selectorString">;
@@ -5119,6 +5123,7 @@ declare const StepDefinitionSchema: z.ZodObject<{
5119
5123
  ], "type">;
5120
5124
  target: z.ZodObject<{
5121
5125
  name: z.ZodString;
5126
+ isElementHidden: z.ZodOptional<z.ZodBoolean>;
5122
5127
  uniqueSelectors: z.ZodArray<z.ZodDiscriminatedUnion<[
5123
5128
  z.ZodObject<{
5124
5129
  type: z.ZodLiteral<"pw.selectorString">;
@@ -5763,6 +5768,7 @@ declare const StepDefinitionSchema: z.ZodObject<{
5763
5768
  ], "type">;
5764
5769
  target: z.ZodObject<{
5765
5770
  name: z.ZodString;
5771
+ isElementHidden: z.ZodOptional<z.ZodBoolean>;
5766
5772
  uniqueSelectors: z.ZodArray<z.ZodDiscriminatedUnion<[
5767
5773
  z.ZodObject<{
5768
5774
  type: z.ZodLiteral<"pw.selectorString">;
@@ -7435,10 +7441,26 @@ type ExecutionStatusUpdateEventData = {
7435
7441
  result: ExecResult;
7436
7442
  resolvedChosenSelectorIndex?: number;
7437
7443
  recovery?: RecoveryMetadata;
7444
+ /**
7445
+ * Deterministic S3 keys for the before/after screenshots captured around
7446
+ * this command. Present only when screenshot capture is enabled for the
7447
+ * run; keys reflect the intended upload location (upload happens at the
7448
+ * end of the testcase).
7449
+ */
7450
+ screenshots?: {
7451
+ before?: string;
7452
+ after?: string;
7453
+ };
7438
7454
  } | RecoveryStatusEvent;
7439
7455
  type ExecutionCompletedEventData = {
7440
7456
  type: "execution_completed";
7441
7457
  result: ExecResult;
7458
+ /**
7459
+ * True when before/after command screenshots were captured and at least one
7460
+ * was successfully uploaded to S3 for this run. Forwarded by the client into
7461
+ * `reports.onFinishTestCase` so it persists onto the testcase document.
7462
+ */
7463
+ screenshotsAvailable?: boolean;
7442
7464
  };
7443
7465
  type ExecutionStartedEventData = {
7444
7466
  type: "execution_started";
@@ -8817,6 +8839,9 @@ type PWSelectorDetails = {
8817
8839
  score: number;
8818
8840
  elements?: Element[];
8819
8841
  };
8842
+ type SelectorGenerationOptions = Partial<InternalOptions> & {
8843
+ visibleOnly?: boolean;
8844
+ };
8820
8845
  declare class SelectorGenerator {
8821
8846
  private injectedScript;
8822
8847
  private _pw;
@@ -8829,7 +8854,7 @@ declare class SelectorGenerator {
8829
8854
  private pushCandidate;
8830
8855
  getMatchingElements(selector: string, options?: {
8831
8856
  visibleOnly?: boolean;
8832
- root?: Element;
8857
+ root?: Element | Document;
8833
8858
  prefix?: string;
8834
8859
  }): Element[];
8835
8860
  private addNearestTextToSelectors;
@@ -8837,13 +8862,14 @@ declare class SelectorGenerator {
8837
8862
  buildPWNoTextCandidates(element: Element, options?: InternalOptions): PWSelectorDetails[];
8838
8863
  computeUnique(element: Element, locatorGenerator: (element: Element, options?: InternalOptions & {
8839
8864
  isTargetNode: boolean;
8840
- }) => PWSelectorDetails[], strategy: "text" | "css", options?: InternalOptions): Generator<UniqueSelector>;
8865
+ }) => PWSelectorDetails[], strategy: "text" | "css", options?: SelectorGenerationOptions): Generator<UniqueSelector>;
8841
8866
  computeUnique2(element: Element, locatorGenerator: (element: Element, options?: InternalOptions & {
8842
8867
  isTargetNode: boolean;
8843
- }) => PWSelectorDetails[], strategy: "text" | "css", options?: InternalOptions): Generator<UniqueSelector>;
8844
- getUniquePWSelectors(element: Element, options?: InternalOptions): Generator<UniqueSelector, undefined, unknown>;
8868
+ }) => PWSelectorDetails[], strategy: "text" | "css", options?: SelectorGenerationOptions): Generator<UniqueSelector>;
8869
+ getUniquePWSelectors(element: Element, options?: SelectorGenerationOptions): Generator<UniqueSelector, undefined, unknown>;
8845
8870
  getCSSChainSelector(element: Element, options: {
8846
8871
  root?: Element | Document;
8872
+ visibleOnly?: boolean;
8847
8873
  }): string;
8848
8874
  getUniqueSelectors(element: Element, options?: InternalOptions & {
8849
8875
  timeout?: number;
@@ -8873,6 +8899,7 @@ type ElementActionEvent = {
8873
8899
  bvtId: string;
8874
8900
  details: ElementDetails;
8875
8901
  uniqueSelectors: UniqueSelector[];
8902
+ isElementHidden?: boolean;
8876
8903
  };
8877
8904
  statistics: {
8878
8905
  handleEventDurationMs: string;
@@ -9072,6 +9099,25 @@ type TraceUploadRequestInput = {
9072
9099
  testCaseId: string;
9073
9100
  projectId: string;
9074
9101
  };
9102
+ type ScreenshotUploadPhase = "before" | "after";
9103
+ type ScreenshotUploadFileDescriptor = {
9104
+ stepId: string;
9105
+ commandId: string;
9106
+ phase: ScreenshotUploadPhase;
9107
+ };
9108
+ type ScreenshotUploadRequestInput = {
9109
+ reportId: string;
9110
+ testCaseId: string;
9111
+ projectId: string;
9112
+ files: ScreenshotUploadFileDescriptor[];
9113
+ };
9114
+ type ScreenshotUploadTarget = {
9115
+ stepId: string;
9116
+ commandId: string;
9117
+ phase: ScreenshotUploadPhase; /** S3 object key the file will live at (deterministic convention). */
9118
+ key: string; /** Presigned PUT URL for uploading the screenshot. */
9119
+ url: string;
9120
+ };
9075
9121
  type ReplayOrchestratorResult = {
9076
9122
  classification: {
9077
9123
  label: string;
@@ -9087,6 +9133,9 @@ type TesterApiClient = {
9087
9133
  getPresignedUrlForTraceUpload: {
9088
9134
  query(input: TraceUploadRequestInput): Promise<string>;
9089
9135
  };
9136
+ getPresignedUrlsForScreenshotUpload: {
9137
+ query(input: ScreenshotUploadRequestInput): Promise<ScreenshotUploadTarget[]>;
9138
+ };
9090
9139
  };
9091
9140
  project: {
9092
9141
  getProjectSettings: {
@@ -9123,6 +9172,9 @@ type UnboxedTuple<T extends unknown[]> = {
9123
9172
  [K in keyof T]: Unboxed<T[K]>;
9124
9173
  };
9125
9174
  type LocatorScope = Frame | FrameLocator;
9175
+ type LocatorVisibilityOptions = {
9176
+ isElementHidden?: boolean;
9177
+ };
9126
9178
  type GlobalThis = {
9127
9179
  __bvt: {
9128
9180
  BrowserObserver: typeof BrowserObserver;
@@ -9246,6 +9298,15 @@ type TesterSession = {
9246
9298
  token?: string;
9247
9299
  trace?: TesterTraceConfig;
9248
9300
  runWithAiRecovery?: boolean;
9301
+ /**
9302
+ * When enabled, a viewport JPEG is captured before and after every
9303
+ * command and the set is uploaded to S3 at the end of the testcase.
9304
+ * Off by default — capture adds latency to every command.
9305
+ */
9306
+ screenshots?: {
9307
+ enabled: boolean;
9308
+ };
9309
+ deterministicRecoveryMode?: "new-tour-maintenance";
9249
9310
  };
9250
9311
  type ExecuteStepsInput = {
9251
9312
  recorderSteps: {
@@ -9285,6 +9346,19 @@ declare class Tester {
9285
9346
  private sessionToken;
9286
9347
  private activeBrowserContext;
9287
9348
  private reportId;
9349
+ private tempPathForAssets;
9350
+ /**
9351
+ * Per-testcase log of before/after command screenshots captured on disk,
9352
+ * pending batch upload to S3 at the end of the run. Reset in onTestCaseStart.
9353
+ */
9354
+ private capturedScreenshots;
9355
+ /**
9356
+ * Per-testcase screenshot counters (reset in onTestCaseStart) used purely for
9357
+ * observability — how many commands were eligible for capture and how many
9358
+ * capture attempts failed. Upload counters are derived at upload time.
9359
+ */
9360
+ private screenshotCommandsConsidered;
9361
+ private screenshotCaptureFailures;
9288
9362
  constructor(getAPIClient?: GetAPIClient, observabilityOrOptions?: AgentObservabilityInput | TesterOptions, optionsArg?: TesterOptions);
9289
9363
  setContext(context: ResolutionContext): void;
9290
9364
  setStepTraceChunkCallbacks(callbacks: StepTraceChunkCallbacks | undefined): void;
@@ -9295,6 +9369,22 @@ declare class Tester {
9295
9369
  private summarizeErrorForExecutionLog;
9296
9370
  private summarizeSessionForExecutionLog;
9297
9371
  private getCommandText;
9372
+ private screenshotsEnabled;
9373
+ /**
9374
+ * Deterministic S3 key for a command screenshot. Must match the convention
9375
+ * used by the server's `getPresignedUrlsForScreenshotUpload` route so the
9376
+ * keys recorded on the command report point at the uploaded objects.
9377
+ */
9378
+ private buildScreenshotKey;
9379
+ private getScreenshotTempDir;
9380
+ /**
9381
+ * Captures a viewport JPEG of the active page for the given command/phase,
9382
+ * writes it to the per-testcase temp dir, and records it for later upload.
9383
+ * Best-effort: any failure (no page, screenshot error) is logged and yields
9384
+ * `undefined` so command execution is never affected.
9385
+ */
9386
+ private captureCommandScreenshot;
9387
+ private toScreenshotRefs;
9298
9388
  private onCommandStart;
9299
9389
  private onCommandPass;
9300
9390
  private onCommandFail;
@@ -9306,6 +9396,12 @@ declare class Tester {
9306
9396
  private isRunSession;
9307
9397
  private isRecordingReplaySession;
9308
9398
  private shouldAttemptAiRecovery;
9399
+ private isNewTourMaintenanceRecoverySession;
9400
+ private shouldUseNewTourMaintenanceRecovery;
9401
+ private inferNewTourGenderOption;
9402
+ private buildNewTourGenderRadioCommand;
9403
+ private buildNewTourGenderRepairPlan;
9404
+ private recoverNewTourMaintenanceGenderCommand;
9309
9405
  private isSupportedRepairContext;
9310
9406
  private shouldUploadTrace;
9311
9407
  private resolveTraceOutputPath;
@@ -9316,6 +9412,16 @@ declare class Tester {
9316
9412
  private wait;
9317
9413
  private uploadFile;
9318
9414
  private uploadTraceFile;
9415
+ private putFileWithRetries;
9416
+ private cleanupScreenshotTempDir;
9417
+ /**
9418
+ * Batch-uploads all command screenshots captured during the run to S3.
9419
+ * Fetches a presigned PUT URL per file in a single round-trip, then uploads
9420
+ * each with retries. Best-effort: returns true when at least one screenshot
9421
+ * was uploaded, false otherwise (or when there is nothing/no token). Always
9422
+ * cleans up the on-disk temp files. Never throws.
9423
+ */
9424
+ private uploadScreenshots;
9319
9425
  private onTestCaseFail;
9320
9426
  private isBrowserDerivedCommand;
9321
9427
  private buildFailureContext;
@@ -9373,7 +9479,7 @@ declare class Tester {
9373
9479
  isFrameObject(frameScope: LocatorScope): frameScope is Frame;
9374
9480
  getFrameObjectFromFrameScope(frameScope: FrameLocator | Frame): Promise<Frame>;
9375
9481
  getFrame(scope: Page, frameElementDescriptors: ElementCommand["target"]["frames"]): Promise<LocatorScope>;
9376
- getLocator(scope: LocatorScope, uniqueSelector: UniqueSelector): {
9482
+ getLocator(scope: LocatorScope, uniqueSelector: UniqueSelector, options?: LocatorVisibilityOptions): {
9377
9483
  target: Locator;
9378
9484
  };
9379
9485
  executeElementAction(locator: Locator, action: ElementAction): Promise<void>;