Merge commit '03915fbb35c202d554d9e4cbc1549c0c4e62bdef' into pipelines/run-20261111-0420-cupertino-out-artifacts-9258

This commit is contained in:
2026-11-11 04:37:15 +00:00
59 changed files with 525 additions and 1850 deletions
@@ -1,6 +1,5 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/ui/status/run_status_icon.dart';
@@ -39,57 +38,49 @@ class _Gateway implements ApiGateway {
}
void main() {
for (final cupertino in [false, true]) {
testWidgets(
'actual detail confirms cancel and folds accepted state ($cupertino)',
(tester) async {
final gateway = _Gateway();
addTearDown(gateway.events.close);
final screen = RunsScreen(gateway: gateway, initialRunId: 7);
await tester.pumpWidget(
cupertino
? CupertinoApp(home: CupertinoPageScaffold(child: screen))
: MaterialApp(home: Scaffold(body: screen)),
);
await tester.pumpAndSettle();
await tester.tap(find.byKey(cancelActionKey));
await tester.pumpAndSettle();
expect(find.text('Cancel run 7?'), findsOneWidget);
expect(gateway.requests.where((r) => r.type == 'cancel_run'), isEmpty);
await tester.tap(find.byKey(cancelKeepKey));
await tester.pumpAndSettle();
expect(gateway.requests.where((r) => r.type == 'cancel_run'), isEmpty);
testWidgets('actual detail confirms cancel and folds accepted state', (
tester,
) async {
final gateway = _Gateway();
addTearDown(gateway.events.close);
final screen = RunsScreen(gateway: gateway, initialRunId: 7);
await tester.pumpWidget(MaterialApp(home: Scaffold(body: screen)));
await tester.pumpAndSettle();
await tester.tap(find.byKey(cancelActionKey));
await tester.pumpAndSettle();
expect(find.text('Cancel run 7?'), findsOneWidget);
expect(gateway.requests.where((r) => r.type == 'cancel_run'), isEmpty);
await tester.tap(find.byKey(cancelKeepKey));
await tester.pumpAndSettle();
expect(gateway.requests.where((r) => r.type == 'cancel_run'), isEmpty);
await tester.tap(find.byKey(cancelActionKey));
await tester.pumpAndSettle();
await tester.tap(find.byKey(cancelConfirmKey));
await tester.pump();
expect(
gateway.requests.where((r) => r.type == 'cancel_run').single.fields,
{'run_id': 7},
);
expect(find.text('canceled'), findsNothing);
gateway.canceled.complete({
'run_detail': {
...gateway.run,
'status': 'canceled',
'executing': false,
},
});
await tester.pumpAndSettle();
expect(find.byKey(cancelActionKey), findsNothing);
expect(find.text('canceled'), findsOneWidget);
// The held list is already visible beside the detail.
expect(
find.byWidgetPredicate(
(widget) => widget is RunStatusIcon && widget.label == 'canceled',
),
findsWidgets,
reason:
'The accepted server state must also update the held list row',
);
await tester.pumpWidget(const SizedBox.shrink());
},
await tester.tap(find.byKey(cancelActionKey));
await tester.pumpAndSettle();
await tester.tap(find.byKey(cancelConfirmKey));
await tester.pump();
expect(
gateway.requests.where((r) => r.type == 'cancel_run').single.fields,
{'run_id': 7},
);
}
expect(find.text('canceled'), findsNothing);
gateway.canceled.complete({
'run_detail': {
...gateway.run,
'status': 'canceled',
'executing': false,
},
});
await tester.pumpAndSettle();
expect(find.byKey(cancelActionKey), findsNothing);
expect(find.text('canceled'), findsOneWidget);
// The held list is already visible beside the detail.
expect(
find.byWidgetPredicate(
(widget) => widget is RunStatusIcon && widget.label == 'canceled',
),
findsWidgets,
reason: 'The accepted server state must also update the held list row',
);
await tester.pumpWidget(const SizedBox.shrink());
});
}
@@ -1,6 +1,5 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'run_detail_finders.dart';
@@ -90,41 +89,30 @@ Future<void> _pump(
}
void main() {
for (final cupertino in [false, true]) {
testWidgets('a decide route opens the waiting prompt ($cupertino)', (
tester,
) async {
final gateway = _Gateway(_waitingRun());
addTearDown(gateway.close);
tester.view.physicalSize = const Size(900, 1000);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
final screen = RunsScreen(
gateway: gateway,
initialRunId: 9,
initialDecide: true,
);
await tester.pumpWidget(
cupertino
? CupertinoApp(home: CupertinoPageScaffold(child: screen))
: MaterialApp(home: Scaffold(body: screen)),
);
await tester.pumpAndSettle();
testWidgets('a decide route opens the waiting prompt', (tester) async {
final gateway = _Gateway(_waitingRun());
addTearDown(gateway.close);
tester.view.physicalSize = const Size(900, 1000);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
final screen = RunsScreen(
gateway: gateway,
initialRunId: 9,
initialDecide: true,
);
await tester.pumpWidget(MaterialApp(home: Scaffold(body: screen)));
await tester.pumpAndSettle();
expect(find.byKey(decisionFeedbackKey), findsOneWidget);
expect(
find.text('Please review this recorded checkpoint.'),
findsOneWidget,
);
expect(find.byKey(decisionFeedbackKey), findsOneWidget);
expect(find.text('Please review this recorded checkpoint.'), findsOneWidget);
// Closing the prompt leaves the loaded detail underneath.
await tester.tap(find.text(decisionCancelLabel));
await tester.pumpAndSettle();
expect(find.byKey(decisionFeedbackKey), findsNothing);
expect(runDetailText('Human checkpoint'), findsOneWidget);
expect(find.byKey(decisionActionKey), findsOneWidget);
});
}
// Closing the prompt leaves the loaded detail underneath.
await tester.tap(find.text(decisionCancelLabel));
await tester.pumpAndSettle();
expect(find.byKey(decisionFeedbackKey), findsNothing);
expect(runDetailText('Human checkpoint'), findsOneWidget);
expect(find.byKey(decisionActionKey), findsOneWidget);
});
testWidgets('a decide route on a non-waiting run invents no prompt', (
tester,
@@ -1,6 +1,5 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/core/api_gateway.dart';
@@ -60,74 +59,63 @@ class _DecisionGateway implements ApiGateway {
}
void main() {
for (final cupertino in [false, true]) {
testWidgets(
'actual detail exposes and confirms recorded decision ($cupertino)',
(tester) async {
final gateway = _DecisionGateway();
addTearDown(gateway.events.close);
final screen = RunsScreen(gateway: gateway, initialRunId: 9);
await tester.pumpWidget(
cupertino
? CupertinoApp(home: CupertinoPageScaffold(child: screen))
: MaterialApp(home: Scaffold(body: screen)),
);
await tester.pumpAndSettle();
expect(find.text(decisionWaitingTitle), findsOneWidget);
// The web's decision banner spans the header's glass strip (under
// the top bar, 12 in from the pane) at the strip's 12px inset, with
// Decide trailing.
final banner = tester.getRect(
find.byKey(const Key('run-decision-banner')),
);
final strip = tester.getRect(
find.descendant(
of: find.byKey(const Key('run-detail-header')),
matching: find.byType(GlassPill),
),
);
final pane = tester.getRect(
find.byKey(const ValueKey('list-detail-body')),
);
expect(strip.left, pane.left + 12);
expect(strip.right, pane.right - 12);
expect(banner.left, strip.left + 12);
expect(banner.right, strip.right - 12);
expect(
tester.getCenter(find.byKey(decisionActionKey)).dx,
greaterThan(banner.center.dx),
);
await tester.tap(find.byKey(decisionActionKey));
await tester.pumpAndSettle();
expect(
find.text('Please review this recorded checkpoint.'),
findsOneWidget,
);
await tester.tap(find.text('approve'));
await tester.enterText(find.byKey(decisionFeedbackKey), ' checked ');
await tester.pump();
expect(gateway.decisions, isEmpty);
await tester.tap(find.text(decisionConfirmLabel));
await tester.pump();
expect(gateway.decisions.single, {
'run_id': 9,
'stage': 'gate',
'option': 'approve',
'feedback': 'checked',
});
gateway.reply.complete({
'run_detail': {
...gateway.run,
'status': 'succeeded',
'executing': false,
},
});
await tester.pumpAndSettle();
expect(find.byKey(decisionActionKey), findsNothing);
expect(find.text(decisionWaitingTitle), findsNothing);
expect(find.text('succeeded'), findsOneWidget);
await tester.pumpWidget(const SizedBox.shrink());
},
testWidgets('actual detail exposes and confirms recorded decision', (
tester,
) async {
final gateway = _DecisionGateway();
addTearDown(gateway.events.close);
final screen = RunsScreen(gateway: gateway, initialRunId: 9);
await tester.pumpWidget(MaterialApp(home: Scaffold(body: screen)));
await tester.pumpAndSettle();
expect(find.text(decisionWaitingTitle), findsOneWidget);
// The web's decision banner spans the header's glass strip (under
// the top bar, 12 in from the pane) at the strip's 12px inset, with
// Decide trailing.
final banner = tester.getRect(find.byKey(const Key('run-decision-banner')));
final strip = tester.getRect(
find.descendant(
of: find.byKey(const Key('run-detail-header')),
matching: find.byType(GlassPill),
),
);
}
final pane = tester.getRect(find.byKey(const ValueKey('list-detail-body')));
expect(strip.left, pane.left + 12);
expect(strip.right, pane.right - 12);
expect(banner.left, strip.left + 12);
expect(banner.right, strip.right - 12);
expect(
tester.getCenter(find.byKey(decisionActionKey)).dx,
greaterThan(banner.center.dx),
);
await tester.tap(find.byKey(decisionActionKey));
await tester.pumpAndSettle();
expect(
find.text('Please review this recorded checkpoint.'),
findsOneWidget,
);
await tester.tap(find.text('approve'));
await tester.enterText(find.byKey(decisionFeedbackKey), ' checked ');
await tester.pump();
expect(gateway.decisions, isEmpty);
await tester.tap(find.text(decisionConfirmLabel));
await tester.pump();
expect(gateway.decisions.single, {
'run_id': 9,
'stage': 'gate',
'option': 'approve',
'feedback': 'checked',
});
gateway.reply.complete({
'run_detail': {
...gateway.run,
'status': 'succeeded',
'executing': false,
},
});
await tester.pumpAndSettle();
expect(find.byKey(decisionActionKey), findsNothing);
expect(find.text(decisionWaitingTitle), findsNothing);
expect(find.text('succeeded'), findsOneWidget);
await tester.pumpWidget(const SizedBox.shrink());
});
}
@@ -17,7 +17,6 @@ void main() {
await mountRetryScreen(
tester,
gateway,
cupertino: false,
onRunSelected: opened.add,
);
@@ -40,7 +39,6 @@ void main() {
await mountRetryScreen(
tester,
gateway,
cupertino: false,
onRunSelected: opened.add,
);
@@ -65,7 +63,6 @@ void main() {
await mountRetryScreen(
tester,
gateway,
cupertino: false,
onRunSelected: opened.add,
);
@@ -87,7 +84,6 @@ void main() {
await mountRetryScreen(
tester,
gateway,
cupertino: false,
onRunSelected: opened.add,
);
@@ -107,7 +103,7 @@ void main() {
) async {
final gateway = RetryWiringGateway(executing: true);
addTearDown(gateway.framesController.close);
await mountRetryScreen(tester, gateway, cupertino: false);
await mountRetryScreen(tester, gateway);
expect(find.byKey(runMoreMenuKey), findsOneWidget);
expect(await retryOffered(tester), isFalse);
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/runs/actions/cancel_wording.dart';
@@ -36,57 +35,48 @@ void main() {
expect(cancel.left, closeTo(16, 0.5));
});
for (final cupertino in [false, true]) {
testWidgets('320 px at 2x keeps Retry reachable ($cupertino)', (
tester,
) async {
tester.view.physicalSize = const Size(320, 480);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
testWidgets('320 px at 2x keeps Retry reachable', (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);
Widget scale(BuildContext context, Widget? app) => MediaQuery(
data: MediaQuery.of(
context,
).copyWith(textScaler: const TextScaler.linear(2)),
child: app!,
);
// The action row itself, in the detail's 16 px inset, so the narrow
// accessibility state is measured without unrelated header controls.
final row = Padding(
padding: const EdgeInsets.all(16),
child: RunDetailActions(
run: retryFailedDetail(),
gateway: gateway,
onRunChanged: (_) {},
),
);
await tester.pumpWidget(
cupertino
? CupertinoApp(
builder: scale,
home: CupertinoPageScaffold(child: SafeArea(child: row)),
)
: MaterialApp(
builder: scale,
home: Scaffold(body: row),
),
);
await tester.pumpAndSettle();
final gateway = RetryWiringGateway();
addTearDown(gateway.framesController.close);
Widget scale(BuildContext context, Widget? app) => MediaQuery(
data: MediaQuery.of(
context,
).copyWith(textScaler: const TextScaler.linear(2)),
child: app!,
);
// The action row itself, in the detail's 16 px inset, so the narrow
// accessibility state is measured without unrelated header controls.
final row = Padding(
padding: const EdgeInsets.all(16),
child: RunDetailActions(
run: retryFailedDetail(),
gateway: gateway,
onRunChanged: (_) {},
),
);
await tester.pumpWidget(
MaterialApp(
builder: scale,
home: Scaffold(body: row),
),
);
await tester.pumpAndSettle();
expect(find.byKey(retryActionKey).hitTestable(), findsOneWidget);
final rect = tester.getRect(find.byKey(retryActionKey));
expect(rect.left, greaterThanOrEqualTo(0));
expect(rect.right, lessThanOrEqualTo(320));
expect(find.byKey(retryActionKey).hitTestable(), findsOneWidget);
final rect = tester.getRect(find.byKey(retryActionKey));
expect(rect.left, greaterThanOrEqualTo(0));
expect(rect.right, lessThanOrEqualTo(320));
await tester.tap(find.byKey(retryActionKey));
await tester.pumpAndSettle();
expect(find.text(retryDialogTitle(7)), findsOneWidget);
await tester.tap(find.byKey(retryKeepKey));
await tester.pumpAndSettle();
expect(gateway.retryCalls, isEmpty);
});
}
await tester.tap(find.byKey(retryActionKey));
await tester.pumpAndSettle();
expect(find.text(retryDialogTitle(7)), findsOneWidget);
await tester.tap(find.byKey(retryKeepKey));
await tester.pumpAndSettle();
expect(gateway.retryCalls, isEmpty);
});
}
@@ -1,6 +1,5 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/runs/ui/run_more_menu.dart';
@@ -88,7 +87,6 @@ class RetryWiringGateway implements ApiGateway {
Future<void> mountRetryScreen(
WidgetTester tester,
RetryWiringGateway gateway, {
required bool cupertino,
ValueChanged<int>? onRunSelected,
}) async {
final screen = RunsScreen(
@@ -96,13 +94,7 @@ Future<void> mountRetryScreen(
initialRunId: 7,
onRunSelected: onRunSelected,
);
await tester.pumpWidget(
cupertino
? CupertinoApp(
home: CupertinoPageScaffold(child: SafeArea(child: screen)),
)
: MaterialApp(home: Scaffold(body: screen)),
);
await tester.pumpWidget(MaterialApp(home: Scaffold(body: screen)));
await tester.pumpAndSettle();
}
@@ -7,65 +7,55 @@ import 'run_retry_wiring_support.dart';
import 'run_detail_finders.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,
);
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);
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 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 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);
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();
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},
);
},
);
}
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,
@@ -73,12 +63,7 @@ void main() {
final gateway = RetryWiringGateway();
addTearDown(gateway.framesController.close);
final opened = <int>[];
await mountRetryScreen(
tester,
gateway,
cupertino: false,
onRunSelected: opened.add,
);
await mountRetryScreen(tester, gateway, onRunSelected: opened.add);
await openRetry(tester);
await tester.tap(find.byKey(retryRestartKey));
@@ -1,6 +1,5 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/core/api_gateway.dart';
@@ -100,16 +99,9 @@ Future<void> _pumpSession(
WidgetTester tester,
_RepairGateway gateway, {
JsonMap? run,
bool cupertino = false,
}) {
final host = _SessionHost(run: run ?? partialRun(), gateway: gateway);
return tester.pumpWidget(
cupertino
? CupertinoApp(
home: CupertinoPageScaffold(child: SafeArea(child: host)),
)
: MaterialApp(home: Scaffold(body: host)),
);
return tester.pumpWidget(MaterialApp(home: Scaffold(body: host)));
}
TextButton _materialButton(WidgetTester tester) => tester.widget<TextButton>(
@@ -254,18 +246,15 @@ void main() {
expect(find.text('partial'), findsOneWidget);
});
testWidgets('the Cupertino host uses a native Cupertino button', (
tester,
) async {
testWidgets('the repair control is a Material text button', (tester) async {
final gateway = _RepairGateway(
(_, _) => Future<JsonMap>.error(StateError('unexpected')),
);
await _pumpSession(tester, gateway, cupertino: true);
await _pumpSession(tester, gateway);
expect(
find.widgetWithText(CupertinoButton, 'Retry export only'),
find.widgetWithText(TextButton, 'Retry export only'),
findsOneWidget,
);
expect(find.widgetWithText(TextButton, 'Retry export only'), findsNothing);
});
}
@@ -1,6 +1,5 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'run_detail_finders.dart';
@@ -65,28 +64,17 @@ class _Gateway implements ApiGateway {
Future<_Gateway> _mount(
WidgetTester tester, {
required bool cupertino,
int initialRunId = 1,
}) async {
final gateway = _Gateway();
final screen = RunsScreen(gateway: gateway, initialRunId: initialRunId);
await tester.pumpWidget(
cupertino
? CupertinoApp(
home: CupertinoPageScaffold(child: SafeArea(child: screen)),
)
: MaterialApp(home: Scaffold(body: screen)),
);
await tester.pumpWidget(MaterialApp(home: Scaffold(body: screen)));
await tester.pumpAndSettle();
return gateway;
}
String _fieldText(WidgetTester tester, {required bool cupertino}) => cupertino
? tester
.widget<CupertinoTextField>(find.byKey(runTitleFieldKey))
.controller!
.text
: tester.widget<TextField>(find.byKey(runTitleFieldKey)).controller!.text;
String _fieldText(WidgetTester tester) =>
tester.widget<TextField>(find.byKey(runTitleFieldKey)).controller!.text;
/// Rename lives in the run detail's more menu.
Future<void> _openRename(WidgetTester tester) async {
@@ -99,7 +87,7 @@ Future<void> _openRename(WidgetTester tester) async {
void main() {
testWidgets('material detail renames through the shared gateway and folds '
'only the server reply into the detail and list', (tester) async {
final gateway = await _mount(tester, cupertino: false);
final gateway = await _mount(tester);
expect(runDetailText('Nightly build'), findsOneWidget);
expect(find.byKey(runMoreMenuKey), findsOneWidget);
@@ -107,7 +95,7 @@ void main() {
await _openRename(tester);
expect(find.byType(AlertDialog), findsOneWidget);
expect(_fieldText(tester, cupertino: false), 'Nightly build');
expect(_fieldText(tester), 'Nightly build');
await tester.enterText(find.byKey(runTitleFieldKey), 'Draft only');
await tester.pump();
@@ -146,35 +134,10 @@ void main() {
);
});
testWidgets('cupertino detail shows the native rename entry point', (
tester,
) async {
final gateway = await _mount(tester, cupertino: true);
expect(find.byKey(runMoreMenuKey), findsOneWidget);
await _openRename(tester);
expect(find.byType(CupertinoAlertDialog), findsOneWidget);
expect(find.byType(AlertDialog), findsNothing);
await tester.enterText(find.byKey(runTitleFieldKey), 'Release build');
await tester.tap(find.byKey(runTitleSaveKey));
await tester.pump();
expect(gateway.saves.single.fields, {
'run_id': 1,
'title': 'Release build',
});
gateway.accept('Release build');
await tester.pumpAndSettle();
expect(find.byType(CupertinoAlertDialog), findsNothing);
expect(runDetailText('Release build'), findsOneWidget);
});
testWidgets('a refused rename keeps the typed title and the stored detail', (
tester,
) async {
final gateway = await _mount(tester, cupertino: false);
final gateway = await _mount(tester);
await _openRename(tester);
await tester.enterText(find.byKey(runTitleFieldKey), ' locked ');
@@ -184,7 +147,7 @@ void main() {
await tester.pumpAndSettle();
expect(find.text('rename refused by the server'), findsOneWidget);
expect(_fieldText(tester, cupertino: false), ' locked ');
expect(_fieldText(tester), ' locked ');
expect(find.byType(AlertDialog), findsOneWidget);
expect(runDetailText('Nightly build'), findsOneWidget);
});
@@ -1,6 +1,5 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/core/api_gateway.dart';
@@ -78,7 +77,6 @@ List<JsonMap> _fixture() {
Future<void> _mount(
WidgetTester tester,
_Gateway gateway, {
bool cupertino = false,
int? initialRunId,
RunsSortStore? store,
ValueChanged<int?>? onBack,
@@ -92,11 +90,7 @@ Future<void> _mount(
onBack: onBack,
sortStore: store ?? MemoryRunsSortStore(),
);
await tester.pumpWidget(
cupertino
? CupertinoApp(home: CupertinoPageScaffold(child: screen))
: MaterialApp(home: Scaffold(body: screen)),
);
await tester.pumpWidget(MaterialApp(home: Scaffold(body: screen)));
await tester.pumpAndSettle();
}
@@ -200,14 +194,14 @@ void main() {
testWidgets('Cancel in the prompt sends nothing', (tester) async {
final gateway = _Gateway(_fixture());
await _mount(tester, gateway, cupertino: true);
await _mount(tester, gateway);
await tester.tap(find.byKey(runsSelectKey));
await tester.pumpAndSettle();
await tester.tap(find.text('Yesterday done'));
await tester.pumpAndSettle();
await tester.tap(find.byKey(runsDeleteSelectedKey));
await tester.pumpAndSettle();
expect(find.byType(CupertinoAlertDialog), findsOneWidget);
expect(find.byType(AlertDialog), findsOneWidget);
expect(find.text('Delete 1 run?'), findsOneWidget);
await tester.tap(find.byKey(deleteRunsKeepKey));
await tester.pumpAndSettle();