@unotest/web 0.9.1 → 0.11.0

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.
@@ -1,5 +1,5 @@
1
- import { i as LocatorValue, W as WebDriver, D as DriverContext, d as DriverPage } from '../interfaces-dbZG10RS.js';
2
- export { j as LocatorStep, k as appendStep, l as describeLocator, m as isLocatorValue, r as rootedAt } from '../interfaces-dbZG10RS.js';
1
+ import { i as LocatorValue, W as WebDriver, D as DriverContext, d as DriverPage } from '../interfaces-MxHi1Air.js';
2
+ export { j as LocatorStep, k as appendStep, l as describeLocator, m as isLocatorValue, r as rootedAt } from '../interfaces-MxHi1Air.js';
3
3
  import { Matcher, RegexLiteral } from '@unotest/protocol';
4
4
  import { ExecutionWalker, ExecutionEvent, RunResult, RunOptions } from '@unotest/dsl/executor';
5
5
  export { ExecutionError, ExecutionEvent, RunOptions, RunResult } from '@unotest/dsl/executor';
@@ -46,6 +46,7 @@ declare function filter(loc: LocatorValue, options: {
46
46
  declare function first(loc: LocatorValue): LocatorValue;
47
47
  declare function last(loc: LocatorValue): LocatorValue;
48
48
  declare function nth(loc: LocatorValue, index: number): LocatorValue;
49
+ declare function randomNth(loc: LocatorValue): LocatorValue;
49
50
  declare function contentFrame(loc: LocatorValue): LocatorValue;
50
51
  declare function chainGetByRole(loc: LocatorValue, role: string, options?: {
51
52
  name?: Matcher;
@@ -83,6 +84,12 @@ interface Logger {
83
84
  child(prefix: string): Logger;
84
85
  }
85
86
 
87
+ interface ScreenshotSink {
88
+ /** Persist one PNG capture. Returns the project-relative path the
89
+ * artifact landed at. */
90
+ save(name: string, png: Buffer): Promise<string>;
91
+ }
92
+
86
93
  type DslPrimitive = string | number | boolean | null;
87
94
  type DslObject = {
88
95
  readonly [key: string]: DslValue;
@@ -107,6 +114,10 @@ interface TestRuntimeDeps {
107
114
  readonly baseUrl?: string;
108
115
  /** Injectable clock — defaults to Date.now. Tests pass a fake. */
109
116
  readonly nowFn?: () => number;
117
+ /** Sink for on-demand `screenshot()` captures. Wired by the CLI runner
118
+ * to the run dir; absent in ad-hoc / explore runtimes (the DSL
119
+ * function then logs and skips). */
120
+ readonly screenshots?: ScreenshotSink;
110
121
  }
111
122
  declare class TestRuntime {
112
123
  readonly runId: string;
@@ -115,6 +126,7 @@ declare class TestRuntime {
115
126
  readonly logger: Logger;
116
127
  readonly sandbox: SandboxConfig;
117
128
  readonly baseUrl?: string;
129
+ readonly screenshots?: ScreenshotSink;
118
130
  private readonly variables;
119
131
  private readonly nowFn;
120
132
  private readonly scope;
@@ -254,6 +266,10 @@ declare class TestRuntimeManager {
254
266
  * attach its overlay to the page held open during a debug pause.
255
267
  * Returns null when the runtime is gone or has no page yet. */
256
268
  currentPage(id: string): DriverPage | null;
269
+ /** Every open page of the runtime's context (debug picker arms its overlay
270
+ * on all of them at once, Playwright-codegen style). Empty when the runtime
271
+ * is gone or has no context yet. */
272
+ pages(id: string): readonly DriverPage[];
257
273
  /** The runtime's driver context (for capture artifacts — console/network).
258
274
  * Null when the runtime isn't registered. */
259
275
  currentContext(id: string): DriverContext | null;
@@ -266,4 +282,4 @@ declare class TestRuntimeManager {
266
282
  /** Build a fully-populated FunctionRegistry. */
267
283
  declare function buildDefaultRegistry(): FunctionRegistry;
268
284
 
269
- export { AstExecutor, type DslArg, type DslArray, type DslFunction, type DslObject, type DslValue, FunctionRegistry, LocatorValue, TestRuntime, TestRuntimeManager, buildDefaultRegistry, chainGetByAltText, chainGetByLabel, chainGetByPlaceholder, chainGetByRole, chainGetByTestId, chainGetByText, chainGetByTitle, contentFrame, filter, first, getByAltText, getByLabel, getByPlaceholder, getByRole, getByTestId, getByText, getByTitle, last, locator, nth, re };
285
+ export { AstExecutor, type DslArg, type DslArray, type DslFunction, type DslObject, type DslValue, FunctionRegistry, LocatorValue, TestRuntime, TestRuntimeManager, buildDefaultRegistry, chainGetByAltText, chainGetByLabel, chainGetByPlaceholder, chainGetByRole, chainGetByTestId, chainGetByText, chainGetByTitle, contentFrame, filter, first, getByAltText, getByLabel, getByPlaceholder, getByRole, getByTestId, getByText, getByTitle, last, locator, nth, randomNth, re };