alt/apps/client/test/widget_test.dart
toki 1f1527d7c6 feat: Flutter Operator Console milestone completion and migration to archive
- Move flutter-operator-console milestone to archive (completed)
- Add AltWorkbenchShell for workbench pattern migration
- Update router and dashboard screen for workbench integration
- Update agent-roadmap and phase documentation
- Headless workflow validation complete (02+01_headless_validation)
- Update client domain rules and README
2026-05-31 21:11:10 +09:00

107 lines
3.2 KiB
Dart

import 'package:alt_client/src/app/app.dart';
import 'package:alt_client/src/integrations/socket/socket_connection_controller.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
class FakeSocketConnectionController extends SocketConnectionController {
final SocketConnectionState initialState;
FakeSocketConnectionController(this.initialState);
@override
SocketConnectionState build() {
return initialState;
}
}
void main() {
testWidgets(
'shows ALT dashboard shell with default disconnected socket state',
(tester) async {
await tester.pumpWidget(const ProviderScope(child: AltClientApp()));
expect(find.text('ALT Console'), findsOneWidget);
expect(find.text('Backtests'), findsWidgets);
expect(find.text('Korea Daily Pipeline'), findsOneWidget);
expect(find.text('Disconnected'), findsOneWidget);
},
);
testWidgets('shows ALT dashboard with socket state Connecting', (
tester,
) async {
await tester.pumpWidget(
ProviderScope(
overrides: [
socketConnectionControllerProvider.overrideWith(
() => FakeSocketConnectionController(
SocketConnectionState.connecting,
),
),
],
child: const AltClientApp(),
),
);
expect(find.text('Socket Contract'), findsOneWidget);
expect(find.text('Connecting'), findsOneWidget);
});
testWidgets('shows ALT dashboard with socket state Connected', (
tester,
) async {
await tester.pumpWidget(
ProviderScope(
overrides: [
socketConnectionControllerProvider.overrideWith(
() =>
FakeSocketConnectionController(SocketConnectionState.connected),
),
],
child: const AltClientApp(),
),
);
expect(find.text('Socket Contract'), findsOneWidget);
expect(find.text('Connected'), findsOneWidget);
});
testWidgets('shows ALT dashboard with socket state Error', (tester) async {
await tester.pumpWidget(
ProviderScope(
overrides: [
socketConnectionControllerProvider.overrideWith(
() => FakeSocketConnectionController(SocketConnectionState.error),
),
],
child: const AltClientApp(),
),
);
expect(find.text('Socket Contract'), findsOneWidget);
expect(find.text('Error'), findsOneWidget);
});
testWidgets('opens ALT agent dock from the right rail', (tester) async {
await tester.pumpWidget(const ProviderScope(child: AltClientApp()));
await tester.tap(find.byIcon(Icons.smart_toy_outlined));
await tester.pump();
expect(find.text('Ask the ALT agent'), findsOneWidget);
expect(find.textContaining('ALT agent shell is ready'), findsOneWidget);
});
testWidgets('switches ALT workbench center content from the right rail', (
tester,
) async {
await tester.pumpWidget(const ProviderScope(child: AltClientApp()));
await tester.tap(find.byIcon(Icons.candlestick_chart_outlined));
await tester.pump();
expect(find.text('Markets'), findsWidgets);
expect(find.textContaining('Market data import'), findsOneWidget);
});
}