diff --git a/packages/flutter_tools/lib/src/commands/create.dart b/packages/flutter_tools/lib/src/commands/create.dart index 92b4e27886c..f0128cde963 100644 --- a/packages/flutter_tools/lib/src/commands/create.dart +++ b/packages/flutter_tools/lib/src/commands/create.dart @@ -62,7 +62,9 @@ class CreateCommand extends FlutterCommand { 'with-driver-test', negatable: true, defaultsTo: false, - help: "Also add a flutter_driver dependency and generate a sample 'flutter drive' test.", + help: '(Deprecated) Also add a flutter_driver dependency and generate a ' + "sample 'flutter drive' test. This flag has been deprecated, instead see " + 'package:integration_test at https://pub.dev/packages/integration_test .', ); argParser.addOption( 'template', @@ -399,12 +401,19 @@ class CreateCommand extends FlutterCommand { throwToolExit(error); } + if (boolArg('with-driver-test')) { + globals.printError( + '--with-driver-test has been deprecated and will no longer add a flutter ' + 'driver template. Instead, learn how to use package:integration_test by ' + 'visiting https://pub.dev/packages/integration_test .' + ); + } + final Map templateContext = _createTemplateContext( organization: organization, projectName: projectName, projectDescription: stringArg('description'), flutterRoot: flutterRoot, - renderDriverTest: boolArg('with-driver-test'), withPluginHook: generatePlugin, androidLanguage: stringArg('android-language'), iosLanguage: stringArg('ios-language'), @@ -663,11 +672,6 @@ https://flutter.dev/docs/development/packages-and-plugins/developing-packages#pl generatedCount += _injectGradleWrapper(project); } - if (boolArg('with-driver-test')) { - final Directory testDirectory = directory.childDirectory('test_driver'); - generatedCount += await _renderTemplate('driver', testDirectory, templateContext, overwrite: overwrite); - } - if (boolArg('pub')) { await pub.get( context: PubContext.create, @@ -721,7 +725,6 @@ https://flutter.dev/docs/development/packages-and-plugins/developing-packages#pl String androidLanguage, String iosLanguage, String flutterRoot, - bool renderDriverTest = false, bool withPluginHook = false, bool ios = false, bool android = false, @@ -755,7 +758,6 @@ https://flutter.dev/docs/development/packages-and-plugins/developing-packages#pl 'dartSdk': '$flutterRoot/bin/cache/dart-sdk', 'androidMinApiLevel': android_common.minApiLevel, 'androidSdkVersion': kAndroidSdkMinVersion, - 'withDriverTest': renderDriverTest, 'pluginClass': pluginClass, 'pluginClassSnakeCase': pluginClassSnakeCase, 'pluginClassCapitalSnakeCase': pluginClassCapitalSnakeCase, diff --git a/packages/flutter_tools/templates/app/lib/main.dart.tmpl b/packages/flutter_tools/templates/app/lib/main.dart.tmpl index 5a82f64575f..ee04c860914 100644 --- a/packages/flutter_tools/templates/app/lib/main.dart.tmpl +++ b/packages/flutter_tools/templates/app/lib/main.dart.tmpl @@ -1,7 +1,4 @@ import 'package:flutter/material.dart'; -{{#withDriverTest}} -import 'package:flutter_driver/driver_extension.dart'; -{{/withDriverTest}} {{#withPluginHook}} import 'dart:async'; @@ -10,11 +7,6 @@ import 'package:{{pluginProjectName}}/{{pluginProjectName}}.dart'; {{/withPluginHook}} void main() { -{{#withDriverTest}} - // Enable integration testing with the Flutter Driver extension. - // See https://flutter.dev/testing/ for more info. - enableFlutterDriverExtension(); -{{/withDriverTest}} runApp(MyApp()); } diff --git a/packages/flutter_tools/templates/app/pubspec.yaml.tmpl b/packages/flutter_tools/templates/app/pubspec.yaml.tmpl index 365c2057766..b46458ad180 100644 --- a/packages/flutter_tools/templates/app/pubspec.yaml.tmpl +++ b/packages/flutter_tools/templates/app/pubspec.yaml.tmpl @@ -43,11 +43,6 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter -{{#withDriverTest}} - flutter_driver: - sdk: flutter - test: ^1.16.0-nullsafety -{{/withDriverTest}} # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/packages/flutter_tools/templates/driver/main_test.dart.tmpl b/packages/flutter_tools/templates/driver/main_test.dart.tmpl deleted file mode 100644 index 1980ea59c0c..00000000000 --- a/packages/flutter_tools/templates/driver/main_test.dart.tmpl +++ /dev/null @@ -1,38 +0,0 @@ -// This is a basic Flutter Driver test for the application. A Flutter Driver -// test is an end-to-end test that "drives" your application from another -// process or even from another computer. If you are familiar with -// Selenium/WebDriver for web, Espresso for Android or UI Automation for iOS, -// this is simply Flutter's version of that. - -import 'package:flutter_driver/flutter_driver.dart'; -import 'package:test/test.dart'; - -void main() { - group('end-to-end test', () { - FlutterDriver driver; - - setUpAll(() async { - // Connect to a running Flutter application instance. - driver = await FlutterDriver.connect(); - }); - - tearDownAll(() async { - if (driver != null) - driver.close(); - }); - - test('tap on the floating action button; verify counter', () async { - // Finds the floating action button (fab) to tap on - SerializableFinder fab = find.byTooltip('Increment'); - - // Wait for the floating action button to appear - await driver.waitFor(fab); - - // Tap on the fab - await driver.tap(fab); - - // Wait for text to change to the desired value - await driver.waitFor(find.text('1')); - }); - }); -} diff --git a/packages/flutter_tools/templates/module/common/lib/main.dart.tmpl b/packages/flutter_tools/templates/module/common/lib/main.dart.tmpl index d3461e82cbe..c814ee91106 100644 --- a/packages/flutter_tools/templates/module/common/lib/main.dart.tmpl +++ b/packages/flutter_tools/templates/module/common/lib/main.dart.tmpl @@ -1,7 +1,4 @@ import 'package:flutter/material.dart'; -{{#withDriverTest}} -import 'package:flutter_driver/driver_extension.dart'; -{{/withDriverTest}} {{#withPluginHook}} import 'dart:async'; @@ -9,17 +6,7 @@ import 'package:flutter/services.dart'; import 'package:{{pluginProjectName}}/{{pluginProjectName}}.dart'; {{/withPluginHook}} -{{^withDriverTest}} void main() => runApp(MyApp()); -{{/withDriverTest}} -{{#withDriverTest}} -void main() { - // Enable integration testing with the Flutter Driver extension. - // See https://flutter.dev/testing/ for more info. - enableFlutterDriverExtension(); - runApp(MyApp()); -} -{{/withDriverTest}} {{^withPluginHook}} class MyApp extends StatelessWidget { diff --git a/packages/flutter_tools/templates/module/common/pubspec.yaml.tmpl b/packages/flutter_tools/templates/module/common/pubspec.yaml.tmpl index ee809b75baf..c03ce4ecded 100644 --- a/packages/flutter_tools/templates/module/common/pubspec.yaml.tmpl +++ b/packages/flutter_tools/templates/module/common/pubspec.yaml.tmpl @@ -31,10 +31,6 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter -{{#withDriverTest}} - flutter_driver: - sdk: flutter -{{/withDriverTest}} # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/packages/flutter_tools/templates/package/pubspec.yaml.tmpl b/packages/flutter_tools/templates/package/pubspec.yaml.tmpl index 6a56bd94900..69a6bebae19 100644 --- a/packages/flutter_tools/templates/package/pubspec.yaml.tmpl +++ b/packages/flutter_tools/templates/package/pubspec.yaml.tmpl @@ -15,10 +15,6 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - {{#withDriverTest}} - flutter_driver: - sdk: flutter - {{/withDriverTest}} # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/packages/flutter_tools/templates/template_manifest.json b/packages/flutter_tools/templates/template_manifest.json index f8a6be6b009..ba6f60f428b 100644 --- a/packages/flutter_tools/templates/template_manifest.json +++ b/packages/flutter_tools/templates/template_manifest.json @@ -139,7 +139,6 @@ "templates/cocoapods/Podfile-ios-objc", "templates/cocoapods/Podfile-ios-swift", "templates/cocoapods/Podfile-macos", - "templates/driver/main_test.dart.tmpl", "templates/module/android/gradle/build.gradle.copy.tmpl", "templates/module/android/gradle/gradle.properties.tmpl", "templates/module/android/host_app_common/app.tmpl/build.gradle.tmpl", diff --git a/packages/flutter_tools/test/commands.shard/permeable/create_test.dart b/packages/flutter_tools/test/commands.shard/permeable/create_test.dart index c8b2d031d56..53261bf5fba 100755 --- a/packages/flutter_tools/test/commands.shard/permeable/create_test.dart +++ b/packages/flutter_tools/test/commands.shard/permeable/create_test.dart @@ -535,23 +535,6 @@ void main() { ); }); - testUsingContext('legacy app project with-driver-test', () async { - return _createAndAnalyzeProject( - projectDir, - ['--with-driver-test', '--template=app'], - ['lib/main.dart'], - ); - }, overrides: { - Pub: () => Pub( - fileSystem: globals.fs, - logger: globals.logger, - processManager: globals.processManager, - usage: globals.flutterUsage, - botDetector: globals.botDetector, - platform: globals.platform, - ), - }); - testUsingContext('module project with pub', () async { return _createProject(projectDir, [ '--template=module',