@dev-blinq/bvt-playwright-js 1.0.0-dev.1 → 1.0.0-dev.3

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.
Files changed (4) hide show
  1. package/index.d.mts +363 -170
  2. package/index.mjs +2328 -499
  3. package/index.mjs.map +1 -1
  4. package/package.json +1 -1
package/index.d.mts CHANGED
@@ -3290,6 +3290,23 @@ declare const CommandSchema: z.ZodDiscriminatedUnion<[
3290
3290
  }, z.core.$strict>>;
3291
3291
  }, z.core.$strict>>>;
3292
3292
  }, z.core.$strict>,
3293
+ z.ZodObject<{
3294
+ _id: z.ZodString;
3295
+ type: z.ZodLiteral<"custom.code">;
3296
+ runtime: z.ZodDefault<z.ZodLiteral<"secure-exec-v1">>;
3297
+ language: z.ZodDefault<z.ZodLiteral<"javascript">>;
3298
+ code: z.ZodString;
3299
+ config: z.ZodOptional<z.ZodDefault<z.ZodObject<{
3300
+ continueOnFailure: z.ZodDefault<z.ZodBoolean>;
3301
+ preCommandDelay: z.ZodDefault<z.ZodNumber>;
3302
+ postCommandDelay: z.ZodDefault<z.ZodNumber>;
3303
+ sideEffectPolicy: z.ZodOptional<z.ZodObject<{
3304
+ isDestructive: z.ZodDefault<z.ZodBoolean>;
3305
+ isIdempotent: z.ZodDefault<z.ZodBoolean>;
3306
+ requiresOptIn: z.ZodDefault<z.ZodBoolean>;
3307
+ }, z.core.$strict>>;
3308
+ }, z.core.$strict>>>;
3309
+ }, z.core.$strict>,
3293
3310
  z.ZodObject<{
3294
3311
  _id: z.ZodString;
3295
3312
  type: z.ZodLiteral<"api.action">;
@@ -6272,6 +6289,23 @@ declare const StepDefinitionSchema: z.ZodObject<{
6272
6289
  }, z.core.$strict>>;
6273
6290
  }, z.core.$strict>>>;
6274
6291
  }, z.core.$strict>,
6292
+ z.ZodObject<{
6293
+ _id: z.ZodString;
6294
+ type: z.ZodLiteral<"custom.code">;
6295
+ runtime: z.ZodDefault<z.ZodLiteral<"secure-exec-v1">>;
6296
+ language: z.ZodDefault<z.ZodLiteral<"javascript">>;
6297
+ code: z.ZodString;
6298
+ config: z.ZodOptional<z.ZodDefault<z.ZodObject<{
6299
+ continueOnFailure: z.ZodDefault<z.ZodBoolean>;
6300
+ preCommandDelay: z.ZodDefault<z.ZodNumber>;
6301
+ postCommandDelay: z.ZodDefault<z.ZodNumber>;
6302
+ sideEffectPolicy: z.ZodOptional<z.ZodObject<{
6303
+ isDestructive: z.ZodDefault<z.ZodBoolean>;
6304
+ isIdempotent: z.ZodDefault<z.ZodBoolean>;
6305
+ requiresOptIn: z.ZodDefault<z.ZodBoolean>;
6306
+ }, z.core.$strict>>;
6307
+ }, z.core.$strict>>>;
6308
+ }, z.core.$strict>,
6275
6309
  z.ZodObject<{
6276
6310
  _id: z.ZodString;
6277
6311
  type: z.ZodLiteral<"api.action">;
@@ -7307,11 +7341,11 @@ type ExecutionStartedEventData = {
7307
7341
  type: "execution_started";
7308
7342
  };
7309
7343
  declare const ScopeTypeSchema: z.ZodEnum<{
7344
+ runtime: "runtime";
7310
7345
  environment: "environment";
7311
7346
  global: "global";
7312
7347
  feature: "feature";
7313
7348
  scenario: "scenario";
7314
- runtime: "runtime";
7315
7349
  }>;
7316
7350
  type ScopeType = z.infer<typeof ScopeTypeSchema>;
7317
7351
  declare const TestDataTypeSchema: z.ZodEnum<{
@@ -7342,11 +7376,11 @@ declare const TestDataEntrySchema: z.ZodObject<{
7342
7376
  }>;
7343
7377
  scope: z.ZodObject<{
7344
7378
  type: z.ZodEnum<{
7379
+ runtime: "runtime";
7345
7380
  environment: "environment";
7346
7381
  global: "global";
7347
7382
  feature: "feature";
7348
7383
  scenario: "scenario";
7349
- runtime: "runtime";
7350
7384
  }>;
7351
7385
  environmentId: z.ZodOptional<z.ZodString>;
7352
7386
  featureId: z.ZodOptional<z.ZodString>;
@@ -7773,6 +7807,69 @@ declare const PickedElementSchema: z.ZodObject<{
7773
7807
  stale: z.ZodOptional<z.ZodBoolean>;
7774
7808
  }, z.core.$strict>;
7775
7809
  type PickedElement = z.infer<typeof PickedElementSchema>;
7810
+ declare const ExecutionResultSchema: z.ZodObject<{
7811
+ success: z.ZodBoolean;
7812
+ result: z.ZodOptional<z.ZodUnknown>;
7813
+ error: z.ZodOptional<z.ZodString>;
7814
+ userMessage: z.ZodOptional<z.ZodString>;
7815
+ logs: z.ZodArray<z.ZodString>;
7816
+ checkpoints: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
7817
+ label: z.ZodString;
7818
+ timestampMs: z.ZodNumber;
7819
+ data: z.ZodOptional<z.ZodUnknown>;
7820
+ }, z.core.$strict>>>>;
7821
+ duration: z.ZodNumber;
7822
+ screenshotAfter: z.ZodOptional<z.ZodString>;
7823
+ mutationSignals: z.ZodOptional<z.ZodObject<{
7824
+ httpMutations: z.ZodArray<z.ZodObject<{
7825
+ method: z.ZodEnum<{
7826
+ POST: "POST";
7827
+ PUT: "PUT";
7828
+ PATCH: "PATCH";
7829
+ DELETE: "DELETE";
7830
+ }>;
7831
+ url: z.ZodString;
7832
+ status: z.ZodNumber;
7833
+ timestampMs: z.ZodNumber;
7834
+ }, z.core.$strict>>;
7835
+ cookieChanges: z.ZodArray<z.ZodObject<{
7836
+ name: z.ZodString;
7837
+ action: z.ZodEnum<{
7838
+ added: "added";
7839
+ modified: "modified";
7840
+ deleted: "deleted";
7841
+ }>;
7842
+ suspectedAuth: z.ZodBoolean;
7843
+ }, z.core.$strict>>;
7844
+ storageMutations: z.ZodObject<{
7845
+ localStorage: z.ZodObject<{
7846
+ added: z.ZodArray<z.ZodString>;
7847
+ modified: z.ZodArray<z.ZodString>;
7848
+ deleted: z.ZodArray<z.ZodString>;
7849
+ }, z.core.$strict>;
7850
+ sessionStorage: z.ZodObject<{
7851
+ added: z.ZodArray<z.ZodString>;
7852
+ modified: z.ZodArray<z.ZodString>;
7853
+ deleted: z.ZodArray<z.ZodString>;
7854
+ }, z.core.$strict>;
7855
+ }, z.core.$strict>;
7856
+ navigationEvents: z.ZodArray<z.ZodObject<{
7857
+ url: z.ZodString;
7858
+ timestampMs: z.ZodNumber;
7859
+ }, z.core.$strict>>;
7860
+ dialogEvents: z.ZodArray<z.ZodObject<{
7861
+ type: z.ZodEnum<{
7862
+ alert: "alert";
7863
+ confirm: "confirm";
7864
+ prompt: "prompt";
7865
+ }>;
7866
+ message: z.ZodString;
7867
+ }, z.core.$strict>>;
7868
+ downloadCount: z.ZodNumber;
7869
+ pageErrorCount: z.ZodNumber;
7870
+ }, z.core.$strict>>;
7871
+ }, z.core.$strict>;
7872
+ type ExecutionResult = z.infer<typeof ExecutionResultSchema>;
7776
7873
  declare const RecoveryArtifactSchema: z.ZodObject<{
7777
7874
  rootCauseAnalysis: z.ZodString;
7778
7875
  aiLog: z.ZodString;
@@ -7844,6 +7941,206 @@ declare class DownloadStore {
7844
7941
  */
7845
7942
  cancelAll(): void;
7846
7943
  }
7944
+ type CustomCodeAllowedHost = {
7945
+ readonly protocol: "http:" | "https:";
7946
+ readonly hostname: string;
7947
+ };
7948
+ type CustomCodePolicy = {
7949
+ readonly maxDurationMs: number;
7950
+ readonly memoryMb: number;
7951
+ readonly outputBytes: number;
7952
+ readonly payloadBytes: number;
7953
+ readonly packages: readonly string[];
7954
+ readonly env: {
7955
+ readonly allowedKeys: readonly string[];
7956
+ };
7957
+ readonly network: {
7958
+ readonly allowedHosts: readonly CustomCodeAllowedHost[];
7959
+ readonly blockPrivateIpRanges: boolean;
7960
+ };
7961
+ readonly filesystem: {
7962
+ readonly root: string;
7963
+ readonly maxBytesPerFile: number;
7964
+ readonly maxFiles: number;
7965
+ };
7966
+ readonly process: {
7967
+ readonly allowedCommands: readonly string[];
7968
+ readonly maxOutputBytes: number;
7969
+ };
7970
+ readonly browser: {
7971
+ readonly pageMethods: readonly string[];
7972
+ readonly locatorMethods: readonly string[];
7973
+ readonly expectMethods: readonly string[];
7974
+ };
7975
+ };
7976
+ type CustomCodeDriverRunInput = {
7977
+ readonly code: string;
7978
+ readonly filePath: string;
7979
+ readonly policy: CustomCodePolicy;
7980
+ readonly bindings: Readonly<Record<string, unknown>>;
7981
+ readonly onStdout: (message: string) => void;
7982
+ readonly onStderr: (message: string) => void;
7983
+ };
7984
+ type CustomCodeDriverRunResult = {
7985
+ readonly exitCode: number;
7986
+ readonly errorMessage?: string;
7987
+ };
7988
+ interface CustomCodeDriver {
7989
+ run(input: CustomCodeDriverRunInput): Promise<CustomCodeDriverRunResult>;
7990
+ }
7991
+ type LogMethod = (...args: any[]) => void;
7992
+ type LogContext = any;
7993
+ type MetricTags = Record<string, string>;
7994
+ type EventProperties = Record<string, unknown>;
7995
+ type ObservabilityLoggerLike = {
7996
+ info: LogMethod;
7997
+ warn: LogMethod;
7998
+ error: LogMethod;
7999
+ withContext?: (context: LogContext) => ObservabilityLoggerLike;
8000
+ log?: LogMethod;
8001
+ };
8002
+ type ObservabilityMetricsLike = {
8003
+ count: (name: string, value?: number, tags?: MetricTags, context?: LogContext) => void;
8004
+ gauge: (name: string, value: number, unit?: any, tags?: MetricTags, context?: LogContext) => void;
8005
+ histogram: (name: string, value: number, unit?: any, tags?: MetricTags, context?: LogContext) => void;
8006
+ latency: (name: string, startMs: number, tags?: MetricTags, context?: LogContext) => void;
8007
+ withContext?: (context: LogContext) => ObservabilityMetricsLike;
8008
+ };
8009
+ type ObservabilityEventsLike = {
8010
+ track: (name: string, properties?: EventProperties, context?: any) => void;
8011
+ withContext?: (context: any) => ObservabilityEventsLike;
8012
+ };
8013
+ type ConsoleLikeLogger = Partial<Record<"log" | "info" | "warn" | "error", LogMethod>>;
8014
+ interface AgentLogger {
8015
+ log: LogMethod;
8016
+ info: LogMethod;
8017
+ warn: LogMethod;
8018
+ error: LogMethod;
8019
+ withContext: (context: LogContext) => AgentLogger;
8020
+ }
8021
+ interface AgentMetrics {
8022
+ count: (name: string, value?: number, tags?: MetricTags, context?: LogContext) => void;
8023
+ gauge: (name: string, value: number, unit?: any, tags?: MetricTags, context?: LogContext) => void;
8024
+ histogram: (name: string, value: number, unit?: any, tags?: MetricTags, context?: LogContext) => void;
8025
+ latency: (name: string, startMs: number, tags?: MetricTags, context?: LogContext) => void;
8026
+ withContext: (context: LogContext) => AgentMetrics;
8027
+ }
8028
+ interface AgentEvents {
8029
+ track: (name: string, properties?: EventProperties, context?: any) => void;
8030
+ withContext: (context: any) => AgentEvents;
8031
+ }
8032
+ interface AgentObservability {
8033
+ logger: AgentLogger;
8034
+ metrics: AgentMetrics;
8035
+ events: AgentEvents;
8036
+ withContext: (context: LogContext) => AgentObservability;
8037
+ }
8038
+ type AgentLoggerInput = AgentLogger | ObservabilityLoggerLike | ConsoleLikeLogger | undefined;
8039
+ type AgentObservabilityInput = AgentObservability | {
8040
+ logger?: AgentLoggerInput;
8041
+ metrics?: AgentMetrics | ObservabilityMetricsLike;
8042
+ events?: AgentEvents | ObservabilityEventsLike;
8043
+ } | AgentLoggerInput;
8044
+ interface TestDataApiOptions {
8045
+ /**
8046
+ * Called after every successful write. Used by WorkerRuntime to fan out
8047
+ * snapshots over the sessionTestData subscription.
8048
+ */
8049
+ onChange?: () => void;
8050
+ /**
8051
+ * Optional logger. When supplied, every setRuntime/getRuntime call emits a
8052
+ * structured info log so the operator can trace test-data writes without
8053
+ * grepping for `provider.upsert`.
8054
+ */
8055
+ logger?: AgentLoggerInput;
8056
+ }
8057
+ declare class TestDataApi {
8058
+ private readonly provider;
8059
+ private readonly context;
8060
+ private readonly options;
8061
+ private readonly logger?;
8062
+ constructor(provider: ITestDataProvider, context: ResolutionContext, options?: TestDataApiOptions);
8063
+ /**
8064
+ * Save a value to runtime test data.
8065
+ *
8066
+ * Runtime values:
8067
+ * - resolvable as `{{key}}` in subsequent steps within the same execution
8068
+ * - scoped to the current scenario; cleared when the scenario or environment changes
8069
+ * - last write wins for the same key inside one run (idempotent)
8070
+ *
8071
+ * @example in AI-chat-generated custom code
8072
+ * const orderId = await page.locator('[data-order-id]').getAttribute('data-order-id');
8073
+ * await context.testData.setRuntime('orderId', orderId ?? '');
8074
+ *
8075
+ * @example with explicit dataType
8076
+ * await context.testData.setRuntime('authToken', token, { dataType: 'secret' });
8077
+ */
8078
+ setRuntime(key: string, value: string, opts?: {
8079
+ dataType?: TestDataType;
8080
+ }): Promise<void>;
8081
+ /**
8082
+ * Shorthand for {@link setRuntime}. Saves a value to the current session's
8083
+ * runtime scope, resolvable as `{{key}}` in subsequent steps.
8084
+ */
8085
+ set(key: string, value: string, opts?: {
8086
+ dataType?: TestDataType;
8087
+ }): Promise<void>;
8088
+ /**
8089
+ * Shorthand for {@link getRuntime}. Reads a value from the current session's
8090
+ * runtime scope. Returns `null` if no entry exists for `key`.
8091
+ */
8092
+ get(key: string): Promise<string | null>;
8093
+ /**
8094
+ * Read a runtime value previously saved via setRuntime or an extract step.
8095
+ *
8096
+ * Returns `null` if no entry exists for `key` in the current runtime scope.
8097
+ * Does NOT walk the scope chain. For full resolution including environment +
8098
+ * global, use the `{{key}}` token syntax with the resolver.
8099
+ */
8100
+ getRuntime(key: string): Promise<string | null>;
8101
+ /**
8102
+ * Read a value through the full runtime → scenario → feature → environment → global
8103
+ * scope chain. This is used by built-in utility commands that need the raw value
8104
+ * rather than `{{key}}` token interpolation.
8105
+ */
8106
+ getScoped(key: string): Promise<string | null>;
8107
+ }
8108
+ type CustomCodeLogEntry = {
8109
+ readonly level: "info" | "warn" | "error";
8110
+ readonly message: string;
8111
+ };
8112
+ type CustomCodeCheckpoint = {
8113
+ readonly label: string;
8114
+ readonly timestampMs: number;
8115
+ readonly data?: unknown;
8116
+ };
8117
+ type CustomCodeExecutionResult = Omit<ExecutionResult, "logs" | "checkpoints" | "duration"> & {
8118
+ readonly logs?: readonly CustomCodeLogEntry[];
8119
+ readonly checkpoints?: readonly CustomCodeCheckpoint[];
8120
+ readonly errorKind?: string;
8121
+ };
8122
+ type ExecuteCustomCodeInput = {
8123
+ readonly commandId: string;
8124
+ readonly code: string;
8125
+ readonly variables: Readonly<Record<string, string>>;
8126
+ readonly page: Page;
8127
+ readonly testData?: Pick<TestDataApi, "set" | "get" | "setRuntime" | "getRuntime" | "getScoped">;
8128
+ readonly fetchImpl: typeof fetch;
8129
+ readonly checkpoint: (label: string, data?: unknown) => Promise<void>;
8130
+ readonly signal?: AbortSignal;
8131
+ };
8132
+ type CustomCodeRuntimeOptions = {
8133
+ readonly driver?: CustomCodeDriver;
8134
+ readonly policy?: CustomCodePolicy;
8135
+ readonly logger?: AgentLoggerInput;
8136
+ };
8137
+ declare class CustomCodeRuntime {
8138
+ private readonly driver;
8139
+ private readonly policy;
8140
+ private readonly logger?;
8141
+ constructor(options?: CustomCodeRuntimeOptions);
8142
+ execute(input: ExecuteCustomCodeInput): Promise<CustomCodeExecutionResult>;
8143
+ }
7847
8144
  type AriaRole = "alert" | "alertdialog" | "application" | "article" | "banner" | "blockquote" | "button" | "caption" | "cell" | "checkbox" | "code" | "columnheader" | "combobox" | "complementary" | "contentinfo" | "definition" | "deletion" | "dialog" | "directory" | "document" | "emphasis" | "feed" | "figure" | "form" | "generic" | "grid" | "gridcell" | "group" | "heading" | "img" | "insertion" | "link" | "list" | "listbox" | "listitem" | "log" | "main" | "mark" | "marquee" | "math" | "meter" | "menu" | "menubar" | "menuitem" | "menuitemcheckbox" | "menuitemradio" | "navigation" | "none" | "note" | "option" | "paragraph" | "presentation" | "progressbar" | "radio" | "radiogroup" | "region" | "row" | "rowgroup" | "rowheader" | "scrollbar" | "search" | "searchbox" | "separator" | "slider" | "spinbutton" | "status" | "strong" | "subscript" | "superscript" | "switch" | "tab" | "table" | "tablist" | "tabpanel" | "term" | "textbox" | "time" | "timer" | "toolbar" | "tooltip" | "tree" | "treegrid" | "treeitem";
7848
8145
  type AriaProps = {
7849
8146
  checked?: boolean | "mixed";
@@ -8659,111 +8956,6 @@ type TesterApiClient = {
8659
8956
  };
8660
8957
  };
8661
8958
  };
8662
- type LogMethod = (...args: any[]) => void;
8663
- type LogContext = any;
8664
- type MetricTags = Record<string, string>;
8665
- type EventProperties = Record<string, unknown>;
8666
- type ObservabilityLoggerLike = {
8667
- info: LogMethod;
8668
- warn: LogMethod;
8669
- error: LogMethod;
8670
- withContext?: (context: LogContext) => ObservabilityLoggerLike;
8671
- log?: LogMethod;
8672
- };
8673
- type ObservabilityMetricsLike = {
8674
- count: (name: string, value?: number, tags?: MetricTags, context?: LogContext) => void;
8675
- gauge: (name: string, value: number, unit?: any, tags?: MetricTags, context?: LogContext) => void;
8676
- histogram: (name: string, value: number, unit?: any, tags?: MetricTags, context?: LogContext) => void;
8677
- latency: (name: string, startMs: number, tags?: MetricTags, context?: LogContext) => void;
8678
- withContext?: (context: LogContext) => ObservabilityMetricsLike;
8679
- };
8680
- type ObservabilityEventsLike = {
8681
- track: (name: string, properties?: EventProperties, context?: any) => void;
8682
- withContext?: (context: any) => ObservabilityEventsLike;
8683
- };
8684
- type ConsoleLikeLogger = Partial<Record<"log" | "info" | "warn" | "error", LogMethod>>;
8685
- interface AgentLogger {
8686
- log: LogMethod;
8687
- info: LogMethod;
8688
- warn: LogMethod;
8689
- error: LogMethod;
8690
- withContext: (context: LogContext) => AgentLogger;
8691
- }
8692
- interface AgentMetrics {
8693
- count: (name: string, value?: number, tags?: MetricTags, context?: LogContext) => void;
8694
- gauge: (name: string, value: number, unit?: any, tags?: MetricTags, context?: LogContext) => void;
8695
- histogram: (name: string, value: number, unit?: any, tags?: MetricTags, context?: LogContext) => void;
8696
- latency: (name: string, startMs: number, tags?: MetricTags, context?: LogContext) => void;
8697
- withContext: (context: LogContext) => AgentMetrics;
8698
- }
8699
- interface AgentEvents {
8700
- track: (name: string, properties?: EventProperties, context?: any) => void;
8701
- withContext: (context: any) => AgentEvents;
8702
- }
8703
- interface AgentObservability {
8704
- logger: AgentLogger;
8705
- metrics: AgentMetrics;
8706
- events: AgentEvents;
8707
- withContext: (context: LogContext) => AgentObservability;
8708
- }
8709
- type AgentLoggerInput = AgentLogger | ObservabilityLoggerLike | ConsoleLikeLogger | undefined;
8710
- type AgentObservabilityInput = AgentObservability | {
8711
- logger?: AgentLoggerInput;
8712
- metrics?: AgentMetrics | ObservabilityMetricsLike;
8713
- events?: AgentEvents | ObservabilityEventsLike;
8714
- } | AgentLoggerInput;
8715
- interface TestDataApiOptions {
8716
- /**
8717
- * Called after every successful write. Used by WorkerRuntime to fan out
8718
- * snapshots over the sessionTestData subscription.
8719
- */
8720
- onChange?: () => void;
8721
- /**
8722
- * Optional logger. When supplied, every setRuntime/getRuntime call emits a
8723
- * structured info log so the operator can trace test-data writes without
8724
- * grepping for `provider.upsert`.
8725
- */
8726
- logger?: AgentLoggerInput;
8727
- }
8728
- declare class TestDataApi {
8729
- private readonly provider;
8730
- private readonly context;
8731
- private readonly options;
8732
- private readonly logger?;
8733
- constructor(provider: ITestDataProvider, context: ResolutionContext, options?: TestDataApiOptions);
8734
- /**
8735
- * Save a value to runtime test data.
8736
- *
8737
- * Runtime values:
8738
- * - resolvable as `{{key}}` in subsequent steps within the same execution
8739
- * - scoped to the current scenario; cleared when the scenario or environment changes
8740
- * - last write wins for the same key inside one run (idempotent)
8741
- *
8742
- * @example in AI-chat-generated custom code
8743
- * const orderId = await page.locator('[data-order-id]').getAttribute('data-order-id');
8744
- * await context.testData.setRuntime('orderId', orderId ?? '');
8745
- *
8746
- * @example with explicit dataType
8747
- * await context.testData.setRuntime('authToken', token, { dataType: 'secret' });
8748
- */
8749
- setRuntime(key: string, value: string, opts?: {
8750
- dataType?: TestDataType;
8751
- }): Promise<void>;
8752
- /**
8753
- * Read a runtime value previously saved via setRuntime or an extract step.
8754
- *
8755
- * Returns `null` if no entry exists for `key` in the current runtime scope.
8756
- * Does NOT walk the scope chain. For full resolution including environment +
8757
- * global, use the `{{key}}` token syntax with the resolver.
8758
- */
8759
- getRuntime(key: string): Promise<string | null>;
8760
- /**
8761
- * Read a value through the full runtime → scenario → feature → environment → global
8762
- * scope chain. This is used by built-in utility commands that need the raw value
8763
- * rather than `{{key}}` token interpolation.
8764
- */
8765
- getScoped(key: string): Promise<string | null>;
8766
- }
8767
8959
  type ApiExecutionResponse = ApiResponseSnapshot;
8768
8960
  type CommandExecutionContext = {
8769
8961
  stepParameters?: Record<string, string>;
@@ -8874,6 +9066,7 @@ type TesterOptions = {
8874
9066
  * an absolute path. Lets the caller (worker / planner) own FS layout.
8875
9067
  */
8876
9068
  getDownloadTargetPath?: (fileName: string) => string;
9069
+ customCodeRuntime?: CustomCodeRuntime;
8877
9070
  };
8878
9071
  type TesterTraceConfig = {
8879
9072
  mode?: "upload";
@@ -8923,6 +9116,7 @@ declare class Tester {
8923
9116
  private readonly fileResolver?;
8924
9117
  private readonly downloadStore?;
8925
9118
  private readonly getDownloadTargetPath?;
9119
+ private readonly customCodeRuntime?;
8926
9120
  private pageList;
8927
9121
  private sessionToken;
8928
9122
  private activeBrowserContext;
@@ -9077,7 +9271,7 @@ declare class Tester {
9077
9271
  downloadCount: number;
9078
9272
  pageErrorCount: number;
9079
9273
  } | undefined;
9080
- } | {
9274
+ } | CustomCodeExecutionResult | {
9081
9275
  status: number;
9082
9276
  statusText: string;
9083
9277
  timeMs: number;
@@ -9086,6 +9280,14 @@ declare class Tester {
9086
9280
  bodyText: string;
9087
9281
  bodyJson?: unknown;
9088
9282
  } | undefined>;
9283
+ /**
9284
+ * Runtime test-data accessor bound to the tester's current data provider and
9285
+ * resolution context. Returns `undefined` when no provider/context is
9286
+ * configured (e.g. a tester constructed without a test-data layer). A fresh
9287
+ * instance is returned each access so it always reflects the latest context
9288
+ * set via `setContext`.
9289
+ */
9290
+ get testDataApi(): TestDataApi | undefined;
9089
9291
  extractToTestData(input: {
9090
9292
  key: string;
9091
9293
  value: string;
@@ -9120,13 +9322,45 @@ export type PlaywrightRunnerParameters = {
9120
9322
  export type PlaywrightRunnerOptions = {
9121
9323
  readonly parameters?: PlaywrightRunnerParameters;
9122
9324
  };
9123
- export type PlaywrightRunnerTester = Pick<Tester, "executeCommand"> & Partial<Pick<Tester, "setContext">>;
9325
+ export type PlaywrightRunnerTester = Pick<Tester, "executeCommand"> & Partial<Pick<Tester, "setContext" | "testDataApi">>;
9124
9326
  export type PlaywrightRunnerDependencies = {
9125
9327
  readonly tester?: PlaywrightRunnerTester;
9126
9328
  readonly testDataProvider?: ITestDataProvider;
9127
9329
  readonly logger?: Pick<Console, "error" | "info" | "log" | "warn">;
9128
9330
  };
9129
- type GeneratedCommand = Parameters<PlaywrightRunnerTester["executeCommand"]>[0]["command"];
9331
+ /**
9332
+ * Tagged union the recorder stores in `command.data.value` for assertions
9333
+ * that accept a string-or-regex (`toHaveText`, `toHaveURL`, ...) or a
9334
+ * primitive-or-regex (`toHaveJSProperty`). Mirrors the `StringOrRegex` /
9335
+ * `PrimitiveOrRegex` schemas in `@blinq/schemas/base.schema`.
9336
+ */
9337
+ export type MatcherValueInput = {
9338
+ type: "string";
9339
+ value: string;
9340
+ } | {
9341
+ type: "number";
9342
+ value: number;
9343
+ } | {
9344
+ type: "boolean";
9345
+ value: boolean;
9346
+ } | {
9347
+ type: "regex";
9348
+ source: string;
9349
+ flags?: string;
9350
+ };
9351
+ /**
9352
+ * Resolve the recorder's tagged value into the form Playwright's matchers
9353
+ * expect: a plain string/number/boolean, or a `RegExp` for `{ type: "regex" }`.
9354
+ *
9355
+ * Generated spec code calls this on `resolvedCommand.data.value` before
9356
+ * passing it to `expect(locator).toHaveText(...)`, `.toHaveJSProperty(...)`,
9357
+ * etc. Returns `undefined` when given `undefined` so it composes cleanly with
9358
+ * optional fields (e.g. `toHaveAttribute`'s `value`).
9359
+ */
9360
+ export declare function toMatcherValue(value: MatcherValueInput): string | number | boolean | RegExp;
9361
+ export declare function toMatcherValue(value: undefined): undefined;
9362
+ export declare function toMatcherValue(value: MatcherValueInput | undefined): string | number | boolean | RegExp | undefined;
9363
+ type GeneratedCommand = Command;
9130
9364
  export declare class TempFileTestDataProvider implements ITestDataProvider {
9131
9365
  readonly filePath: string;
9132
9366
  readonly seedFilePath?: string | undefined;
@@ -9166,63 +9400,7 @@ export declare class PlaywrightRunner {
9166
9400
  */
9167
9401
  attach(page: Page): void;
9168
9402
  detach(): void;
9169
- executeCommand(command: GeneratedCommand, parameters?: Record<string, string>): Promise<{
9170
- success: boolean;
9171
- logs: string[];
9172
- checkpoints: {
9173
- label: string;
9174
- timestampMs: number;
9175
- data?: unknown;
9176
- }[];
9177
- duration: number;
9178
- result?: unknown;
9179
- error?: string | undefined;
9180
- userMessage?: string | undefined;
9181
- screenshotAfter?: string | undefined;
9182
- mutationSignals?: {
9183
- httpMutations: {
9184
- method: "POST" | "PUT" | "PATCH" | "DELETE";
9185
- url: string;
9186
- status: number;
9187
- timestampMs: number;
9188
- }[];
9189
- cookieChanges: {
9190
- name: string;
9191
- action: "added" | "modified" | "deleted";
9192
- suspectedAuth: boolean;
9193
- }[];
9194
- storageMutations: {
9195
- localStorage: {
9196
- added: string[];
9197
- modified: string[];
9198
- deleted: string[];
9199
- };
9200
- sessionStorage: {
9201
- added: string[];
9202
- modified: string[];
9203
- deleted: string[];
9204
- };
9205
- };
9206
- navigationEvents: {
9207
- url: string;
9208
- timestampMs: number;
9209
- }[];
9210
- dialogEvents: {
9211
- type: "alert" | "confirm" | "prompt";
9212
- message: string;
9213
- }[];
9214
- downloadCount: number;
9215
- pageErrorCount: number;
9216
- } | undefined;
9217
- } | {
9218
- status: number;
9219
- statusText: string;
9220
- timeMs: number;
9221
- sizeBytes: number;
9222
- headers: Record<string, string>;
9223
- bodyText: string;
9224
- bodyJson?: unknown;
9225
- } | undefined>;
9403
+ executeCommand(command: GeneratedCommand, parameters?: Record<string, string>): Promise<unknown>;
9226
9404
  /**
9227
9405
  * Run the preprocessor pipeline (step parameters, data-resolver tokens,
9228
9406
  * ai-chat code tokens, test-data API) over `command` and validate the
@@ -9288,6 +9466,12 @@ export type CreateBlinqTestOptions = {
9288
9466
  export type BlinqTestRuntime = {
9289
9467
  readonly page: Page;
9290
9468
  readonly parameters: PlaywrightRunnerParameters;
9469
+ /**
9470
+ * Runtime test-data accessor. Extract steps write the extracted value via
9471
+ * `bvt.testDataApi.setRuntime(key, value, { dataType })` so it resolves as
9472
+ * `{{key}}` in later steps.
9473
+ */
9474
+ readonly testDataApi: TestDataApi;
9291
9475
  executeCommand(command: GeneratedCommand, parameters?: Record<string, string>): Promise<unknown>;
9292
9476
  resolveCommand(command: unknown, parameters?: Record<string, string>): Promise<Command>;
9293
9477
  find(command: Command): Promise<Locator | Page | FrameLocator | null>;
@@ -9298,9 +9482,18 @@ export type BlinqTestFixtures = {
9298
9482
  readonly bvt: BlinqTestRuntime;
9299
9483
  };
9300
9484
  /**
9301
- * Build a Playwright `test` extended with a `bvt` fixture. Generated spec
9302
- * files import `test` from this function and call `bvt.executeCommand(...)`
9303
- * inside `test.step` blocks, exactly as they did with the cucumber runner.
9485
+ * Build a Playwright `test` extended with a `bvt` fixture and a `beforeEach`
9486
+ * hook that navigates to the resolved environment's `baseURL`.
9487
+ *
9488
+ * The environments file is read **synchronously, once** when this function
9489
+ * is called (i.e. when `support/bvt.ts` is evaluated). The resolved baseURL
9490
+ * is then used by a `test.beforeEach` hook that runs **first** before each
9491
+ * test — Playwright executes `beforeEach` hooks in registration order, and
9492
+ * because `createBlinqTest` runs at module-evaluation time, any
9493
+ * user-registered `beforeEach` runs after this one.
9494
+ *
9495
+ * Generated spec files import `test` from this function and call
9496
+ * `bvt.executeCommand(...)` inside `test.step` blocks.
9304
9497
  */
9305
9498
  export declare function createBlinqTest(options?: CreateBlinqTestOptions): import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & BlinqTestFixtures, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions>;
9306
9499