maestro_test 0.3.1 copy "maestro_test: ^0.3.1" to clipboard
maestro_test: ^0.3.1 copied to clipboard

discontinuedreplaced by: patrol
outdated

Simple, easy-to-learn, Flutter-native UI testing framework eliminating limitations of flutter_driver

maestro_test #

maestro_test on pub.dev code
style

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.

It also provides a new custom selector system to make writing Flutter widget tests more concisce, and writing them faster & more fun.

Installation #

Add maestro_test as a dev dependency in pubspec.yaml:

dev_dependencies:
  maestro_test: ^0.3.1

Using features of the underlying native platform #

// example/integration_test/example_test.dart
import 'package:example/main.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:maestro_test/maestro_test.dart';

void main() {
  final maestro = Maestro.forTest();

  maestroTest(
    'counter state is the same after going to Home and going back',
    ($) async {
      await tester.pumpWidgetAndSettle(const MyApp());

      await $(FloatingActionButton).tap();
      expect($(#counterText).text, '1');

      await maestro.pressHome();
      await maestro.pressDoubleRecentApps();

      expect($(#counterText).text, '1');
      await $(FloatingActionButton).tap();
      expect($(#counterText).text, '2');

      await maestro.openHalfNotificationShade();
      await maestro.pressBack();
    },
  );
}

Custom selectors #

import 'package:example/main.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:maestro_test/maestro_test.dart';

void main() {
  maestroTest(
    'logs in successfully',
    ($) async {
      await $.pumpWidgetAndSettle(const MyApp());

      await $(#emailInput).enterText('user@leancode.co');
      await $(#passwordInput).enterText('ny4ncat');

      // Find widget with text 'Log in' which is a descendant of widget with key
      // box1 which is a descendant of a Scaffold widget and tap on it.
      await $(Scaffold).$(#box1).$('Log in').tap();

      // Selects the first Scrollable which has a Text descendant
      $(Scrollable).withDescendant(Text);

      // Selects the first Scrollable which has a Button descendant which has a Text descendant
      $(Scrollable).withDescendant($(Text).withDescendant(Text));
    },
  );
}
8
likes
0
pub points
0%
popularity

Publisher

verified publisherleancode.pl

Simple, easy-to-learn, Flutter-native UI testing framework eliminating limitations of flutter_driver

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_test, freezed_annotation, http, integration_test, json_annotation, logging, meta

More

Packages that depend on maestro_test