@dev-blinq/bvt-playwright-js 1.0.0-dev.4.staging.79.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";
@@ -9360,6 +9361,8 @@ declare class Tester {
9360
9361
  headers: Record<string, string>;
9361
9362
  bodyText: string;
9362
9363
  bodyJson?: unknown;
9364
+ } | {
9365
+ resolvedChosenSelectorIndex: number;
9363
9366
  } | undefined>;
9364
9367
  /**
9365
9368
  * Runtime test-data accessor bound to the tester's current data provider and
package/index.mjs CHANGED
@@ -21119,6 +21119,11 @@ async function restoreSessionStorageState(page, value) {
21119
21119
 
21120
21120
  //#endregion
21121
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
+ }
21122
21127
  const browserTypesMap = {
21123
21128
  chromium,
21124
21129
  firefox,
@@ -21277,7 +21282,7 @@ var Tester = class {
21277
21282
  startedAt: /* @__PURE__ */ new Date()
21278
21283
  };
21279
21284
  }
21280
- async onCommandPass(command, stepDefinitionId, session, recovery) {
21285
+ async onCommandPass(command, stepDefinitionId, session, metadata) {
21281
21286
  this.obs.logger.log(`Command executed successfully: ${command}`);
21282
21287
  if (session?.type === "run") {
21283
21288
  this.obs.logger.log(`Ending Playwright tracing group for command: ${command}`);
@@ -21294,7 +21299,8 @@ var Tester = class {
21294
21299
  stepDefinitionId,
21295
21300
  completedAt,
21296
21301
  result: { type: "success" },
21297
- recovery
21302
+ ...typeof metadata?.resolvedChosenSelectorIndex === "number" ? { resolvedChosenSelectorIndex: metadata.resolvedChosenSelectorIndex } : {},
21303
+ ...metadata?.recovery ? { recovery: metadata.recovery } : {}
21298
21304
  };
21299
21305
  }
21300
21306
  async onCommandFail(command, stepDefinitionId, error, session, recovery) {
@@ -21587,7 +21593,7 @@ var Tester = class {
21587
21593
  });
21588
21594
  if ((command.type === "custom" || command.type === "custom.code") && commandResult && isFailedCustomCommandResult(commandResult)) throw new Error(commandResult.error || `Custom command "${command._id}" failed.`);
21589
21595
  this.obs.logger.log(`Finished executing command: ${command}`);
21590
- yield await this.onCommandPass(command, stepDefinitionId, session);
21596
+ yield await this.onCommandPass(command, stepDefinitionId, session, { resolvedChosenSelectorIndex: getResolvedChosenSelectorIndex(commandResult) });
21591
21597
  } catch (error) {
21592
21598
  const executionError = this.toExecutionError(error);
21593
21599
  let terminalExecutionError = executionError;
@@ -21706,7 +21712,7 @@ var Tester = class {
21706
21712
  };
21707
21713
  emittedTerminalRecoveryStatus = true;
21708
21714
  this.obs.logger.log(`Recovered command ${command._id} with whole-step repair`);
21709
- yield await this.onCommandPass(command, stepDefinitionId, session, recoveryMeta);
21715
+ yield await this.onCommandPass(command, stepDefinitionId, session, { recovery: recoveryMeta });
21710
21716
  commandIndex = recorderStep.definition.commands.length - 1;
21711
21717
  continue;
21712
21718
  } catch (retryError) {
@@ -21824,7 +21830,7 @@ var Tester = class {
21824
21830
  };
21825
21831
  emittedTerminalRecoveryStatus = true;
21826
21832
  this.obs.logger.log(`Recovered command ${command._id} with step repair`);
21827
- yield await this.onCommandPass(command, stepDefinitionId, session, recoveryMeta);
21833
+ yield await this.onCommandPass(command, stepDefinitionId, session, { recovery: recoveryMeta });
21828
21834
  if (decision.stepRepairPlan.type === "command-operations" || decision.stepRepairPlan.preserveSuffix) commandIndex = recorderStep.definition.commands.length - 1;
21829
21835
  continue;
21830
21836
  } catch (retryError) {
@@ -22412,7 +22418,7 @@ var Tester = class {
22412
22418
  };
22413
22419
  await this.executeElementAction(locator.target, dataWithModifiedTimeout);
22414
22420
  this.obs.logger.info(`Action "${data.type}" completed successfully on target "${target.name}" with fallback selector`);
22415
- return;
22421
+ return { resolvedChosenSelectorIndex: i };
22416
22422
  } catch (error) {
22417
22423
  this.obs.logger.warn(`Action "${data.type}" failed on fallback selector "${JSON.stringify(selectorInfo, null, 2)}". Trying next selector if available...`, error);
22418
22424
  errors.push(this.toExecutionError(error));
@@ -22462,7 +22468,7 @@ var Tester = class {
22462
22468
  this.obs.logger.info(`Retrying assertion "${data.type}" using next selector: ${JSON.stringify(selectorInfo)}`);
22463
22469
  await this.executeElementAssertion(locator.target, dataWithModifiedTimeout, isNegativeAssertion);
22464
22470
  this.obs.logger.info(`Assertion "${data.type}" passed on target "${target.name}" with fallback selector`);
22465
- return;
22471
+ return { resolvedChosenSelectorIndex: i };
22466
22472
  } catch (error) {
22467
22473
  this.obs.logger.warn(`Assertion "${data.type}" failed on fallback selector "${JSON.stringify(selectorInfo, null, 2)}". Trying next selector if available...`, error);
22468
22474
  errors.push(this.toExecutionError(error));
@@ -22501,7 +22507,7 @@ var Tester = class {
22501
22507
  this.obs.logger.info(`Retrying extraction "${extract.type}" using next selector: ${JSON.stringify(fallbackSelectorInfo)}`);
22502
22508
  await this.executeElementExtraction(fallbackLocator.target, extract, storageDetails);
22503
22509
  this.obs.logger.info(`Extraction "${extract.type}" completed successfully on target "${target.name}" with fallback selector`);
22504
- return;
22510
+ return { resolvedChosenSelectorIndex: i };
22505
22511
  } catch (error) {
22506
22512
  this.obs.logger.warn(`Extraction "${extract.type}" failed on fallback selector "${JSON.stringify(fallbackSelectorInfo, null, 2)}". Trying next selector if available...`, error);
22507
22513
  errors.push(this.toExecutionError(error));