Skip to content

Conversation

brendandahl
Copy link
Collaborator

@brendandahl brendandahl commented Aug 21, 2025

This changes how the browser test runner works by default. It will now automatically detect the browser type and:

  • Use the same options used in CircleCI (for chrome and firefox)
  • Create and delete a temporary profile directory
  • Terminate the browser

Adds two new options:

  • EMTEST_BROWSER_AUTO_CONFIG or --browser-auto-config: disables the automatic configuration,
  • EMTEST_HEADLESS or --headless: run the test in headless mode

Last, two flags were removed from chrome:

  • --disk-cache-dir this was causing errors (on CI and locally)
  • --incognito not allowed in corporate environments and not needed since the profile directory is automatically deleted.

These changes make it much easier to reproduce the circle ci environment locally and make running a test multiple times more reliable.

This changes how the browser test runner works by default when only
a browser executable is passed into EMTEST_BROWSER (e.g. EMTEST_BROWSER=chrome).
The test runner will now automatically:
 - Use the same options used in CircleCI (for chrome and firefox)
 - Create and delete a temporary profile directory
 - Terminate the browser
These changes make it much easier to reproduce the circle ci environment
locally and make running a test multiple times more reliable.

To make it easier to also run in "headed" mode, I added a `--headed`
option. Also, if the user specifies EMTEST_BROWSER with options the old
behavior will be used and a custom start command can be used.

Last, two flags were removed from chrome:
- `--disk-cache-dir` this was causing errors (on CI and locally)
- `--incognito` not allowed in corporate environments and not needed since
  the profile directory is automatically deleted.
@brendandahl brendandahl requested review from sbc100 and kripken August 21, 2025 18:49
@@ -2335,6 +2370,15 @@ def browser_restart(cls):
logger.info('Browser did not respond to `terminate`. Using `kill`')
cls.browser_proc.kill()
cls.browser_proc.wait()
if cls.browser_data_dir:
utils.delete_dir(cls.browser_data_dir)
cls.browser_data_dir = None
Copy link
Collaborator

Choose a reason for hiding this comment

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

It might be useful for debugging to leave this around after terminate, and instead clean it up on startup.

@sbc100 sbc100 requested a review from juj August 21, 2025 20:01
- add option to enable/disable auto browser config
- switch to --headless flag
- fix checking common.EMTEST_BROWSER since it's updated later
@brendandahl
Copy link
Collaborator Author

I still need to fix the profile dir and I also totally missed that for firefox we create a profile file with some settings. I need to add that in here...

@sbc100
Copy link
Collaborator

sbc100 commented Aug 21, 2025

I still need to fix the profile dir and I also totally missed that for firefox we create a profile file with some settings. I need to add that in here...

Maybe we can find equivalent command line flags?

-copy firefox user.js file to profile
@brendandahl
Copy link
Collaborator Author

I still need to fix the profile dir and I also totally missed that for firefox we create a profile file with some settings. I need to add that in here...

Maybe we can find equivalent command line flags?

There weren't equivalents a few years ago, and from a quick search I don't see anything has changed.

@brendandahl brendandahl requested a review from juj August 22, 2025 22:23
@brendandahl brendandahl requested review from kripken and sbc100 August 25, 2025 21:19
@brendandahl
Copy link
Collaborator Author

brendandahl commented Aug 25, 2025

To summarize changes:

  • default to windowed mode (add --headless to do the opposite)
  • setup firefox profile js
  • added flag to skip auto profile setup
  • put profile dir in out/ dir

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.

4 participants