Revert "Flutter Web Driver Support (#47470)" (#47698)

This reverts commit cc1c9649c4.
This commit is contained in:
Francisco Magdaleno
2019-12-23 15:20:11 -08:00
committed by GitHub
parent 9861a1c045
commit f2f9d0e4fd
55 changed files with 752 additions and 2108 deletions

View File

@@ -69,34 +69,6 @@ class DriveCommand extends RunCommandBase {
..addFlag('build',
defaultsTo: true,
help: 'Build the app before running.',
)
..addOption('driver-port',
defaultsTo: '4444',
help: 'The port where Webdriver server is launched at. Defaults to 4444.',
valueHelp: '4444'
)
..addFlag('headless',
defaultsTo: true,
help: 'Whether the driver browser is going to be launched in headless mode. Defaults to true.',
)
..addOption('browser-name',
defaultsTo: 'chrome',
help: 'Name of browser where tests will be executed. \n'
'Following browsers are supported: \n'
'Chrome, Firefox, Safari (macOS and iOS) and Edge. Defaults to Chrome.',
allowed: <String>[
'chrome',
'edge',
'firefox',
'ios-safari',
'safari',
]
)
..addOption('browser-dimension',
defaultsTo: '1600,1024',
help: 'The dimension of browser when running Flutter Web test. \n'
'This will affect screenshot and all offset-related actions. \n'
'By default. it is set to 1600,1024 (1600 by 1024).',
);
}
@@ -161,16 +133,8 @@ class DriveCommand extends RunCommandBase {
Cache.releaseLockEarly();
final Map<String, String> environment = <String, String>{
'VM_SERVICE_URL': observatoryUri,
'SELENIUM_PORT': argResults['driver-port'].toString(),
'BROWSER_NAME': argResults['browser-name'].toString(),
'BROWSER_DIMENSION': argResults['browser-dimension'].toString(),
'HEADLESS': argResults['headless'].toString(),
};
try {
await testRunner(<String>[testFile], environment);
await testRunner(<String>[testFile], observatoryUri);
} catch (error, stackTrace) {
if (error is ToolExit) {
rethrow;
@@ -327,13 +291,13 @@ Future<LaunchResult> _startApp(DriveCommand command) async {
}
/// Runs driver tests.
typedef TestRunner = Future<void> Function(List<String> testArgs, Map<String, String> environment);
typedef TestRunner = Future<void> Function(List<String> testArgs, String observatoryUri);
TestRunner testRunner = _runTests;
void restoreTestRunner() {
testRunner = _runTests;
}
Future<void> _runTests(List<String> testArgs, Map<String, String> environment) async {
Future<void> _runTests(List<String> testArgs, String observatoryUri) async {
printTrace('Running driver tests.');
PackageMap.globalPackagesPath = fs.path.normalize(fs.path.absolute(PackageMap.globalPackagesPath));
@@ -346,7 +310,7 @@ Future<void> _runTests(List<String> testArgs, Map<String, String> environment) a
'--packages=${PackageMap.globalPackagesPath}',
'-rexpanded',
],
environment: environment,
environment: <String, String>{'VM_SERVICE_URL': observatoryUri},
);
if (result != 0) {
throwToolExit('Driver tests failed: $result', exitCode: result);

View File

@@ -11,9 +11,9 @@ dependencies:
# To update these, use "flutter update-packages --force-upgrade".
archive: 2.0.11
args: 1.5.2
dwds: 0.8.5
dwds: 0.8.1
completion: 0.2.1+1
coverage: 0.13.3+3
coverage: 0.13.3+1
crypto: 2.1.3
file: 5.1.0
http: 0.12.0+2
@@ -46,7 +46,7 @@ dependencies:
test_core: 0.2.15
# Code generation dependencies
build_runner_core: 4.3.0
build_runner_core: 4.2.0
dart_style: 1.3.3
code_builder: 3.2.1
build: 1.2.2
@@ -118,7 +118,7 @@ dev_dependencies:
test: 1.9.4
build_runner: 1.7.2
build_vm_compilers: 1.0.4
build_test: 0.10.11
build_test: 0.10.10
multi_server_socket: 1.0.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
node_preamble: 1.4.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -128,4 +128,4 @@ dartdoc:
# Exclude this package from the hosted API docs.
nodoc: true
# PUBSPEC CHECKSUM: 6e90
# PUBSPEC CHECKSUM: de88

View File

@@ -46,7 +46,7 @@ void main() {
appStarter = (DriveCommand command) {
throw 'Unexpected call to appStarter';
};
testRunner = (List<String> testArgs, Map<String, String> environment) {
testRunner = (List<String> testArgs, String observatoryUri) {
throw 'Unexpected call to testRunner';
};
appStopper = (DriveCommand command) {
@@ -171,16 +171,8 @@ void main() {
appStarter = expectAsync1((DriveCommand command) async {
return LaunchResult.succeeded();
});
testRunner = expectAsync2((List<String> testArgs, Map<String, String> environment) async {
testRunner = expectAsync2((List<String> testArgs, String observatoryUri) async {
expect(testArgs, <String>[testFile]);
// VM_SERVICE_URL is not set by drive command arguments
expect(environment, <String, String>{
'VM_SERVICE_URL': 'null',
'SELENIUM_PORT': '4567',
'BROWSER_NAME': 'firefox',
'BROWSER_DIMENSION': '1024,768',
'HEADLESS': 'false',
});
return null;
});
appStopper = expectAsync1((DriveCommand command) async {
@@ -195,10 +187,6 @@ void main() {
'drive',
'--target=$testApp',
'--no-pub',
'--no-headless',
'--driver-port=4567',
'--browser-name=firefox',
'--browser-dimension=1024,768',
];
await createTestCommandRunner(command).run(args);
expect(testLogger.errorText, isEmpty);
@@ -216,7 +204,7 @@ void main() {
appStarter = expectAsync1((DriveCommand command) async {
return LaunchResult.succeeded();
});
testRunner = (List<String> testArgs, Map<String, String> environment) async {
testRunner = (List<String> testArgs, String observatoryUri) async {
throwToolExit(null, exitCode: 123);
};
appStopper = expectAsync1((DriveCommand command) async {
@@ -373,7 +361,7 @@ void main() {
testApp = fs.path.join(tempDir.path, 'test', 'e2e.dart');
testFile = fs.path.join(tempDir.path, 'test_driver', 'e2e_test.dart');
testRunner = (List<String> testArgs, Map<String, String> environment) async {
testRunner = (List<String> testArgs, String observatoryUri) async {
throwToolExit(null, exitCode: 123);
};
appStopper = expectAsync1(
@@ -506,7 +494,7 @@ void main() {
testApp = fs.path.join(tempDir.path, 'test', 'e2e.dart');
testFile = fs.path.join(tempDir.path, 'test_driver', 'e2e_test.dart');
testRunner = (List<String> testArgs, Map<String, String> environment) async {
testRunner = (List<String> testArgs, String observatoryUri) async {
throwToolExit(null, exitCode: 123);
};
appStopper = expectAsync1(