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

import 'dart:io';

import 'package:flutter_devicelab/framework/adb.dart';
import 'package:flutter_devicelab/framework/framework.dart';
9
import 'package:flutter_devicelab/framework/task_result.dart';
10 11
import 'package:flutter_devicelab/framework/utils.dart';

12
// This test runs "//dev/integration_tests/flutter_gallery/test/live_smoketest.dart", which communicates
13 14 15
// with the Java code to report its status. If this test fails due to a problem on the Dart
// side, you can debug that by just running that file directly using `flutter run`.

16
Future<void> main() async {
17 18 19 20
  deviceOperatingSystem = DeviceOperatingSystem.android;

  await task(() async {
    final Directory galleryDirectory =
21
      dir('${flutterDirectory.path}/dev/integration_tests/flutter_gallery');
22
    await inDirectory(galleryDirectory, () async {
23 24
      final Device device = await devices.workingDevice;
      await device.unlock();
25
      await flutter('packages', options: <String>['get']);
26
      await flutter('clean');
27 28
      await flutter('build', options: <String>['apk', '--target', 'test/live_smoketest.dart']);
      await exec('./tool/run_instrumentation_test.sh', <String>[], environment: <String, String>{
29
        'JAVA_HOME': await findJavaHome(),
30
      });
31 32
    });

33
    return TaskResult.success(null);
34 35
  });
}