xworkmate-app/test/features/modules_page_test.dart

33 lines
1.1 KiB
Dart

import 'package:flutter_test/flutter_test.dart';
import 'package:xworkmate/features/modules/modules_page.dart';
import 'package:xworkmate/models/app_models.dart';
import '../test_support.dart';
void main() {
testWidgets(
'ModulesPage switches connectors tab and routes module actions to settings',
(WidgetTester tester) async {
final controller = await createTestController(tester);
controller.navigateTo(WorkspaceDestination.modules);
await pumpPage(
tester,
child: ModulesPage(controller: controller, onOpenDetail: (_) {}),
);
await tester.tap(find.text('配置').first);
await tester.pumpAndSettle();
expect(controller.destination, WorkspaceDestination.settings);
await tester.tap(find.text('连接器'));
await tester.pumpAndSettle();
expect(find.textContaining('连接 Gateway 后可加载连接器状态'), findsOneWidget);
await tester.tap(find.text('接入模块'));
await tester.pumpAndSettle();
expect(controller.destination, WorkspaceDestination.settings);
},
);
}