@dev-blinq/bvt-playwright-js 1.0.0-dev.4.staging.79.1 → 1.0.0-dev.4.staging.93.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
@@ -7409,6 +7409,7 @@ type ExecutionStatusUpdateEventData = {
7409
7409
  stepDefinitionId: string;
7410
7410
  completedAt?: ExecutionEventTimestamp;
7411
7411
  result: ExecResult;
7412
+ resolvedChosenSelectorIndex?: number;
7412
7413
  recovery?: RecoveryMetadata;
7413
7414
  } | RecoveryStatusEvent;
7414
7415
  type ExecutionCompletedEventData = {
@@ -7897,6 +7898,7 @@ declare const ExecutionResultSchema: z.ZodObject<{
7897
7898
  data: z.ZodOptional<z.ZodUnknown>;
7898
7899
  }, z.core.$strict>>>>;
7899
7900
  duration: z.ZodNumber;
7901
+ screenshotBefore: z.ZodOptional<z.ZodString>;
7900
7902
  screenshotAfter: z.ZodOptional<z.ZodString>;
7901
7903
  mutationSignals: z.ZodOptional<z.ZodObject<{
7902
7904
  httpMutations: z.ZodArray<z.ZodObject<{
@@ -8911,6 +8913,7 @@ declare class BrowserObserver {
8911
8913
  private rrwebBufferedBytes;
8912
8914
  private rrwebCommandAnchors;
8913
8915
  static instance: BrowserObserver | null;
8916
+ private writeConsole;
8914
8917
  private getRrwebChunkEventCountThreshold;
8915
8918
  private getRrwebChunkByteThreshold;
8916
8919
  private getRrwebMaskProfile;
@@ -9316,6 +9319,7 @@ declare class Tester {
9316
9319
  result?: unknown;
9317
9320
  error?: string | undefined;
9318
9321
  userMessage?: string | undefined;
9322
+ screenshotBefore?: string | undefined;
9319
9323
  screenshotAfter?: string | undefined;
9320
9324
  mutationSignals?: {
9321
9325
  httpMutations: {
@@ -9360,6 +9364,8 @@ declare class Tester {
9360
9364
  headers: Record<string, string>;
9361
9365
  bodyText: string;
9362
9366
  bodyJson?: unknown;
9367
+ } | {
9368
+ resolvedChosenSelectorIndex: number;
9363
9369
  } | undefined>;
9364
9370
  /**
9365
9371
  * Runtime test-data accessor bound to the tester's current data provider and
package/index.mjs CHANGED
@@ -6202,6 +6202,15 @@ const AiRecoveredScenarioVersionSchema = object({
6202
6202
  supersededAt: date().optional()
6203
6203
  }).strict();
6204
6204
 
6205
+ //#endregion
6206
+ //#region ../../core/schemas/src/custom-code-step-template/custom-code-step-template.schema.ts
6207
+ const CustomCodeStepTemplateSchema = object({
6208
+ _id: EntityIdSchema,
6209
+ projectId: EntityIdSchema,
6210
+ name: string().min(1).max(500),
6211
+ code: string().min(1).max(1e5)
6212
+ }).strict();
6213
+
6205
6214
  //#endregion
6206
6215
  //#region ../../core/schemas/src/workspace/workspace.schema.ts
6207
6216
  const EnvironmentSchema = object({
@@ -9842,11 +9851,6 @@ const FillFormBatchResultSchema = object({
9842
9851
  domGrew: boolean(),
9843
9852
  fieldTimingsMs: array(number().nonnegative()).optional()
9844
9853
  }).strict();
9845
- const FormFieldDataTokenSchema = object({
9846
- fieldId: string().min(1),
9847
- value: union([string(), array(string())])
9848
- }).strict();
9849
- const FormFieldDataTokenPlanSchema = object({ tokens: array(FormFieldDataTokenSchema) }).strict();
9850
9854
 
9851
9855
  //#endregion
9852
9856
  //#region ../../core/schemas/src/ai-chat/types.ts
@@ -9960,6 +9964,7 @@ const ExecutionResultSchema = object({
9960
9964
  logs: array(string()),
9961
9965
  checkpoints: array(CheckpointSchema).optional().default([]),
9962
9966
  duration: number().nonnegative(),
9967
+ screenshotBefore: string().optional(),
9963
9968
  screenshotAfter: string().optional(),
9964
9969
  mutationSignals: SegmentMutationSignalsSchema.optional()
9965
9970
  }).strict();
@@ -21119,6 +21124,11 @@ async function restoreSessionStorageState(page, value) {
21119
21124
 
21120
21125
  //#endregion
21121
21126
  //#region ../../core/bvt-agent/src/agent/tester.ts
21127
+ function getResolvedChosenSelectorIndex(result) {
21128
+ if (!result || typeof result !== "object") return;
21129
+ const candidate = result.resolvedChosenSelectorIndex;
21130
+ return Number.isInteger(candidate) ? candidate : void 0;
21131
+ }
21122
21132
  const browserTypesMap = {
21123
21133
  chromium,
21124
21134
  firefox,
@@ -21277,7 +21287,7 @@ var Tester = class {
21277
21287
  startedAt: /* @__PURE__ */ new Date()
21278
21288
  };
21279
21289
  }
21280
- async onCommandPass(command, stepDefinitionId, session, recovery) {
21290
+ async onCommandPass(command, stepDefinitionId, session, metadata) {
21281
21291
  this.obs.logger.log(`Command executed successfully: ${command}`);
21282
21292
  if (session?.type === "run") {
21283
21293
  this.obs.logger.log(`Ending Playwright tracing group for command: ${command}`);
@@ -21294,7 +21304,8 @@ var Tester = class {
21294
21304
  stepDefinitionId,
21295
21305
  completedAt,
21296
21306
  result: { type: "success" },
21297
- recovery
21307
+ ...typeof metadata?.resolvedChosenSelectorIndex === "number" ? { resolvedChosenSelectorIndex: metadata.resolvedChosenSelectorIndex } : {},
21308
+ ...metadata?.recovery ? { recovery: metadata.recovery } : {}
21298
21309
  };
21299
21310
  }
21300
21311
  async onCommandFail(command, stepDefinitionId, error, session, recovery) {
@@ -21587,7 +21598,7 @@ var Tester = class {
21587
21598
  });
21588
21599
  if ((command.type === "custom" || command.type === "custom.code") && commandResult && isFailedCustomCommandResult(commandResult)) throw new Error(commandResult.error || `Custom command "${command._id}" failed.`);
21589
21600
  this.obs.logger.log(`Finished executing command: ${command}`);
21590
- yield await this.onCommandPass(command, stepDefinitionId, session);
21601
+ yield await this.onCommandPass(command, stepDefinitionId, session, { resolvedChosenSelectorIndex: getResolvedChosenSelectorIndex(commandResult) });
21591
21602
  } catch (error) {
21592
21603
  const executionError = this.toExecutionError(error);
21593
21604
  let terminalExecutionError = executionError;
@@ -21706,7 +21717,7 @@ var Tester = class {
21706
21717
  };
21707
21718
  emittedTerminalRecoveryStatus = true;
21708
21719
  this.obs.logger.log(`Recovered command ${command._id} with whole-step repair`);
21709
- yield await this.onCommandPass(command, stepDefinitionId, session, recoveryMeta);
21720
+ yield await this.onCommandPass(command, stepDefinitionId, session, { recovery: recoveryMeta });
21710
21721
  commandIndex = recorderStep.definition.commands.length - 1;
21711
21722
  continue;
21712
21723
  } catch (retryError) {
@@ -21824,7 +21835,7 @@ var Tester = class {
21824
21835
  };
21825
21836
  emittedTerminalRecoveryStatus = true;
21826
21837
  this.obs.logger.log(`Recovered command ${command._id} with step repair`);
21827
- yield await this.onCommandPass(command, stepDefinitionId, session, recoveryMeta);
21838
+ yield await this.onCommandPass(command, stepDefinitionId, session, { recovery: recoveryMeta });
21828
21839
  if (decision.stepRepairPlan.type === "command-operations" || decision.stepRepairPlan.preserveSuffix) commandIndex = recorderStep.definition.commands.length - 1;
21829
21840
  continue;
21830
21841
  } catch (retryError) {
@@ -22412,7 +22423,7 @@ var Tester = class {
22412
22423
  };
22413
22424
  await this.executeElementAction(locator.target, dataWithModifiedTimeout);
22414
22425
  this.obs.logger.info(`Action "${data.type}" completed successfully on target "${target.name}" with fallback selector`);
22415
- return;
22426
+ return { resolvedChosenSelectorIndex: i };
22416
22427
  } catch (error) {
22417
22428
  this.obs.logger.warn(`Action "${data.type}" failed on fallback selector "${JSON.stringify(selectorInfo, null, 2)}". Trying next selector if available...`, error);
22418
22429
  errors.push(this.toExecutionError(error));
@@ -22462,7 +22473,7 @@ var Tester = class {
22462
22473
  this.obs.logger.info(`Retrying assertion "${data.type}" using next selector: ${JSON.stringify(selectorInfo)}`);
22463
22474
  await this.executeElementAssertion(locator.target, dataWithModifiedTimeout, isNegativeAssertion);
22464
22475
  this.obs.logger.info(`Assertion "${data.type}" passed on target "${target.name}" with fallback selector`);
22465
- return;
22476
+ return { resolvedChosenSelectorIndex: i };
22466
22477
  } catch (error) {
22467
22478
  this.obs.logger.warn(`Assertion "${data.type}" failed on fallback selector "${JSON.stringify(selectorInfo, null, 2)}". Trying next selector if available...`, error);
22468
22479
  errors.push(this.toExecutionError(error));
@@ -22501,7 +22512,7 @@ var Tester = class {
22501
22512
  this.obs.logger.info(`Retrying extraction "${extract.type}" using next selector: ${JSON.stringify(fallbackSelectorInfo)}`);
22502
22513
  await this.executeElementExtraction(fallbackLocator.target, extract, storageDetails);
22503
22514
  this.obs.logger.info(`Extraction "${extract.type}" completed successfully on target "${target.name}" with fallback selector`);
22504
- return;
22515
+ return { resolvedChosenSelectorIndex: i };
22505
22516
  } catch (error) {
22506
22517
  this.obs.logger.warn(`Extraction "${extract.type}" failed on fallback selector "${JSON.stringify(fallbackSelectorInfo, null, 2)}". Trying next selector if available...`, error);
22507
22518
  errors.push(this.toExecutionError(error));