mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-26 03:35:33 +00:00
Bug 1570183 [wpt PR 18186] - Move ChromeAndroid to ExecutorWebDriver, a=testonly
Automatic update from web-platform-tests Move ChromeAndroid to ExecutorWebDriver (#18186) Fixes #16056 Docs changes: * Remove instructions for special setups that are no longer needed. * Document more existing limitations of the implementation. -- wpt-commits: ab508a6ecf41df2acec4c09d2b516a550ce41fe9 wpt-pr: 18186
This commit is contained in:
parent
bebff2af0d
commit
a84f00f52b
@ -2,35 +2,22 @@
|
||||
|
||||
To run WPT on Chrome on an Android device, some additional set up is required.
|
||||
|
||||
First of all, as usual Android development, we need to have `adb` and be able to
|
||||
connect to the device.
|
||||
As with usual Android development, you need to have `adb` and be able to
|
||||
connect to the device. Run `adb devices` to verify.
|
||||
|
||||
## Hosts
|
||||
Currently, Android support is a prototype with some known issues:
|
||||
|
||||
Until we find a better way, we need to root the Android device and update the
|
||||
/etc/hosts file to include the entries printed by `./wpt make-hosts-file`.
|
||||
* We install ChromeDriver corresponding to the Chrome version on your *host*,
|
||||
so you will need a special flag to bypass ChromeDriver's version check if the
|
||||
test device runs a different version of Chrome from your host.
|
||||
* The package name is hard coded. If you are testing a custom build, you will
|
||||
need to search and replace `com.android.chrome` in `tools/`.
|
||||
* We do not support reftests at the moment.
|
||||
|
||||
## CA certificate
|
||||
Note: rooting the device or installing a root CA is no longer required.
|
||||
|
||||
In order to run HTTPS tests, we need to add
|
||||
[WPT's CA](https://github.com/web-platform-tests/wpt/blob/master/tools/certs/cacert.pem)
|
||||
to the phone. First, convert the certificate from PEM to CRT:
|
||||
Example:
|
||||
|
||||
```
|
||||
openssl x509 -outform der -in tools/certs/cacert.pem -out cacert.crt
|
||||
```
|
||||
|
||||
Then copy `cacert.crt` to your phone's external storage (preferably to
|
||||
Downloads/ as it'll be easier to find). Open Settings -> Security & location ->
|
||||
Encryption & credentials -> Install from storage. Find and install `cacert.crt`.
|
||||
(The setting entries might be slightly different based your Android version.)
|
||||
|
||||
Note that having this CA installed on your device outside of a test
|
||||
environment represents a security risk.
|
||||
|
||||
|
||||
Finally, we may run wpt with the `chrome_android` product
|
||||
|
||||
```
|
||||
./wpt run chrome_android [test_list]
|
||||
```bash
|
||||
./wpt run --webdriver-arg=--disable-build-check --test-type=testharness chrome_android TESTS
|
||||
```
|
||||
|
@ -595,7 +595,7 @@ class ChromeAndroid(Browser):
|
||||
return find_executable("chromedriver")
|
||||
|
||||
def install_webdriver(self, dest=None, channel=None, browser_binary=None):
|
||||
chrome = Chrome()
|
||||
chrome = Chrome(self.logger)
|
||||
return chrome.install_webdriver(dest, channel)
|
||||
|
||||
def version(self, binary=None, webdriver_binary=None):
|
||||
|
@ -1,2 +1 @@
|
||||
mozprocess==1.0.0
|
||||
selenium==3.141.0
|
||||
|
@ -2,18 +2,18 @@ import subprocess
|
||||
|
||||
from .base import Browser, ExecutorBrowser, require_arg
|
||||
from .base import get_timeout_multiplier # noqa: F401
|
||||
from .chrome import executor_kwargs as chrome_executor_kwargs
|
||||
from ..webdriver_server import ChromeDriverServer
|
||||
from ..executors import executor_kwargs as base_executor_kwargs
|
||||
from ..executors.executorselenium import (SeleniumTestharnessExecutor, # noqa: F401
|
||||
SeleniumRefTestExecutor) # noqa: F401
|
||||
from ..executors.executorwebdriver import (WebDriverTestharnessExecutor, # noqa: F401
|
||||
WebDriverRefTestExecutor) # noqa: F401
|
||||
from ..executors.executorchrome import ChromeDriverWdspecExecutor # noqa: F401
|
||||
|
||||
|
||||
__wptrunner__ = {"product": "chrome_android",
|
||||
"check_args": "check_args",
|
||||
"browser": "ChromeAndroidBrowser",
|
||||
"executor": {"testharness": "SeleniumTestharnessExecutor",
|
||||
"reftest": "SeleniumRefTestExecutor",
|
||||
"executor": {"testharness": "WebDriverTestharnessExecutor",
|
||||
"reftest": "WebDriverRefTestExecutor",
|
||||
"wdspec": "ChromeDriverWdspecExecutor"},
|
||||
"browser_kwargs": "browser_kwargs",
|
||||
"executor_kwargs": "executor_kwargs",
|
||||
@ -36,31 +36,25 @@ def browser_kwargs(test_type, run_info_data, config, **kwargs):
|
||||
|
||||
def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
|
||||
**kwargs):
|
||||
from selenium.webdriver import DesiredCapabilities
|
||||
|
||||
# Use extend() to modify the global list in place.
|
||||
# Use update() to modify the global list in place.
|
||||
_wptserve_ports.update(set(
|
||||
server_config['ports']['http'] + server_config['ports']['https'] +
|
||||
server_config['ports']['ws'] + server_config['ports']['wss']
|
||||
))
|
||||
|
||||
executor_kwargs = base_executor_kwargs(test_type, server_config, cache_manager, run_info_data,
|
||||
**kwargs)
|
||||
executor_kwargs["close_after_done"] = True
|
||||
capabilities = dict(DesiredCapabilities.CHROME.items())
|
||||
capabilities["goog:chromeOptions"] = {}
|
||||
# TODO(chrome): browser_channel should be properly supported.
|
||||
executor_kwargs = chrome_executor_kwargs(test_type, server_config,
|
||||
cache_manager, run_info_data,
|
||||
**kwargs)
|
||||
del executor_kwargs["capabilities"]["goog:chromeOptions"]["prefs"]
|
||||
del executor_kwargs["capabilities"]["goog:chromeOptions"]["useAutomationExtension"]
|
||||
|
||||
# TODO(Hexcles): browser_channel should be properly supported.
|
||||
package_name = "com.android.chrome" # stable channel
|
||||
# Required to start on mobile
|
||||
capabilities["goog:chromeOptions"]["androidPackage"] = package_name
|
||||
executor_kwargs["capabilities"]["goog:chromeOptions"]["androidPackage"] = \
|
||||
package_name
|
||||
# Map wptrunner args to chromeOptions.
|
||||
|
||||
for (kwarg, capability) in [("binary", "binary"), ("binary_args", "args")]:
|
||||
if kwargs[kwarg] is not None:
|
||||
capabilities["goog:chromeOptions"][capability] = kwargs[kwarg]
|
||||
if test_type == "testharness":
|
||||
capabilities["useAutomationExtension"] = False
|
||||
capabilities["excludeSwitches"] = ["enable-automation"]
|
||||
executor_kwargs["capabilities"] = capabilities
|
||||
return executor_kwargs
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user