Skip to content

Commit

Permalink
Support ./wpt run --channel=preview safari (#13460)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
foolip authored and jgraham committed Oct 11, 2018
1 parent 3bf07bd commit 9f2daa2
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
4 changes: 2 additions & 2 deletions docs/_running-tests/safari.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
```
29 changes: 16 additions & 13 deletions tools/wpt/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -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
Expand Down Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -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):
Expand Down
2 changes: 2 additions & 0 deletions tools/wpt/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
latest_channels = {
'firefox': 'nightly',
'chrome': 'dev',
'safari': 'preview',
'safari_webdriver': 'preview',
'servo': 'nightly'
}

Expand Down
2 changes: 1 addition & 1 deletion tools/wpt/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 9f2daa2

Please sign in to comment.