main_test.dart 1.03 KB
Newer Older
Ian Hickson's avatar
Ian Hickson committed
1
// Copyright 2014 The Flutter Authors. All rights reserved.
2 3 4 5
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter_driver/flutter_driver.dart';
6
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
7 8 9

void main() {
  group('channel suite', () {
10
    late FlutterDriver driver;
11 12 13 14 15 16 17 18 19 20

    setUpAll(() async {
      driver = await FlutterDriver.connect();
    });

    test('step through', () async {
      final SerializableFinder stepButton = find.byValueKey('step');
      final SerializableFinder statusField = find.byValueKey('status');
      int step = 0;
      while (await driver.getText(statusField) == 'ok') {
21
        print('Tapping for step $step...');
22 23 24 25 26 27 28
        await driver.tap(stepButton);
        step++;
      }
      final String status = await driver.getText(statusField);
      if (status != 'complete') {
        fail('Failed at step $step with status $status');
      }
29
    }, timeout: Timeout.none);
30 31

    tearDownAll(() async {
32
      driver.close();
33 34 35
    });
  });
}