feat(app): wire native cancel and track complete port acceptance

This commit is contained in:
2026-10-21 20:04:38 +01:00
parent 0eb3e23fc8
commit e20ac9f5a1
10 changed files with 295 additions and 13 deletions
+26
View File
@@ -377,6 +377,16 @@ try {
if ((await path()) !== '/settings') throw new Error('Settings did not update route');
captures.push(await capture('settings-cupertino-registered-phone'));
await clickText('Runs');
await clickText('Fixture cancel run', { contains: true });
await assertBody('Original prompt');
await clickText('Cancel run');
await assertBody('Cancel run 4?');
captures.push(await capture('cancel-cupertino-confirm'));
await clickText('Keep');
const kept = await (await fetch(`${fixture.url}/fixture/state`)).json();
if (kept.cancelRequests.length) throw new Error('Keep sent a cancellation');
// Material host: the same deep link and route must render standard Material
// controls (the Cupertino host was selected by the macOS browser above).
await send(
@@ -408,7 +418,23 @@ try {
}
captures.push(await capture('settings-material-registered-phone'));
await clickText('Runs');
await clickText('Fixture cancel run', { contains: true });
await assertBody('Original prompt');
await clickText('Cancel run');
await assertBody('Cancel run 4?');
captures.push(await capture('cancel-material-confirm'));
await clickText('Cancel run');
await assertBody('canceled');
captures.push(await capture('cancel-material-accepted'));
await clickText('Back to list');
await assertBody('Fixture cancel run');
await assertBody('canceled');
const fixtureState = await (await fetch(`${fixture.url}/fixture/state`)).json();
if (JSON.stringify(fixtureState.cancelRequests) !== JSON.stringify([{ run_id: 4 }])) {
throw new Error('Cancel sent the wrong payload or repeated the request');
}
if (fixtureState.subscribed < 2) throw new Error(`App never resubscribed: ${JSON.stringify(fixtureState)}`);
if (fixtureState.listRuns < 2) throw new Error(`App never reloaded: ${JSON.stringify(fixtureState)}`);
if (fixtureState.getRun < 2) throw new Error(`Detail was not rehydrated: ${JSON.stringify(fixtureState)}`);