Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
62e74ea
Fix README.md for url_launcher_web (#2136)
hterkelsen Oct 7, 2019
a5a1b36
[video_player] Basic test for VideoPlayerController initialization (#…
amirh Oct 7, 2019
a9153ef
BugFix: `formatHint` was meant for network streams. (#2141)
jtmcdole Oct 7, 2019
bf17b0a
Rename instrumentation_adapter plugin to e2e plugin (#2161)
collinjackson Oct 8, 2019
9f9e5f7
[local_auth] Define clang module for iOS (#2146)
jmagman Oct 8, 2019
2fcff58
[url_launcher] Enable androidx and jetifier in android gradle propert…
bparrishMines Oct 10, 2019
1dae5b7
[url_launcher] Define clang module for iOS (#2177)
jmagman Oct 11, 2019
3900700
[shared_preferences] Define clang module for iOS
jmagman Oct 11, 2019
369a879
[sensors] Define clang module for iOS (#2175)
jmagman Oct 11, 2019
b182da8
[package_info] Define clang module for iOS (#2148)
jmagman Oct 11, 2019
178263d
[quick_actions] Define clang module for iOS (#2149)
jmagman Oct 11, 2019
ff8a4d7
[path_provider] Define clang module for iOS (#2147)
jmagman Oct 11, 2019
decb6b6
[e2e] update README (#2178)
collinjackson Oct 11, 2019
0359295
[android_intent] Migrate to the new embedding (#2143)
Oct 14, 2019
026043e
[video_player] Define clang module for iOS (#2183)
jmagman Oct 14, 2019
878daa9
[google_sign_in] Define clang module for iOS (#2184)
jmagman Oct 14, 2019
3f8502e
[webview_flutter] Define clang module for iOS (#2185)
jmagman Oct 14, 2019
37cb413
[battery] Define clang module for iOS (#2179)
jmagman Oct 14, 2019
f54320b
[share] Define clang module for iOS (#2180)
jmagman Oct 14, 2019
63d0571
[android_intent] Bump the Flutter SDK min version (#2188)
Oct 14, 2019
8697a03
Run clang analyzer on iOS and macOS code in CI test when packages cha…
jmagman Oct 14, 2019
326b21b
[battery] Support the v2 Android embedder (#2152)
amirh Oct 14, 2019
3a77d38
[battery] relax the example app minimal required Flutter version (#2…
amirh Oct 14, 2019
0992077
[image_picker] fix crash when aar from 'flutter build aar' (#2120)
liujingtech Oct 14, 2019
573c9ff
[flutter_webview] Migrate to the new embedding (#2169)
Oct 15, 2019
f7297f5
[e2e] Update to support new embedder (#2190)
collinjackson Oct 15, 2019
fb37cfc
[image_picker] Fix iOS build and analyzer warnings (#2191)
jmagman Oct 15, 2019
ba5c774
[camera] Migrate to the new embedding (#2165)
Oct 15, 2019
67697ab
[Connectivity] migrate to the new android embedding (#2142)
Oct 15, 2019
93fe8f7
[in_app_purchase] Fix iOS build warning (#2192)
jmagman Oct 15, 2019
c794ac1
[in_app_purchase] migrate to the v2 android embedding (#2155)
Oct 15, 2019
8150245
[url_launcher] Migrate to the new embedding (#2157)
Oct 15, 2019
3305e37
[webview_flutter] (Trivial) Add V2 warnings (#2196)
Oct 15, 2019
ac1052e
[battery] add e2e dependency to the example app (#2194)
amirh Oct 15, 2019
c155379
Enable testing on both master and stable (#2197)
collinjackson Oct 16, 2019
575f3e7
Revert "Enable testing on both master and stable (#2197)" (#2199)
collinjackson Oct 16, 2019
3e047f9
[url_launcher] Revert embedding support (#2201)
Oct 16, 2019
2ca7b52
[flutter_webview] Revert v2 embedder support (#2200)
Oct 16, 2019
8251326
Add plugin for Android lifecycle in embedding (#2168)
amirh Oct 16, 2019
ec57790
s/flutter_android_lifecycle/flutter_plugin_android_lifecycle/ (#2205)
amirh Oct 17, 2019
c3a9764
update readme (#2206)
amirh Oct 17, 2019
2c161ec
[flutter_plugin_android_lifecycle] bump e2e depenency to 0.2.1 (#2207)
amirh Oct 17, 2019
8099875
[android_intent] Cleanup the V2 migration (#2195)
Oct 17, 2019
dce7169
[package_info] Support the v2 Android embedder (with e2e tests) (#2160)
collinjackson Oct 17, 2019
3e271bc
Re-land testing of plugins on stable (#2203)
collinjackson Oct 17, 2019
2951f84
[url_launcher] Re-land v2 embedding support (#2204)
Oct 17, 2019
b1488e6
Ensure that when testing on stable Cirrus is upgraded to latest on iO…
collinjackson Oct 17, 2019
37936b5
[google_maps_flutter] Add NonNull macro to reduce warnings in iOS (#2…
ened Oct 18, 2019
4cb29b5
[android_intent] componentName must be provided before resolveActivit…
Oct 18, 2019
7310033
[battery]remove AndroidX constraint (#2216)
Oct 18, 2019
a3b00b0
[in_app_purchase] remove AndroidX constraint (#2215)
Oct 18, 2019
53e2151
remove android x in magic script (#2218)
Oct 18, 2019
e4b0cc4
remove android x constraint (#2219)
Oct 18, 2019
a79b89c
[connectivity]remove AndroidX constraint (#2212)
Oct 18, 2019
84dec1a
[url_launcher]remove AndroidX constraint (#2220)
Oct 19, 2019
dadb913
remove android x constraint (#2221)
Oct 19, 2019
017a57e
[path_provider] Android: Support multiple external storage options (#…
ened Oct 21, 2019
08fd95c
[Share] Support v2 android embedder. (#2156)
Oct 21, 2019
3ad2d83
[sensor] Support v2 android embedder. (#2164)
Oct 21, 2019
e61ba6e
[device_info] Support v2 android embedding. (#2163)
Oct 21, 2019
655dd19
[flutter_plugin_android_lifecycle] register the e2e plugin in the exa…
amirh Oct 21, 2019
28107c1
delete all example/android/app/gradle.properties files (#2208)
amirh Oct 21, 2019
fe9b559
[shared_preferences] Support v2 android embedding. (#2162)
Oct 22, 2019
f04b3c8
[url_launcher] Add `url_launcher_platform_interface` package (#2217)
hterkelsen Oct 22, 2019
a68932e
Forbid `... implements UrlLauncherPlatform` (#2230)
amirh Oct 23, 2019
63b4e6b
[url_launcher] Use `url_launcher_platform_interface` to handle calls …
hterkelsen Oct 23, 2019
a1fffa6
[multiple] V2 embedding plugins use compileOnly (#2232)
Oct 25, 2019
a5b7ba8
Use package import to import files inside lib/ directory. (#2236)
chingjun Oct 25, 2019
8160f31
[cleanup] Remove AndroidX warning (#2231)
Oct 28, 2019
bdd41e9
[Shared_preferences]suppress warnings (#2241)
Oct 28, 2019
fe49a79
[e2e] update README (#2233)
collinjackson Oct 28, 2019
7a6c105
[image_picker] swap width and height when source image when orientati…
owops Oct 29, 2019
421b241
[google_maps_flutter] Cast error.code to unsigned long to avoid using…
tommyzed Oct 29, 2019
dff23ca
[url_launcher] Migrate url_launcher_web to the platform interface (#2…
hterkelsen Oct 29, 2019
5b179e3
Adapt the FlutterLifecycleAdapter to the new embedding API (#2243)
amirh Oct 29, 2019
89c4816
[camera] Android: Improve image streaming by creating a request suita…
PerLycke Oct 29, 2019
4c793a3
[google_sign_in] Fix deprecated API usage issue by upgrading CocoaPod…
collinjackson Oct 29, 2019
ffb7903
[local_auth] Api to stop authentication (#2111)
karan-rawal Oct 30, 2019
451a689
run the publish with the pub version from flutter stable (#2250)
amirh Nov 1, 2019
f31d16a
[webview_flutter] Re-land support v2 embedding support (#2209)
Nov 1, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rename instrumentation_adapter plugin to e2e plugin (flutter#2161)
* Rename instrumentation_adapter plugin to e2e plugin
* Refactored test, demonstrate reading the exit code
* Updated README
  • Loading branch information
collinjackson authored Oct 8, 2019
commit bf17b0aebb01b1785a8d0b64ff0e4f9b61264752
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 0.2.0

* Renamed package from instrumentation_adapter to e2e.
* Refactored example app test.
* **Breaking change**. Renamed `InstrumentationAdapterFlutterBinding` to
`E2EWidgetsFlutterBinding`.
* Updated README.

## 0.1.4

* Migrate example to AndroidX.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# instrumentation_adapter
# e2e

Adapts flutter_test results as Android instrumentation tests, making them usable
for Firebase Test Lab and other Android CI providers.
Expand All @@ -7,24 +7,59 @@ iOS support is not available yet, but is planned in the future.

## Usage

Add a dependency on the `instrumentation_adapter` package in the
Add a dependency on the `e2e` package in the
`dev_dependencies` section of pubspec.yaml. For plugins, do this in the
pubspec.yaml of the example app.

Invoke `InstrumentationAdapterFlutterBinding.ensureInitialized()` at the start
of a test file, e.g.

```dart
import 'package:instrumentation_adapter/instrumentation_adapter.dart';
import 'package:e2e/e2e.dart';

void main() {
InstrumentationAdapterFlutterBinding.ensureInitialized();
testWidgets("failing test example", (WidgetTester tester) async {
expect(2 + 2, equals(5));
});
exit(result == 'pass' ? 0 : 1);
}
```

## Using Flutter driver to run tests

`E2EWidgetsTestBinding` supports launching the on-device tests with `flutter drive`.
Note that the tests don't use the `FlutterDriver` API, they use `testWidgets` instead.

Put the a file named `<package_name>_test.dart` in the app' `test_driver` directory:

```
import 'package:flutter_driver/flutter_driver.dart';

Future<void> main() async {
final FlutterDriver driver = await FlutterDriver.connect();
await driver.requestData(null, timeout: const Duration(minutes: 1));
driver.close();
exit(result == 'pass' ? 0 : 1);
}
```

To run a example app test with Flutter driver:

```
cd example
flutter drive test/<package_name>_e2e.dart
```

To test plugin APIs using Flutter driver:

```
cd example
flutter drive --driver=test_driver/<package_name>_test.dart test/<package_name>_e2e.dart
```

## Android device testing

Create an instrumentation test file in your application's
**android/app/src/androidTest/java/com/example/myapp/** directory (replacing
com, example, and myapp with values from your app's package name). You can name
Expand All @@ -34,7 +69,7 @@ this test file MainActivityTest.java or another name of your choice.
package com.example.myapp;

import androidx.test.rule.ActivityTestRule;
import dev.flutter.plugins.instrumentationadapter.FlutterRunner;
import dev.flutter.plugins.e2e.FlutterRunner;
import org.junit.Rule;
import org.junit.runner.RunWith;

Expand Down Expand Up @@ -67,7 +102,16 @@ dependencies {
}
```

Use gradle commands to build an instrumentation test for Android.
To e2e test on a local Android device (emulated or physical):

```
./gradlew connectedAndroidTest -Ptarget=`pwd`/../test_driver/<package_name>_e2e.dart
```

## Firebase Test Lab

To run an e2e test on Android devices using Firebase Test Lab, use gradle commands to build an
instrumentation test for Android.

```
pushd android
Expand All @@ -90,14 +134,4 @@ gcloud firebase test android run --type instrumentation \
--results-dir=<RESULTS_DIRECTORY>
```

## Flutter driver support

`InstrumentationAdapterFlutterBinding` also reports test results to `FlutterDriver`
when run on the command line via `flutter drive`.

```dart
final FlutterDriver driver = await FlutterDriver.connect();
final String result = await driver.requestData(null, timeout: const Duration(minutes: 1));
driver.close();
exit(result == 'pass' ? 0 : 1);
```
iOS support for Firebase Test Lab is not yet available, but is planned.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
group 'com.example.instrumentation_adapter'
group 'com.example.e2e'
version '1.0-SNAPSHOT'

buildscript {
Expand Down
1 change: 1 addition & 0 deletions packages/e2e/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'e2e'
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.flutter.instrumentation_adapter">
package="dev.flutter.e2e">
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package dev.flutter.plugins.instrumentationadapter;
package dev.flutter.plugins.e2e;

import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
Expand All @@ -12,17 +12,17 @@
import java.util.Map;
import java.util.concurrent.CompletableFuture;

/** InstrumentationAdapterPlugin */
public class InstrumentationAdapterPlugin implements MethodCallHandler {
/** E2EPlugin */
public class E2EPlugin implements MethodCallHandler {

public static CompletableFuture<Map<String, String>> testResults = new CompletableFuture<>();

private static final String CHANNEL = "dev.flutter/InstrumentationAdapterFlutterBinding";
private static final String CHANNEL = "plugins.flutter.dev/e2e";

/** Plugin registration. */
public static void registerWith(Registrar registrar) {
final MethodChannel channel = new MethodChannel(registrar.messenger(), CHANNEL);
channel.setMethodCallHandler(new InstrumentationAdapterPlugin());
channel.setMethodCallHandler(new E2EPlugin());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package dev.flutter.plugins.instrumentationadapter;
package dev.flutter.plugins.e2e;

import android.app.Activity;
import androidx.test.rule.ActivityTestRule;
Expand Down Expand Up @@ -49,7 +49,7 @@ public Description getDescription() {
public void run(RunNotifier notifier) {
Map<String, String> results = null;
try {
results = InstrumentationAdapterPlugin.testResults.get();
results = E2EPlugin.testResults.get();
} catch (ExecutionException | InterruptedException e) {
throw new IllegalThreadStateException("Unable to get test results");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# instrumentation_adapter_example
# e2e_example

Demonstrates how to use the instrumentation_adapter plugin.
Demonstrates how to use the e2e plugin.

## Getting Started

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ android {

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.instrumentation_adapter_example"
applicationId "com.example.e2e_example"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.instrumentation_adapter_example;
package com.example.e2e_example;

import androidx.test.rule.ActivityTestRule;
import dev.flutter.plugins.instrumentationadapter.FlutterRunner;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.instrumentation_adapter_example">
package="com.example.e2e_example">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.instrumentation_adapter_example">
package="com.example.e2e_example">

<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
Expand All @@ -8,7 +8,7 @@
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="instrumentation_adapter_example"
android:label="e2e_example"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.instrumentation_adapter_example;
package com.example.e2e_example;

import android.os.Bundle;
import io.flutter.app.FlutterActivity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.instrumentation_adapter_example">
package="com.example.e2e_example">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ org.gradle.jvmargs=-Xmx1536M

android.useAndroidX=true
android.enableJetifier=true
android.enableR8=true
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>instrumentation_adapter_example</string>
<string>e2e_example</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: instrumentation_adapter_example
description: Demonstrates how to use the instrumentation_adapter plugin.
name: e2e_example
description: Demonstrates how to use the e2e plugin.
publish_to: 'none'

environment:
Expand All @@ -16,7 +16,7 @@ dev_dependencies:
sdk: flutter
flutter_driver:
sdk: flutter
instrumentation_adapter:
e2e:
path: ../

# For information on the generic Dart part of this file, see the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
import 'dart:io' show Platform;
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:instrumentation_adapter/instrumentation_adapter.dart';
import 'package:e2e/e2e.dart';

import 'package:instrumentation_adapter_example/main.dart';
import 'package:e2e_example/main.dart';

void main() {
InstrumentationAdapterFlutterBinding.ensureInitialized();
E2EWidgetsFlutterBinding.ensureInitialized();
testWidgets('verify text', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import 'dart:async';
import 'dart:io';

import 'package:flutter_driver/flutter_driver.dart';

Future<void> main() async {
final FlutterDriver driver = await FlutterDriver.connect();
await driver.requestData(null, timeout: const Duration(minutes: 1));
final String result =
await driver.requestData(null, timeout: const Duration(minutes: 1));
driver.close();
exit(result == 'pass' ? 0 : 1);
}
4 changes: 4 additions & 0 deletions packages/e2e/ios/Classes/E2EPlugin.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#import <Flutter/Flutter.h>

@interface E2EPlugin : NSObject <FlutterPlugin>
@end
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#import "InstrumentationAdapterPlugin.h"
#import "E2EPlugin.h"

@implementation InstrumentationAdapterPlugin
@implementation E2EPlugin
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
FlutterMethodChannel* channel = [FlutterMethodChannel
methodChannelWithName:@"dev.flutter/InstrumentationAdapterFlutterBinding"
binaryMessenger:[registrar messenger]];
InstrumentationAdapterPlugin* instance = [[InstrumentationAdapterPlugin alloc] init];
FlutterMethodChannel* channel =
[FlutterMethodChannel methodChannelWithName:@"plugins.flutter.dev/e2e"
binaryMessenger:[registrar messenger]];
E2EPlugin* instance = [[E2EPlugin alloc] init];
[registrar addMethodCallDelegate:instance channel:channel];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'instrumentation_adapter'
s.name = 'e2e'
s.version = '0.0.1'
s.summary = 'Instrumentation adapter.'
s.summary = 'Adapter for e2e tests.'
s.description = <<-DESC
Runs tests that use the flutter_test API as integration tests.
DESC
s.homepage = 'https://github.com/flutter/plugins/tree/master/packages/instrumentation_adapter'
s.homepage = 'https://github.com/flutter/plugins/tree/master/packages/e2e'
s.license = { :file => '../LICENSE' }
s.author = { 'Flutter Team' => '[email protected]' }
s.source = { :path => '.' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ import 'package:flutter/widgets.dart';

/// A subclass of [LiveTestWidgetsFlutterBinding] that reports tests results
/// on a channel to adapt them to native instrumentation test format.
class InstrumentationAdapterFlutterBinding
extends LiveTestWidgetsFlutterBinding {
InstrumentationAdapterFlutterBinding() {
class E2EWidgetsFlutterBinding extends LiveTestWidgetsFlutterBinding {
E2EWidgetsFlutterBinding() {
// TODO(jackson): Report test results as they arrive
tearDownAll(() async {
try {
Expand All @@ -29,14 +28,14 @@ class InstrumentationAdapterFlutterBinding

static WidgetsBinding ensureInitialized() {
if (WidgetsBinding.instance == null) {
InstrumentationAdapterFlutterBinding();
E2EWidgetsFlutterBinding();
}
assert(WidgetsBinding.instance is InstrumentationAdapterFlutterBinding);
assert(WidgetsBinding.instance is E2EWidgetsFlutterBinding);
return WidgetsBinding.instance;
}

static const MethodChannel _channel =
MethodChannel('dev.flutter/InstrumentationAdapterFlutterBinding');
MethodChannel('plugins.flutter.dev/e2e');

static Map<String, String> _results = <String, String>{};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: instrumentation_adapter
name: e2e
description: Runs tests that use the flutter_test API as integration tests.
version: 0.1.4
version: 0.2.0
author: Flutter Team <[email protected]>
homepage: https://github.com/flutter/plugins/tree/master/packages/instrumentation_adapter
homepage: https://github.com/flutter/plugins/tree/master/packages/e2e

environment:
sdk: ">=2.1.0 <3.0.0"
Expand All @@ -15,5 +15,5 @@ dependencies:

flutter:
plugin:
androidPackage: dev.flutter.plugins.instrumentationadapter
pluginClass: InstrumentationAdapterPlugin
androidPackage: dev.flutter.plugins.e2e
pluginClass: E2EPlugin
1 change: 0 additions & 1 deletion packages/instrumentation_adapter/android/settings.gradle

This file was deleted.

Loading