@dev-blinq/bvt-playwright-js 1.0.0-dev.4.staging.135.1 → 1.0.0-dev.4.staging.155.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
@@ -276,6 +276,14 @@ declare const elementAssertionSchema: z.ZodDiscriminatedUnion<[
276
276
  z.ZodObject<{
277
277
  type: z.ZodLiteral<"toHaveProperty">;
278
278
  name: z.ZodString;
279
+ operator: z.ZodOptional<z.ZodEnum<{
280
+ equals: "equals";
281
+ notEquals: "notEquals";
282
+ contains: "contains";
283
+ lessThan: "lessThan";
284
+ greaterThan: "greaterThan";
285
+ exists: "exists";
286
+ }>>;
279
287
  value: z.ZodOptional<z.ZodDiscriminatedUnion<[
280
288
  z.ZodObject<{
281
289
  type: z.ZodLiteral<"string">;
@@ -1336,6 +1344,7 @@ declare const CommandSchema: z.ZodDiscriminatedUnion<[
1336
1344
  ], "type">;
1337
1345
  target: z.ZodObject<{
1338
1346
  name: z.ZodString;
1347
+ isElementHidden: z.ZodOptional<z.ZodBoolean>;
1339
1348
  uniqueSelectors: z.ZodArray<z.ZodDiscriminatedUnion<[
1340
1349
  z.ZodObject<{
1341
1350
  type: z.ZodLiteral<"pw.selectorString">;
@@ -2011,6 +2020,14 @@ declare const CommandSchema: z.ZodDiscriminatedUnion<[
2011
2020
  z.ZodObject<{
2012
2021
  type: z.ZodLiteral<"toHaveProperty">;
2013
2022
  name: z.ZodString;
2023
+ operator: z.ZodOptional<z.ZodEnum<{
2024
+ equals: "equals";
2025
+ notEquals: "notEquals";
2026
+ contains: "contains";
2027
+ lessThan: "lessThan";
2028
+ greaterThan: "greaterThan";
2029
+ exists: "exists";
2030
+ }>>;
2014
2031
  value: z.ZodOptional<z.ZodDiscriminatedUnion<[
2015
2032
  z.ZodObject<{
2016
2033
  type: z.ZodLiteral<"string">;
@@ -2096,6 +2113,7 @@ declare const CommandSchema: z.ZodDiscriminatedUnion<[
2096
2113
  ], "type">;
2097
2114
  target: z.ZodObject<{
2098
2115
  name: z.ZodString;
2116
+ isElementHidden: z.ZodOptional<z.ZodBoolean>;
2099
2117
  uniqueSelectors: z.ZodArray<z.ZodDiscriminatedUnion<[
2100
2118
  z.ZodObject<{
2101
2119
  type: z.ZodLiteral<"pw.selectorString">;
@@ -2740,6 +2758,7 @@ declare const CommandSchema: z.ZodDiscriminatedUnion<[
2740
2758
  ], "type">;
2741
2759
  target: z.ZodObject<{
2742
2760
  name: z.ZodString;
2761
+ isElementHidden: z.ZodOptional<z.ZodBoolean>;
2743
2762
  uniqueSelectors: z.ZodArray<z.ZodDiscriminatedUnion<[
2744
2763
  z.ZodObject<{
2745
2764
  type: z.ZodLiteral<"pw.selectorString">;
@@ -4335,6 +4354,7 @@ declare const StepDefinitionSchema: z.ZodObject<{
4335
4354
  ], "type">;
4336
4355
  target: z.ZodObject<{
4337
4356
  name: z.ZodString;
4357
+ isElementHidden: z.ZodOptional<z.ZodBoolean>;
4338
4358
  uniqueSelectors: z.ZodArray<z.ZodDiscriminatedUnion<[
4339
4359
  z.ZodObject<{
4340
4360
  type: z.ZodLiteral<"pw.selectorString">;
@@ -5010,6 +5030,14 @@ declare const StepDefinitionSchema: z.ZodObject<{
5010
5030
  z.ZodObject<{
5011
5031
  type: z.ZodLiteral<"toHaveProperty">;
5012
5032
  name: z.ZodString;
5033
+ operator: z.ZodOptional<z.ZodEnum<{
5034
+ equals: "equals";
5035
+ notEquals: "notEquals";
5036
+ contains: "contains";
5037
+ lessThan: "lessThan";
5038
+ greaterThan: "greaterThan";
5039
+ exists: "exists";
5040
+ }>>;
5013
5041
  value: z.ZodOptional<z.ZodDiscriminatedUnion<[
5014
5042
  z.ZodObject<{
5015
5043
  type: z.ZodLiteral<"string">;
@@ -5095,6 +5123,7 @@ declare const StepDefinitionSchema: z.ZodObject<{
5095
5123
  ], "type">;
5096
5124
  target: z.ZodObject<{
5097
5125
  name: z.ZodString;
5126
+ isElementHidden: z.ZodOptional<z.ZodBoolean>;
5098
5127
  uniqueSelectors: z.ZodArray<z.ZodDiscriminatedUnion<[
5099
5128
  z.ZodObject<{
5100
5129
  type: z.ZodLiteral<"pw.selectorString">;
@@ -5739,6 +5768,7 @@ declare const StepDefinitionSchema: z.ZodObject<{
5739
5768
  ], "type">;
5740
5769
  target: z.ZodObject<{
5741
5770
  name: z.ZodString;
5771
+ isElementHidden: z.ZodOptional<z.ZodBoolean>;
5742
5772
  uniqueSelectors: z.ZodArray<z.ZodDiscriminatedUnion<[
5743
5773
  z.ZodObject<{
5744
5774
  type: z.ZodLiteral<"pw.selectorString">;
@@ -7411,10 +7441,26 @@ type ExecutionStatusUpdateEventData = {
7411
7441
  result: ExecResult;
7412
7442
  resolvedChosenSelectorIndex?: number;
7413
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
+ };
7414
7454
  } | RecoveryStatusEvent;
7415
7455
  type ExecutionCompletedEventData = {
7416
7456
  type: "execution_completed";
7417
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;
7418
7464
  };
7419
7465
  type ExecutionStartedEventData = {
7420
7466
  type: "execution_started";
@@ -8793,6 +8839,9 @@ type PWSelectorDetails = {
8793
8839
  score: number;
8794
8840
  elements?: Element[];
8795
8841
  };
8842
+ type SelectorGenerationOptions = Partial<InternalOptions> & {
8843
+ visibleOnly?: boolean;
8844
+ };
8796
8845
  declare class SelectorGenerator {
8797
8846
  private injectedScript;
8798
8847
  private _pw;
@@ -8805,7 +8854,7 @@ declare class SelectorGenerator {
8805
8854
  private pushCandidate;
8806
8855
  getMatchingElements(selector: string, options?: {
8807
8856
  visibleOnly?: boolean;
8808
- root?: Element;
8857
+ root?: Element | Document;
8809
8858
  prefix?: string;
8810
8859
  }): Element[];
8811
8860
  private addNearestTextToSelectors;
@@ -8813,13 +8862,14 @@ declare class SelectorGenerator {
8813
8862
  buildPWNoTextCandidates(element: Element, options?: InternalOptions): PWSelectorDetails[];
8814
8863
  computeUnique(element: Element, locatorGenerator: (element: Element, options?: InternalOptions & {
8815
8864
  isTargetNode: boolean;
8816
- }) => PWSelectorDetails[], strategy: "text" | "css", options?: InternalOptions): Generator<UniqueSelector>;
8865
+ }) => PWSelectorDetails[], strategy: "text" | "css", options?: SelectorGenerationOptions): Generator<UniqueSelector>;
8817
8866
  computeUnique2(element: Element, locatorGenerator: (element: Element, options?: InternalOptions & {
8818
8867
  isTargetNode: boolean;
8819
- }) => PWSelectorDetails[], strategy: "text" | "css", options?: InternalOptions): Generator<UniqueSelector>;
8820
- 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>;
8821
8870
  getCSSChainSelector(element: Element, options: {
8822
8871
  root?: Element | Document;
8872
+ visibleOnly?: boolean;
8823
8873
  }): string;
8824
8874
  getUniqueSelectors(element: Element, options?: InternalOptions & {
8825
8875
  timeout?: number;
@@ -8849,6 +8899,7 @@ type ElementActionEvent = {
8849
8899
  bvtId: string;
8850
8900
  details: ElementDetails;
8851
8901
  uniqueSelectors: UniqueSelector[];
8902
+ isElementHidden?: boolean;
8852
8903
  };
8853
8904
  statistics: {
8854
8905
  handleEventDurationMs: string;
@@ -9048,6 +9099,25 @@ type TraceUploadRequestInput = {
9048
9099
  testCaseId: string;
9049
9100
  projectId: string;
9050
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
+ };
9051
9121
  type ReplayOrchestratorResult = {
9052
9122
  classification: {
9053
9123
  label: string;
@@ -9063,6 +9133,9 @@ type TesterApiClient = {
9063
9133
  getPresignedUrlForTraceUpload: {
9064
9134
  query(input: TraceUploadRequestInput): Promise<string>;
9065
9135
  };
9136
+ getPresignedUrlsForScreenshotUpload: {
9137
+ query(input: ScreenshotUploadRequestInput): Promise<ScreenshotUploadTarget[]>;
9138
+ };
9066
9139
  };
9067
9140
  project: {
9068
9141
  getProjectSettings: {
@@ -9099,6 +9172,9 @@ type UnboxedTuple<T extends unknown[]> = {
9099
9172
  [K in keyof T]: Unboxed<T[K]>;
9100
9173
  };
9101
9174
  type LocatorScope = Frame | FrameLocator;
9175
+ type LocatorVisibilityOptions = {
9176
+ isElementHidden?: boolean;
9177
+ };
9102
9178
  type GlobalThis = {
9103
9179
  __bvt: {
9104
9180
  BrowserObserver: typeof BrowserObserver;
@@ -9222,6 +9298,15 @@ type TesterSession = {
9222
9298
  token?: string;
9223
9299
  trace?: TesterTraceConfig;
9224
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";
9225
9310
  };
9226
9311
  type ExecuteStepsInput = {
9227
9312
  recorderSteps: {
@@ -9261,6 +9346,19 @@ declare class Tester {
9261
9346
  private sessionToken;
9262
9347
  private activeBrowserContext;
9263
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;
9264
9362
  constructor(getAPIClient?: GetAPIClient, observabilityOrOptions?: AgentObservabilityInput | TesterOptions, optionsArg?: TesterOptions);
9265
9363
  setContext(context: ResolutionContext): void;
9266
9364
  setStepTraceChunkCallbacks(callbacks: StepTraceChunkCallbacks | undefined): void;
@@ -9271,6 +9369,22 @@ declare class Tester {
9271
9369
  private summarizeErrorForExecutionLog;
9272
9370
  private summarizeSessionForExecutionLog;
9273
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;
9274
9388
  private onCommandStart;
9275
9389
  private onCommandPass;
9276
9390
  private onCommandFail;
@@ -9282,6 +9396,12 @@ declare class Tester {
9282
9396
  private isRunSession;
9283
9397
  private isRecordingReplaySession;
9284
9398
  private shouldAttemptAiRecovery;
9399
+ private isNewTourMaintenanceRecoverySession;
9400
+ private shouldUseNewTourMaintenanceRecovery;
9401
+ private inferNewTourGenderOption;
9402
+ private buildNewTourGenderRadioCommand;
9403
+ private buildNewTourGenderRepairPlan;
9404
+ private recoverNewTourMaintenanceGenderCommand;
9285
9405
  private isSupportedRepairContext;
9286
9406
  private shouldUploadTrace;
9287
9407
  private resolveTraceOutputPath;
@@ -9292,6 +9412,16 @@ declare class Tester {
9292
9412
  private wait;
9293
9413
  private uploadFile;
9294
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;
9295
9425
  private onTestCaseFail;
9296
9426
  private isBrowserDerivedCommand;
9297
9427
  private buildFailureContext;
@@ -9349,7 +9479,7 @@ declare class Tester {
9349
9479
  isFrameObject(frameScope: LocatorScope): frameScope is Frame;
9350
9480
  getFrameObjectFromFrameScope(frameScope: FrameLocator | Frame): Promise<Frame>;
9351
9481
  getFrame(scope: Page, frameElementDescriptors: ElementCommand["target"]["frames"]): Promise<LocatorScope>;
9352
- getLocator(scope: LocatorScope, uniqueSelector: UniqueSelector): {
9482
+ getLocator(scope: LocatorScope, uniqueSelector: UniqueSelector, options?: LocatorVisibilityOptions): {
9353
9483
  target: Locator;
9354
9484
  };
9355
9485
  executeElementAction(locator: Locator, action: ElementAction): Promise<void>;