Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@ recovery. Anything provable in-process belongs in a unit test instead.
| fast | `pnpm run test:e2e` | scriptable fake driver, no SDKs | `pnpm run test`, CI |
| slow | `pnpm run test:e2e:slow` | real `simctl` / `adb` / emulators | manual, pre-release |

The slow lane runs with vitest's `default` reporter: under an agent vitest's minimal reporter drops
the console output of a passing test, and a slow flow's step and `device.ready` lines are what its log is
read for.

The slow flows are tagged `slow` plus `ios`/`android`, so the fast lane excludes
them with `--tags-filter='!slow'`. Each also gates itself at runtime with
`describe.skipIf` on platform and SDK availability. Filter further with, for
them with `--tags-filter='!slow'`. Each also gates itself at runtime on platform and SDK
availability: with `describe.skipIf`, or, in `slow-warm-pool.test.ts`, with
`context.skip(reason)` inside each test. Filter further with, for
example, `pnpm exec vitest run --project e2e --tags-filter='ios && !android'`.

The fast lane runs four files at once: each flow has its own `SIMLOCK_HOME`, so
Expand Down Expand Up @@ -57,12 +62,9 @@ running test body silently never fires — see the comment in `helpers/env.ts`.

- **The slow lane does not pass reliably as a whole run.** A daemon
occasionally outlives `daemon stop` and trips teardown's stray-process
assertion; not yet root-caused, and not yet distinguished from the reclaim
stall recorded in [../docs/internal/KNOWN-PITFALLS.md](../docs/internal/KNOWN-PITFALLS.md).
assertion; not yet root-caused.
The slim lane also fails while a 50-label disable batch can outrun its fixed
60s limit on a cold boot ([#206](https://github.com/callstackincubator/simlock/issues/206)). Treat the slow lane as a manual,
one-flow-at-a-time tool until both are fixed.
- `daemon status` ignores `--json` and always prints raw JSON; documented by an
`it.fails` in `daemon-lifecycle.test.ts`.
- Android is exercised through the fake driver in the fast lane; only
`slow-android-smoke.test.ts` touches a real emulator.
`slow-android-smoke.test.ts` and `slow-warm-pool.test.ts` touch a real emulator.
4 changes: 2 additions & 2 deletions e2e/helpers/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export interface TestEnv {
cli(args: readonly string[], options?: CliOptions): Promise<CliResult>;
cliBackground(args: readonly string[], options?: CliOptions): CliBackgroundHandle;
mcpClient(options?: McpClientOptions): Promise<McpClientHandle>;
events(since?: string): Promise<RecordedEvent[]>;
events(since?: string, timeout?: number): Promise<RecordedEvent[]>;
expectEvents(
names: readonly string[],
options?: { readonly since?: string; readonly timeout?: number },
Expand Down Expand Up @@ -235,7 +235,7 @@ export async function withDaemon(options: WithDaemonOptions = {}): Promise<TestE
mcpClients.add(handle);
return handle;
},
events: (since) => events(env, since),
events: (since, timeout) => events(env, since, timeout),
expectEvents: (names, expectOptions) => expectEvents(env, names, expectOptions),
async startDaemon() {
return cli(["daemon", "start"], env);
Expand Down
12 changes: 10 additions & 2 deletions e2e/helpers/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,16 @@ export interface RecordedEvent {
}

/** Replays the business-event history via `simlock events --since`, parsed. */
export async function events(env: NodeJS.ProcessEnv, since = "1h"): Promise<RecordedEvent[]> {
const result = await cli(["events", "--since", since], env);
export async function events(
env: NodeJS.ProcessEnv,
since = "1h",
timeout?: number,
): Promise<RecordedEvent[]> {
const result = await cli(
["events", "--since", since],
env,
timeout === undefined ? {} : { timeout },
);
if (result.code !== 0) {
throw new Error(`simlock events failed (exit ${String(result.code)}): ${result.stderr}`);
}
Expand Down
1 change: 1 addition & 0 deletions e2e/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ export { freeLoopbackPort } from "./port.js";
export type { TestEnv } from "./env.js";
export { waitFor } from "./wait.js";
export { events } from "./events.js";
export type { RecordedEvent } from "./events.js";
export { waitForDeviceState, waitForLeaseCount } from "./status.js";
export type { CliResult } from "./cli.js";
Loading
Loading