a1c4c1c402
Settings leaves the tab bar (Pipelines, Runs, Chat, Search) and opens as a page from a gear in the Pipelines bar, keeping /settings, its keys and a Back to Pipelines (also the system Back). Every floating tab bar shows icons only, named for assistive technology. On wide windows the shell's tab bar stays at the bottom right; a split detail learns its height plus a 12px gap, so its tabs or the chat composer float above it, and pages the detail opens (the stage page) stay in its pane through its own navigator.
137 lines
5.4 KiB
Dart
137 lines
5.4 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pipelines_app/features/runs/data/runs_repository.dart';
|
|
import 'package:pipelines_app/features/runs/ui/run_detail_tab.dart';
|
|
import 'package:pipelines_app/features/runs/ui/run_detail_view.dart';
|
|
import 'package:pipelines_app/features/runs/ui/runs_controller.dart';
|
|
import 'package:pipelines_app/shell/adaptive_shell.dart';
|
|
import 'package:pipelines_app/shell/destination.dart';
|
|
import 'package:pipelines_app/shell/detail_page.dart';
|
|
import 'package:pipelines_app/shell/list_detail.dart';
|
|
import 'package:pipelines_app/ui/adaptive/floating_bar_layout.dart';
|
|
import 'package:pipelines_app/ui/adaptive/glass_pill.dart';
|
|
|
|
import '../features/runs/ui/run_detail_graph_support.dart';
|
|
import '../features/runs/ui/run_detail_visit_support.dart';
|
|
|
|
/// On a wide split window (unfolded foldable, desktop) the real run detail
|
|
/// and the stage page it opens keep the shell's tab bar at the bottom right
|
|
/// and float their own tabs above it with a gap; the stage page opens inside
|
|
/// the detail pane instead of covering the shell.
|
|
void main() {
|
|
Rect pillOf(WidgetTester tester, Finder owner) => tester.getRect(
|
|
find.descendant(of: owner, matching: find.byType(GlassPill)).first,
|
|
);
|
|
|
|
Rect shellPill(WidgetTester tester) => tester.getRect(
|
|
find
|
|
.ancestor(
|
|
of: find.byKey(const ValueKey('shell.destination.runs')).first,
|
|
matching: find.byType(GlassPill),
|
|
)
|
|
.first,
|
|
);
|
|
|
|
Future<void> pumpSplitRun(WidgetTester tester, bool cupertino) async {
|
|
tester.view.physicalSize = const Size(1200, 800);
|
|
tester.view.devicePixelRatio = 1;
|
|
addTearDown(tester.view.reset);
|
|
final gateway = RunDetailFakeGateway(visitRunFixture());
|
|
final controller = RunsController(RunsRepository(gateway));
|
|
addTearDown(controller.dispose);
|
|
await controller.select(77);
|
|
final shell = AdaptiveShell(
|
|
cupertino: cupertino,
|
|
destination: AppDestination.runs,
|
|
destinationBodies: {
|
|
AppDestination.runs: (_) => ListDetailPanes(
|
|
list: ListView(
|
|
children: [for (var i = 0; i < 30; i++) Text('run row $i')],
|
|
),
|
|
detail: DetailPane(
|
|
destination: AppDestination.runs,
|
|
implyBack: false,
|
|
builder: (_) => RunDetailView(
|
|
controller: controller,
|
|
gateway: gateway,
|
|
onBack: () {},
|
|
),
|
|
),
|
|
),
|
|
},
|
|
);
|
|
await tester.pumpWidget(
|
|
cupertino
|
|
? CupertinoApp(home: shell)
|
|
: MaterialApp(
|
|
theme: ThemeData(platform: TargetPlatform.android),
|
|
home: shell,
|
|
),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
}
|
|
|
|
for (final cupertino in [false, true]) {
|
|
final host = cupertino ? 'Cupertino' : 'Material';
|
|
|
|
testWidgets('$host 1200: run tabs float above the shell bar, and the '
|
|
'stage page opens in the pane with its tabs above it too', (
|
|
tester,
|
|
) async {
|
|
await pumpSplitRun(tester, cupertino);
|
|
final body = tester.getRect(
|
|
find.byKey(const ValueKey('list-detail-body')),
|
|
);
|
|
var main = shellPill(tester);
|
|
expect(main.right, closeTo(1200 - kFloatingBarMargin, 0.5));
|
|
expect(main.bottom, closeTo(800 - kFloatingBarMargin, 0.5));
|
|
|
|
final runTabs = pillOf(tester, find.byKey(const Key('run-detail-tabs')));
|
|
expect(runTabs.left, greaterThanOrEqualTo(body.left));
|
|
expect(runTabs.right, closeTo(1200 - kFloatingBarMargin, 0.5));
|
|
expect(runTabs.overlaps(main), isFalse);
|
|
expect(main.top - runTabs.bottom, closeTo(kStackedBarGap, 0.5));
|
|
|
|
// Open the stage page from the timeline.
|
|
await openRunDetailTab(tester, RunDetailTab.timeline);
|
|
final row = find.byKey(const ValueKey('run-timeline-visit-1'));
|
|
await tester.ensureVisible(row);
|
|
await tester.pumpAndSettle();
|
|
await tester.tap(row);
|
|
await tester.pumpAndSettle();
|
|
|
|
expect(find.byKey(const Key('run-visit-back')), findsOneWidget);
|
|
// The page covers only the detail pane: the root navigator has nothing
|
|
// pushed, and the list and the shell's tab bar stay in place.
|
|
expect(
|
|
tester.state<NavigatorState>(find.byType(Navigator).first).canPop(),
|
|
isFalse,
|
|
);
|
|
expect(find.text('run row 0'), findsOneWidget);
|
|
final back = tester.getRect(find.byKey(const Key('run-visit-back')));
|
|
expect(back.left, greaterThanOrEqualTo(body.left));
|
|
main = shellPill(tester);
|
|
expect(main.right, closeTo(1200 - kFloatingBarMargin, 0.5));
|
|
final visitTabs = pillOf(
|
|
tester,
|
|
find.byKey(const Key('run-visit-tabs')).last,
|
|
);
|
|
expect(visitTabs.left, greaterThanOrEqualTo(body.left));
|
|
expect(visitTabs.overlaps(main), isFalse);
|
|
expect(main.top - visitTabs.bottom, closeTo(kStackedBarGap, 0.5));
|
|
expect(tester.takeException(), isNull);
|
|
|
|
// The shell's tabs still work over the open stage page.
|
|
await tester.tap(find.byKey(const ValueKey('shell.destination.runs')));
|
|
await tester.pumpAndSettle();
|
|
|
|
// Back closes the page inside the pane, back to the run.
|
|
await tester.tap(find.byKey(const Key('run-visit-back')));
|
|
await tester.pumpAndSettle();
|
|
expect(find.byKey(const Key('run-visit-back')), findsNothing);
|
|
expect(find.byKey(const Key('run-detail-tabs')), findsOneWidget);
|
|
});
|
|
}
|
|
}
|