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
1 change: 0 additions & 1 deletion .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ jobs:
run: |
xcrun simctl install "${{ steps.ios-simulator.outputs.simulator-udid }}" "${{ steps.fixture-app.outputs.app-path }}"
node --experimental-strip-types src/bin.ts test examples/test-app/replays/gesture-pan-duration.ad --udid "${{ steps.ios-simulator.outputs.simulator-udid }}" --timeout 180000 --retries 2 --artifacts-dir test/artifacts/replays-ios-gesture-pan-duration --report-junit test/artifacts/replays-ios-gesture-pan-duration.junit.xml
pnpm clean:daemon

- name: Run fixture-backed iOS simulator E2E smoke
env:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/replays-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,7 @@ jobs:
- name: Prove selector drag reaches its destination on iOS
run: |
xcrun simctl install "${{ steps.ios-simulator.outputs.simulator-udid }}" "${{ steps.fixture-app.outputs.app-path }}"
pnpm clean:daemon
node --experimental-strip-types src/bin.ts replay examples/test-app/replays/drag.ad --platform ios --udid "${{ steps.ios-simulator.outputs.simulator-udid }}" --session nightly-ios-target-drag --json
pnpm clean:daemon

- name: Run full fixture-backed iOS simulator E2E
env:
Expand Down
44 changes: 44 additions & 0 deletions test/integration/ios-simulator-e2e/live-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import {
} from './snapshot-backend-conformance.ts';

const C = PUBLIC_COMMANDS;
const DEFAULT_RUNNER_PREPARE_TIMEOUT_MS = 420_000;

type AgentDeviceSdk = typeof import('../../../src/sdk/index.ts');

Expand Down Expand Up @@ -85,6 +86,7 @@ export async function runIosSimulatorE2E(): Promise<void> {
const context = createContext();
let primaryError: unknown;
try {
await prepareRunner(context);
await executeLiveScenarios(context);
} catch (error) {
primaryError = error;
Expand All @@ -93,6 +95,31 @@ export async function runIosSimulatorE2E(): Promise<void> {
throwLiveRunErrors(primaryError, cleanupError);
}

/** A runner start must not spend the first runner-backed command's 90 s request timeout. */
async function prepareRunner(context: LiveContext): Promise<void> {
const timeoutMs = Number(
process.env.AGENT_DEVICE_IOS_PREPARE_TIMEOUT_MS ?? DEFAULT_RUNNER_PREPARE_TIMEOUT_MS,
);
await runStep(
context,
'prepare iOS runner',
[
'prepare',
'ios-runner',
'--platform',
'ios',
'--udid',
context.udid,
'--state-dir',
context.stateDir,
'--timeout',
String(timeoutMs),
'--json',
],
{ commonFlags: false, timeoutMs: timeoutMs + 30_000 },
);
}

async function executeLiveScenarios(context: LiveContext): Promise<void> {
let assertionCaptureVerified = false;
for (const scenario of LIVE_SCENARIOS.filter((candidate) => candidate.tier === 'smoke')) {
Expand Down Expand Up @@ -141,6 +168,11 @@ async function assertLiveAssertionCapture(context: LiveContext): Promise<void> {

async function finalizeLiveRun(context: LiveContext): Promise<unknown> {
let cleanupError = await finalizeSessionCleanup(context, sessionExists, cleanupSession);
try {
await stopDaemon(context);
} catch (error) {
cleanupError = combineErrors(cleanupError, error, 'cleanup and daemon stop failed');
}
try {
writeCoverageReport(context);
} catch (error) {
Expand All @@ -149,6 +181,18 @@ async function finalizeLiveRun(context: LiveContext): Promise<unknown> {
return cleanupError;
}

/** The daemon holds this run's TMPDIR and claims directory, which the test wrapper deletes. */
async function stopDaemon(context: LiveContext): Promise<void> {
await runStep(
context,
'stop daemon',
['daemon', 'stop', '--state-dir', context.stateDir, '--json'],
{
commonFlags: false,
},
);
}

/**
* Decides whether session-scoped cleanup runs: full:device-lifecycle reboots the
* simulator and the session lease does not survive that in every environment, so this
Expand Down
Loading