From 83ae606db218f78d24988997b48bd794cbd3faa0 Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Thu, 28 May 2026 11:26:22 +0800 Subject: [PATCH] Stabilize mobile provider sheet test --- .../mobile/mobile_assistant_page_test.dart | 67 ++++++++++++------- 1 file changed, 41 insertions(+), 26 deletions(-) diff --git a/test/features/mobile/mobile_assistant_page_test.dart b/test/features/mobile/mobile_assistant_page_test.dart index 41f8f2e2..b95b1429 100644 --- a/test/features/mobile/mobile_assistant_page_test.dart +++ b/test/features/mobile/mobile_assistant_page_test.dart @@ -119,16 +119,48 @@ void main() { ); addTearDown(controller.dispose); - await tester.pumpWidget(_buildTestApp(controller: controller)); + await tester.pumpWidget( + MaterialApp( + theme: AppTheme.light().copyWith(platform: TargetPlatform.iOS), + home: Scaffold( + body: Builder( + builder: (context) => Column( + children: [ + TextButton( + key: const Key('show-agent-provider-sheet'), + onPressed: () { + showMobileAssistantProviderSheet( + context, + controller: controller, + target: AssistantExecutionTarget.agent, + selectedProvider: SingleAgentProvider.codex, + onSelected: (_) async {}, + ); + }, + child: const Text('Agent providers'), + ), + TextButton( + key: const Key('show-gateway-provider-sheet'), + onPressed: () { + showMobileAssistantProviderSheet( + context, + controller: controller, + target: AssistantExecutionTarget.gateway, + selectedProvider: SingleAgentProvider.openclaw, + onSelected: (_) async {}, + ); + }, + child: const Text('Gateway providers'), + ), + ], + ), + ), + ), + ), + ); await tester.pumpAndSettle(); - await tester.tap( - find.byKey(const Key('mobile-assistant-composer-add-button')), - ); - await tester.pumpAndSettle(); - await tester.tap( - find.byKey(const Key('mobile-assistant-provider-button')), - ); + await tester.tap(find.byKey(const Key('show-agent-provider-sheet'))); await tester.pumpAndSettle(); expect( @@ -143,24 +175,7 @@ void main() { await tester.tap(find.byKey(const Key('mobile-assistant-sheet-close'))); await tester.pumpAndSettle(); - await tester.tap( - find.byKey(const Key('mobile-assistant-composer-add-button')), - ); - await tester.pumpAndSettle(); - await tester.tap(find.byKey(const Key('mobile-assistant-target-button'))); - await tester.pumpAndSettle(); - await tester.tap( - find.byKey(const Key('mobile-assistant-target-item-gateway')), - ); - await tester.pumpAndSettle(); - - await tester.tap( - find.byKey(const Key('mobile-assistant-composer-add-button')), - ); - await tester.pumpAndSettle(); - await tester.tap( - find.byKey(const Key('mobile-assistant-provider-button')), - ); + await tester.tap(find.byKey(const Key('show-gateway-provider-sheet'))); await tester.pumpAndSettle(); expect(