Skip to content

Commit

Permalink
Trying to get product name, at least
Browse files Browse the repository at this point in the history
  • Loading branch information
spectranaut committed May 1, 2024
1 parent df5ff2b commit 9c37e34
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
5 changes: 4 additions & 1 deletion tools/wpt/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,10 @@ def download(self, dest=None, channel=None, rename=None, version=None, revision=
return installer_path

def find_binary(self, venv_path=None, channel=None):
return self._find_binary_in_directory(self._get_browser_binary_dir(venv_path, channel))
# Todo: why does chromium fail to run on my computer? why are we trying to find it in
# /home/spectranaut/repos/wpt/_venv3/browsers/nightly ?????
return which('chromium')
#return self._find_binary_in_directory(self._get_browser_binary_dir(venv_path, channel))

def install(self, dest=None, channel=None, version=None, revision=None):
dest = self._get_browser_binary_dir(dest, channel)
Expand Down
7 changes: 5 additions & 2 deletions tools/wptrunner/wptrunner/executors/executorwebdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,11 @@ def get_computed_role(self, element):
# TODO: this is not actually a webdriver protocol, so, where to put it.. exactly?
class WebDriverPlatformAccessibilityProtocolPart(PlatformAccessibilityProtocolPart):
def setup(self):
self.webdriver = self.parent.webdriver
self.webdriver = self.parent.webdriver # self.parent is WebDriverProtocol
self.platform = self.webdriver.capabilities['platformName'] # 'linux'
self.browser_name = self.webdriver.capabilities['browserName'] # 'chrome' for both chrome and chromium, unfortunately;

def get_accessibility_api_node(self, id):
# Is this where the magic should happen?
return "Test"


Expand Down Expand Up @@ -477,6 +478,8 @@ class WebDriverProtocol(Protocol):
WebDriverDevicePostureProtocolPart]

def __init__(self, executor, browser, capabilities, **kwargs):
# Now we have browser.product_name! Does that help?

super().__init__(executor, browser)
self.capabilities = capabilities
if hasattr(browser, "capabilities"):
Expand Down
11 changes: 8 additions & 3 deletions tools/wptrunner/wptrunner/testrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def __init__(self, suite_name, index, test_queue,
test_implementations, stop_flag, retry_index=0, rerun=1,
pause_after_test=False, pause_on_unexpected=False,
restart_on_unexpected=True, debug_info=None,
capture_stdio=True, restart_on_new_group=True, recording=None, max_restarts=5):
capture_stdio=True, restart_on_new_group=True, recording=None, max_restarts=5, product_name=None):
"""Thread that owns a single TestRunner process and any processes required
by the TestRunner (e.g. the Firefox binary).
Expand All @@ -332,6 +332,7 @@ def __init__(self, suite_name, index, test_queue,
self.suite_name = suite_name
self.manager_number = index
self.test_implementation_key = None
self.product_name = product_name

self.test_implementations = {}
for key, test_implementation in test_implementations.items():
Expand Down Expand Up @@ -594,6 +595,7 @@ def start_test_runner(self):
self.executor_kwargs["group_metadata"] = self.state.group_metadata
self.executor_kwargs["browser_settings"] = self.browser.browser_settings
executor_browser_cls, executor_browser_kwargs = self.browser.browser.executor_browser()
executor_browser_kwargs["product_name"] = self.product_name

args = (self.remote_queue,
self.command_queue,
Expand Down Expand Up @@ -984,8 +986,10 @@ def __init__(self, suite_name, test_queue_builder, test_implementations,
capture_stdio=True,
restart_on_new_group=True,
recording=None,
max_restarts=5):
max_restarts=5,
product_name=None):
self.suite_name = suite_name
self.product_name = product_name
self.test_queue_builder = test_queue_builder
self.test_implementations = test_implementations
self.pause_after_test = pause_after_test
Expand Down Expand Up @@ -1031,7 +1035,8 @@ def run(self, tests):
self.capture_stdio,
self.restart_on_new_group,
recording=self.recording,
max_restarts=self.max_restarts)
max_restarts=self.max_restarts,
product_name=self.product_name)
manager.start()
self.pool.add(manager)
self.wait()
Expand Down
1 change: 1 addition & 0 deletions tools/wptrunner/wptrunner/wptrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ def run_test_iteration(test_status, test_loader, test_queue_builder,
kwargs["restart_on_new_group"],
recording=recording,
max_restarts=kwargs["max_restarts"],
product_name=product.name
) as manager_group:
try:
handle_interrupt_signals()
Expand Down

0 comments on commit 9c37e34

Please sign in to comment.