61 lines
1.8 KiB
Dart
61 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:integration_test/integration_test.dart';
|
|
import 'package:logger/logger.dart';
|
|
import 'package:prasule/api/wallet_manager.dart';
|
|
|
|
import 'package:prasule/main.dart';
|
|
import 'package:prasule/pw/platformfield.dart';
|
|
|
|
void main() {
|
|
final logger = Logger();
|
|
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
|
group("Test Setup screen:", () {
|
|
testWidgets('First-time setup', (WidgetTester tester) async {
|
|
// delete all data
|
|
await WalletManager.deleteAllData();
|
|
// Build our app and trigger a frame.
|
|
await tester.pumpWidget(
|
|
const MyApp(
|
|
locale: Locale('en', 'US'),
|
|
),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
logger.i("Looking for welcome header");
|
|
expect(find.text('Welcome!'), findsOneWidget);
|
|
|
|
// Tap "Next" button
|
|
await tester.tap(find.text("Next"));
|
|
await tester.pumpAndSettle();
|
|
|
|
logger.i("Next view, looking for name+balance fields");
|
|
|
|
final firstFields = find.byType(PlatformField);
|
|
|
|
expect(firstFields, findsExactly(2));
|
|
|
|
logger.i("Entering text");
|
|
await tester.enterText(find.byType(PlatformField).first, "Debugging");
|
|
await tester.pumpAndSettle();
|
|
await tester.enterText(find.byType(PlatformField).last, "100");
|
|
await tester.pumpAndSettle();
|
|
|
|
// Tap "Next" button
|
|
await tester.tap(find.text("Next"));
|
|
await tester.pumpAndSettle();
|
|
|
|
// Tap "Finish" button
|
|
await tester.tap(find.text("Finish"));
|
|
await tester.pumpAndSettle();
|
|
|
|
expect(
|
|
find.byWidgetPredicate(
|
|
(widget) =>
|
|
widget is DropdownButton &&
|
|
((widget as DropdownButton<int>).value ?? -1) == 0,
|
|
),
|
|
findsOne,
|
|
);
|
|
});
|
|
});
|
|
}
|