Skip to content

Conversation

juj
Copy link
Collaborator

@juj juj commented Oct 5, 2025

Add support for running the browser harness with EMTEST_BROWSER=/Applications/Safari.App/Contents/MacOS/Safari on a macOS system.

This fixes both the singlethreaded and multithreaded harness runs.

@juj juj changed the title Enable support for running the multithreaded test harness in Safari. Enable support for running the test harness in Safari. Oct 5, 2025
test/common.py Outdated
# by the delta before->after.
cls.browser_procs = list(set(procs_after).difference(set(procs_before)))
if len(cls.browser_procs) == 0:
logger.warning('Could not detect the launched browser subprocesses. The test harness may not be able to close browser windows if a test hangs, and at harness exit.')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be an error instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can make it an error, but it is only so when running with EMTEST_BROWSER_AUTO_CONFIG enabled. (I think btw disabling EMTEST_BROWSER_AUTO_CONFIG might currently be broken and atm not possible)

If user adds a custom browser string, and EMTEST_BROWSER_AUTO_CONFIG is not enabled, then the browser might run in a tab on an existing browser, in which case this detection will not work.

test/common.py Outdated
# --fresh: do not restore old tabs (e.g. if user had old navigated windows open)
# --background: Open the new Safari window behind the current Terminal window, to make following the test run more pleasing (this is for convenience only)
# -a <exe_name>: The path to the executable to open, in this case Safari
browser_args = ['open', '--new', '--fresh', '--background', '-a'] + browser_args
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't these args go in SafariConfig?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe these should be used also for Chrome and FF on macOS? i.e. is open the way we should be launching all browsers on macOS?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'll need a new construct in the configs, there is no current way to model a prefix of args in the existing set of config fields. I can do that in a moment.

Using open is not needed for Firefox at least. Not sure about Chrome, but I presume not.

test/common.py Outdated
else:
exit_with_error(f'EMTEST_BROWSER_AUTO_CONFIG only currently works with firefox or chrome. EMTEST_BROWSER was "{EMTEST_BROWSER}"')
if not config:
exit_with_error(f'EMTEST_BROWSER_AUTO_CONFIG only currently works with firefox, chrome and safari. EMTEST_BROWSER was "{EMTEST_BROWSER}"')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error seems like its unreachable since its inside the if EMTEST_BROWSER_AUTO_CONFIG and config block?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, good catch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants