You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are several issues related to setting window size/position when running Firefox under Wayland display server (Linux). This PR sets the MOZ_ENABLE_WAYLAND=0 environment variable in our PyTest configuration, so Firefox uses XWayland instead.
(This should fix several CI failures)
🔄 Types of changes
Bug fix (backwards compatible)
PR Type
Bug fix
Description
Set MOZ_ENABLE_WAYLAND=0 for Firefox in tests to use XWayland.
Fixes issues with window size/position under Wayland on Linux.
Resolves CI failures related to Firefox on Wayland.
Changes walkthrough 📝
Relevant files
Bug fix
conftest.py
Configure Firefox to use XWayland in tests
py/conftest.py
Added environment variable MOZ_ENABLE_WAYLAND=0 for Firefox.
Ensures Firefox uses XWayland instead of Wayland.
Fixes issues with window size/position under Wayland.
✅ Ensure environment variable timingSuggestion Impact:The commit partially addressed the suggestion's concern about environment variable timing by moving the MOZ_ENABLE_WAYLAND setting to the Remote driver section, ensuring it's set before Firefox is launched in that context. However, it didn't implement the conditional check to avoid overriding existing values.
code diff:
- os.environ['MOZ_ENABLE_WAYLAND'] = '0'+ os.environ["MOZ_ENABLE_WAYLAND"] = "0"
if driver_class == "Chrome":
options = get_options(driver_class, request.config)
if driver_class == "Edge":
options = get_options(driver_class, request.config)
if driver_class == "WebKitGTK":
options = get_options(driver_class, request.config)
- if driver_class.lower() == "WPEWebKit":+ if driver_class == "WPEWebKit":
options = get_options(driver_class, request.config)
if driver_class == "Remote":
options = get_options("Firefox", request.config) or webdriver.FirefoxOptions()
options.set_capability("moz:firefoxOptions", {})
options.enable_downloads = True
+ # There are issues with window size/position when running Firefox+ # under Wayland, so we use XWayland instead.+ os.environ["MOZ_ENABLE_WAYLAND"] = "0"
Setting environment variables after the process has started may not affect Firefox's behavior. Environment variables should be set before Firefox is launched. Consider checking if this environment variable is being set early enough to affect Firefox's startup behavior.
# There are issues with window size/position when running Firefox
# under Wayland, so we use XWayland instead.
-os.environ['MOZ_ENABLE_WAYLAND'] = '0'+# Set this before Firefox is launched to ensure it takes effect+if 'MOZ_ENABLE_WAYLAND' not in os.environ:+ os.environ['MOZ_ENABLE_WAYLAND'] = '0'
[Suggestion has been applied]
Suggestion importance[1-10]: 7
__
Why: The suggestion correctly identifies a potential issue with environment variable timing. Setting environment variables after process initialization may not affect Firefox's behavior, and the improved code adds a check to avoid overriding existing values, which is a good practice for environment configuration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
🔗 Related Issues
Fixes #15584
💥 What does this PR do?
There are several issues related to setting window size/position when running Firefox under Wayland display server (Linux). This PR sets the
MOZ_ENABLE_WAYLAND=0environment variable in our PyTest configuration, so Firefox uses XWayland instead.(This should fix several CI failures)
🔄 Types of changes
PR Type
Bug fix
Description
Set
MOZ_ENABLE_WAYLAND=0for Firefox in tests to use XWayland.Fixes issues with window size/position under Wayland on Linux.
Resolves CI failures related to Firefox on Wayland.
Changes walkthrough 📝
conftest.py
Configure Firefox to use XWayland in testspy/conftest.py
MOZ_ENABLE_WAYLAND=0for Firefox.