Unify flexible list-detail panes and highlight active pipelines and runs
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import '../../shell/destination.dart';
|
||||
import '../../shell/detail_page.dart';
|
||||
import '../../shell/list_detail.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@@ -15,10 +16,6 @@ import 'widgets/pipeline_list_panel.dart';
|
||||
|
||||
export 'pipeline_models.dart' show PipelineDetail, PipelineVersion;
|
||||
|
||||
/// Below this width the list and detail are separate pages; above it they sit
|
||||
/// side by side. One local breakpoint, not a styling system.
|
||||
const double kPipelinesWideBreakpoint = 720;
|
||||
|
||||
/// The read-only Pipelines destination: list, filters/sort, detail, source and
|
||||
/// version history.
|
||||
///
|
||||
@@ -217,7 +214,7 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
|
||||
final stageKey = _takeStageKey();
|
||||
final body = LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final wide = constraints.maxWidth >= kPipelinesWideBreakpoint;
|
||||
final wide = showsListBesideDetail(context);
|
||||
// On a phone an open pipeline is its own page over the tabs.
|
||||
_page.sync(
|
||||
context,
|
||||
@@ -243,29 +240,19 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
|
||||
),
|
||||
);
|
||||
if (!wide) return PipelineListPanel(controller: _controller);
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: PipelineListPanel(controller: _controller),
|
||||
),
|
||||
_divider(context),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: PipelineDetailPanel(
|
||||
controller: _controller,
|
||||
gateway: widget.gateway,
|
||||
showBack: false,
|
||||
onRunStarted: widget.onRunStarted,
|
||||
onViewPipelineRuns: widget.onViewPipelineRuns,
|
||||
stageKey: stageKey,
|
||||
stagePipelineId: widget.initialPipelineId,
|
||||
stageVersion: widget.initialVersion,
|
||||
stageRequest: _stageRequest,
|
||||
),
|
||||
),
|
||||
],
|
||||
return ListDetailPanes(
|
||||
list: PipelineListPanel(controller: _controller),
|
||||
detail: PipelineDetailPanel(
|
||||
controller: _controller,
|
||||
gateway: widget.gateway,
|
||||
showBack: false,
|
||||
onRunStarted: widget.onRunStarted,
|
||||
onViewPipelineRuns: widget.onViewPipelineRuns,
|
||||
stageKey: stageKey,
|
||||
stagePipelineId: widget.initialPipelineId,
|
||||
stageVersion: widget.initialVersion,
|
||||
stageRequest: _stageRequest,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -281,7 +268,7 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
|
||||
/// refresh in it; an open pipeline on a phone keeps refresh only.
|
||||
Widget _embeddedBody(BuildContext context, Widget body) {
|
||||
if (ShellBar.available(context)) {
|
||||
final wide = MediaQuery.sizeOf(context).width >= kPipelinesWideBreakpoint;
|
||||
final wide = showsListBesideDetail(context);
|
||||
final listShown = wide || !_controller.hasSelection;
|
||||
return ShellBar(
|
||||
actions: [
|
||||
@@ -355,16 +342,6 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _divider(BuildContext context) {
|
||||
if (useCupertinoControls(context)) {
|
||||
return Container(
|
||||
width: 1,
|
||||
color: CupertinoColors.separator.resolveFrom(context),
|
||||
);
|
||||
}
|
||||
return const VerticalDivider(width: 1);
|
||||
}
|
||||
|
||||
Widget _materialShell(BuildContext context, Widget body) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
|
||||
@@ -197,6 +197,8 @@ class PipelineListPanel extends StatelessWidget {
|
||||
return ListTile(
|
||||
key: Key('pipeline-row-${pipeline.id}'),
|
||||
selected: controller.selectedId == pipeline.id,
|
||||
selectedTileColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
selectedColor: Theme.of(context).colorScheme.onSecondaryContainer,
|
||||
onTap: () =>
|
||||
controller.openPipeline(pipeline.id, version: pipeline.version),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
@@ -219,14 +221,20 @@ class PipelineListPanel extends StatelessWidget {
|
||||
backgroundColor: AppColors.groupedBackground,
|
||||
children: [
|
||||
for (final pipeline in items)
|
||||
CupertinoListTile(
|
||||
key: Key('pipeline-row-${pipeline.id}'),
|
||||
title: _rowTitle(context, pipeline),
|
||||
subtitle: _rowMetadata(context, pipeline, now),
|
||||
trailing: const CupertinoListTileChevron(),
|
||||
onTap: () => controller.openPipeline(
|
||||
pipeline.id,
|
||||
version: pipeline.version,
|
||||
Semantics(
|
||||
selected: controller.selectedId == pipeline.id,
|
||||
child: CupertinoListTile(
|
||||
key: Key('pipeline-row-${pipeline.id}'),
|
||||
backgroundColor: controller.selectedId == pipeline.id
|
||||
? CupertinoColors.tertiarySystemFill.resolveFrom(context)
|
||||
: null,
|
||||
title: _rowTitle(context, pipeline),
|
||||
subtitle: _rowMetadata(context, pipeline, now),
|
||||
trailing: const CupertinoListTileChevron(),
|
||||
onTap: () => controller.openPipeline(
|
||||
pipeline.id,
|
||||
version: pipeline.version,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:flutter/widgets.dart';
|
||||
import '../../core/api_gateway.dart';
|
||||
import '../../shell/destination.dart';
|
||||
import '../../shell/detail_page.dart';
|
||||
import '../../shell/list_detail.dart';
|
||||
import '../../ui/adaptive/host.dart';
|
||||
import '../attention/notify/notification_controller.dart';
|
||||
import '../attention/runtime/attention_controller.dart';
|
||||
@@ -247,9 +248,8 @@ class _RunsScreenState extends State<RunsScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final selected = controller.selectedRunId != null;
|
||||
// On a phone an open run is its own page over the tabs; a wide window
|
||||
// keeps it in the tab, beside the destination rail.
|
||||
final narrow = MediaQuery.sizeOf(context).width < kDetailPageMaxWidth;
|
||||
// The same adaptive list/detail layout as Pipelines and Chat.
|
||||
final narrow = !showsListBesideDetail(context);
|
||||
_page.sync(
|
||||
context,
|
||||
selected: selected && narrow,
|
||||
@@ -260,7 +260,7 @@ class _RunsScreenState extends State<RunsScreen> {
|
||||
final list = AnimatedBuilder(
|
||||
animation: controller,
|
||||
builder: (context, _) => RunsList(
|
||||
active: !selected,
|
||||
active: narrow ? !selected : true,
|
||||
controller: controller,
|
||||
onSelected: _select,
|
||||
syncToken: widget.syncToken,
|
||||
@@ -271,11 +271,16 @@ class _RunsScreenState extends State<RunsScreen> {
|
||||
),
|
||||
);
|
||||
if (narrow) return list;
|
||||
return Stack(
|
||||
children: [
|
||||
Offstage(offstage: selected, child: list),
|
||||
if (selected) _detail(_back),
|
||||
],
|
||||
return ListDetailPanes(
|
||||
list: list,
|
||||
detail: selected
|
||||
? DetailPane(
|
||||
key: const ValueKey('run-detail-pane'),
|
||||
destination: AppDestination.runs,
|
||||
implyBack: false,
|
||||
builder: (_) => _detail(_back),
|
||||
)
|
||||
: const Center(child: Text('Select a run to open it here.')),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,6 +199,7 @@ class RunsList extends StatelessWidget {
|
||||
final id = run['id'];
|
||||
return RunListRow(
|
||||
run: run,
|
||||
selected: id == controller.selectedRunId,
|
||||
now: DateTime.now(),
|
||||
onTap: id is num ? () => onSelected(id) : null,
|
||||
);
|
||||
@@ -213,11 +214,13 @@ class RunListRow extends StatelessWidget {
|
||||
super.key,
|
||||
required this.run,
|
||||
required this.now,
|
||||
this.selected = false,
|
||||
this.onTap,
|
||||
});
|
||||
|
||||
final JsonMap run;
|
||||
final DateTime now;
|
||||
final bool selected;
|
||||
final VoidCallback? onTap;
|
||||
|
||||
@override
|
||||
@@ -233,9 +236,14 @@ class RunListRow extends StatelessWidget {
|
||||
final secondary = cupertino
|
||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.onSurfaceVariant;
|
||||
final base = cupertino
|
||||
final nativeStyle = cupertino
|
||||
? CupertinoTheme.of(context).textTheme.textStyle
|
||||
: Theme.of(context).textTheme.bodyMedium ?? const TextStyle();
|
||||
final base = !cupertino && selected
|
||||
? nativeStyle.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSecondaryContainer,
|
||||
)
|
||||
: nativeStyle;
|
||||
final titleStyle = base.copyWith(fontWeight: FontWeight.w600);
|
||||
final small = base.copyWith(
|
||||
color: secondary,
|
||||
@@ -304,17 +312,31 @@ class RunListRow extends StatelessWidget {
|
||||
child: body,
|
||||
);
|
||||
return Semantics(
|
||||
selected: selected,
|
||||
button: onTap != null,
|
||||
child: cupertino
|
||||
? CupertinoButton(
|
||||
key: ValueKey('run-row-$id'),
|
||||
color: selected
|
||||
? CupertinoColors.tertiarySystemFill.resolveFrom(context)
|
||||
: null,
|
||||
padding: EdgeInsets.zero,
|
||||
minimumSize: Size.zero,
|
||||
pressedOpacity: 0.6,
|
||||
onPressed: onTap,
|
||||
child: DefaultTextStyle(style: base, child: padded),
|
||||
)
|
||||
: InkWell(key: ValueKey('run-row-$id'), onTap: onTap, child: padded),
|
||||
: Material(
|
||||
key: ValueKey('run-row-surface-$id'),
|
||||
color: selected
|
||||
? Theme.of(context).colorScheme.secondaryContainer
|
||||
: Colors.transparent,
|
||||
child: InkWell(
|
||||
key: ValueKey('run-row-$id'),
|
||||
onTap: onTap,
|
||||
child: padded,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,9 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
|
||||
late AppDestination _selected;
|
||||
final Set<AppDestination> _visited = {};
|
||||
final ShellBarRegistry _bar = ShellBarRegistry();
|
||||
// The Cupertino sidebar and tab layouts have different parents. Preserve
|
||||
// destination selection/state while the same content moves between them.
|
||||
final GlobalKey _destinationStackKey = GlobalKey();
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
@@ -274,7 +277,7 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
|
||||
}
|
||||
|
||||
Widget _destinationStack(List<Widget> contents, int index) =>
|
||||
IndexedStack(index: index, children: contents);
|
||||
IndexedStack(key: _destinationStackKey, index: index, children: contents);
|
||||
}
|
||||
|
||||
/// The wide-window Cupertino destination list: the web's 200px rail with the
|
||||
|
||||
@@ -5,10 +5,6 @@ import '../ui/adaptive/host.dart';
|
||||
import 'destination.dart';
|
||||
import 'shell_bar.dart';
|
||||
|
||||
/// Narrower than this, an open item is its own page; wider windows keep it
|
||||
/// beside the destination rail.
|
||||
const double kDetailPageMaxWidth = 600;
|
||||
|
||||
/// Keeps one full-screen detail page (an open run, pipeline or chat) in step
|
||||
/// with a screen's selection: selecting pushes the page over the tabs, like a
|
||||
/// new activity, and closing it (its Back, the system Back) clears the
|
||||
@@ -137,10 +133,18 @@ class _DetailPaneState extends State<DetailPane> {
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
automaticallyImplyLeading: widget.implyBack,
|
||||
// Inline pane bars are not routes and must not join the shell's
|
||||
// navigation-bar hero when resizing into a pushed phone page.
|
||||
transitionBetweenRoutes: widget.implyBack,
|
||||
middle: Text(title),
|
||||
trailing: actions.isEmpty
|
||||
? null
|
||||
: Row(mainAxisSize: MainAxisSize.min, children: actions),
|
||||
: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
for (final action in actions) Flexible(child: action),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: SafeArea(child: body),
|
||||
);
|
||||
@@ -149,7 +153,7 @@ class _DetailPaneState extends State<DetailPane> {
|
||||
appBar: AppBar(
|
||||
automaticallyImplyLeading: widget.implyBack,
|
||||
title: Text(title),
|
||||
actions: actions,
|
||||
actions: [for (final action in actions) Flexible(child: action)],
|
||||
),
|
||||
body: SafeArea(top: false, child: body),
|
||||
);
|
||||
|
||||
@@ -7,17 +7,12 @@ import '../ui/adaptive/host.dart';
|
||||
/// (with the destination rail) instead of pushing the item as its own page.
|
||||
const double kListDetailMinWidth = 600;
|
||||
|
||||
/// The list pane's share of a two-pane window, bounded so neither the rows
|
||||
/// nor the open item become unusably narrow.
|
||||
const double _listFraction = 0.36;
|
||||
const double _listMinWidth = 280;
|
||||
const double _listMaxWidth = 400;
|
||||
|
||||
/// Whether the window at [context] shows list and detail side by side.
|
||||
bool showsListBesideDetail(BuildContext context) =>
|
||||
MediaQuery.sizeOf(context).width >= kListDetailMinWidth;
|
||||
|
||||
/// A list beside its open item, split by the platform's own divider.
|
||||
/// Equal flexible panes, shared by Pipelines, Runs and Chat. No destination
|
||||
/// supplies a pixel width, minimum/maximum pane width or split ratio.
|
||||
class ListDetailPanes extends StatelessWidget {
|
||||
const ListDetailPanes({super.key, required this.list, required this.detail});
|
||||
|
||||
@@ -32,21 +27,33 @@ class ListDetailPanes extends StatelessWidget {
|
||||
color: CupertinoColors.separator.resolveFrom(context),
|
||||
)
|
||||
: const VerticalDivider(width: 1);
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final width = (constraints.maxWidth * _listFraction).clamp(
|
||||
_listMinWidth,
|
||||
_listMaxWidth,
|
||||
);
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
SizedBox(width: width, child: list),
|
||||
divider,
|
||||
Expanded(child: detail),
|
||||
],
|
||||
);
|
||||
},
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Expanded(
|
||||
child: SizedBox.expand(
|
||||
key: const ValueKey('list-detail-list'),
|
||||
child: Semantics(
|
||||
container: true,
|
||||
explicitChildNodes: true,
|
||||
identifier: 'list-detail-list',
|
||||
child: list,
|
||||
),
|
||||
),
|
||||
),
|
||||
divider,
|
||||
Expanded(
|
||||
child: SizedBox.expand(
|
||||
key: const ValueKey('list-detail-body'),
|
||||
child: Semantics(
|
||||
container: true,
|
||||
explicitChildNodes: true,
|
||||
identifier: 'list-detail-body',
|
||||
child: detail,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
# Consistent selected rows and list/detail panes
|
||||
|
||||
## Changes
|
||||
|
||||
- Pipelines, Runs and Chat now use `shell/list_detail.dart`'s `ListDetailPanes`.
|
||||
Both panes are plain `Expanded` children: equal shares of the available space,
|
||||
with no pixel pane widths, min/max width clamps or per-screen split ratios.
|
||||
Removed the Chat width clamps and Pipelines' separate weighted split.
|
||||
- All three use the existing shared responsive breakpoint for list/detail
|
||||
presentation. Phone-size selections remain real pushed pages with stock Back.
|
||||
- Runs keeps its list, filters and attention bell available beside an open run.
|
||||
Its own detail bar is scoped to the detail pane, matching Chat's composition.
|
||||
The selected row remains visible while loading or when a detail read fails.
|
||||
- Pipelines and Runs use the same theme-based selected backgrounds as Chat:
|
||||
Material secondary-container color and Cupertino tertiary-system fill, with
|
||||
selected semantics. Switching items moves the highlight.
|
||||
- Detail-bar actions flex within the pane rather than overflowing narrow panes.
|
||||
Cupertino destination state survives sidebar/tab-layout reparenting; inline
|
||||
bars do not join route-navigation heroes when resizing into a phone page.
|
||||
|
||||
## Checks and evidence
|
||||
|
||||
- Full `flutter test`: **1,927 passed**. `flutter analyze`: clean.
|
||||
- Release web build: `build/shared-list-detail-web`.
|
||||
- New integration matrix covers both native hosts, light/dark, three widths,
|
||||
every destination, switching two selections, equal pane widths, and
|
||||
wide → phone → wide resizing without clearing the selected item.
|
||||
- Existing run-action/navigation tests now scope detail assertions to the detail
|
||||
(the list deliberately repeats the selected title). Phone Back coverage is
|
||||
retained; wide tests assert the visible list/detail rather than a removed Back.
|
||||
- Real browser probes measure pane bounds and selected accessibility state in
|
||||
`build/shared-list-detail-{material,material-dark,cupertino,cupertino-light}/`.
|
||||
In every variant, list and body widths are equal and identical across all three
|
||||
destinations. Selection changes do not resize either pane. Captures inspected.
|
||||
- Fixture limits: pipeline schedules are intentionally unsupported by the wiring
|
||||
fixture; the second run deliberately refuses its detail read. These are fixture
|
||||
error states, not claims that schedules or provider execution were verified.
|
||||
- No pre-change screenshot captured. Source diffs show the removed independent
|
||||
widths and hidden Runs list. No public web/APK publication or new device test
|
||||
was performed for this change.
|
||||
@@ -0,0 +1,234 @@
|
||||
import 'dart:ui' show Tristate;
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:pipelines_app/features/chat/screen.dart';
|
||||
import 'package:pipelines_app/features/pipelines/screen.dart';
|
||||
import 'package:pipelines_app/features/runs/screen.dart';
|
||||
import 'package:pipelines_app/shell/adaptive_shell.dart';
|
||||
import 'package:pipelines_app/shell/destination.dart';
|
||||
import 'package:pipelines_app/ui/theme/app_theme.dart';
|
||||
|
||||
import '../features/pipelines/fixtures.dart';
|
||||
|
||||
void main() {
|
||||
for (final cupertino in [false, true]) {
|
||||
for (final brightness in Brightness.values) {
|
||||
for (final width in [640.0, 840.0, 1280.0]) {
|
||||
testWidgets('shared equal panes and selected rows: $cupertino '
|
||||
'$brightness at $width', (tester) async {
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
tester.view.physicalSize = Size(width, 900);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
final fixture = PipelineFixture();
|
||||
final gateway = FakeGateway(
|
||||
(type, fields) => switch (type) {
|
||||
'list_pipelines' => pipelineListReply(fixture.summaries),
|
||||
'get_pipeline' => pipelineDetailReply(
|
||||
fixture.detailFor(
|
||||
fields['pipeline_id'] as int,
|
||||
fields['version'] as int,
|
||||
)!,
|
||||
),
|
||||
'list_runs' => {
|
||||
'runs': [
|
||||
for (final id in [1, 2])
|
||||
{'id': id, 'title': 'Run item $id', 'status': 'succeeded'},
|
||||
],
|
||||
},
|
||||
'get_run' => {
|
||||
'run_detail': {
|
||||
'id': fields['run_id'],
|
||||
'title': 'Run item ${fields['run_id']}',
|
||||
'status': 'succeeded',
|
||||
'input': {'prompt': 'Recorded input'},
|
||||
},
|
||||
},
|
||||
'chat_sessions' => {
|
||||
'chat_sessions': [
|
||||
{
|
||||
'id': 'a',
|
||||
'title': 'Chat item a',
|
||||
'backend': 'claude',
|
||||
'model': 'claude-opus',
|
||||
'mode': 'auto',
|
||||
'mode_name': 'Auto',
|
||||
},
|
||||
{
|
||||
'id': 'b',
|
||||
'title': 'Chat item b',
|
||||
'backend': 'claude',
|
||||
'model': 'claude-opus',
|
||||
'mode': 'auto',
|
||||
'mode_name': 'Auto',
|
||||
},
|
||||
],
|
||||
},
|
||||
'chat_messages' => {
|
||||
'chat_history': {'messages': []},
|
||||
},
|
||||
_ => {},
|
||||
},
|
||||
);
|
||||
final shell = AdaptiveShell(
|
||||
cupertino: cupertino,
|
||||
destinationBodies: {
|
||||
AppDestination.pipelines: (_) =>
|
||||
PipelinesScreen(gateway: gateway, embedded: true),
|
||||
AppDestination.runs: (_) => RunsScreen(gateway: gateway),
|
||||
AppDestination.chat: (_) => ChatScreen(gateway: gateway),
|
||||
},
|
||||
);
|
||||
await tester.pumpWidget(
|
||||
cupertino
|
||||
? CupertinoApp(
|
||||
theme: CupertinoThemeData(brightness: brightness),
|
||||
home: shell,
|
||||
)
|
||||
: MaterialApp(
|
||||
theme: brightness == Brightness.dark
|
||||
? appDarkTheme()
|
||||
: appLightTheme(),
|
||||
home: shell,
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
final paneWidths = <double>[];
|
||||
for (final destination in ['Pipelines', 'Runs', 'Chat']) {
|
||||
if (destination != 'Pipelines') {
|
||||
await tester.tap(find.text(destination).first);
|
||||
await tester.pumpAndSettle();
|
||||
expect(
|
||||
tester.takeException(),
|
||||
isNull,
|
||||
reason: '$destination list',
|
||||
);
|
||||
}
|
||||
final list = find.byKey(const ValueKey('list-detail-list'));
|
||||
final detail = find.byKey(const ValueKey('list-detail-body'));
|
||||
expect(list, findsOneWidget);
|
||||
expect(detail, findsOneWidget);
|
||||
final before = tester.getSize(list).width;
|
||||
paneWidths.add(before);
|
||||
expect(before, closeTo(tester.getSize(detail).width, 0.01));
|
||||
final rowKeys = switch (destination) {
|
||||
'Pipelines' => ['pipeline-row-1', 'pipeline-row-2'],
|
||||
'Runs' => ['run-row-1', 'run-row-2'],
|
||||
_ => ['chat-row-a', 'chat-row-b'],
|
||||
};
|
||||
for (final key in rowKeys) {
|
||||
final target = find.byKey(ValueKey(key));
|
||||
// In a narrow Cupertino list the row center can be a star/menu
|
||||
// control. Open the chat through its title, not a trailing action.
|
||||
await tester.tap(
|
||||
destination == 'Chat'
|
||||
? find.descendant(
|
||||
of: target,
|
||||
matching: find.text('Chat item ${key.split('-').last}'),
|
||||
)
|
||||
: target,
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(
|
||||
tester.takeException(),
|
||||
isNull,
|
||||
reason: '$destination after opening $key',
|
||||
);
|
||||
expect(tester.getSize(list).width, closeTo(before, 0.01));
|
||||
expect(tester.getSize(detail).width, closeTo(before, 0.01));
|
||||
expect(
|
||||
tester.state<NavigatorState>(find.byType(Navigator)).canPop(),
|
||||
isFalse,
|
||||
);
|
||||
for (final rowKey in rowKeys) {
|
||||
final row = find.byKey(ValueKey(rowKey));
|
||||
expect(
|
||||
row,
|
||||
findsOneWidget,
|
||||
reason: 'the list must remain visible',
|
||||
);
|
||||
final selected = rowKey == key;
|
||||
expect(
|
||||
tester.getSemantics(row).flagsCollection.isSelected ==
|
||||
Tristate.isTrue,
|
||||
selected,
|
||||
reason: '$destination: $rowKey after opening $key',
|
||||
);
|
||||
final context = tester.element(row);
|
||||
if (cupertino) {
|
||||
final color = destination == 'Runs'
|
||||
? tester.widget<CupertinoButton>(row).color
|
||||
: tester.widget<CupertinoListTile>(row).backgroundColor;
|
||||
expect(
|
||||
color,
|
||||
selected
|
||||
? CupertinoColors.tertiarySystemFill.resolveFrom(
|
||||
context,
|
||||
)
|
||||
: isNull,
|
||||
);
|
||||
} else if (destination == 'Runs') {
|
||||
final id = rowKey.split('-').last;
|
||||
expect(
|
||||
tester
|
||||
.widget<Material>(
|
||||
find.byKey(ValueKey('run-row-surface-$id')),
|
||||
)
|
||||
.color,
|
||||
selected
|
||||
? Theme.of(context).colorScheme.secondaryContainer
|
||||
: Colors.transparent,
|
||||
);
|
||||
} else {
|
||||
final tile = tester.widget<ListTile>(row);
|
||||
expect(tile.selected, selected);
|
||||
expect(
|
||||
tile.selectedTileColor,
|
||||
Theme.of(context).colorScheme.secondaryContainer,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
// A phone still uses stock page navigation; returning to a wide
|
||||
// window must keep the selected item without clearing its route.
|
||||
tester.view.physicalSize = const Size(390, 900);
|
||||
await tester.pumpAndSettle();
|
||||
expect(
|
||||
tester.state<NavigatorState>(find.byType(Navigator)).canPop(),
|
||||
isTrue,
|
||||
reason: '$destination should push its selected item on a phone',
|
||||
);
|
||||
expect(
|
||||
find.byKey(const ValueKey('list-detail-list')),
|
||||
findsNothing,
|
||||
);
|
||||
tester.view.physicalSize = Size(width, 900);
|
||||
await tester.pumpAndSettle();
|
||||
expect(
|
||||
tester.state<NavigatorState>(find.byType(Navigator)).canPop(),
|
||||
isFalse,
|
||||
);
|
||||
expect(tester.getSize(list).width, closeTo(before, 0.01));
|
||||
expect(
|
||||
tester
|
||||
.getSemantics(find.byKey(ValueKey(rowKeys.last)))
|
||||
.flagsCollection
|
||||
.isSelected,
|
||||
Tristate.isTrue,
|
||||
);
|
||||
}
|
||||
expect(
|
||||
paneWidths,
|
||||
everyElement(closeTo(paneWidths.first, 0.01)),
|
||||
reason: 'Pipelines, Runs and Chat must use identical pane widths',
|
||||
);
|
||||
expect(tester.takeException(), isNull);
|
||||
await tester.pumpWidget(const SizedBox.shrink());
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -143,6 +143,9 @@ void main() {
|
||||
testWidgets('a /runs/1 boot link opens that run and Back returns to /runs', (
|
||||
tester,
|
||||
) async {
|
||||
tester.view.physicalSize = const Size(390, 844);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
final channel = FakeChannel()..readyCompleter.complete();
|
||||
final client = PipelinesClient(channelFactory: (_) => channel);
|
||||
final provider = PlatformRouteInformationProvider(
|
||||
@@ -159,6 +162,7 @@ void main() {
|
||||
],
|
||||
);
|
||||
await replyDetail(tester, channel, 1);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Run 1'), findsWidgets);
|
||||
expect(findNativeBack(), findsOneWidget);
|
||||
@@ -166,7 +170,7 @@ void main() {
|
||||
expect(find.text('Pipelines — Not implemented'), findsNothing);
|
||||
|
||||
await tester.tap(findNativeBack());
|
||||
await tester.pump();
|
||||
await tester.pumpAndSettle();
|
||||
expect(provider.value.uri.path, '/runs');
|
||||
expect(find.text('Deep-linked run'), findsWidgets);
|
||||
});
|
||||
@@ -259,7 +263,8 @@ void main() {
|
||||
await tester.pump();
|
||||
expect(provider.value.uri.path, '/runs/2');
|
||||
await replyDetail(tester, channel, 2);
|
||||
expect(findNativeBack(), findsOneWidget);
|
||||
expect(findNativeBack(), findsNothing);
|
||||
expect(find.byKey(const ValueKey('run-detail-pane')), findsOneWidget);
|
||||
|
||||
// The engine's browser Back arrives as new route information.
|
||||
await provider.didPushRouteInformation(
|
||||
@@ -278,7 +283,8 @@ void main() {
|
||||
await tester.pump();
|
||||
await replyDetail(tester, channel, 2);
|
||||
await tester.pump();
|
||||
expect(findNativeBack(), findsOneWidget);
|
||||
expect(findNativeBack(), findsNothing);
|
||||
expect(find.byKey(const ValueKey('run-detail-pane')), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('a malformed boot path is corrected to /pipelines', (
|
||||
|
||||
@@ -10,6 +10,7 @@ import 'package:pipelines_app/core/transport/pipelines_client.dart';
|
||||
import 'package:pipelines_app/features/runs/screen.dart';
|
||||
|
||||
import '../core/transport/pipelines_client_test.dart' show FakeChannel;
|
||||
import '../features/runs/ui/run_detail_finders.dart';
|
||||
|
||||
ServerEndpoint webServer() => ServerEndpoint.resolve(
|
||||
base: Uri.parse('http://127.0.0.1:8096/'),
|
||||
@@ -228,13 +229,13 @@ void main() {
|
||||
}),
|
||||
);
|
||||
await tester.pump();
|
||||
expect(find.text('Open run'), findsOneWidget);
|
||||
expect(find.text('Back to list'), findsOneWidget);
|
||||
expect(runDetailText('Open run'), findsOneWidget);
|
||||
expect(find.byKey(const ValueKey('run-row-1')), findsOneWidget);
|
||||
|
||||
first.incoming.addError(StateError('network drop'));
|
||||
await tester.pump();
|
||||
expect(find.byType(RunsScreen), findsOneWidget);
|
||||
expect(find.text('Open run'), findsOneWidget);
|
||||
expect(runDetailText('Open run'), findsOneWidget);
|
||||
expect(find.text('Reconnecting to Pipelines…'), findsOneWidget);
|
||||
|
||||
for (
|
||||
@@ -262,7 +263,7 @@ void main() {
|
||||
await tester.pump(const Duration(milliseconds: 10));
|
||||
}
|
||||
final refreshed = detailRequests(second, 1).single;
|
||||
expect(find.text('Open run'), findsOneWidget);
|
||||
expect(runDetailText('Open run'), findsOneWidget);
|
||||
second.incoming.add(
|
||||
jsonEncode({
|
||||
'id': refreshed['id'],
|
||||
@@ -271,8 +272,8 @@ void main() {
|
||||
}),
|
||||
);
|
||||
await tester.pump();
|
||||
expect(find.text('Open run'), findsOneWidget);
|
||||
expect(find.text('Back to list'), findsOneWidget);
|
||||
expect(runDetailText('Open run'), findsOneWidget);
|
||||
expect(find.byKey(const ValueKey('run-row-1')), findsOneWidget);
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -324,7 +324,8 @@ void main() {
|
||||
|
||||
expect(provider.value.uri.path, '/runs/2');
|
||||
expect(find.byType(SearchScreen), findsNothing);
|
||||
expect(findNativeBack(), findsOneWidget);
|
||||
expect(findNativeBack(), findsNothing);
|
||||
expect(find.byKey(const ValueKey('run-detail-pane')), findsOneWidget);
|
||||
expect(find.text('Run 2'), findsWidgets);
|
||||
// The shell was never remounted, so the open run was not re-read.
|
||||
expect(requestsOf(channel, 'get_run'), hasLength(1));
|
||||
@@ -409,7 +410,8 @@ void main() {
|
||||
expect(provider.value.uri.path, '/runs/7');
|
||||
await replyRunDetail(tester, channel, 7, index: 1);
|
||||
expect(find.byType(SearchScreen), findsNothing);
|
||||
expect(findNativeBack(), findsOneWidget);
|
||||
expect(findNativeBack(), findsNothing);
|
||||
expect(find.byKey(const ValueKey('run-detail-pane')), findsOneWidget);
|
||||
expect(find.text('Run 7'), findsWidgets);
|
||||
// One app socket carried the search and the run reads.
|
||||
expect(sockets, 1);
|
||||
@@ -651,8 +653,8 @@ void main() {
|
||||
// leaves from the loading placeholder instead.
|
||||
await openArtifactHit(tester, channel);
|
||||
expect(provider.value.uri.path, '/runs/7');
|
||||
expect(findNativeBack(), findsOneWidget);
|
||||
await tester.tap(findNativeBack());
|
||||
expect(find.byKey(const ValueKey('run-detail-pane')), findsOneWidget);
|
||||
await tester.tap(find.text('Back to list'));
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
expect(provider.value.uri.path, '/runs');
|
||||
@@ -711,7 +713,9 @@ void main() {
|
||||
|
||||
await tester.tap(find.byKey(const Key('run-visit-back')));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(findNativeBack());
|
||||
await provider.didPushRouteInformation(
|
||||
RouteInformation(uri: Uri.parse('/runs')),
|
||||
);
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
expect(provider.value.uri.path, '/runs');
|
||||
|
||||
@@ -115,8 +115,8 @@ void main() {
|
||||
await tester.pump();
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
await tester.tap(find.text(native ? 'Back' : 'Back to list'));
|
||||
await tester.pump();
|
||||
// The wide list and its bell stay available beside the open detail.
|
||||
expect(find.byKey(const ValueKey('run-row-2')), findsOneWidget);
|
||||
await openAttentionSheet(tester);
|
||||
await tester.tap(find.byKey(attentionRowKey('2:Failed')));
|
||||
await tester.pump();
|
||||
|
||||
@@ -79,8 +79,7 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(cancelActionKey), findsNothing);
|
||||
expect(find.text('canceled'), findsOneWidget);
|
||||
await tester.tap(find.text(cupertino ? 'Back' : 'Back to list'));
|
||||
await tester.pumpAndSettle();
|
||||
// The held list is already visible beside the detail.
|
||||
expect(
|
||||
find.byWidgetPredicate(
|
||||
(widget) => widget is RunStatusIcon && widget.label == 'canceled',
|
||||
|
||||
@@ -3,6 +3,7 @@ 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';
|
||||
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';
|
||||
@@ -120,7 +121,7 @@ void main() {
|
||||
await tester.tap(find.text(decisionCancelLabel));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(decisionFeedbackKey), findsNothing);
|
||||
expect(find.text('Human checkpoint'), findsOneWidget);
|
||||
expect(runDetailText('Human checkpoint'), findsOneWidget);
|
||||
expect(find.byKey(decisionActionKey), findsOneWidget);
|
||||
});
|
||||
}
|
||||
@@ -134,7 +135,7 @@ void main() {
|
||||
|
||||
expect(find.byKey(decisionFeedbackKey), findsNothing);
|
||||
expect(find.byKey(decisionActionKey), findsNothing);
|
||||
expect(find.text('Human checkpoint'), findsOneWidget);
|
||||
expect(runDetailText('Human checkpoint'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('a route without decide keeps the plain waiting detail', (
|
||||
@@ -145,7 +146,7 @@ void main() {
|
||||
await _pump(tester, gateway, decide: false);
|
||||
|
||||
expect(find.byKey(decisionFeedbackKey), findsNothing);
|
||||
expect(find.text('Human checkpoint'), findsOneWidget);
|
||||
expect(runDetailText('Human checkpoint'), findsOneWidget);
|
||||
expect(find.byKey(decisionActionKey), findsOneWidget);
|
||||
|
||||
// The landed button still opens the same prompt deliberately.
|
||||
|
||||
@@ -79,7 +79,7 @@ void main() {
|
||||
);
|
||||
final tabs = tester.getRect(find.byKey(const Key('run-detail-tabs')));
|
||||
expect(banner.left, tabs.left);
|
||||
expect(banner.width, greaterThan(tabs.width));
|
||||
expect(banner.width, greaterThanOrEqualTo(tabs.width));
|
||||
expect(
|
||||
tester.getCenter(find.byKey(decisionActionKey)).dx,
|
||||
greaterThan(banner.center.dx),
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_detail_view.dart';
|
||||
|
||||
/// Wide screens deliberately repeat the selected title in the visible list.
|
||||
Finder runDetailText(String text) =>
|
||||
find.descendant(of: find.byType(RunDetailView), matching: find.text(text));
|
||||
@@ -5,6 +5,7 @@ import 'package:pipelines_app/core/transport/connection_state.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('a reply without an id never opens a guessed run', (
|
||||
@@ -27,7 +28,7 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(opened, isEmpty);
|
||||
expect(find.text(retryFailedTitle), findsOneWidget);
|
||||
expect(runDetailText(retryFailedTitle), findsOneWidget);
|
||||
expect(find.text('Unknown run'), findsNothing);
|
||||
expect(gateway.calls.where((call) => call.type == 'get_run'), hasLength(1));
|
||||
});
|
||||
@@ -49,7 +50,7 @@ void main() {
|
||||
|
||||
expect(find.text('the run is still executing'), findsOneWidget);
|
||||
expect(opened, isEmpty);
|
||||
expect(find.text(retryFailedTitle), findsOneWidget);
|
||||
expect(runDetailText(retryFailedTitle), findsOneWidget);
|
||||
await tester.tap(find.byKey(retryKeepKey));
|
||||
await tester.pumpAndSettle();
|
||||
expect(await retryOffered(tester), isTrue);
|
||||
@@ -97,7 +98,7 @@ void main() {
|
||||
// The accepted detail still folds, but its id is the source run, so there
|
||||
// is no new run to open and no second read.
|
||||
expect(opened, isEmpty);
|
||||
expect(find.text(retryCreatedTitle), findsOneWidget);
|
||||
expect(runDetailText(retryCreatedTitle), findsOneWidget);
|
||||
expect(gateway.calls.where((call) => call.type == 'get_run'), hasLength(1));
|
||||
});
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ 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() {
|
||||
for (final cupertino in [false, true]) {
|
||||
@@ -20,7 +21,7 @@ void main() {
|
||||
onRunSelected: opened.add,
|
||||
);
|
||||
|
||||
expect(find.text(retryFailedTitle), findsOneWidget);
|
||||
expect(runDetailText(retryFailedTitle), findsOneWidget);
|
||||
expect(find.byKey(runMoreMenuKey), findsOneWidget);
|
||||
expect(await retryOffered(tester), isTrue);
|
||||
expect(find.byKey(cancelActionKey), findsNothing);
|
||||
@@ -49,14 +50,14 @@ void main() {
|
||||
);
|
||||
// The prompt closes only from server truth; no navigation is guessed.
|
||||
expect(opened, isEmpty);
|
||||
expect(find.text(retryFailedTitle), findsOneWidget);
|
||||
expect(runDetailText(retryFailedTitle), findsOneWidget);
|
||||
|
||||
gateway.acceptRetry(retryCreatedDetail());
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(opened, [8]);
|
||||
expect(find.text(retryCreatedTitle), findsOneWidget);
|
||||
expect(find.text(retryFailedTitle), findsNothing);
|
||||
expect(runDetailText(retryCreatedTitle), findsOneWidget);
|
||||
expect(runDetailText(retryFailedTitle), findsNothing);
|
||||
expect(await retryOffered(tester), isFalse);
|
||||
expect(
|
||||
gateway.calls.where((call) => call.type == 'get_run').last.fields,
|
||||
|
||||
@@ -3,6 +3,7 @@ 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';
|
||||
import 'package:pipelines_app/features/runs/ui/run_more_menu.dart';
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
import 'package:pipelines_app/core/transport/connection_state.dart';
|
||||
@@ -100,7 +101,7 @@ void main() {
|
||||
'only the server reply into the detail and list', (tester) async {
|
||||
final gateway = await _mount(tester, cupertino: false);
|
||||
|
||||
expect(find.text('Nightly build'), findsOneWidget);
|
||||
expect(runDetailText('Nightly build'), findsOneWidget);
|
||||
expect(find.byKey(runMoreMenuKey), findsOneWidget);
|
||||
expect(gateway.saves, isEmpty);
|
||||
|
||||
@@ -114,7 +115,7 @@ void main() {
|
||||
await tester.tap(find.byKey(runTitleCancelKey));
|
||||
await tester.pumpAndSettle();
|
||||
expect(gateway.saves, isEmpty);
|
||||
expect(find.text('Nightly build'), findsOneWidget);
|
||||
expect(runDetailText('Nightly build'), findsOneWidget);
|
||||
|
||||
await _openRename(tester);
|
||||
await tester.enterText(find.byKey(runTitleFieldKey), ' Release build ');
|
||||
@@ -126,18 +127,23 @@ void main() {
|
||||
'title': ' Release build ',
|
||||
});
|
||||
// Still the stored title: nothing is applied before the server replies.
|
||||
expect(find.text('Nightly build'), findsOneWidget);
|
||||
expect(runDetailText('Nightly build'), findsOneWidget);
|
||||
expect(find.text('Release build'), findsNothing);
|
||||
|
||||
gateway.accept('Release build');
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byType(AlertDialog), findsNothing);
|
||||
expect(find.text('Release build'), findsOneWidget);
|
||||
expect(runDetailText('Release build'), findsOneWidget);
|
||||
expect(find.text('Nightly build'), findsNothing);
|
||||
|
||||
await tester.tap(find.text('Back to list'));
|
||||
await tester.pump();
|
||||
expect(find.text('Release build'), findsOneWidget);
|
||||
// The list stays visible, and its row follows the accepted rename too.
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byKey(const ValueKey('run-row-1')),
|
||||
matching: find.text('Release build'),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('cupertino detail shows the native rename entry point', (
|
||||
@@ -162,7 +168,7 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(CupertinoAlertDialog), findsNothing);
|
||||
expect(find.text('Release build'), findsOneWidget);
|
||||
expect(runDetailText('Release build'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('a refused rename keeps the typed title and the stored detail', (
|
||||
@@ -180,6 +186,6 @@ void main() {
|
||||
expect(find.text('rename refused by the server'), findsOneWidget);
|
||||
expect(_fieldText(tester, cupertino: false), ' locked ');
|
||||
expect(find.byType(AlertDialog), findsOneWidget);
|
||||
expect(find.text('Nightly build'), findsOneWidget);
|
||||
expect(runDetailText('Nightly build'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
import '../../../native_back.dart';
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
import 'package:pipelines_app/features/runs/screen.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_detail_view.dart';
|
||||
import 'run_detail_finders.dart';
|
||||
|
||||
class _Gateway implements ApiGateway {
|
||||
final framesController = StreamController<JsonMap>.broadcast();
|
||||
@@ -88,7 +90,11 @@ void main() {
|
||||
expect(gateway.detailRequests[1], hasLength(1));
|
||||
expect(find.text('Loading run details…'), findsOneWidget);
|
||||
expect(find.text('Back to list'), findsOneWidget);
|
||||
expect(find.text('Alpha run'), findsNothing);
|
||||
expect(
|
||||
find.text('Alpha run'),
|
||||
findsOneWidget,
|
||||
reason: 'the list stays visible',
|
||||
);
|
||||
|
||||
await tester.tap(find.text('Back to list'));
|
||||
await tester.pump();
|
||||
@@ -113,7 +119,7 @@ void main() {
|
||||
});
|
||||
await tester.pump();
|
||||
|
||||
expect(find.text('Alpha run'), findsOneWidget);
|
||||
expect(runDetailText('Alpha run'), findsOneWidget);
|
||||
expect(find.text('Input'), findsOneWidget);
|
||||
expect(find.text('Loading run details…'), findsNothing);
|
||||
});
|
||||
@@ -126,7 +132,13 @@ void main() {
|
||||
gateway.failDetail(2, 0, StateError('server unavailable'));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.textContaining('server unavailable'), findsOneWidget);
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byType(RunDetailView),
|
||||
matching: find.textContaining('server unavailable'),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.text('Back to list'), findsOneWidget);
|
||||
|
||||
await tester.tap(find.text('Back to list'));
|
||||
@@ -146,13 +158,16 @@ void main() {
|
||||
expect(gateway.detailRequests[2], hasLength(1));
|
||||
gateway.replyDetail(2, 0, {'id': 2, 'title': 'Beta run'});
|
||||
await tester.pump();
|
||||
expect(find.text('Beta run'), findsOneWidget);
|
||||
expect(find.text('Back to list'), findsOneWidget);
|
||||
expect(runDetailText('Beta run'), findsOneWidget);
|
||||
expect(find.byKey(const ValueKey('run-row-1')), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('selection and Back report route changes to the host', (
|
||||
tester,
|
||||
) async {
|
||||
tester.view.physicalSize = const Size(390, 844);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
int? selected;
|
||||
int? backedPipeline;
|
||||
await tester.pumpWidget(
|
||||
@@ -168,10 +183,10 @@ void main() {
|
||||
await tester.pump();
|
||||
expect(selected, 2);
|
||||
gateway.replyDetail(2, 0, {'id': 2, 'title': 'Beta run'});
|
||||
await tester.pump();
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
await tester.tap(find.text('Back to list'));
|
||||
await tester.pump();
|
||||
await tester.tap(findNativeBack());
|
||||
await tester.pumpAndSettle();
|
||||
expect(backedPipeline, isNull);
|
||||
expect(find.text('Alpha run'), findsOneWidget);
|
||||
});
|
||||
@@ -201,6 +216,9 @@ void main() {
|
||||
testWidgets('run detail keeps the pipeline filter for Back routing', (
|
||||
tester,
|
||||
) async {
|
||||
tester.view.physicalSize = const Size(390, 844);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
int? backPipeline;
|
||||
await tester.pumpWidget(
|
||||
_materialScreen(
|
||||
@@ -219,10 +237,10 @@ void main() {
|
||||
);
|
||||
await tester.pump();
|
||||
gateway.replyDetail(2, 0, {'id': 2, 'title': 'Beta run'});
|
||||
await tester.pump();
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
await tester.tap(find.text('Back to list'));
|
||||
await tester.pump();
|
||||
await tester.tap(findNativeBack());
|
||||
await tester.pumpAndSettle();
|
||||
expect(backPipeline, 3);
|
||||
});
|
||||
|
||||
@@ -232,14 +250,14 @@ void main() {
|
||||
expect(gateway.detailRequests[2], hasLength(1));
|
||||
gateway.replyDetail(2, 0, {'id': 2, 'title': 'Beta run'});
|
||||
await tester.pump();
|
||||
expect(find.text('Beta run'), findsOneWidget);
|
||||
expect(runDetailText('Beta run'), findsOneWidget);
|
||||
|
||||
await tester.pumpWidget(_materialScreen(gateway, initialRunId: 1));
|
||||
await tester.pump();
|
||||
expect(gateway.detailRequests[1], hasLength(1));
|
||||
gateway.replyDetail(1, 0, {'id': 1, 'title': 'Alpha run'});
|
||||
await tester.pump();
|
||||
expect(find.text('Alpha run'), findsOneWidget);
|
||||
expect(runDetailText('Alpha run'), findsOneWidget);
|
||||
|
||||
await tester.pumpWidget(_materialScreen(gateway));
|
||||
await tester.pump();
|
||||
@@ -255,7 +273,7 @@ void main() {
|
||||
await _mountList(tester, gateway);
|
||||
gateway.replyDetail(2, 0, {'id': 2, 'title': 'Beta run'});
|
||||
await tester.pump();
|
||||
expect(find.text('Beta run'), findsOneWidget);
|
||||
expect(runDetailText('Beta run'), findsOneWidget);
|
||||
|
||||
await tester.pumpWidget(
|
||||
_materialScreen(gateway, initialRunId: 2, syncToken: 1),
|
||||
@@ -272,12 +290,12 @@ void main() {
|
||||
'status': 'succeeded',
|
||||
});
|
||||
await tester.pump();
|
||||
expect(find.text('Beta run'), findsOneWidget);
|
||||
expect(find.text('Back to list'), findsOneWidget);
|
||||
expect(runDetailText('Beta run'), findsOneWidget);
|
||||
expect(find.byKey(const ValueKey('run-row-1')), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets(
|
||||
'Cupertino host keeps exactly one navigation bar while pending',
|
||||
'wide Cupertino host keeps list and detail bars while pending',
|
||||
(tester) async {
|
||||
await tester.pumpWidget(
|
||||
CupertinoApp(
|
||||
@@ -291,8 +309,8 @@ void main() {
|
||||
);
|
||||
await _mountList(tester, gateway);
|
||||
|
||||
expect(find.byType(CupertinoPageScaffold), findsOneWidget);
|
||||
expect(find.byType(CupertinoNavigationBar), findsOneWidget);
|
||||
expect(find.byType(CupertinoPageScaffold), findsNWidgets(2));
|
||||
expect(find.byType(CupertinoNavigationBar), findsNWidgets(2));
|
||||
expect(find.text('Loading run details…'), findsOneWidget);
|
||||
expect(find.byType(CupertinoActivityIndicator), findsOneWidget);
|
||||
expect(find.text('Back to list'), findsOneWidget);
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
// Shared pane geometry and selected rows, against isolated loopback fixtures.
|
||||
import assert from 'node:assert/strict';
|
||||
import { mkdir, mkdtemp, writeFile } from 'node:fs/promises';
|
||||
import { once } from 'node:events';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { join, resolve } from 'node:path';
|
||||
import { startFixture } from './runs_probe_server.mjs';
|
||||
import { startWiringFixture } from './pipelines_wiring_probe_server.mjs';
|
||||
import { launchChrome, waitForPort, waitForPage, connect, sleep } from './pipelines_probe_cdp_lib.mjs';
|
||||
import { axNodes, enableSemantics, waitFor, capture, clickAt } from './pipelines_probe_cdp_input.mjs';
|
||||
|
||||
const platform = process.env.PROBE_PLATFORM ?? 'material';
|
||||
const width = Number(process.env.PROBE_WIDTH ?? 1280);
|
||||
const dark = process.env.PROBE_DARK === '1';
|
||||
const output = resolve(process.argv[3] ?? `build/list-detail-${platform}`);
|
||||
await mkdir(output, { recursive: true });
|
||||
const root = resolve(process.argv[2]);
|
||||
const runs = await startFixture({ root, chatMessages: [], chatSessions: [
|
||||
{ id: 'ses_probechat', title: 'First fixture chat', backend: 'claude', model: 'claude-opus', mode: 'auto', mode_name: 'Auto' },
|
||||
{ id: 'ses_secondchat', title: 'Second fixture chat', backend: 'claude', model: 'claude-opus', mode: 'auto', mode_name: 'Auto' },
|
||||
] });
|
||||
const pipelines = await startWiringFixture({ root });
|
||||
const profile = await mkdtemp(join(tmpdir(), 'list-detail-consistency-'));
|
||||
const chrome = launchChrome('/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', profile, 'about:blank');
|
||||
const log = { platform, width, dark, checks: [], captures: [], panes: [] };
|
||||
let c;
|
||||
const geometry = () => c.evaluate(`(() => {
|
||||
const box = id => { const r = document.querySelector('[flt-semantics-identifier="' + id + '"]')?.getBoundingClientRect(); return r && {x:r.x,width:r.width}; };
|
||||
return {list:box('list-detail-list'),body:box('list-detail-body')};
|
||||
})()`);
|
||||
const selected = async titles => (await c.evaluate(`Array.from(document.querySelector('[flt-semantics-identifier="list-detail-list"]').querySelectorAll('[aria-current="true"], [aria-selected="true"]')).map(e => e.getAttribute('aria-label') || e.textContent || '')`)).filter(name => titles.some(title => name.includes(title)));
|
||||
async function open(title) {
|
||||
const node = await waitFor(async () => {
|
||||
const nodes = await axNodes(c);
|
||||
return nodes.find(n => n.name?.value === title && n.role?.value === 'StaticText' && n.backendDOMNodeId)
|
||||
?? nodes.find(n => n.name?.value?.includes(title) && n.backendDOMNodeId);
|
||||
}, 12000);
|
||||
assert.ok(node, title);
|
||||
const { model } = await c.send('DOM.getBoxModel', { backendNodeId: node.backendDOMNodeId });
|
||||
const [x1,y1,,,x3,y3] = model.content;
|
||||
await clickAt(c, (x1+x3)/2, (y1+y3)/2);
|
||||
await c.send('Input.dispatchMouseEvent', { type: 'mouseMoved', x: width-5, y: 895 });
|
||||
}
|
||||
try {
|
||||
c = await connect((await waitForPage(await waitForPort(join(profile, 'DevToolsActivePort')))).webSocketDebuggerUrl);
|
||||
await c.send('Page.enable');
|
||||
if (platform === 'material') await c.send('Emulation.setUserAgentOverride', {
|
||||
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/155.0.0.0 Safari/537.36', platform: 'Win32',
|
||||
});
|
||||
await c.send('Emulation.setDeviceMetricsOverride', { width, height: 900, deviceScaleFactor: 1, mobile: false });
|
||||
await c.send('Emulation.setEmulatedMedia', { features: [{ name:'prefers-color-scheme',value:dark?'dark':'light' }] });
|
||||
for (const [destination, fixture, titles] of [
|
||||
['pipelines', pipelines, ['Release verification', 'Nightly documentation']],
|
||||
['runs', runs, ['Fixture live run', 'Fixture failing run']],
|
||||
['chat', runs, ['First fixture chat', 'Second fixture chat']],
|
||||
]) {
|
||||
await c.send('Page.navigate', { url: fixture.url + '/' + destination });
|
||||
assert.ok(await waitFor(() => c.evaluate("Boolean(document.querySelector('flt-semantics-placeholder'))"),30000));
|
||||
await enableSemantics(c);
|
||||
assert.ok(await waitFor(async () => (await geometry()).list,30000));
|
||||
const before = await geometry();
|
||||
assert.ok(Math.abs(before.list.width-before.body.width)<1, 'equal panes before selection');
|
||||
assert.deepEqual(await selected(titles), []);
|
||||
for (let i=0;i<titles.length;i++) {
|
||||
await open(titles[i]);
|
||||
assert.ok(await waitFor(async () => (await selected(titles)).some(name => name.includes(titles[i])),12000), `${destination} selected ${titles[i]}`);
|
||||
assert.equal((await selected(titles)).length,1,'only the active row is selected');
|
||||
const bounds = await geometry();
|
||||
assert.ok(Math.abs(bounds.list.width-bounds.body.width)<1,'equal flexible panes');
|
||||
assert.equal(bounds.list.width,before.list.width,'selection does not resize panes');
|
||||
log.panes.push({destination,title:titles[i],...bounds});
|
||||
await sleep(300);
|
||||
await capture(c,output,log,`${destination}-selected-${i+1}`);
|
||||
}
|
||||
log.checks.push(`${destination}: list remains visible, selection moves, panes remain equal`);
|
||||
}
|
||||
assert.ok(log.panes.every(p => Math.abs(p.list.width-log.panes[0].list.width)<1),'identical pane widths across destinations');
|
||||
log.checks.push('all three destinations have identical pane widths');
|
||||
console.log(JSON.stringify(log,null,2));
|
||||
} catch (error) {
|
||||
if(c) {
|
||||
await capture(c,output,log,'failure');
|
||||
await writeFile(join(output,'failure-ax.json'),JSON.stringify(await axNodes(c),null,2));
|
||||
}
|
||||
throw error;
|
||||
} finally {
|
||||
await writeFile(join(output,'result.json'),JSON.stringify(log,null,2));
|
||||
c?.close();const exited=once(chrome,'exit');chrome.kill();await exited;
|
||||
await Promise.all([runs.close(),pipelines.close()]);
|
||||
}
|
||||
@@ -310,7 +310,7 @@ async function staticFile(base, pathname, req, res) {
|
||||
* It serves the built probe bundle and upgrades /connect on the same origin, so
|
||||
* the normal web composition infers this server from Uri.base.
|
||||
*/
|
||||
export async function startFixture({ root, runs = RUNS, runDetail, files = {}, chatMessages, chatHistoryDelayMs = 0, onChatHistory }) {
|
||||
export async function startFixture({ root, runs = RUNS, runDetail, files = {}, chatMessages, chatSessions, chatHistoryDelayMs = 0, onChatHistory }) {
|
||||
const base = await realpath(root);
|
||||
const connections = new Set();
|
||||
const sockets = new Set();
|
||||
@@ -547,7 +547,7 @@ export async function startFixture({ root, runs = RUNS, runDetail, files = {}, c
|
||||
}
|
||||
if (request.type === 'chat_sessions') {
|
||||
client.send({ id: request.id, type: 'chat_sessions',
|
||||
chat_sessions: [CHAT_SESSION] });
|
||||
chat_sessions: chatSessions ?? [CHAT_SESSION] });
|
||||
return;
|
||||
}
|
||||
if (request.type === 'chat_subscribe') {
|
||||
|
||||
Reference in New Issue
Block a user