21 lines
858 B
Dart
21 lines
858 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:glitch_gm_lab/main.dart';
|
|
import 'package:http/http.dart' as http;
|
|
import 'package:http/testing.dart';
|
|
|
|
void main() {
|
|
testWidgets('commands remain disabled without cabinet state', (tester) async {
|
|
final client = MockClient((_) async => http.Response('{}', 503));
|
|
await tester.pumpWidget(MaterialApp(home: CabinetPage(client: client)));
|
|
await tester.pump();
|
|
expect(find.text('INTEGRATION LAB - SIMULATED CABINET'), findsOneWidget);
|
|
expect(find.text('Power on'), findsOneWidget);
|
|
for (final button in tester.widgetList<FilledButton>(find.byType(FilledButton))) {
|
|
expect(button.onPressed, isNull);
|
|
}
|
|
expect(find.textContaining('Disconnected'), findsOneWidget);
|
|
await tester.pumpWidget(const SizedBox());
|
|
});
|
|
}
|