@unotest/web 0.53.0 → 0.55.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,6 +1,6 @@
1
1
  import { InjectedDomHelpers } from '@unotest/grounder-client/dom-walker';
2
2
  import { PickerMode } from '@unotest/protocol';
3
- import { E as ElementHint, A as AnimationInfo } from '../interfaces-BU-PQbt4.js';
3
+ import { E as ElementHint, A as AnimationInfo } from '../interfaces-CNvyInrY.js';
4
4
  import '../config/schema.js';
5
5
  import 'zod';
6
6
 
@@ -477,13 +477,18 @@ declare function readLocalStorageItem(key: string): string | null;
477
477
  declare function writeDocumentHidden([hidden, announce]: [boolean, boolean]): void;
478
478
  /** Make the document's scripts see the app launched in `mode` (`standalone`
479
479
  * for one added to the home screen): `matchMedia('(display-mode: …)')`
480
- * answers for that mode, and `navigator.standalone` — where the engine
481
- * has it, as WebKit does — says whether it is standalone. No engine
480
+ * answers for that mode, and with `navigatorStandalone` (WebKit)
481
+ * `navigator.standalone` says whether it is standalone. The caller names
482
+ * the engine rather than the page probing for the property: Playwright's
483
+ * WebKit has it on macOS and not on Linux, where boxes run. No engine
482
484
  * emulates the feature itself, so CSS `@media (display-mode: …)` and a
483
485
  * query combining it with other features still see the browser; the
484
486
  * config reference says so. The answer is the real list object (listeners,
485
487
  * `onchange`) of a query that is always true or always false. */
486
- declare function writeDisplayMode(mode: string): void;
488
+ declare function writeDisplayMode(args: {
489
+ mode: string;
490
+ navigatorStandalone: boolean;
491
+ }): void;
487
492
  /** Read every identifying attribute off a live element (role inferred from
488
493
  * tag + ARIA, accname approximated). Returns a structured raw hint. */
489
494
  declare function inspectElementRaw(el: Element, args: {
@@ -2883,7 +2883,8 @@ function writeDocumentHidden([hidden, announce]) {
2883
2883
  if (!hidden) window.dispatchEvent(new FocusEvent("focus"));
2884
2884
  }
2885
2885
  __name(writeDocumentHidden, "writeDocumentHidden");
2886
- function writeDisplayMode(mode) {
2886
+ function writeDisplayMode(args) {
2887
+ const { mode } = args;
2887
2888
  globalThis.__name ??= (fn) => fn;
2888
2889
  const original = window.matchMedia.bind(window);
2889
2890
  function askedMode(query) {
@@ -2901,7 +2902,7 @@ function writeDisplayMode(mode) {
2901
2902
  Object.defineProperty(list, "media", { configurable: true, value: query });
2902
2903
  return list;
2903
2904
  };
2904
- if ("standalone" in navigator) {
2905
+ if (args.navigatorStandalone) {
2905
2906
  Object.defineProperty(navigator, "standalone", { configurable: true, get: /* @__PURE__ */ __name(() => mode === "standalone", "get") });
2906
2907
  }
2907
2908
  }
@@ -398,6 +398,8 @@ interface PageNetworkEntry {
398
398
  /** 0 when the request failed before any response. */
399
399
  status: number;
400
400
  ok: boolean;
401
+ /** The response's headers, names in lower case; empty without a response. */
402
+ headers: Readonly<Record<string, string>>;
401
403
  failureText?: string;
402
404
  /** A `mockRoute` answered or aborted it. */
403
405
  mocked?: true;
@@ -694,6 +696,14 @@ interface DriverContext {
694
696
  * always (500 entries per context), unlike `networkEntries()`.
695
697
  */
696
698
  pageNetwork(): ReadonlyArray<PageNetworkEntry>;
699
+ /**
700
+ * An entry of the active page `accept` takes — of those recorded, the
701
+ * one sent first; else the first to finish — or null after `timeoutMs`.
702
+ * What to take is the caller's choice: the driver hands entries over.
703
+ */
704
+ waitForPageResponse(accept: (entry: PageNetworkEntry) => boolean, opts: {
705
+ timeoutMs: number;
706
+ }): Promise<PageNetworkEntry | null>;
697
707
  /**
698
708
  * The first download of this context the scenario has not taken yet,
699
709
  * waiting up to `timeoutMs` (default: the navigation budget) for one.