963adec122
One floating frosted tab bar (host NavigationBar / CupertinoTabBar in the shared GlassPill) replaces the NavigationRail, the Cupertino sidebar and the run detail, stage page and pipeline detail tab strips. Below 600px it spans the width minus 16px margins; wider it is sized to its tabs at the right edge. Content keeps the full width, scrolls behind the bar and learns its height as bottom media padding; lists pad their end clear of it and FABs sit above it. The bar now sizes itself from its own constraints instead of the screen size, which fixes the widget_test failure where a MediaQuery without a size gave it negative width constraints.
124 lines
3.8 KiB
Dart
124 lines
3.8 KiB
Dart
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';
|
|
import 'package:pipelines_app/features/runs/actions/decision_wording.dart';
|
|
import 'package:pipelines_app/features/runs/screen.dart';
|
|
|
|
class _DecisionGateway implements ApiGateway {
|
|
final events = StreamController<JsonMap>.broadcast();
|
|
final decisions = <JsonMap>[];
|
|
final reply = Completer<JsonMap>();
|
|
final JsonMap run = {
|
|
'id': 9,
|
|
'title': 'Human checkpoint',
|
|
'name': 'fixture',
|
|
'status': 'waiting',
|
|
'executing': false,
|
|
'current_stage': 'gate',
|
|
'graph': {
|
|
'stages': [
|
|
{
|
|
'key': 'gate',
|
|
'type': 'human',
|
|
'edges': {'approve': '#success'},
|
|
},
|
|
],
|
|
},
|
|
'steps': [
|
|
{
|
|
'sequence': 1,
|
|
'stage': 'gate',
|
|
'status': 'waiting',
|
|
'output': {
|
|
'prompt': 'Please review this recorded checkpoint.',
|
|
'options': ['approve'],
|
|
},
|
|
},
|
|
],
|
|
};
|
|
|
|
@override
|
|
Stream<JsonMap> get frames => events.stream;
|
|
@override
|
|
Future<JsonMap> call(String type, [JsonMap fields = const {}]) =>
|
|
switch (type) {
|
|
'list_runs' => Future.value({
|
|
'runs': [run],
|
|
}),
|
|
'get_run' => Future.value({'run_detail': run}),
|
|
'decide_run' => _decide(fields),
|
|
_ => Future.error(UnsupportedError(type)),
|
|
};
|
|
Future<JsonMap> _decide(JsonMap fields) {
|
|
decisions.add(fields);
|
|
return reply.future;
|
|
}
|
|
}
|
|
|
|
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 at its 16px inset, with
|
|
// Decide trailing.
|
|
final banner = tester.getRect(
|
|
find.byKey(const Key('run-decision-banner')),
|
|
);
|
|
final pane = tester.getRect(
|
|
find.byKey(const ValueKey('list-detail-body')),
|
|
);
|
|
expect(banner.left, pane.left + 16);
|
|
expect(banner.right, pane.right - 16);
|
|
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());
|
|
},
|
|
);
|
|
}
|
|
}
|