feat(app): Rename and Schedule this run move into the run detail's more menu

This commit is contained in:
2026-10-23 16:10:20 +01:00
parent 9e2d3c558d
commit 13d293eb47
12 changed files with 264 additions and 170 deletions
@@ -3,13 +3,12 @@ import 'package:flutter/material.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 'package:pipelines_app/features/runs/ui/run_detail_actions.dart';
import 'run_retry_wiring_support.dart';
void main() {
testWidgets('a hidden retry adds no extra gap for Rename and Cancel', (
testWidgets('a hidden retry adds no leading gap before Cancel', (
tester,
) async {
final gateway = RetryWiringGateway();
@@ -32,45 +31,13 @@ void main() {
// Retry is not eligible on the running run and must not consume spacing.
expect(find.byKey(retryActionKey), findsNothing);
final rename = tester.getRect(find.byKey(runTitleActionKey));
// Rename lives in the more menu; Cancel now leads the row.
final cancel = tester.getRect(find.byKey(cancelActionKey));
expect(cancel.left - rename.right, closeTo(8, 0.5));
expect(cancel.left, closeTo(16, 0.5));
});
for (final cupertino in [false, true]) {
testWidgets('adjacent actions keep native spacing at 320 px ($cupertino)', (
tester,
) async {
tester.view.physicalSize = const Size(320, 480);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
final gateway = RetryWiringGateway();
addTearDown(gateway.framesController.close);
final row = Padding(
padding: const EdgeInsets.all(16),
child: RunDetailActions(
run: retryFailedDetail(),
gateway: gateway,
onRunChanged: (_) {},
),
);
await tester.pumpWidget(
cupertino
? CupertinoApp(
home: CupertinoPageScaffold(child: SafeArea(child: row)),
)
: MaterialApp(home: Scaffold(body: row)),
);
await tester.pumpAndSettle();
expectNativeActionSpacing(tester);
});
}
for (final cupertino in [false, true]) {
testWidgets('320 px at 2x keeps Rename and Retry reachable ($cupertino)', (
testWidgets('320 px at 2x keeps Retry reachable ($cupertino)', (
tester,
) async {
tester.view.physicalSize = const Size(320, 480);
@@ -109,12 +76,10 @@ void main() {
);
await tester.pumpAndSettle();
expect(find.byKey(runTitleActionKey).hitTestable(), findsOneWidget);
expect(find.byKey(retryActionKey).hitTestable(), findsOneWidget);
final rect = tester.getRect(find.byKey(retryActionKey));
expect(rect.left, greaterThanOrEqualTo(0));
expect(rect.right, lessThanOrEqualTo(320));
expectNativeActionSpacing(tester);
await tester.tap(find.byKey(retryActionKey));
await tester.pumpAndSettle();
@@ -125,27 +90,3 @@ void main() {
});
}
}
/// Asserts the action row uses the detail's native 8 dp / 4 dp spacing.
///
/// The row previously had no `spacing`, leaving the outlined Rename border
/// touching the filled Retry button; browser measurement at 320 px reported a
/// 0.008 px gap. A hidden action must not consume spacing either.
void expectNativeActionSpacing(WidgetTester tester) {
final rename = tester.getRect(find.byKey(runTitleActionKey));
final retry = tester.getRect(find.byKey(retryActionKey));
final sameRow = retry.top < rename.bottom && rename.top < retry.bottom;
if (sameRow) {
expect(
retry.left - rename.right,
greaterThanOrEqualTo(8 - 0.01),
reason: 'side-by-side actions need the 8 dp Wrap spacing',
);
} else {
expect(
retry.top - rename.bottom,
greaterThanOrEqualTo(4 - 0.01),
reason: 'wrapped actions need the 4 dp Wrap run spacing',
);
}
}