@unotest/web 0.46.0 → 0.48.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 { L as LocatorValue, o as DriverDownload, D as DriverContext, W as WebDriver, h as DriverPage } from '../interfaces-CYoL4Taq.js';
2
- export { p as LocatorStep, q as appendStep, r as describeLocator, s as isLocatorValue, t as rootedAt } from '../interfaces-CYoL4Taq.js';
1
+ import { L as LocatorValue, o as DriverDownload, D as DriverContext, W as WebDriver, h as DriverPage } from '../interfaces-CTMGjJIs.js';
2
+ export { p as LocatorStep, q as appendStep, r as describeLocator, s as isLocatorValue, t as rootedAt } from '../interfaces-CTMGjJIs.js';
3
3
  import { Matcher, RegexLiteral, JudgeRequest, JudgeVerdict, VisualFailureRecord, SoftFailureRecord, TeardownStateRecord, TeardownFailureRecord } 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';
@@ -147,6 +147,11 @@ interface Judge {
147
147
  /** Produce a structured verdict. A clean `fail` is a RESULT (returned);
148
148
  * infrastructure faults throw JudgeUnavailableError / ConfigError. */
149
149
  judge(request: JudgeRequest): Promise<JudgeVerdict>;
150
+ /** Resolve when judge() could run; throw the ConfigError /
151
+ * JudgeUnavailableError the first judge() would. Asked once before a
152
+ * run that reaches assertJudge, so a broken setup fails before the
153
+ * browser instead of at the first verdict (#72). */
154
+ ready(): Promise<void>;
150
155
  }
151
156
 
152
157
  interface JudgeVerdictRecord extends JudgeVerdict {
@@ -344,6 +349,11 @@ declare class ContextSet {
344
349
  /** Open one more context, make it active, return its index. */
345
350
  open(): Promise<number>;
346
351
  select(index: unknown): void;
352
+ /** Put `next` in the active context's place — same index, so whatever is
353
+ * bound to the index (teardowns, the journal's context number) follows —
354
+ * and close the one it replaces. Listeners hear it as a switch: the
355
+ * active context is a different one now. */
356
+ replaceActive(next: DriverContext): Promise<void>;
347
357
  onSwitch(listener: (index: number) => void): () => void;
348
358
  /** Close every context, newest first; the failures come back. */
349
359
  closeAll(): Promise<ContextCloseFailure[]>;
@@ -354,7 +364,7 @@ type DslPrimitive = string | number | boolean | null;
354
364
  type DslObject = {
355
365
  readonly [key: string]: DslValue;
356
366
  };
357
- type DslArray = readonly DslValue[];
367
+ type DslArray = DslValue[];
358
368
  type DslValue = DslPrimitive | DslObject | DslArray;
359
369
  /** The browser contexts a runtime acts in: its own set, started from the
360
370
  * context the runner opened — or one it SHARES with its host (a flow
@@ -367,10 +377,15 @@ type RuntimeContexts = {
367
377
  readonly openContext?: ContextFactory;
368
378
  /** Ceiling on contexts per entry (`config.maxContexts`). */
369
379
  readonly maxContexts?: number;
380
+ /** Opens the entry's context again with the same options on the real
381
+ * window (`setViewport(null)`). Absent → it cannot be (a browser
382
+ * profile fixes the window when it starts; an attached session). */
383
+ readonly openOnWindow?: ContextFactory;
370
384
  readonly contexts?: undefined;
371
385
  } | {
372
386
  readonly contexts: ContextSet;
373
387
  readonly context?: undefined;
388
+ readonly openOnWindow?: undefined;
374
389
  };
375
390
  type TestRuntimeDeps = RuntimeContexts & TestRuntimeServices;
376
391
  interface TestRuntimeServices {
@@ -426,6 +441,8 @@ declare class TestRuntime {
426
441
  readonly driver: WebDriver;
427
442
  /** Every browser context of this entry and which one is active. */
428
443
  readonly contexts: ContextSet;
444
+ /** See `RuntimeContexts.openOnWindow`. */
445
+ readonly openOnWindow?: ContextFactory;
429
446
  readonly logger: Logger;
430
447
  readonly sandbox: SandboxConfig;
431
448
  readonly baseUrl?: string;
@@ -503,6 +520,9 @@ declare class FunctionRegistry {
503
520
  has(name: string): boolean;
504
521
  get(name: string): DslFunction | undefined;
505
522
  names(): string[];
523
+ /** The run-time half of the validator's `suggestForUnknown`: the walker
524
+ * quotes it in "Unknown DSL function", from the same table. */
525
+ suggestForUnknown(name: string): string | null;
506
526
  }
507
527
 
508
528
  declare class AstExecutor extends ExecutionWalker<TestRuntime> {