Files
pipelines/app/test/features/runs/ui/run_retry_wiring_test.dart
T
alan 364fd5b538 Remove Cupertino run action branches
Keep the Material-only run action behavior while preserving public Cupertino parameters for callers that will be cleaned up separately. Narrow the related tests to the supported Material path.
2026-11-11 04:18:26 +00:00

87 lines
3.2 KiB
Dart

import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/runs/ui/run_more_menu.dart';
import 'package:pipelines_app/features/runs/actions/cancel_wording.dart';
import 'package:pipelines_app/features/runs/actions/retry_wording.dart';
import 'run_retry_wiring_support.dart';
import 'run_detail_finders.dart';
void main() {
testWidgets(
'accepted retry reply opens the server-identified run',
(tester) async {
final gateway = RetryWiringGateway();
addTearDown(gateway.framesController.close);
final opened = <int>[];
await mountRetryScreen(tester, gateway, onRunSelected: opened.add);
expect(runDetailText(retryFailedTitle), findsOneWidget);
expect(find.byKey(runMoreMenuKey), findsOneWidget);
expect(await retryOffered(tester), isTrue);
expect(find.byKey(cancelActionKey), findsNothing);
expect(gateway.retryCalls, isEmpty);
await openRetry(tester);
expect(find.text(retryDialogTitle(7)), findsOneWidget);
expect(find.text(retryDialogMessage), findsOneWidget);
expect(gateway.retryCalls, isEmpty);
await tester.tap(find.byKey(retryKeepKey));
await tester.pumpAndSettle();
expect(gateway.retryCalls, isEmpty);
expect(opened, isEmpty);
expect(await retryOffered(tester), isTrue);
await confirmRetry(tester);
expect(gateway.retryCalls, hasLength(1));
final fields = gateway.retryCalls.single.fields;
expect(fields.keys.toSet(), {'run_id', 'request_key'});
expect(fields['run_id'], 7);
expect(fields['request_key'], startsWith('app-retry-7-'));
expect((fields['request_key'] as String).length, lessThanOrEqualTo(128));
// The prompt closes only from server truth; no navigation is guessed.
expect(opened, isEmpty);
expect(runDetailText(retryFailedTitle), findsOneWidget);
gateway.acceptRetry(retryCreatedDetail());
await tester.pumpAndSettle();
expect(opened, [8]);
expect(runDetailText(retryCreatedTitle), findsOneWidget);
expect(runDetailText(retryFailedTitle), findsNothing);
expect(await retryOffered(tester), isFalse);
expect(
gateway.calls.where((call) => call.type == 'get_run').last.fields,
{'run_id': 8},
);
},
);
testWidgets('restart sends its explicit mode through the real detail row', (
tester,
) async {
final gateway = RetryWiringGateway();
addTearDown(gateway.framesController.close);
final opened = <int>[];
await mountRetryScreen(tester, gateway, onRunSelected: opened.add);
await openRetry(tester);
await tester.tap(find.byKey(retryRestartKey));
await tester.pumpAndSettle();
expect(find.text(restartDialogTitle(7)), findsOneWidget);
await tester.tap(find.byKey(retryConfirmKey));
await tester.pump();
final fields = gateway.retryCalls.single.fields;
expect(fields.keys.toSet(), {'run_id', 'request_key', 'retry_mode'});
expect(fields['run_id'], 7);
expect(fields['retry_mode'], 'restart');
expect(fields['request_key'], startsWith('app-retry-7-'));
gateway.acceptRetry(retryCreatedDetail());
await tester.pumpAndSettle();
expect(opened, [8]);
expect(find.text(retryCreatedTitle), findsOneWidget);
});
}