Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
6 changes: 6 additions & 0 deletions packages/e2e/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.2.1

* Updated to support new embedder.
* Print a warning if the plugin is not registered.
* Updated method channel name.

## 0.2.0+1

* Updated README.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

package dev.flutter.plugins.e2e;

import android.content.Context;
import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
Expand All @@ -13,16 +16,34 @@
import java.util.concurrent.CompletableFuture;

/** E2EPlugin */
public class E2EPlugin implements MethodCallHandler {
public class E2EPlugin implements MethodCallHandler, FlutterPlugin {
private MethodChannel methodChannel;

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

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

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

@Override
public void onAttachedToEngine(FlutterPluginBinding binding) {
onAttachedToEngine(
binding.getApplicationContext(), binding.getFlutterEngine().getDartExecutor());
}

private void onAttachedToEngine(Context applicationContext, BinaryMessenger messenger) {
methodChannel = new MethodChannel(messenger, "plugins.flutter.io/e2e");
methodChannel.setMethodCallHandler(this);
}

@Override
public void onDetachedFromEngine(FlutterPluginBinding binding) {
methodChannel.setMethodCallHandler(null);
methodChannel = null;
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions packages/e2e/lib/e2e.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class E2EWidgetsFlutterBinding extends LiveTestWidgetsFlutterBinding {
await _channel.invokeMethod<void>(
'allTestsFinished', <String, dynamic>{'results': _results});
} on MissingPluginException {
// Tests were run on the host rather than a device.
print('Warning: E2E test plugin was not detected.');
}
if (!_allTestsPassed.isCompleted) _allTestsPassed.complete(true);
});
Expand All @@ -35,7 +35,7 @@ class E2EWidgetsFlutterBinding extends LiveTestWidgetsFlutterBinding {
}

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

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

Expand Down
2 changes: 1 addition & 1 deletion packages/e2e/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: e2e
description: Runs tests that use the flutter_test API as integration tests.
version: 0.2.0+1
version: 0.2.1
author: Flutter Team <flutter-dev@googlegroups.com>
homepage: https://github.com/flutter/plugins/tree/master/packages/e2e

Expand Down