c53dedc544
Render Retry beside Rename on a stopped failed run under both native
hosts, send only {run_id, request_key} for resume and add
retry_mode=restart for a fresh start, and open the run the accepted
reply names. Keep hidden actions out of the Wrap so native 8/4 dp
spacing is not doubled, and use a literal 2^32 entropy bound because
dart2js evaluates 1 << 32 as 0.
Adds wiring, guard and layout tests, a browser-only key regression and
the retry probe; notes/R2c-wire.md records the checks and limits.
103 lines
3.6 KiB
Dart
103 lines
3.6 KiB
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pipelines_app/features/runs/actions/cancel_wording.dart';
|
|
import 'package:pipelines_app/features/runs/actions/retry_wording.dart';
|
|
import 'package:pipelines_app/features/runs/actions/title_wording.dart';
|
|
|
|
import 'run_retry_wiring_support.dart';
|
|
|
|
void main() {
|
|
for (final cupertino in [false, true]) {
|
|
testWidgets(
|
|
'accepted retry reply opens the server-identified run ($cupertino)',
|
|
(tester) async {
|
|
final gateway = RetryWiringGateway();
|
|
addTearDown(gateway.framesController.close);
|
|
final opened = <int>[];
|
|
await mountRetryScreen(
|
|
tester,
|
|
gateway,
|
|
cupertino: cupertino,
|
|
onRunSelected: opened.add,
|
|
);
|
|
|
|
expect(find.text(retryFailedTitle), findsOneWidget);
|
|
expect(find.byKey(runTitleActionKey), findsOneWidget);
|
|
expect(find.byKey(retryActionKey), findsOneWidget);
|
|
expect(find.byKey(cancelActionKey), findsNothing);
|
|
expect(gateway.retryCalls, isEmpty);
|
|
|
|
await tester.tap(find.byKey(retryActionKey));
|
|
await tester.pumpAndSettle();
|
|
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(find.byKey(retryActionKey), findsOneWidget);
|
|
|
|
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(find.text(retryFailedTitle), findsOneWidget);
|
|
|
|
gateway.acceptRetry(retryCreatedDetail());
|
|
await tester.pumpAndSettle();
|
|
|
|
expect(opened, [8]);
|
|
expect(find.text(retryCreatedTitle), findsOneWidget);
|
|
expect(find.text(retryFailedTitle), findsNothing);
|
|
expect(find.byKey(retryActionKey), findsNothing);
|
|
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,
|
|
cupertino: false,
|
|
onRunSelected: opened.add,
|
|
);
|
|
|
|
await tester.tap(find.byKey(retryActionKey));
|
|
await tester.pumpAndSettle();
|
|
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);
|
|
});
|
|
}
|