maestro_test 0.1.3 maestro_test: ^0.1.3 copied to clipboard
Simple, easy-to-learn, Flutter-native UI testing framework eliminating limitations of flutter_driver
maestro_test #
maestro_test
package builds on top of flutter_driver
to make it easy to
control the native device from Dart. It does this by using Android's
UIAutomator library.
Installation #
Add maestro_test
as a dev dependency in pubspec.yaml
:
dev_dependencies:
maestro_test: ^0.1.3
Usage #
// integration_test/app_test.dart
import 'package:example/app.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:maestro_test/maestro_test.dart';
void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Automator.init(verbose: true);
final automator = Automator.instance;
testWidgets(
"counter state is the same after going to Home and switching apps",
(WidgetTester tester) async {
Text findCounterText() {
return tester
.firstElement(find.byKey(const ValueKey('counterText')))
.widget as Text;
}
await tester.pumpWidget(const MyApp());
await tester.pumpAndSettle();
await tester.tap(find.byType(FloatingActionButton));
await tester.pumpAndSettle();
expect(findCounterText().data, '1');
await automator.pressHome();
await automator.pressDoubleRecentApps();
expect(findCounterText().data, '1');
await tester.tap(find.byType(FloatingActionButton));
await tester.pumpAndSettle();
expect(findCounterText().data, '2');
await automator.openNotifications();
},
);
}