@dev-blinq/bvt-playwright-js 1.0.0-dev.4.staging.74.1 → 1.0.0-dev.4.staging.83.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
@@ -6491,12 +6491,12 @@ declare const StepDefinitionSchema: z.ZodObject<{
6491
6491
  }, z.core.$strict>
6492
6492
  ], "type">>;
6493
6493
  type: z.ZodOptional<z.ZodEnum<{
6494
- custom: "custom";
6495
6494
  ai: "ai";
6496
6495
  rec: "rec";
6497
6496
  api: "api";
6498
6497
  assert: "assert";
6499
6498
  reuse: "reuse";
6499
+ custom: "custom";
6500
6500
  }>>;
6501
6501
  allowCustomWholeStepRepair: z.ZodOptional<z.ZodBoolean>;
6502
6502
  }, z.core.$strict>;
@@ -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 = {
@@ -7485,11 +7486,11 @@ declare const ResolutionContextSchema: z.ZodObject<{
7485
7486
  type ResolutionContext = z.infer<typeof ResolutionContextSchema>;
7486
7487
  declare const BrowserObserverStateKSchema: z.ZodUnion<readonly [
7487
7488
  z.ZodEnum<{
7489
+ ai: "ai";
7488
7490
  input: "input";
7489
7491
  text: "text";
7490
7492
  context: "context";
7491
7493
  hover: "hover";
7492
- ai: "ai";
7493
7494
  none: "none";
7494
7495
  snapshot: "snapshot";
7495
7496
  element: "element";
@@ -8212,11 +8213,13 @@ type CustomCodeRuntimeOptions = {
8212
8213
  readonly driver?: CustomCodeDriver;
8213
8214
  readonly policy?: CustomCodePolicy;
8214
8215
  readonly logger?: AgentLoggerInput;
8216
+ readonly pgHostBridge?: boolean;
8215
8217
  };
8216
8218
  declare class CustomCodeRuntime {
8217
8219
  private readonly driver;
8218
8220
  private readonly policy;
8219
8221
  private readonly logger?;
8222
+ private readonly pgHostBridge;
8220
8223
  constructor(options?: CustomCodeRuntimeOptions);
8221
8224
  execute(input: ExecuteCustomCodeInput): Promise<CustomCodeExecutionResult>;
8222
8225
  }
@@ -9358,6 +9361,8 @@ declare class Tester {
9358
9361
  headers: Record<string, string>;
9359
9362
  bodyText: string;
9360
9363
  bodyJson?: unknown;
9364
+ } | {
9365
+ resolvedChosenSelectorIndex: number;
9361
9366
  } | undefined>;
9362
9367
  /**
9363
9368
  * Runtime test-data accessor bound to the tester's current data provider and
package/index.mjs CHANGED
@@ -9803,6 +9803,7 @@ const FieldKindSchema = _enum([
9803
9803
  "number",
9804
9804
  "date",
9805
9805
  "select",
9806
+ "custom-select",
9806
9807
  "multiselect",
9807
9808
  "checkbox",
9808
9809
  "radio",
@@ -9829,12 +9830,23 @@ const FillFormBatchResultEntrySchema = object({
9829
9830
  "error"
9830
9831
  ]),
9831
9832
  error: string().optional(),
9832
- actualValue: string().optional()
9833
+ actualValue: string().optional(),
9834
+ signal: object({
9835
+ filled: boolean(),
9836
+ matchesConfirmField: boolean().optional(),
9837
+ valueSatisfiesIntent: boolean().optional()
9838
+ }).strict().optional()
9833
9839
  }).strict();
9834
9840
  const FillFormBatchResultSchema = object({
9835
9841
  results: array(FillFormBatchResultEntrySchema),
9836
- domGrew: boolean()
9842
+ domGrew: boolean(),
9843
+ fieldTimingsMs: array(number().nonnegative()).optional()
9844
+ }).strict();
9845
+ const FormFieldDataTokenSchema = object({
9846
+ fieldId: string().min(1),
9847
+ value: union([string(), array(string())])
9837
9848
  }).strict();
9849
+ const FormFieldDataTokenPlanSchema = object({ tokens: array(FormFieldDataTokenSchema) }).strict();
9838
9850
 
9839
9851
  //#endregion
9840
9852
  //#region ../../core/schemas/src/ai-chat/types.ts
@@ -9885,13 +9897,31 @@ const GenerateParameterizedStepNameRequestSchema = object({
9885
9897
  scenarioId: string().min(1).optional(),
9886
9898
  projectId: string().min(1).optional()
9887
9899
  });
9900
+ const AiChatFormFieldSnapshotSchema = object({
9901
+ tag: string().min(1),
9902
+ type: string().nullable(),
9903
+ id: string().nullable(),
9904
+ name: string().nullable(),
9905
+ ariaLabel: string().nullable(),
9906
+ placeholder: string().nullable(),
9907
+ required: boolean(),
9908
+ disabled: boolean(),
9909
+ readOnly: boolean().default(false),
9910
+ label: string().nullable(),
9911
+ selector: string().nullable(),
9912
+ options: array(string()).optional(),
9913
+ formIndex: number().int().nonnegative().nullable().optional(),
9914
+ formName: string().nullable().optional()
9915
+ }).strict();
9888
9916
  const AiChatPageContextSchema = object({
9889
9917
  url: string().url(),
9890
9918
  title: string().min(1),
9891
9919
  accessibilityTree: string().min(1),
9892
9920
  visibleText: string().min(1).optional(),
9893
9921
  domSnapshot: string().min(1).optional(),
9894
- screenshotBase64: string().min(1).optional()
9922
+ screenshotBase64: string().min(1).optional(),
9923
+ formFields: array(AiChatFormFieldSnapshotSchema).optional(),
9924
+ formFieldsCapped: boolean().optional()
9895
9925
  }).strict();
9896
9926
  const ValidationComplexitySchema = _enum([
9897
9927
  "simple",
@@ -21089,6 +21119,11 @@ async function restoreSessionStorageState(page, value) {
21089
21119
 
21090
21120
  //#endregion
21091
21121
  //#region ../../core/bvt-agent/src/agent/tester.ts
21122
+ function getResolvedChosenSelectorIndex(result) {
21123
+ if (!result || typeof result !== "object") return;
21124
+ const candidate = result.resolvedChosenSelectorIndex;
21125
+ return Number.isInteger(candidate) ? candidate : void 0;
21126
+ }
21092
21127
  const browserTypesMap = {
21093
21128
  chromium,
21094
21129
  firefox,
@@ -21247,7 +21282,7 @@ var Tester = class {
21247
21282
  startedAt: /* @__PURE__ */ new Date()
21248
21283
  };
21249
21284
  }
21250
- async onCommandPass(command, stepDefinitionId, session, recovery) {
21285
+ async onCommandPass(command, stepDefinitionId, session, metadata) {
21251
21286
  this.obs.logger.log(`Command executed successfully: ${command}`);
21252
21287
  if (session?.type === "run") {
21253
21288
  this.obs.logger.log(`Ending Playwright tracing group for command: ${command}`);
@@ -21264,7 +21299,8 @@ var Tester = class {
21264
21299
  stepDefinitionId,
21265
21300
  completedAt,
21266
21301
  result: { type: "success" },
21267
- recovery
21302
+ ...typeof metadata?.resolvedChosenSelectorIndex === "number" ? { resolvedChosenSelectorIndex: metadata.resolvedChosenSelectorIndex } : {},
21303
+ ...metadata?.recovery ? { recovery: metadata.recovery } : {}
21268
21304
  };
21269
21305
  }
21270
21306
  async onCommandFail(command, stepDefinitionId, error, session, recovery) {
@@ -21557,7 +21593,7 @@ var Tester = class {
21557
21593
  });
21558
21594
  if ((command.type === "custom" || command.type === "custom.code") && commandResult && isFailedCustomCommandResult(commandResult)) throw new Error(commandResult.error || `Custom command "${command._id}" failed.`);
21559
21595
  this.obs.logger.log(`Finished executing command: ${command}`);
21560
- yield await this.onCommandPass(command, stepDefinitionId, session);
21596
+ yield await this.onCommandPass(command, stepDefinitionId, session, { resolvedChosenSelectorIndex: getResolvedChosenSelectorIndex(commandResult) });
21561
21597
  } catch (error) {
21562
21598
  const executionError = this.toExecutionError(error);
21563
21599
  let terminalExecutionError = executionError;
@@ -21676,7 +21712,7 @@ var Tester = class {
21676
21712
  };
21677
21713
  emittedTerminalRecoveryStatus = true;
21678
21714
  this.obs.logger.log(`Recovered command ${command._id} with whole-step repair`);
21679
- yield await this.onCommandPass(command, stepDefinitionId, session, recoveryMeta);
21715
+ yield await this.onCommandPass(command, stepDefinitionId, session, { recovery: recoveryMeta });
21680
21716
  commandIndex = recorderStep.definition.commands.length - 1;
21681
21717
  continue;
21682
21718
  } catch (retryError) {
@@ -21794,7 +21830,7 @@ var Tester = class {
21794
21830
  };
21795
21831
  emittedTerminalRecoveryStatus = true;
21796
21832
  this.obs.logger.log(`Recovered command ${command._id} with step repair`);
21797
- yield await this.onCommandPass(command, stepDefinitionId, session, recoveryMeta);
21833
+ yield await this.onCommandPass(command, stepDefinitionId, session, { recovery: recoveryMeta });
21798
21834
  if (decision.stepRepairPlan.type === "command-operations" || decision.stepRepairPlan.preserveSuffix) commandIndex = recorderStep.definition.commands.length - 1;
21799
21835
  continue;
21800
21836
  } catch (retryError) {
@@ -22382,7 +22418,7 @@ var Tester = class {
22382
22418
  };
22383
22419
  await this.executeElementAction(locator.target, dataWithModifiedTimeout);
22384
22420
  this.obs.logger.info(`Action "${data.type}" completed successfully on target "${target.name}" with fallback selector`);
22385
- return;
22421
+ return { resolvedChosenSelectorIndex: i };
22386
22422
  } catch (error) {
22387
22423
  this.obs.logger.warn(`Action "${data.type}" failed on fallback selector "${JSON.stringify(selectorInfo, null, 2)}". Trying next selector if available...`, error);
22388
22424
  errors.push(this.toExecutionError(error));
@@ -22432,7 +22468,7 @@ var Tester = class {
22432
22468
  this.obs.logger.info(`Retrying assertion "${data.type}" using next selector: ${JSON.stringify(selectorInfo)}`);
22433
22469
  await this.executeElementAssertion(locator.target, dataWithModifiedTimeout, isNegativeAssertion);
22434
22470
  this.obs.logger.info(`Assertion "${data.type}" passed on target "${target.name}" with fallback selector`);
22435
- return;
22471
+ return { resolvedChosenSelectorIndex: i };
22436
22472
  } catch (error) {
22437
22473
  this.obs.logger.warn(`Assertion "${data.type}" failed on fallback selector "${JSON.stringify(selectorInfo, null, 2)}". Trying next selector if available...`, error);
22438
22474
  errors.push(this.toExecutionError(error));
@@ -22471,7 +22507,7 @@ var Tester = class {
22471
22507
  this.obs.logger.info(`Retrying extraction "${extract.type}" using next selector: ${JSON.stringify(fallbackSelectorInfo)}`);
22472
22508
  await this.executeElementExtraction(fallbackLocator.target, extract, storageDetails);
22473
22509
  this.obs.logger.info(`Extraction "${extract.type}" completed successfully on target "${target.name}" with fallback selector`);
22474
- return;
22510
+ return { resolvedChosenSelectorIndex: i };
22475
22511
  } catch (error) {
22476
22512
  this.obs.logger.warn(`Extraction "${extract.type}" failed on fallback selector "${JSON.stringify(fallbackSelectorInfo, null, 2)}". Trying next selector if available...`, error);
22477
22513
  errors.push(this.toExecutionError(error));