diff --git a/scripts/fuzz/harness.test.ts b/scripts/fuzz/harness.test.ts index ca5ba97308..a9c3a16938 100644 --- a/scripts/fuzz/harness.test.ts +++ b/scripts/fuzz/harness.test.ts @@ -211,37 +211,38 @@ describe('run envelope', () => { }); describe('artifact promotion', () => { - it('promotes a saved failing case into the corpus, once', () => { + it.each([false, true])('promotes a saved failing case once (existing corpus: %s)', (existing) => { const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'fuzz-promote-')); const corpus = path.join(dir, 'regressions.json'); - fs.writeFileSync(corpus, '[]\n'); + const entry = { target: 'self-check-untyped-throw', input: 'promote me', note: 'existing' }; + fs.writeFileSync(corpus, JSON.stringify(existing ? [entry] : [])); const artifact = path.join(dir, 'case.json'); fs.writeFileSync( artifact, JSON.stringify({ target: 'self-check-untyped-throw', input: 'promote me', - kind: 'untyped-throw', - detail: 'seeded', + kind: 'empty-hint', + detail: 'artifact-only', }), ); const env = { AGENT_DEVICE_FUZZ_CORPUS: corpus }; - const first = runHarness(['--input-file', artifact, '--append-corpus'], env); - expect(first.stdout).toContain('Case still violates the invariant'); - expect(first.stdout).toContain('Appended 1 case(s)'); - expect(first.status).toBe(1); + const { status, stdout } = runHarness(['--input-file', artifact, '--append-corpus'], env); + expect(stdout).toContain('Case still violates the invariant'); + expect(stdout).toContain( + existing ? 'already contains every failing case' : 'Appended 1 case(s)', + ); + expect(status).toBe(1); expect(JSON.parse(fs.readFileSync(corpus, 'utf8'))).toEqual([ { - target: 'self-check-untyped-throw', - input: 'promote me', - note: expect.stringContaining('untyped-throw'), + ...entry, + note: existing + ? entry.note + : expect.stringContaining('untyped-throw: Error: self-check untyped throw'), }, ]); - const second = runHarness(['--input-file', artifact, '--append-corpus'], env); - expect(second.stdout).toContain('already contains every failing case'); - expect(JSON.parse(fs.readFileSync(corpus, 'utf8'))).toHaveLength(1); fs.rmSync(dir, { recursive: true, force: true }); }); }); diff --git a/test/integration/interaction-contract/interaction-response-shape.contract.test.ts b/test/integration/interaction-contract/interaction-response-shape.contract.test.ts index 3d8d3b88b5..bce9255eb2 100644 --- a/test/integration/interaction-contract/interaction-response-shape.contract.test.ts +++ b/test/integration/interaction-contract/interaction-response-shape.contract.test.ts @@ -1,6 +1,7 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; import { assertRpcOk } from '../provider-scenarios/assertions.ts'; +import { PARALLEL_PROVIDER_SCENARIO_TIMEOUT_MS } from '../provider-scenarios/test-timeouts.ts'; import type { ProviderScenarioTranscript } from '../provider-scenarios/transcript.ts'; import { RUNNER_CONTINUE_NODES } from './fixtures.ts'; import { @@ -60,23 +61,27 @@ const NOISY_DEFAULT_TAP_RESULT = { jitterPx: 0, }; -test('interaction response shape: press @ref uses the canonical ref envelope', async () => { - await withIosContractDaemon( - [runnerSnapshotEntry(RUNNER_CONTINUE_NODES), runnerTapEntry(NOISY_DEFAULT_TAP_RESULT)], - async (daemon, transcript) => { - assertRpcOk(await daemon.callCommand('snapshot', [], { snapshotInteractiveOnly: true })); - - const data = assertRpcOk(await daemon.callCommand('press', ['@e2'])); - assertRunnerRequest(transcript, 'ios.runner.tap', tapRequest(200, 322)); - - assertCanonicalRef(data, { - message: 'Tapped @e2 (200, 322)', - x: 200, - y: 322, - }); - }, - ); -}); +test( + 'interaction response shape: press @ref uses the canonical ref envelope', + async () => { + await withIosContractDaemon( + [runnerSnapshotEntry(RUNNER_CONTINUE_NODES), runnerTapEntry(NOISY_DEFAULT_TAP_RESULT)], + async (daemon, transcript) => { + assertRpcOk(await daemon.callCommand('snapshot', [], { snapshotInteractiveOnly: true })); + + const data = assertRpcOk(await daemon.callCommand('press', ['@e2'])); + assertRunnerRequest(transcript, 'ios.runner.tap', tapRequest(200, 322)); + + assertCanonicalRef(data, { + message: 'Tapped @e2 (200, 322)', + x: 200, + y: 322, + }); + }, + ); + }, + PARALLEL_PROVIDER_SCENARIO_TIMEOUT_MS, +); test('interaction response shape: fill @ref uses the canonical ref envelope', async () => { await withIosContractDaemon(