Unverified Commit 1a9d635f authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] remove --with-driver-test (#67783)

Remove flutter create --with-driver-test . Fixes #64095
parent da92fc92
...@@ -62,7 +62,9 @@ class CreateCommand extends FlutterCommand { ...@@ -62,7 +62,9 @@ class CreateCommand extends FlutterCommand {
'with-driver-test', 'with-driver-test',
negatable: true, negatable: true,
defaultsTo: false, 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( argParser.addOption(
'template', 'template',
...@@ -399,12 +401,19 @@ class CreateCommand extends FlutterCommand { ...@@ -399,12 +401,19 @@ class CreateCommand extends FlutterCommand {
throwToolExit(error); 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<String, dynamic> templateContext = _createTemplateContext( final Map<String, dynamic> templateContext = _createTemplateContext(
organization: organization, organization: organization,
projectName: projectName, projectName: projectName,
projectDescription: stringArg('description'), projectDescription: stringArg('description'),
flutterRoot: flutterRoot, flutterRoot: flutterRoot,
renderDriverTest: boolArg('with-driver-test'),
withPluginHook: generatePlugin, withPluginHook: generatePlugin,
androidLanguage: stringArg('android-language'), androidLanguage: stringArg('android-language'),
iosLanguage: stringArg('ios-language'), iosLanguage: stringArg('ios-language'),
...@@ -663,11 +672,6 @@ https://flutter.dev/docs/development/packages-and-plugins/developing-packages#pl ...@@ -663,11 +672,6 @@ https://flutter.dev/docs/development/packages-and-plugins/developing-packages#pl
generatedCount += _injectGradleWrapper(project); 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')) { if (boolArg('pub')) {
await pub.get( await pub.get(
context: PubContext.create, context: PubContext.create,
...@@ -721,7 +725,6 @@ https://flutter.dev/docs/development/packages-and-plugins/developing-packages#pl ...@@ -721,7 +725,6 @@ https://flutter.dev/docs/development/packages-and-plugins/developing-packages#pl
String androidLanguage, String androidLanguage,
String iosLanguage, String iosLanguage,
String flutterRoot, String flutterRoot,
bool renderDriverTest = false,
bool withPluginHook = false, bool withPluginHook = false,
bool ios = false, bool ios = false,
bool android = false, bool android = false,
...@@ -755,7 +758,6 @@ https://flutter.dev/docs/development/packages-and-plugins/developing-packages#pl ...@@ -755,7 +758,6 @@ https://flutter.dev/docs/development/packages-and-plugins/developing-packages#pl
'dartSdk': '$flutterRoot/bin/cache/dart-sdk', 'dartSdk': '$flutterRoot/bin/cache/dart-sdk',
'androidMinApiLevel': android_common.minApiLevel, 'androidMinApiLevel': android_common.minApiLevel,
'androidSdkVersion': kAndroidSdkMinVersion, 'androidSdkVersion': kAndroidSdkMinVersion,
'withDriverTest': renderDriverTest,
'pluginClass': pluginClass, 'pluginClass': pluginClass,
'pluginClassSnakeCase': pluginClassSnakeCase, 'pluginClassSnakeCase': pluginClassSnakeCase,
'pluginClassCapitalSnakeCase': pluginClassCapitalSnakeCase, 'pluginClassCapitalSnakeCase': pluginClassCapitalSnakeCase,
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
{{#withDriverTest}}
import 'package:flutter_driver/driver_extension.dart';
{{/withDriverTest}}
{{#withPluginHook}} {{#withPluginHook}}
import 'dart:async'; import 'dart:async';
...@@ -10,11 +7,6 @@ import 'package:{{pluginProjectName}}/{{pluginProjectName}}.dart'; ...@@ -10,11 +7,6 @@ import 'package:{{pluginProjectName}}/{{pluginProjectName}}.dart';
{{/withPluginHook}} {{/withPluginHook}}
void main() { void main() {
{{#withDriverTest}}
// Enable integration testing with the Flutter Driver extension.
// See https://flutter.dev/testing/ for more info.
enableFlutterDriverExtension();
{{/withDriverTest}}
runApp(MyApp()); runApp(MyApp());
} }
......
...@@ -43,11 +43,6 @@ dependencies: ...@@ -43,11 +43,6 @@ dependencies:
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter 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 # For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec # following page: https://dart.dev/tools/pub/pubspec
......
// 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'));
});
});
}
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
{{#withDriverTest}}
import 'package:flutter_driver/driver_extension.dart';
{{/withDriverTest}}
{{#withPluginHook}} {{#withPluginHook}}
import 'dart:async'; import 'dart:async';
...@@ -9,17 +6,7 @@ import 'package:flutter/services.dart'; ...@@ -9,17 +6,7 @@ import 'package:flutter/services.dart';
import 'package:{{pluginProjectName}}/{{pluginProjectName}}.dart'; import 'package:{{pluginProjectName}}/{{pluginProjectName}}.dart';
{{/withPluginHook}} {{/withPluginHook}}
{{^withDriverTest}}
void main() => runApp(MyApp()); 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}} {{^withPluginHook}}
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
......
...@@ -31,10 +31,6 @@ dependencies: ...@@ -31,10 +31,6 @@ dependencies:
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
{{#withDriverTest}}
flutter_driver:
sdk: flutter
{{/withDriverTest}}
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec # following page: https://dart.dev/tools/pub/pubspec
......
...@@ -15,10 +15,6 @@ dependencies: ...@@ -15,10 +15,6 @@ dependencies:
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
{{#withDriverTest}}
flutter_driver:
sdk: flutter
{{/withDriverTest}}
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec # following page: https://dart.dev/tools/pub/pubspec
......
...@@ -139,7 +139,6 @@ ...@@ -139,7 +139,6 @@
"templates/cocoapods/Podfile-ios-objc", "templates/cocoapods/Podfile-ios-objc",
"templates/cocoapods/Podfile-ios-swift", "templates/cocoapods/Podfile-ios-swift",
"templates/cocoapods/Podfile-macos", "templates/cocoapods/Podfile-macos",
"templates/driver/main_test.dart.tmpl",
"templates/module/android/gradle/build.gradle.copy.tmpl", "templates/module/android/gradle/build.gradle.copy.tmpl",
"templates/module/android/gradle/gradle.properties.tmpl", "templates/module/android/gradle/gradle.properties.tmpl",
"templates/module/android/host_app_common/app.tmpl/build.gradle.tmpl", "templates/module/android/host_app_common/app.tmpl/build.gradle.tmpl",
......
...@@ -535,23 +535,6 @@ void main() { ...@@ -535,23 +535,6 @@ void main() {
); );
}); });
testUsingContext('legacy app project with-driver-test', () async {
return _createAndAnalyzeProject(
projectDir,
<String>['--with-driver-test', '--template=app'],
<String>['lib/main.dart'],
);
}, overrides: <Type, Generator>{
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 { testUsingContext('module project with pub', () async {
return _createProject(projectDir, <String>[ return _createProject(projectDir, <String>[
'--template=module', '--template=module',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment