Skip to content

Commit 46f1c4d

Browse files
committed
test: preserve terminal replay failure hints
1 parent 454bbbb commit 46f1c4d

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

‎packages/daemon/src/sessions/handlers/session-progress.test.ts‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,3 +269,37 @@ test('sharded suite progress carries each device and shard-scoped session', asyn
269269
expect(starts.map((event) => event.deviceId)).toEqual(['emulator-5554', 'emulator-5556']);
270270
expect(starts.map((event) => event.deviceName)).toEqual(['Pixel 8', 'Pixel 8 Pro']);
271271
});
272+
273+
test('a terminal replay failure reports its message and hint without retrying', async () => {
274+
const root = mkdtempForTestSync('agent-device-session-test-terminal-failure-');
275+
const testPath = path.join(root, '01-terminal-failure.ad');
276+
fs.writeFileSync(testPath, 'context platform=android\nopen "Demo"\n');
277+
let attempts = 0;
278+
279+
const { events, data } = await runSuite({
280+
root,
281+
requestId: 'terminal-failure',
282+
invoke: async () => {
283+
attempts += 1;
284+
return {
285+
ok: false,
286+
error: {
287+
code: 'ASSERTION_FAILED',
288+
message: 'the final assertion failed',
289+
hint: 'try replay --from 01-terminal-failure.ad',
290+
},
291+
};
292+
},
293+
});
294+
295+
expect(attempts).toBe(1);
296+
expect(data.failed).toBe(1);
297+
const [failure] = replayEvents(events).filter((event) => event.status === 'fail');
298+
expect(failure).toMatchObject({
299+
attempt: 1,
300+
maxAttempts: 1,
301+
message: 'Replay failed at step 1 (open "Demo"): the final assertion failed',
302+
hint: 'try replay --from 01-terminal-failure.ad',
303+
});
304+
expect(failure?.retrying).toBeUndefined();
305+
});

0 commit comments

Comments
 (0)