From b7d5d026f40a207d2da96ca3ff6a6267e0f5819a Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Wed, 21 Oct 2026 21:01:09 +0100 Subject: [PATCH] fix(app): repair runs test wiring inherited from main Main's Runs detail now requires the shared gateway, but three inherited call sites (two Changes tests and the diff wiring probe) still constructed it without one, and the Cupertino 2x detail test tapped Output before the reveal scroll had been pumped. Pass the existing fake gateway at each call site and settle after scrollUntilVisible. No production behaviour changes. --- .../runs/ui/run_changes_action_test.dart | 47 +++++++++---------- .../runs/ui/run_changes_status_test.dart | 9 +++- .../runs/ui/run_detail_widget_test.dart | 1 + app/tool/diff_wiring_probe.dart | 23 +++++---- 4 files changed, 44 insertions(+), 36 deletions(-) diff --git a/app/test/features/runs/ui/run_changes_action_test.dart b/app/test/features/runs/ui/run_changes_action_test.dart index 62a6c0a7..98aa4c68 100644 --- a/app/test/features/runs/ui/run_changes_action_test.dart +++ b/app/test/features/runs/ui/run_changes_action_test.dart @@ -55,11 +55,16 @@ Future _pumpDetail( WidgetTester tester, _Platform platform, RunsController controller, + ApiGateway gateway, ) async { tester.view.physicalSize = const Size(500, 1200); tester.view.devicePixelRatio = 1; addTearDown(tester.view.reset); - final view = RunDetailView(controller: controller, onBack: () {}); + final view = RunDetailView( + controller: controller, + gateway: gateway, + onBack: () {}, + ); await tester.pumpWidget( platform == _Platform.material ? MaterialApp(home: Scaffold(body: view)) @@ -81,25 +86,22 @@ void main() { testWidgets( '${platform.name}: Changes opens the recorded files, diff and returns', (tester) async { - final controller = RunsController( - RunsRepository( - _FakeGateway( - _run( - fileChanges: captureFixture( - files: [ - fileChangeFixture( - path: 'lib/feature.dart', - patch: multiHunkPatch, - ), - ], + final gateway = _FakeGateway( + _run( + fileChanges: captureFixture( + files: [ + fileChangeFixture( + path: 'lib/feature.dart', + patch: multiHunkPatch, ), - ), + ], ), ), ); + final controller = RunsController(RunsRepository(gateway)); addTearDown(controller.dispose); await controller.select(9); - await _pumpDetail(tester, platform, controller); + await _pumpDetail(tester, platform, controller, gateway); await tester.tap(find.byKey(runChangesButtonKey)); await tester.pumpAndSettle(); @@ -149,21 +151,18 @@ void main() { (tester) async { final diagnostic = 'Workspace snapshot unavailable; changes could not be compared.'; - final controller = RunsController( - RunsRepository( - _FakeGateway( - _run( - fileChanges: captureFixture( - status: 'unavailable', - diagnostic: diagnostic, - ), - ), + final gateway = _FakeGateway( + _run( + fileChanges: captureFixture( + status: 'unavailable', + diagnostic: diagnostic, ), ), ); + final controller = RunsController(RunsRepository(gateway)); addTearDown(controller.dispose); await controller.select(9); - await _pumpDetail(tester, platform, controller); + await _pumpDetail(tester, platform, controller, gateway); await tester.tap(find.byKey(runChangesButtonKey)); await tester.pumpAndSettle(); diff --git a/app/test/features/runs/ui/run_changes_status_test.dart b/app/test/features/runs/ui/run_changes_status_test.dart index bdaf6c8d..7b9edc71 100644 --- a/app/test/features/runs/ui/run_changes_status_test.dart +++ b/app/test/features/runs/ui/run_changes_status_test.dart @@ -59,10 +59,15 @@ Future _pumpDetail( tester.view.physicalSize = const Size(500, 1200); tester.view.devicePixelRatio = 1; addTearDown(tester.view.reset); - final controller = RunsController(RunsRepository(_FakeGateway(run))); + final gateway = _FakeGateway(run); + final controller = RunsController(RunsRepository(gateway)); addTearDown(controller.dispose); await controller.select(9); - final view = RunDetailView(controller: controller, onBack: () {}); + final view = RunDetailView( + controller: controller, + gateway: gateway, + onBack: () {}, + ); await tester.pumpWidget( platform == _Platform.material ? MaterialApp( diff --git a/app/test/features/runs/ui/run_detail_widget_test.dart b/app/test/features/runs/ui/run_detail_widget_test.dart index 1557b2b5..2fca9c77 100644 --- a/app/test/features/runs/ui/run_detail_widget_test.dart +++ b/app/test/features/runs/ui/run_detail_widget_test.dart @@ -168,6 +168,7 @@ void main() { 200, scrollable: find.byType(Scrollable).first, ); + await tester.pumpAndSettle(); await tester.tap(find.text('Output')); await tester.pumpAndSettle(); expect(find.textContaining('"ok": true'), findsOneWidget); diff --git a/app/tool/diff_wiring_probe.dart b/app/tool/diff_wiring_probe.dart index 40515069..9045866b 100644 --- a/app/tool/diff_wiring_probe.dart +++ b/app/tool/diff_wiring_probe.dart @@ -147,17 +147,16 @@ class _ProbeBody extends StatefulWidget { } class _ProbeBodyState extends State<_ProbeBody> { - late final RunsController _controller = RunsController( - RunsRepository( - _FakeGateway( - _run( - unavailable: widget.unavailable, - status: widget.status, - stepStatus: widget.stepStatus, - ), - ), + late final _FakeGateway _gateway = _FakeGateway( + _run( + unavailable: widget.unavailable, + status: widget.status, + stepStatus: widget.stepStatus, ), ); + late final RunsController _controller = RunsController( + RunsRepository(_gateway), + ); @override void initState() { @@ -173,7 +172,11 @@ class _ProbeBodyState extends State<_ProbeBody> { @override Widget build(BuildContext context) { - final detail = RunDetailView(controller: _controller, onBack: () {}); + final detail = RunDetailView( + controller: _controller, + gateway: _gateway, + onBack: () {}, + ); if (Theme.of(context).platform == TargetPlatform.iOS) { return CupertinoPageScaffold( navigationBar: const CupertinoNavigationBar(middle: Text('Runs')),