flutter_gallery_instrumentation_test.dart 1.25 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:async';
import 'dart:io';

import 'package:flutter_devicelab/framework/adb.dart';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/utils.dart';

Future<Null> main() async {
  deviceOperatingSystem = DeviceOperatingSystem.android;

  await task(() async {
    final Directory galleryDirectory =
      dir('${flutterDirectory.path}/examples/flutter_gallery');
    await inDirectory(galleryDirectory, () async {
19 20
      final Device device = await devices.workingDevice;
      await device.unlock();
21
      await flutter('packages', options: <String>['get']);
22
      await flutter('clean');
23
      await flutter('build', options: <String>['apk', '--target', 'test/live_smoketest.dart']);
24
      final String androidStudioPath = grep('Android Studio at', from: await evalFlutter('doctor', options: <String>['-v'])).first.split(' ').last;
25 26 27
      await exec('./tool/run_instrumentation_test.sh', <String>[], environment: <String, String>{
        'JAVA_HOME': '$androidStudioPath/jre',
      });
28 29 30 31 32
    });

    return new TaskResult.success(null);
  });
}