test(app): verify recorded Changes navigation in the real app flow

This commit is contained in:
2026-10-21 22:12:21 +01:00
parent 7219c5a3e3
commit 08e216a2fa
2 changed files with 62 additions and 17 deletions
+42 -17
View File
@@ -260,35 +260,57 @@ try {
await assertBody('Original prompt');
await assertBody('Timeline');
await assertBody('build · visit 3');
captures.push(await capture('i1-runs-phone-detail'));
await assertOcr(captures[5], 'fixture prompt with spaces');
const detailCapture = await capture('i1-runs-phone-detail');
captures.push(detailCapture);
await assertOcr(detailCapture, 'fixture prompt with spaces');
// The recorded Changes action opens the landed viewer for this run's steps:
// the recorded file, its rendered diff, and back to the same detail.
await clickText('Changes');
await assertBody('1 file changed');
await assertBody('lib/features/fixture.dart');
captures.push(await capture('changes-phone-list'));
await clickText('lib/features/fixture.dart', { contains: true });
await assertBody('Rendered');
await assertBody('added fixture line');
await assertBody('removed fixture line');
captures.push(await capture('changes-phone-diff'));
await clickText('Close diff');
await assertBody('lib/features/fixture.dart');
await delay(600);
await clickText('Back', { contains: true });
await assertBody('Original prompt');
await setSize(1280, 800);
await assertBody('Original prompt');
captures.push(await capture('i1-runs-desktop-detail'));
await assertOcr(captures[6], 'fixture prompt with spaces');
const desktopDetail = await capture('i1-runs-desktop-detail');
captures.push(desktopDetail);
await assertOcr(desktopDetail, 'fixture prompt with spaces');
await setSize(390, 844);
await clickText('Input');
await wheel(250);
await delay(300);
captures.push(await capture('i1-runs-phone-detail-input'));
await assertOcr(captures[7], 'input payload');
const inputCapture = await capture('i1-runs-phone-detail-input');
captures.push(inputCapture);
await assertOcr(inputCapture, 'input payload');
await scrollUntil('Output');
await clickText('Output');
await wheel(250);
await delay(300);
captures.push(await capture('i1-runs-phone-detail-output'));
await assertOcr(captures[8], 'answer');
const outputCapture = await capture('i1-runs-phone-detail-output');
captures.push(outputCapture);
await assertOcr(outputCapture, 'answer');
await scrollUntil('Metrics');
await clickText('Metrics');
await wheel(300);
await delay(300);
captures.push(await capture('i1-runs-phone-detail-metrics'));
await assertOcr(captures[9], 'Total tokens');
await assertOcr(captures[9], 'Reported cost');
const metricsCapture = await capture('i1-runs-phone-detail-metrics');
captures.push(metricsCapture);
await assertOcr(metricsCapture, 'Total tokens');
await assertOcr(metricsCapture, 'Reported cost');
// Browser Back/Forward move between the in-app routes, not out of the app.
const path = () => evaluate('location.pathname');
@@ -305,8 +327,9 @@ try {
async () => (await semanticText()).includes('Fixture live run'),
'browser Back to the runs list',
);
captures.push(await capture('i1-runs-phone-browser-back-list'));
await assertOcr(captures[10], 'Fixture live run');
const backListCapture = await capture('i1-runs-phone-browser-back-list');
captures.push(backListCapture);
await assertOcr(backListCapture, 'Fixture live run');
await evaluate('history.forward()');
await waitFor(
@@ -333,8 +356,9 @@ try {
if (duringDrop.includes(raw)) throw new Error(`Raw transport text shown: ${raw}`);
}
if ((await path()) !== '/runs/1') throw new Error(`Drop moved the URL to ${await path()}`);
captures.push(await capture('i1-reconnect-detail-retained-phone'));
await assertOcr(captures[13], 'Original prompt');
const retainedCapture = await capture('i1-reconnect-detail-retained-phone');
captures.push(retainedCapture);
await assertOcr(retainedCapture, 'Original prompt');
// Accepting again plus Retry restores the same detail without a remount.
const accepted = await fetch(`${fixture.url}/fixture/accept`, { method: 'POST' });
@@ -359,12 +383,13 @@ try {
for (const raw of ['WebSocketException', 'WebSocketChannelException', 'Failed to connect']) {
if (gate.includes(raw)) throw new Error(`Gate printed raw transport text: ${raw}`);
}
captures.push(await capture('i1-gate-unavailable-friendly-phone'));
const gateCapture = await capture('i1-gate-unavailable-friendly-phone');
captures.push(gateCapture);
await delay(1500);
if (!(await semanticText()).includes('Pipelines server unavailable')) {
throw new Error('Gate left the unavailable state while retrying');
}
await assertOcr(captures[15], 'Pipelines server unavailable');
await assertOcr(gateCapture, 'Pipelines server unavailable');
await fetch(`${fixture.url}/fixture/accept`, { method: 'POST' });
await clickText('Retry');
+20
View File
@@ -110,6 +110,26 @@ function detail(id, live, canceled = false) {
status: 'completed',
outcome: 'success',
target: '#success',
file_changes: {
status: 'complete',
scope: 'Git tracked and nonignored files in the run directory',
files: [
{
path: 'lib/features/fixture.dart',
kind: 'modified',
patch:
'--- a/lib/features/fixture.dart\n' +
'+++ b/lib/features/fixture.dart\n' +
'@@ -1,2 +1,2 @@\n' +
' context line\n' +
'-removed fixture line\n' +
'+added fixture line\n',
},
],
skipped: 0,
omitted: 0,
diagnostic: '',
},
},
{
stage: 'test',