Flutter Web Driver Support (#45951)
* Support Flutter Driver test for Flutter Web application. * Support Flutter Driver test for Flutter Web application. * Fix documentation issues. * Support Flutter Driver test for Flutter Web application. * Fix documentation. * Remove unused file from dartdoc check. * Sync to date. * Revert change to dartdoc. * Address comments. * Apply suggestions from code review Co-Authored-By: Jonah Williams <jonahwilliams@google.com> * Update copyrights. * Update allowed list for browsers. * Verify command line arguments for Drive command is correctly parsed. * Make waitUntilFirstFrameRasterized throw unimplementedError for Flutter Web Driver. * Add comment for why sync WebDriver is used. * Update documentations. * Add more unit tests and update documentation. * Configure test.dart so that web_extension_test will be executed with --platform=chrome. * Revert unnecessary changes. * Add new file path for Windows to blacklist. * Reconstruct the structure of flutter_driver/test/src folder to remove filtering logic in dev/bots/test.dart/ * Fix path to web_extension_test.dart. * Add instructions for how to use WebFlutterDriver. * Update getLayerTree to use sendCommand instead of _sendCommand. * Update pubspec files.
This commit is contained in:
committed by
Jonah Williams
parent
f546aa7def
commit
1ef0eadb45
@@ -4,7 +4,7 @@
|
||||
|
||||
import 'package:flutter_driver/src/common/find.dart';
|
||||
|
||||
import '../common.dart';
|
||||
import '../../common.dart';
|
||||
|
||||
void main() {
|
||||
test('Ancestor finder serialize', () {
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter_driver/src/extension/io_extension.dart';
|
||||
|
||||
import '../../common.dart';
|
||||
|
||||
void main() {
|
||||
group('test io_extension',() {
|
||||
Future<Map<String, dynamic>> Function(Map<String, String>) call;
|
||||
|
||||
setUp(() {
|
||||
call = (Map<String, String> args) async {
|
||||
return Future<Map<String, dynamic>>.value(args);
|
||||
};
|
||||
});
|
||||
|
||||
test('io_extension should throw exception', () {
|
||||
expect(() => registerWebServiceExtension(call),
|
||||
throwsA(isInstanceOf<UnsupportedError>()));
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import 'package:flutter_driver/flutter_driver.dart';
|
||||
import 'package:flutter_driver/src/driver/common.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
import '../common.dart';
|
||||
import '../../common.dart';
|
||||
|
||||
void main() {
|
||||
group('TimelineSummary', () {
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import 'package:flutter_driver/src/driver/timeline.dart';
|
||||
|
||||
import '../common.dart';
|
||||
import '../../common.dart';
|
||||
|
||||
void main() {
|
||||
group('Timeline', () {
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import 'package:flutter_driver/src/common/wait.dart';
|
||||
|
||||
import '../common.dart';
|
||||
import '../../common.dart';
|
||||
|
||||
void main() {
|
||||
group('WaitForCondition', () {
|
||||
@@ -0,0 +1,149 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter_driver/src/driver/web_driver_config.dart';
|
||||
import 'package:webdriver/sync_io.dart' as sync_io;
|
||||
|
||||
import '../../common.dart';
|
||||
|
||||
void main() {
|
||||
group('getDesiredCapabilities', () {
|
||||
test('Chrome with headless on', () {
|
||||
final Map<String, dynamic> expected = <String, dynamic>{
|
||||
'acceptInsecureCerts': true,
|
||||
'browserName': 'chrome',
|
||||
'goog:loggingPrefs': <String, String>{ sync_io.LogType.performance: 'ALL'},
|
||||
'chromeOptions': <String, dynamic>{
|
||||
'args': <String>[
|
||||
'--bwsi',
|
||||
'--disable-background-timer-throttling',
|
||||
'--disable-default-apps',
|
||||
'--disable-extensions',
|
||||
'--disable-popup-blocking',
|
||||
'--disable-translate',
|
||||
'--no-default-browser-check',
|
||||
'--no-sandbox',
|
||||
'--no-first-run',
|
||||
'--headless'
|
||||
],
|
||||
'perfLoggingPrefs': <String, String>{
|
||||
'traceCategories':
|
||||
'devtools.timeline,'
|
||||
'v8,blink.console,benchmark,blink,'
|
||||
'blink.user_timing'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
expect(getDesiredCapabilities(Browser.chrome, true), expected);
|
||||
});
|
||||
|
||||
test('Chrome with headless off', () {
|
||||
final Map<String, dynamic> expected = <String, dynamic>{
|
||||
'acceptInsecureCerts': true,
|
||||
'browserName': 'chrome',
|
||||
'goog:loggingPrefs': <String, String>{ sync_io.LogType.performance: 'ALL'},
|
||||
'chromeOptions': <String, dynamic>{
|
||||
'args': <String>[
|
||||
'--bwsi',
|
||||
'--disable-background-timer-throttling',
|
||||
'--disable-default-apps',
|
||||
'--disable-extensions',
|
||||
'--disable-popup-blocking',
|
||||
'--disable-translate',
|
||||
'--no-default-browser-check',
|
||||
'--no-sandbox',
|
||||
'--no-first-run',
|
||||
],
|
||||
'perfLoggingPrefs': <String, String>{
|
||||
'traceCategories':
|
||||
'devtools.timeline,'
|
||||
'v8,blink.console,benchmark,blink,'
|
||||
'blink.user_timing'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
expect(getDesiredCapabilities(Browser.chrome, false), expected);
|
||||
|
||||
});
|
||||
|
||||
test('Firefox with headless on', () {
|
||||
final Map<String, dynamic> expected = <String, dynamic>{
|
||||
'acceptInsecureCerts': true,
|
||||
'browserName': 'firefox',
|
||||
'moz:firefoxOptions' : <String, dynamic>{
|
||||
'args': <String>['-headless'],
|
||||
'prefs': <String, dynamic>{
|
||||
'dom.file.createInChild': true,
|
||||
'dom.timeout.background_throttling_max_budget': -1,
|
||||
'media.autoplay.default': 0,
|
||||
'media.gmp-manager.url': '',
|
||||
'media.gmp-provider.enabled': false,
|
||||
'network.captive-portal-service.enabled': false,
|
||||
'security.insecure_field_warning.contextual.enabled': false,
|
||||
'test.currentTimeOffsetSeconds': 11491200
|
||||
},
|
||||
'log': <String, String>{'level': 'trace'}
|
||||
}
|
||||
};
|
||||
|
||||
expect(getDesiredCapabilities(Browser.firefox, true), expected);
|
||||
});
|
||||
|
||||
test('Firefox with headless off', () {
|
||||
final Map<String, dynamic> expected = <String, dynamic>{
|
||||
'acceptInsecureCerts': true,
|
||||
'browserName': 'firefox',
|
||||
'moz:firefoxOptions' : <String, dynamic>{
|
||||
'args': <String>[],
|
||||
'prefs': <String, dynamic>{
|
||||
'dom.file.createInChild': true,
|
||||
'dom.timeout.background_throttling_max_budget': -1,
|
||||
'media.autoplay.default': 0,
|
||||
'media.gmp-manager.url': '',
|
||||
'media.gmp-provider.enabled': false,
|
||||
'network.captive-portal-service.enabled': false,
|
||||
'security.insecure_field_warning.contextual.enabled': false,
|
||||
'test.currentTimeOffsetSeconds': 11491200
|
||||
},
|
||||
'log': <String, String>{'level': 'trace'}
|
||||
}
|
||||
};
|
||||
|
||||
expect(getDesiredCapabilities(Browser.firefox, false), expected);
|
||||
});
|
||||
|
||||
test('Edge', () {
|
||||
final Map<String, dynamic> expected = <String, dynamic>{
|
||||
'acceptInsecureCerts': true,
|
||||
'browserName': 'edge',
|
||||
};
|
||||
|
||||
expect(getDesiredCapabilities(Browser.edge, false), expected);
|
||||
});
|
||||
|
||||
test('macOS Safari', () {
|
||||
final Map<String, dynamic> expected = <String, dynamic>{
|
||||
'browserName': 'safari',
|
||||
'safari.options': <String, dynamic>{
|
||||
'skipExtensionInstallation': true,
|
||||
'cleanSession': true
|
||||
}
|
||||
};
|
||||
|
||||
expect(getDesiredCapabilities(Browser.safari, false), expected);
|
||||
});
|
||||
|
||||
test('iOS Safari', () {
|
||||
final Map<String, dynamic> expected = <String, dynamic>{
|
||||
'platformName': 'ios',
|
||||
'browserName': 'safari',
|
||||
'safari:useSimulator': true
|
||||
};
|
||||
|
||||
expect(getDesiredCapabilities(Browser.iosSafari, false), expected);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:js' as js;
|
||||
|
||||
import 'package:flutter_driver/src/extension/web_extension.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('test web_extension', () {
|
||||
Future<Map<String, dynamic>> Function(Map<String, String>) call;
|
||||
|
||||
setUp(() {
|
||||
call = (Map<String, String> args) async {
|
||||
return Future<Map<String, dynamic>>.value(args);
|
||||
};
|
||||
});
|
||||
|
||||
test('web_extension should register a function', () {
|
||||
expect(() => registerWebServiceExtension(call),
|
||||
returnsNormally);
|
||||
expect(js.context.hasProperty('\$flutterDriver'), true);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user