文件最后提交记录最后更新时间
[various] Scrubs pre-SDK-21 Android code (#9112) - Removes any annotations or runtime checks related to Android API 20 or 21, as 21 is the minimum API version supported by the versions of Flutter these plugins support. - Removes comment/README references to limitations for <21. - Updates READMEs for app-facing packages to reflect the current support levels. Fixes https://github.com/flutter/flutter/issues/157106 ## Pre-Review Checklist [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.1 年前
Update repo for 3.32 stable (#9311) Does all of the steps from https://github.com/flutter/flutter/blob/master/docs/ecosystem/release/Updating-Packages-repo-for-a-stable-release.md for the 3.32 stable release (except the first one, as the stable roller has already landed).11 个月前
[espresso] Adds EspressoFlutter as a first-party plugin (#2369) * Initial open source release of Espresso bindings for Flutter as a new first-party plugin, espresso.6 年前
[espresso] Adds EspressoFlutter as a first-party plugin (#2369) * Initial open source release of Espresso bindings for Flutter as a new first-party plugin, espresso.6 年前
Standardize Copyrights: Chromium->Flutter (#2996) In all copyright messages (and in the Xcode project organization name) standardize on "The Flutter Authors", adding "The Chromium Authors" to the Flutter AUTHORS list. This reduces inconsistency in the copyright lines in this repository, moving closer to a single consistent copyright+license (as in flutter/engine and flutter/flutter) Updates the validation script to no longer accept "The Chromium Authors" or "the Chromium project authors" in first-party code.5 年前
[various] Scrubs pre-SDK-21 Android code (#9112) - Removes any annotations or runtime checks related to Android API 20 or 21, as 21 is the minimum API version supported by the versions of Flutter these plugins support. - Removes comment/README references to limitations for <21. - Updates READMEs for app-facing packages to reflect the current support levels. Fixes https://github.com/flutter/flutter/issues/157106 ## Pre-Review Checklist [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.1 年前
Standardize copyright year (#3737) Standardizes all first-party copyrights on a single year, as is done in flutter/flutter and flutter/engine. All code now uses 2013, which is the earliest year that was in any existing copyright notice. The script checks now enforce the exact format of first-party licenses and copyrights. Fixes flutter/flutter#784485 年前
[various] Scrubs pre-SDK-21 Android code (#9112) - Removes any annotations or runtime checks related to Android API 20 or 21, as 21 is the minimum API version supported by the versions of Flutter these plugins support. - Removes comment/README references to limitations for <21. - Updates READMEs for app-facing packages to reflect the current support levels. Fixes https://github.com/flutter/flutter/issues/157106 ## Pre-Review Checklist [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.1 年前
[various] Scrubs pre-SDK-21 Android code (#9112) - Removes any annotations or runtime checks related to Android API 20 or 21, as 21 is the minimum API version supported by the versions of Flutter these plugins support. - Removes comment/README references to limitations for <21. - Updates READMEs for app-facing packages to reflect the current support levels. Fixes https://github.com/flutter/flutter/issues/157106 ## Pre-Review Checklist [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.1 年前
README.md

espresso

Provides bindings for Espresso tests of Flutter Android apps.

Android
Support SDK 21+

Installation

Add the espresso package as a dev_dependency in your app's pubspec.yaml. If you're testing the example app of a package, add it as a dev_dependency of the main package as well.

Add android:usesCleartextTraffic="true" in the <application> in the AndroidManifest.xml of the Android app used for testing. It's best to put this in a debug or androidTest AndroidManifest.xml so that you don't ship it to end users. (See the example app of this package.)

Add the following dependencies in android/app/build.gradle:

dependencies {
    testImplementation 'junit:junit:4.13.2'
    testImplementation "com.google.truth:truth:1.1.3"
    androidTestImplementation 'androidx.test:runner:1.6.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
    api 'androidx.test:core:1.2.0'
}

Create an android/app/src/androidTest folder and put a test file in a package-appropriate subfolder, e.g. android/app/src/androidTest/java/com/example/MainActivityTest.java:

package com.example.espresso_example;

import static androidx.test.espresso.flutter.EspressoFlutter.onFlutterWidget;
import static androidx.test.espresso.flutter.action.FlutterActions.click;
import static androidx.test.espresso.flutter.action.FlutterActions.syntheticClick;
import static androidx.test.espresso.flutter.assertion.FlutterAssertions.matches;
import static androidx.test.espresso.flutter.matcher.FlutterMatchers.isDescendantOf;
import static androidx.test.espresso.flutter.matcher.FlutterMatchers.withText;
import static androidx.test.espresso.flutter.matcher.FlutterMatchers.withTooltip;
import static androidx.test.espresso.flutter.matcher.FlutterMatchers.withType;
import static androidx.test.espresso.flutter.matcher.FlutterMatchers.withValueKey;
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.fail;

import androidx.test.core.app.ActivityScenario;
import androidx.test.espresso.flutter.EspressoFlutter.WidgetInteraction;
import androidx.test.espresso.flutter.assertion.FlutterAssertions;
import androidx.test.espresso.flutter.matcher.FlutterMatchers;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

/** Unit tests for {@link EspressoFlutter}. */
@RunWith(AndroidJUnit4.class)
public class MainActivityTest {

    @Before
    public void setUp() throws Exception {
        ActivityScenario.launch(MainActivity.class);
    }

    @Test
    public void performClick() {
        onFlutterWidget(withTooltip("Increment")).perform(click());
        onFlutterWidget(withValueKey("CountText")).check(matches(withText("Button tapped 1 time.")));
    }

You'll need to create a test app that enables the Flutter driver extension. You can put this in your test_driver/ folder, e.g. test_driver/example.dart. Replace <app_package_name> with the package name of your app. If you're developing a plugin, this will be the package name of the example app.

import 'package:flutter_driver/driver_extension.dart';
import 'package:<app_package_name>/main.dart' as app;

void main() {
  enableFlutterDriverExtension();
  app.main();
}

The following command line command runs the test locally:

./gradlew app:connectedAndroidTest -Ptarget=`pwd`/../test_driver/example.dart

Espresso tests can also be run on Firebase Test Lab:

./gradlew app:assembleAndroidTest
./gradlew app:assembleDebug -Ptarget=<path_to_test>.dart
gcloud auth activate-service-account --key-file=<PATH_TO_KEY_FILE>
gcloud --quiet config set project <PROJECT_NAME>
gcloud firebase test android run --type instrumentation \
  --app build/app/outputs/apk/debug/app-debug.apk \
  --test build/app/outputs/apk/androidTest/debug/app-debug-androidTest.apk\
  --timeout 2m \
  --results-bucket=<RESULTS_BUCKET> \
  --results-dir=<RESULTS_DIRECTORY>