Bug 1498069 [wpt PR 13460] - Support `./wpt run --channel=preview safari`, a=testonly
authorPhilip Jägenstedt <philip@foolip.org>
Sat, 13 Oct 2018 19:31:07 +0000
changeset 499592 23b003a5135d911c8f36cb49b65eec79a74989f6
parent 499591 d73b4b4ab638d1e5e70576972627924e7e6e3132
child 499593 5c8a070fcfe8691f7c6344bd7091b5a6a41a0739
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1498069, 13460
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1498069 [wpt PR 13460] - Support `./wpt run --channel=preview safari`, a=testonly Automatic update from web-platform-testsSupport `./wpt run --channel=preview safari` (#13460) 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. -- wpt-commits: 9f2daa2a5d08d0d44f680501af2b62292f6264f0 wpt-pr: 13460
testing/web-platform/tests/docs/_running-tests/safari.md
testing/web-platform/tests/tools/wpt/browser.py
testing/web-platform/tests/tools/wpt/install.py
testing/web-platform/tests/tools/wpt/run.py
--- a/testing/web-platform/tests/docs/_running-tests/safari.md
+++ b/testing/web-platform/tests/docs/_running-tests/safari.md
@@ -17,12 +17,12 @@ To run Safari on macOS, some manual setu
     [macOS High Sierra issue](https://github.com/web-platform-tests/wpt/issues/9007).
 
 Now, run the tests using the `safari` product:
 ```
 ./wpt run safari [test_list]
 ```
 
 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]
 ```
--- a/testing/web-platform/tests/tools/wpt/browser.py
+++ b/testing/web-platform/tests/tools/wpt/browser.py
@@ -39,17 +39,17 @@ class Browser(object):
 
         If the WebDriver for the browser is able to find the binary itself, this
         method doesn't need to be implemented, in which case NotImplementedError
         is suggested to be raised to prevent accidental use.
         """
         return NotImplemented
 
     @abstractmethod
-    def find_webdriver(self):
+    def find_webdriver(self, channel=None):
         """Find the binary of the WebDriver."""
         return NotImplemented
 
     @abstractmethod
     def version(self, binary=None):
         """Retrieve the release version of the installed browser."""
         return NotImplemented
 
@@ -209,17 +209,17 @@ class Firefox(Browser):
     def find_certutil(self):
         path = find_executable("certutil")
         if path is None:
             return None
         if os.path.splitdrive(path)[1].split(os.path.sep) == ["", "Windows", "system32", "certutil.exe"]:
             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):
         version_string = call(binary, "--version").strip()
         m = re.match(r"Mozilla Firefox (\d+\.\d+(?:\.\d+)?)(a|b)?", version_string)
         if not m:
             return None, "nightly"
         version, status = m.groups()
@@ -385,17 +385,17 @@ class Fennec(Browser):
     requirements = "requirements_firefox.txt"
 
     def install(self, dest=None, channel=None):
         raise NotImplementedError
 
     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):
         raise NotImplementedError
 
     def version(self, binary=None):
         return None
 
@@ -439,17 +439,17 @@ class Chrome(Browser):
         elif platform == "win":
             bits = "32"
 
         return "%s%s" % (platform, bits)
 
     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):
         if dest is None:
             dest = os.pwd
         latest = get("http://chromedriver.storage.googleapis.com/LATEST_RELEASE").text.strip()
         url = "http://chromedriver.storage.googleapis.com/%s/chromedriver_%s.zip" % (latest,
                                                                                      self.platform_string())
@@ -487,17 +487,17 @@ class ChromeAndroid(Browser):
     requirements = "requirements_chrome_android.txt"
 
     def install(self, dest=None, channel=None):
         raise NotImplementedError
 
     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):
         chrome = Chrome()
         return chrome.install_webdriver(dest, channel)
 
     def version(self, binary):
         return None
@@ -540,17 +540,17 @@ class Opera(Browser):
         elif platform == "win":
             bits = "32"
 
         return "%s%s" % (platform, bits)
 
     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):
         if dest is None:
             dest = os.pwd
         latest = get("https://api.github.com/repos/operasoftware/operachromiumdriver/releases/latest").json()["tag_name"]
         url = "https://github.com/operasoftware/operachromiumdriver/releases/download/%s/operadriver_%s.zip" % (latest,
                                                                                                                 self.platform_string())
@@ -583,17 +583,17 @@ class Edge(Browser):
     requirements = "requirements_edge.txt"
 
     def install(self, dest=None, channel=None):
         raise NotImplementedError
 
     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):
         raise NotImplementedError
 
     def version(self, binary):
         return None
 
@@ -609,17 +609,17 @@ class InternetExplorer(Browser):
     requirements = "requirements_ie.txt"
 
     def install(self, dest=None, channel=None):
         raise NotImplementedError
 
     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):
         raise NotImplementedError
 
     def version(self, binary):
         return None
 
@@ -634,18 +634,21 @@ class Safari(Browser):
     requirements = "requirements_safari.txt"
 
     def install(self, dest=None, channel=None):
         raise NotImplementedError
 
     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
 
     def version(self, binary):
         return None
 
 
@@ -698,17 +701,17 @@ class Servo(Browser):
         return path
 
     def find_binary(self, venv_path=None, channel=None):
         path = find_executable("servo", os.path.join(venv_path, "servo"))
         if path is 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):
         raise NotImplementedError
 
     def version(self, binary):
         """Retrieve the release version of the installed browser."""
         output = call(binary, "--version")
@@ -722,17 +725,17 @@ class Sauce(Browser):
     requirements = "requirements_sauce.txt"
 
     def install(self, dest=None, channel=None):
         raise NotImplementedError
 
     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):
         raise NotImplementedError
 
     def version(self, binary):
         return None
 
@@ -744,16 +747,16 @@ class WebKit(Browser):
     requirements = "requirements_webkit.txt"
 
     def install(self, dest=None, channel=None):
         raise NotImplementedError
 
     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):
         raise NotImplementedError
 
     def version(self, binary):
         return None
--- a/testing/web-platform/tests/tools/wpt/install.py
+++ b/testing/web-platform/tests/tools/wpt/install.py
@@ -1,16 +1,18 @@
 import argparse
 import browser
 import sys
 
 
 latest_channels = {
     'firefox': 'nightly',
     'chrome': 'dev',
+    'safari': 'preview',
+    'safari_webdriver': 'preview',
     'servo': 'nightly'
 }
 
 channel_by_name = {
     'stable': 'stable',
     'release': 'stable',
     'beta': 'beta',
     'nightly': latest_channels,
--- a/testing/web-platform/tests/tools/wpt/run.py
+++ b/testing/web-platform/tests/tools/wpt/run.py
@@ -378,17 +378,17 @@ class Safari(BrowserSetup):
     name = "safari"
     browser_cls = browser.Safari
 
     def install(self, venv, channel=None):
         raise NotImplementedError
 
     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")
 
             kwargs["webdriver_binary"] = webdriver_binary
 
 
 class SafariWebDriver(Safari):