Skip to content

Commit d665e02

Browse files
authored
refactor(ios-e2e): use canonical wait reasons in confirmation helper (#2919)
1 parent dc9ab86 commit d665e02

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

‎test/integration/ios-simulator-e2e-deep-link-confirmation.test.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import assert from 'node:assert/strict';
22
import test from 'node:test';
33

4+
import { WAIT_REASONS } from '@agent-device/contracts/wait';
45
import type { CliJsonResult } from './cli-json.ts';
56
import {
67
answerDeepLinkConfirmation,
@@ -15,16 +16,16 @@ const LANDED = result(0, { success: true });
1516
const LAUNCH_PENDING = result(1, {
1617
error: {
1718
code: 'COMMAND_FAILED',
18-
details: { reason: 'wait_capture_stalled', runnerErrorCode: 'APP_NOT_RUNNING' },
19+
details: { reason: WAIT_REASONS.captureStalled, runnerErrorCode: 'APP_NOT_RUNNING' },
1920
},
2021
});
2122
const WRONG_ROUTE = result(1, {
22-
error: { code: 'COMMAND_FAILED', details: { reason: 'wait_target_absent' } },
23+
error: { code: 'COMMAND_FAILED', details: { reason: WAIT_REASONS.targetAbsent } },
2324
});
2425
const READABLE_TIMEOUT = result(1, {
2526
error: {
2627
code: 'COMMAND_FAILED',
27-
details: { reason: 'wait_deadline_exceeded', readableCaptures: 5, captureTruncated: true },
28+
details: { reason: WAIT_REASONS.deadlineExceeded, readableCaptures: 5, captureTruncated: true },
2829
},
2930
});
3031
const OPEN_PROMPT = result(0, {

‎test/integration/ios-simulator-e2e/live-deep-link-confirmation.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import assert from 'node:assert/strict';
22

3+
import { WAIT_REASONS } from '@agent-device/contracts/wait';
34
import type { CliJsonResult } from '../cli-json.ts';
45
import { type LiveContext, runStep } from './live-harness.ts';
56

@@ -59,12 +60,13 @@ export async function answerDeepLinkConfirmation(
5960
const details = arrived.json?.error?.details;
6061
const launchPending = details?.runnerErrorCode === APP_NOT_RUNNING;
6162
const reason = details?.reason;
62-
const readableMiss = reason === 'wait_target_absent' || reason === 'wait_deadline_exceeded';
63+
const readableMiss =
64+
reason === WAIT_REASONS.targetAbsent || reason === WAIT_REASONS.deadlineExceeded;
6365
const interruptedCapture =
64-
reason === 'wait_capture_stalled' || reason === 'wait_runner_restart_exhausted';
66+
reason === WAIT_REASONS.captureStalled || reason === WAIT_REASONS.runnerRestartExhausted;
6567
if (!launchPending && !readableMiss && !interruptedCapture) return;
6668
if (!answered) answered = await acceptOpenConfirmation(device);
67-
if (!answered && reason === 'wait_target_absent') return;
69+
if (!answered && reason === WAIT_REASONS.targetAbsent) return;
6870
}
6971
}
7072

0 commit comments

Comments
 (0)