• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// This is a basic Flutter Driver test for the application. A Flutter Driver
2// test is an end-to-end test that "drives" your application from another
3// process or even from another computer. If you are familiar with
4// Selenium/WebDriver for web, Espresso for Android or UI Automation for iOS,
5// this is simply Flutter's version of that.
6
7import 'package:flutter_driver/flutter_driver.dart';
8import 'package:test/test.dart';
9
10void main() {
11  group('end-to-end test', () {
12    FlutterDriver driver;
13
14    setUpAll(() async {
15      // Connect to a running Flutter application instance.
16      driver = await FlutterDriver.connect();
17    });
18
19    tearDownAll(() async {
20      if (driver != null)
21        driver.close();
22    });
23
24    test('tap on the floating action button; verify counter', () async {
25      // Finds the floating action button (fab) to tap on
26      SerializableFinder fab = find.byTooltip('Increment');
27
28      // Wait for the floating action button to appear
29      await driver.waitFor(fab);
30
31      // Tap on the fab
32      await driver.tap(fab);
33
34      // Wait for text to change to the desired value
35      await driver.waitFor(find.text('1'));
36    });
37  });
38}
39