diff --git a/packages/integration_test/CHANGELOG.md b/packages/integration_test/CHANGELOG.md index 6e5e4bb3d51b..ee72930a75a9 100644 --- a/packages/integration_test/CHANGELOG.md +++ b/packages/integration_test/CHANGELOG.md @@ -1,6 +1,7 @@ ## 0.8.1 * Show stack trace of widget test errors on the platform side +* Fix method channel name for iOS ## 0.8.0 diff --git a/packages/integration_test/README.md b/packages/integration_test/README.md index bb0bfa2eb1ae..a48210beacf8 100644 --- a/packages/integration_test/README.md +++ b/packages/integration_test/README.md @@ -6,7 +6,7 @@ and native Android instrumentation testing. ## Usage -Add a dependency on the `integration_test` package in the +Add a dependency on the `integration_test` and `flutter_test` package in the `dev_dependencies` section of pubspec.yaml. For plugins, do this in the pubspec.yaml of the example app. @@ -14,6 +14,7 @@ Invoke `IntegrationTestWidgetsFlutterBinding.ensureInitialized()` at the start of a test file, e.g. ```dart +import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; void main() { @@ -32,7 +33,7 @@ app code, it should go in `example/test/`. It is also acceptable to put integration_test tests in `test_driver/` folder so that they're alongside the runner app (see below). -## Using Flutter driver to run tests +## Using Flutter Driver to Run Tests `IntegrationTestWidgetsTestBinding` supports launching the on-device tests with `flutter drive`. Note that the tests don't use the `FlutterDriver` API, they @@ -47,28 +48,27 @@ import 'dart:async'; import 'package:integration_test/integration_test_driver.dart'; Future main() async => integrationDriver(); - ``` To run a example app test with Flutter driver: -``` +```sh cd example flutter drive test/_integration.dart ``` To test plugin APIs using Flutter driver: -``` +```sh cd example -flutter drive --driver=test_driver/_test.dart test/_e2e.dart +flutter drive --driver=test_driver/_test.dart test/_integration_test.dart ``` You can run tests on web in release or profile mode. First you need to make sure you have downloaded the driver for the browser. -``` +```sh cd example flutter drive -v --target=test_driver/dart -d web-server --release --browser-name=chrome ``` @@ -84,7 +84,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.e2e.FlutterTestRunner; +import dev.flutter.plugins.integration_test.FlutterTestRunner; import org.junit.Rule; import org.junit.runner.RunWith; @@ -99,7 +99,7 @@ Update your application's **myapp/android/app/build.gradle** to make sure it uses androidx's version of AndroidJUnitRunner and has androidx libraries as a dependency. -``` +```gradle android { ... defaultConfig { @@ -117,10 +117,10 @@ dependencies { } ``` -To e2e test on a local Android device (emulated or physical): +To run a test on a local Android device (emulated or physical): -``` -./gradlew app:connectedAndroidTest -Ptarget=`pwd`/../test_driver/_e2e.dart +```sh +./gradlew app:connectedAndroidTest -Ptarget=`pwd`/../test_driver/_integration_test.dart ``` ## Firebase Test Lab @@ -130,7 +130,7 @@ the guides in the [Firebase test lab documentation](https://firebase.google.com/docs/test-lab/?gclid=EAIaIQobChMIs5qVwqW25QIV8iCtBh3DrwyUEAAYASAAEgLFU_D_BwE) to set up a project. -To run an e2e test on Android devices using Firebase Test Lab, use gradle commands to build an +To run a test on Android devices using Firebase Test Lab, use gradle commands to build an instrumentation test for Android, after creating `androidTest` as suggested in the last section. ```bash @@ -172,10 +172,10 @@ target 'Runner' do end ``` -To e2e test on your iOS device (simulator or real), rebuild your iOS targets with Flutter tool. +To run a test on your iOS device (simulator or real), rebuild your iOS targets with Flutter tool. -``` -flutter build ios -t test_driver/_e2e.dart (--simulator) +```sh +flutter build ios -t test_driver/_integration_test.dart (--simulator) ``` Open Xcode project (by default, it's `ios/Runner.xcodeproj`). Create a test target @@ -184,9 +184,9 @@ change the code. You can change `RunnerTests.m` to the name of your choice. ```objective-c #import -#import +#import -E2E_IOS_RUNNER(RunnerTests) +INTEGRATION_TEST_IOS_RUNNER(RunnerTests) ``` -Now you can start RunnerTests to kick out e2e tests! +Now you can start RunnerTests to kick out integration tests! diff --git a/packages/integration_test/example/README.md b/packages/integration_test/example/README.md index 64a5e8780bc2..7c61fbf5c8de 100644 --- a/packages/integration_test/example/README.md +++ b/packages/integration_test/example/README.md @@ -1,6 +1,6 @@ -# e2e_example +# integration_test_example -Demonstrates how to use the e2e plugin. +Demonstrates how to use the `package:integration_test`. ## Getting Started diff --git a/packages/integration_test/ios/Classes/IntegrationTestPlugin.m b/packages/integration_test/ios/Classes/IntegrationTestPlugin.m index 99d0c7fdf888..e7e5a74c01ee 100644 --- a/packages/integration_test/ios/Classes/IntegrationTestPlugin.m +++ b/packages/integration_test/ios/Classes/IntegrationTestPlugin.m @@ -1,6 +1,6 @@ #import "IntegrationTestPlugin.h" -static NSString *const kIntegrationTestPluginChannel = @"plugins.flutter.io/integratoin_test"; +static NSString *const kIntegrationTestPluginChannel = @"plugins.flutter.io/integration_test"; static NSString *const kMethodTestFinished = @"allTestsFinished"; @interface IntegrationTestPlugin ()