Support for app flavors in flutter tooling (#11676)

This commit is contained in:
Mikkel Nygaard Ravn
2017-08-22 10:38:23 +02:00
committed by GitHub
parent f25e2f5213
commit 8d07d3f652
59 changed files with 1951 additions and 154 deletions

View File

@@ -0,0 +1,14 @@
// 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 'package:flutter_devicelab/framework/adb.dart';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/tasks/integration_tests.dart';
Future<Null> main() async {
deviceOperatingSystem = DeviceOperatingSystem.android;
await task(createFlavorsTest());
}

View File

@@ -0,0 +1,14 @@
// 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 'package:flutter_devicelab/framework/adb.dart';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/tasks/integration_tests.dart';
Future<Null> main() async {
deviceOperatingSystem = DeviceOperatingSystem.ios;
await task(createFlavorsTest());
}

View File

@@ -0,0 +1,14 @@
// 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 'package:flutter_devicelab/framework/adb.dart';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/tasks/integration_tests.dart';
Future<Null> main() async {
deviceOperatingSystem = DeviceOperatingSystem.android;
await task(createFlavorsTest());
}

View File

@@ -23,6 +23,14 @@ TaskFunction createPlatformInteractionTest() {
);
}
TaskFunction createFlavorsTest() {
return new DriverTest(
'${flutterDirectory.path}/dev/integration_tests/flavors',
'lib/main.dart',
extraOptions: <String>['--flavor', 'paid']
);
}
TaskFunction createPlatformChannelSampleTest() {
return new DriverTest(
'${flutterDirectory.path}/examples/platform_channel',
@@ -32,10 +40,16 @@ TaskFunction createPlatformChannelSampleTest() {
class DriverTest {
DriverTest(this.testDirectory, this.testTarget);
DriverTest(
this.testDirectory,
this.testTarget, {
this.extraOptions = const <String>[],
}
);
final String testDirectory;
final String testTarget;
final List<String> extraOptions;
Future<TaskResult> call() {
return inDirectory(testDirectory, () async {
@@ -46,14 +60,15 @@ class DriverTest {
if (deviceOperatingSystem == DeviceOperatingSystem.ios)
await prepareProvisioningCertificates(testDirectory);
await flutter('drive', options: <String>[
final List<String> options = <String>[
'-v',
'-t',
testTarget,
'-d',
deviceId,
]);
];
options.addAll(extraOptions);
await flutter('drive', options: options);
return new TaskResult.success(null);
});

View File

@@ -59,6 +59,13 @@ tasks:
stage: devicelab
required_agent_capabilities: ["has-android-device"]
flavors_test:
description: >
Checks that flavored builds work on Android.
stage: devicelab
required_agent_capabilities: ["has-android-device"]
flaky: true
channels_integration_test:
description: >
Checks that platform channels work on Android.
@@ -161,6 +168,13 @@ tasks:
# iOS on-device tests
flavors_test_ios:
description: >
Checks that flavored builds work on iOS.
stage: devicelab_ios
required_agent_capabilities: ["has-ios-device"]
flaky: true
channels_integration_test_ios:
description: >
Checks that platform channels work on iOS.
@@ -242,6 +256,13 @@ tasks:
# Tests running on Windows host
flavors_test_win:
description: >
Checks that flavored builds work on Windows.
stage: devicelab_win
required_agent_capabilities: ["windows"]
flaky: true
channels_integration_test_win:
description: >
Checks that platform channels work when app is launched from Windows.