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.
This commit is contained in:
@@ -55,11 +55,16 @@ Future<void> _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();
|
||||
|
||||
@@ -59,10 +59,15 @@ Future<void> _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(
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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')),
|
||||
|
||||
Reference in New Issue
Block a user