feat(app): an open pipeline, run or chat fills a phone screen; Back steps up one level; stage tabs end with Session

This commit is contained in:
2026-10-23 22:49:21 +01:00
parent dd324d1f92
commit 0e6db03903
9 changed files with 104 additions and 108 deletions
+28
View File
@@ -13,6 +13,7 @@ AppRouterDelegate delegate(AppRoute initial, {void Function()? onChat}) =>
);
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
test('system Back leaves one chat session for the chat list', () async {
var left = 0;
final router = delegate(AppRoute.chatSession('s1'), onChat: () => left++);
@@ -22,6 +23,33 @@ void main() {
expect(left, 1);
});
test('system Back steps up one level at a time', () async {
var runs = 0;
final router = AppRouterDelegate(
builder: (context, route) => const SizedBox.shrink(),
onPopToRuns: () => runs++,
onPopToChat: () {},
cupertino: false,
initial: AppRoute.run.stage(77, 'plan', visit: 0),
);
addTearDown(router.dispose);
// A stage returns to its run, then the run to the Runs list.
expect(await router.popRoute(), isTrue);
expect(router.route, AppRoute.run(77));
expect(await router.popRoute(), isTrue);
expect(runs, 1);
// A pipeline stage returns to its pipeline, then to the list, and the
// list leaves Back to the platform.
router.goTo(AppRoute.pipelineStage(4, 'plan', version: 2));
expect(await router.popRoute(), isTrue);
expect(router.route, AppRoute.pipeline(4, version: 2));
expect(await router.popRoute(), isTrue);
expect(router.route, AppRoute.pipelines);
expect(await router.popRoute(), isFalse);
});
test('system Back on a list destination stays with the platform', () async {
final router = delegate(AppRoute.chat);
addTearDown(router.dispose);
+4 -3
View File
@@ -268,7 +268,7 @@ void main() {
testWidgets(
'the Search tab opens focused and the Runs tab keeps the open run',
(tester) async {
tester.view.physicalSize = const Size(390, 844);
tester.view.physicalSize = const Size(900, 1000);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
@@ -295,7 +295,8 @@ void main() {
);
await replyRunList(tester, channel);
await replyRunDetail(tester, channel, 2);
expect(find.byKey(const ValueKey('shell.back')), findsOneWidget);
// On a phone an open run fills the screen and the tabs step aside, so
// switching tabs with a run open is a wide-window move.
// Search is the fifth tab.
await tapTab(tester, 'Search');
@@ -337,7 +338,7 @@ void main() {
testWidgets('a result opens through the existing run route over one socket', (
tester,
) async {
tester.view.physicalSize = const Size(390, 844);
tester.view.physicalSize = const Size(900, 1000);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);