Explain more specifically how to use flutter drive
/what it does (#161450)
_Run integration tests for the project_ is not an accurate statement, as there is nothing inherently about `flutter_driver` that is for integration tests (for example, it could be just plain automation, benchmarking, etc). In addition, clarifies what the most common two arguments might be and their defaults. Co-authored-by: Andrew Kolos <andrewrkolos@gmail.com>
This commit is contained in:
parent
01fc23238e
commit
5f06c091b9
@ -216,7 +216,11 @@ class DriveCommand extends RunCommandBase {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
final String description =
|
final String description =
|
||||||
'Run integration tests for the project on an attached device or emulator.';
|
'Builds and installs the app, and runs a Dart program that connects to '
|
||||||
|
'the app, often to run externally facing integration tests, such as with '
|
||||||
|
'package:test and package:flutter_driver.\n'
|
||||||
|
'\n'
|
||||||
|
'Usage: flutter drive --target <lib/main.dart> --driver <test_driver/main_test.dart>.';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get category => FlutterCommandCategory.project;
|
String get category => FlutterCommandCategory.project;
|
||||||
|
@ -588,6 +588,32 @@ void main() {
|
|||||||
DeviceManager: () => fakeDeviceManager,
|
DeviceManager: () => fakeDeviceManager,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
testUsingContext('flutter drive --help explains how to use the command', () async {
|
||||||
|
final DriveCommand command = DriveCommand(
|
||||||
|
fileSystem: fileSystem,
|
||||||
|
logger: logger,
|
||||||
|
platform: platform,
|
||||||
|
signals: signals,
|
||||||
|
);
|
||||||
|
|
||||||
|
// TODO(matanlurey): https://github.com/flutter/flutter/issues/158532.
|
||||||
|
final StringBuffer printOutput = StringBuffer();
|
||||||
|
final Zone capturePrintZone = Zone.current.fork(
|
||||||
|
specification: ZoneSpecification(
|
||||||
|
print: (_, _, _, String line) {
|
||||||
|
printOutput.writeln(line);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
await capturePrintZone.run(() async {
|
||||||
|
await createTestCommandRunner(command).run(<String>['drive', '--help']);
|
||||||
|
});
|
||||||
|
expect(
|
||||||
|
printOutput.toString(),
|
||||||
|
stringContainsInOrder(<String>['flutter drive', '--target', '--driver']),
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
class ThrowingScreenshotDevice extends ScreenshotDevice {
|
class ThrowingScreenshotDevice extends ScreenshotDevice {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user