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 all commits
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
4 changes: 0 additions & 4 deletions packages/e2e/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
## 0.4.1

* Adds support for Android E2E tests that utilize other @Rule's, like GrantPermissionRule.

## 0.4.0

* **Breaking change** Driver request_data call's response has changed to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,23 @@

package dev.flutter.plugins.e2e;

import android.app.Activity;
import android.util.Log;
import androidx.test.rule.ActivityTestRule;
import java.lang.reflect.Field;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import org.junit.Rule;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runner.Runner;
import org.junit.runner.notification.Failure;
import org.junit.runner.notification.RunNotifier;

public class FlutterTestRunner extends Runner {

private static final String TAG = "FlutterTestRunner";

final Class testClass;
TestRule rule = null;
ActivityTestRule<Activity> rule = null;

public FlutterTestRunner(Class<?> testClass) {
super();
Expand All @@ -33,10 +32,7 @@ public FlutterTestRunner(Class<?> testClass) {
if (field.isAnnotationPresent(Rule.class)) {
try {
Object instance = testClass.newInstance();
if (field.get(instance) instanceof ActivityTestRule) {
rule = (TestRule) field.get(instance);
break;
}
rule = (ActivityTestRule<Activity>) field.get(instance);
} catch (InstantiationException | IllegalAccessException e) {
// This might occur if the developer did not make the rule public.
// We could call field.setAccessible(true) but it seems better to throw.
Expand All @@ -57,9 +53,7 @@ public void run(RunNotifier notifier) {
throw new RuntimeException("Unable to run tests due to missing activity rule");
}
try {
if (rule instanceof ActivityTestRule) {
((ActivityTestRule) rule).launchActivity(null);
}
rule.launchActivity(null);
} catch (RuntimeException e) {
Log.v(TAG, "launchActivity failed, possibly because the activity was already running. " + e);
Log.v(
Expand Down

This file was deleted.

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.4.1
version: 0.4.0
homepage: https://github.com/flutter/plugins/tree/master/packages/e2e

environment:
Expand Down