oto/apps/client/test/widget_test.dart
toki e3b1d9b33b feat: flutter console skeleton and core connection client
- Add Flutter console skeleton (oto_console_contract, overview, shell)
- Add core_connection_client.dart for client app core connection
- Update oto_client_app.dart to integrate new components
- Add widget_test.dart and console tests
- Update pubspec.yaml and pubspec.lock with new dependencies
2026-06-17 07:20:06 +09:00

47 lines
1.5 KiB
Dart

import 'package:flutter_test/flutter_test.dart';
import 'package:oto_console/oto_console.dart';
import 'package:oto_client/src/app/oto_client_app.dart';
void main() {
testWidgets('OTO client hosts embeddable console widgets', (tester) async {
await tester.pumpWidget(OtoClientApp(coreClient: _FakeCoreClient()));
await tester.pump();
expect(find.text('Build Operations Overview'), findsOneWidget);
expect(find.text('CORE ONLINE'), findsOneWidget);
expect(find.text('Health'), findsOneWidget);
expect(find.text('Readiness'), findsOneWidget);
expect(find.byTooltip('Agent'), findsOneWidget);
await tester.tap(find.byTooltip('Agent'));
await tester.pumpAndSettle();
expect(find.textContaining('OTO agent surface is ready'), findsOneWidget);
expect(find.textContaining('Runner Registry'), findsOneWidget);
});
}
class _FakeCoreClient implements OtoCoreConnectionClient {
@override
Future<OtoCoreConnectionSnapshot> check(OtoConsoleConfig config) async {
return const OtoCoreConnectionSnapshot(
state: OtoCoreConnectionState.online,
health: OtoCoreEndpointStatus(
label: 'Health',
path: '/healthz',
state: OtoCoreConnectionState.online,
statusCode: 200,
message: 'OK',
),
readiness: OtoCoreEndpointStatus(
label: 'Readiness',
path: '/readyz',
state: OtoCoreConnectionState.online,
statusCode: 200,
message: 'OK',
),
policyNote: 'CORS headers or a same-origin proxy are required.',
);
}
}