@delacour/warden-e2e 0.1.1 → 0.2.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,7 @@
1
1
  import { type DevtoolsFacet, type DevtoolsResult } from "./devtools/devtools.types";
2
+ import type { NativeLogDeps } from "./devtools/native-log";
2
3
  import type { Driver, DriverResult } from "./driver/driver.types";
4
+ import { type HidRecoveryDeps } from "./driver/ios/hid-recovery";
3
5
  import { type E2eEnv } from "./env";
4
6
  import type { AttemptContext, FixtureFactory } from "./runner/fixtures.types";
5
7
  import { type ResultsWriter } from "./runner/results";
@@ -25,6 +27,15 @@ export type Session = {
25
27
  readonly results: ResultsWriter;
26
28
  /** builds `app`/`device`/`screen` for each attempt (T4/T6); settable so tests can fake it */
27
29
  fixtures: FixtureFactory | undefined;
30
+ /** how a failed attempt's `native.log` / crash reports are read; absent in unit tests (nothing is spawned) */
31
+ nativeLog: NativeLogDeps | undefined;
32
+ /**
33
+ * Present for iOS runs with recovery wired: after a test failed with a lost HID connection, reboots the sim and
34
+ * reopens the driver and devtools, once per session. Resolves `true` when the test is worth running again.
35
+ */
36
+ recoverHid: (() => Promise<boolean>) | undefined;
37
+ /** closes the open driver and devtools so the next call opens them afresh (the device was rebooted under them) */
38
+ resetDevice(): Promise<void>;
28
39
  /** where the console reporter prints one line; default fd 1 */
29
40
  readonly log: (line: string) => void;
30
41
  /** the running attempt, if any */
@@ -70,6 +81,10 @@ export type SessionOptions = {
70
81
  driverFactory?: DriverFactory;
71
82
  /** how to attach devtools; default {@link openDevtools} */
72
83
  devtools?: DevtoolsOpener;
84
+ /** native log reader; default {@link setDefaultNativeLog}'s */
85
+ nativeLog?: NativeLogDeps;
86
+ /** sim reboot seams; default {@link setDefaultHidRecovery}'s */
87
+ hidRecovery?: HidRecoveryDeps;
73
88
  /** fixture factory; default {@link setDefaultFixtureFactory}'s */
74
89
  fixtures?: FixtureFactory;
75
90
  /** console line sink; default writes to fd 1 (bun test captures `process.stdout`, fd 1 is not captured) */
@@ -77,6 +92,10 @@ export type SessionOptions = {
77
92
  /** close from `process.on("exit")`; default true */
78
93
  exitHook?: boolean;
79
94
  };
95
+ /** Wires the HID-loss recovery used when a session gets none (`preload.ts` registers the real one). */
96
+ export declare function setDefaultHidRecovery(deps: HidRecoveryDeps | undefined): void;
97
+ /** Wires the native-log reader used when a session gets none (`preload.ts` registers the real one). */
98
+ export declare function setDefaultNativeLog(deps: NativeLogDeps | undefined): void;
80
99
  /** Wires the factory used when `getSession` gets none (`driver/open.ts`'s opener, set by the package entry). */
81
100
  export declare function setDefaultDriverFactory(factory: DriverFactory | undefined): void;
82
101
  /** Whether a default driver factory is wired (so the preload leaves a test-installed fake alone). */