From e42a409b0460acf569bcf2b6505a0d119343341f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20J=C3=A4genstedt?= Date: Wed, 10 Oct 2018 22:31:38 +0200 Subject: [PATCH] Support `./wpt run --channel=preview safari` This mostly to avoid the lengthy argument currently required: `--webdriver-binary "/Applications/Safari Technology Preview.app/Contents/MacOS/safaridriver"` Using `--browser-channel=preview` and the product `safari_webdriver` also works. --- docs/_running-tests/safari.md | 4 ++-- tools/wpt/browser.py | 29 ++++++++++++++++------------- tools/wpt/install.py | 2 ++ tools/wpt/run.py | 2 +- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/docs/_running-tests/safari.md b/docs/_running-tests/safari.md index e6cedd97f965fe..3ef508d3780aae 100644 --- a/docs/_running-tests/safari.md +++ b/docs/_running-tests/safari.md @@ -22,7 +22,7 @@ Now, run the tests using the `safari` product: ``` This will use the `safaridriver` found on the path, which will be stable Safari. -To run Safari Technology Preview instead, use the `--webdriver-binary` argument: +To run Safari Technology Preview instead, use the `--channel=preview` argument: ``` -./wpt run --webdriver-binary "/Applications/Safari Technology Preview.app/Contents/MacOS/safaridriver" safari [test_list] +./wpt run --channel=preview safari [test_list] ``` diff --git a/tools/wpt/browser.py b/tools/wpt/browser.py index 3b3074a985607a..51f0dbdba92655 100644 --- a/tools/wpt/browser.py +++ b/tools/wpt/browser.py @@ -41,7 +41,7 @@ def find_binary(self, venv_path=None, channel=None): return NotImplemented @abstractmethod - def find_webdriver(self): + def find_webdriver(self, channel=None): """Find the binary of the WebDriver.""" return NotImplemented @@ -211,7 +211,7 @@ def find_certutil(self): return None return path - def find_webdriver(self): + def find_webdriver(self, channel=None): return find_executable("geckodriver") def get_version_and_channel(self, binary): @@ -387,7 +387,7 @@ def install(self, dest=None, channel=None): def find_binary(self, venv_path=None, channel=None): raise NotImplementedError - def find_webdriver(self): + def find_webdriver(self, channel=None): raise NotImplementedError def install_webdriver(self, dest=None, channel=None): @@ -441,7 +441,7 @@ def platform_string(self): def find_binary(self, venv_path=None, channel=None): raise NotImplementedError - def find_webdriver(self): + def find_webdriver(self, channel=None): return find_executable("chromedriver") def install_webdriver(self, dest=None, channel=None): @@ -489,7 +489,7 @@ def install(self, dest=None, channel=None): def find_binary(self, venv_path=None, channel=None): raise NotImplementedError - def find_webdriver(self): + def find_webdriver(self, channel=None): return find_executable("chromedriver") def install_webdriver(self, dest=None, channel=None): @@ -541,7 +541,7 @@ def platform_string(self): def find_binary(self, venv_path=None, channel=None): raise NotImplementedError - def find_webdriver(self): + def find_webdriver(self, channel=None): return find_executable("operadriver") def install_webdriver(self, dest=None, channel=None): @@ -584,7 +584,7 @@ def install(self, dest=None, channel=None): def find_binary(self, venv_path=None, channel=None): raise NotImplementedError - def find_webdriver(self): + def find_webdriver(self, channel=None): return find_executable("MicrosoftWebDriver") def install_webdriver(self, dest=None, channel=None): @@ -610,7 +610,7 @@ def install(self, dest=None, channel=None): def find_binary(self, venv_path=None, channel=None): raise NotImplementedError - def find_webdriver(self): + def find_webdriver(self, channel=None): return find_executable("IEDriverServer.exe") def install_webdriver(self, dest=None, channel=None): @@ -635,8 +635,11 @@ def install(self, dest=None, channel=None): def find_binary(self, venv_path=None, channel=None): raise NotImplementedError - def find_webdriver(self): - return find_executable("safaridriver") + def find_webdriver(self, channel=None): + path = None + if channel == "preview": + path = "/Applications/Safari Technology Preview.app/Contents/MacOS" + return find_executable("safaridriver", path) def install_webdriver(self, dest=None, channel=None): raise NotImplementedError @@ -695,7 +698,7 @@ def find_binary(self, venv_path=None, channel=None): path = find_executable("servo") return path - def find_webdriver(self): + def find_webdriver(self, channel=None): return None def install_webdriver(self, dest=None, channel=None): @@ -719,7 +722,7 @@ def install(self, dest=None, channel=None): def find_binary(self, venev_path=None, channel=None): raise NotImplementedError - def find_webdriver(self): + def find_webdriver(self, channel=None): raise NotImplementedError def install_webdriver(self, dest=None, channel=None): @@ -741,7 +744,7 @@ def install(self, dest=None, channel=None): def find_binary(self, venv_path=None, channel=None): return None - def find_webdriver(self): + def find_webdriver(self, channel=None): return None def install_webdriver(self, dest=None, channel=None): diff --git a/tools/wpt/install.py b/tools/wpt/install.py index 62c833aa3f0c70..f588a412845848 100644 --- a/tools/wpt/install.py +++ b/tools/wpt/install.py @@ -6,6 +6,8 @@ latest_channels = { 'firefox': 'nightly', 'chrome': 'dev', + 'safari': 'preview', + 'safari_webdriver': 'preview', 'servo': 'nightly' } diff --git a/tools/wpt/run.py b/tools/wpt/run.py index d9a44fd3711563..da01a816974bfe 100644 --- a/tools/wpt/run.py +++ b/tools/wpt/run.py @@ -371,7 +371,7 @@ def install(self, venv, channel=None): def setup_kwargs(self, kwargs): if kwargs["webdriver_binary"] is None: - webdriver_binary = self.browser.find_webdriver() + webdriver_binary = self.browser.find_webdriver(channel=kwargs["browser_channel"]) if webdriver_binary is None: raise WptrunError("Unable to locate safaridriver binary")