2026-11-21 19:17:22 +08:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
|
import 'package:openchamber/screens/sessions_screen.dart';
|
|
|
|
|
import 'package:openchamber/state.dart';
|
|
|
|
|
import 'package:openchamber/storage.dart';
|
|
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
|
testWidgets('the sidebar footer names the server and opens settings',
|
|
|
|
|
(tester) async {
|
|
|
|
|
final app = AppState();
|
|
|
|
|
app.conn = Connection(
|
|
|
|
|
id: 'c1',
|
|
|
|
|
label: '家里的服务器',
|
|
|
|
|
url: 'http://127.0.0.1:3000',
|
|
|
|
|
);
|
|
|
|
|
addTearDown(app.dispose);
|
|
|
|
|
|
|
|
|
|
await tester.pumpWidget(MaterialApp(
|
|
|
|
|
home: Scaffold(body: SessionListPane(app: app)),
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
expect(find.text('家里的服务器'), findsOneWidget);
|
|
|
|
|
expect(find.byIcon(Icons.dns_outlined), findsOneWidget);
|
2026-11-26 00:36:27 +08:00
|
|
|
expect(find.byTooltip('全部功能'), findsOneWidget);
|
2026-11-21 19:17:22 +08:00
|
|
|
expect(find.byTooltip('设置'), findsOneWidget);
|
|
|
|
|
|
2026-11-26 00:36:27 +08:00
|
|
|
// 全部功能 sits left of the settings key and holds the scheduled tasks.
|
|
|
|
|
await tester.tap(find.byTooltip('全部功能'));
|
|
|
|
|
await tester.pumpAndSettle();
|
|
|
|
|
expect(find.text('计划任务'), findsOneWidget);
|
|
|
|
|
await tester.pageBack();
|
|
|
|
|
await tester.pumpAndSettle();
|
|
|
|
|
|
2026-11-21 19:17:22 +08:00
|
|
|
await tester.tap(find.byTooltip('设置'));
|
|
|
|
|
await tester.pumpAndSettle();
|
|
|
|
|
// The settings page replaced the shell.
|
|
|
|
|
expect(find.text('外观'), findsOneWidget);
|
|
|
|
|
expect(find.text('聊天'), findsOneWidget);
|
|
|
|
|
expect(find.text('宠物'), findsOneWidget);
|
|
|
|
|
});
|
|
|
|
|
}
|