Skip to content

Commit 4ca7d66

Browse files
committed
test(dry-run): cover run step error samples
1 parent e8179bb commit 4ca7d66

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

src/lib/dry-run/samples.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,22 @@ describe('findSample', () => {
405405
expect(body.stepSummary.failedCount).toBe(0);
406406
});
407407

408+
it('GET /runs/{runId} sample includes a failed run step with backend error text', () => {
409+
const e = findSample(
410+
'GET',
411+
'https://api.testsprite.com/api/cli/v1/runs/run_xyz?includeSteps=true',
412+
);
413+
expect(e?.operationId).toBe('getRun');
414+
const body = e?.body() as {
415+
steps: Array<{ type: string; status: string; error: string | null }>;
416+
};
417+
const failedStep = body.steps.find(step => step.status === 'failed');
418+
expect(failedStep).toMatchObject({
419+
type: 'assertion',
420+
error: expect.stringContaining('AssertionError'),
421+
});
422+
});
423+
408424
it('getTest sample carries priority field (G1a)', () => {
409425
const e = findSample('GET', 'https://api.testsprite.com/api/cli/v1/tests/test_abc');
410426
expect(e?.operationId).toBe('getTest');

src/lib/dry-run/samples.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,17 @@ const ENTRIES: DryRunSampleEntry[] = [
713713
htmlSnapshotUrl: null,
714714
createdAt: '2026-05-15T19:32:20.000Z',
715715
},
716+
{
717+
stepIndex: '0003',
718+
type: 'assertion',
719+
action: 'assert_visible',
720+
status: 'failed',
721+
description: 'Confirmation toast is visible',
722+
error: 'AssertionError: confirmation toast did not appear before timeout',
723+
screenshotUrl: 'https://s3-presigned.example.com/snap/run-step-0003.png?X-Amz-dryrun',
724+
htmlSnapshotUrl: 'https://s3-presigned.example.com/snap/run-step-0003.html?X-Amz-dryrun',
725+
createdAt: '2026-05-15T19:32:30.000Z',
726+
},
716727
],
717728
} satisfies RunResponse),
718729
];

0 commit comments

Comments
 (0)