mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
[flutter_tools] remove --with-driver-test (#67783)
Remove flutter create --with-driver-test . Fixes #64095
This commit is contained in:
parent
da92fc92e9
commit
1a9d635f64
@ -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<String, dynamic> 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,
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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'));
|
||||
});
|
||||
});
|
||||
}
|
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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",
|
||||
|
@ -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 {
|
||||
return _createProject(projectDir, <String>[
|
||||
'--template=module',
|
||||
|
Loading…
Reference in New Issue
Block a user