flutter_test_robots 1.2.0 copy "flutter_test_robots: ^1.2.0" to clipboard
flutter_test_robots: ^1.2.0 copied to clipboard

Flutter test tools and extensions to simulate human-computer interactions

Flutter Test Robots - Easily simulate human behaviors in tests

Built by the Flutter Bounty Hunters



Check out our Usage Guide


Easy keyboard shortcuts #

flutter_test_robots adds methods to WidgetTester for many common keyboard shortcuts.

void main() {
  testWidgets("easy shortcuts", (tester) async {
    await tester.pressEnter();

    await tester.pressShiftEnter();
    
    await tester.pressAltLeftArrow();
  });
}

Simulate hardware keyboard text input #

flutter_test_robots presses key combos for every character in a given string.

void main() {
  testWidgets("type with a hardware keyboard", (tester) async {
    // Simulate every key press that's needed to type "Hello, world!".
    await tester.typeKeyboardText("Hello, world!");
  });
}

Simulate IME text input #

flutter_test_robots breaks strings into text editing deltas and sends the deltas through the standard DeltaTextInputClient API.

void main() {
  testWidgets("type with the IME", (tester) async {
    // Simulate every IME delta needed to type "Hello, world!".
    await tester.ime.typeText("Hello, world!");
  });
}

flutter_test_robots can configure a WidgetTester viewport like popular recent phones.

void main() {
  testWidgets("renders on iPhone 16 Pro Max", (tester) async {
    tester.asIPhone16ProMax();

    await tester.pumpWidget(MyApp());
  });

  testWidgets("renders on every built-in test device", (tester) async {
    for (final device in TestDevices.all) {
      tester.configureForDevice(device);

      await tester.pumpWidget(MyApp());
    }
  });
}
34
likes
150
points
64.3k
downloads

Documentation

API reference

Publisher

verified publisherflutterbountyhunters.com

Weekly Downloads

Flutter test tools and extensions to simulate human-computer interactions

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter, flutter_test

More

Packages that depend on flutter_test_robots