[wdspec] Use a dedicated geckodriver instance for Mozilla-specific tests
Categories
(Remote Protocol :: Agent, task, P3)
Tracking
(firefox154 fixed)
| Tracking | Status | |
|---|---|---|
| firefox154 | --- | fixed |
People
(Reporter: whimboo, Assigned: whimboo)
References
(Blocks 1 open bug, Regressed 1 open bug)
Details
(Whiteboard: [webdriver:m21])
Attachments
(2 files, 1 obsolete file)
Mozilla-specific wdspec tests currently share the harness-managed geckodriver/Firefox session. With the introduction of --allow-system-access gating in geckodriver (bug 2037819), tests requiring system access can no longer rely on the shared harness session.
The proposed changes introduce a dedicated geckodriver fixture for Mozilla-specific tests with the following improvements:
Geckodriver fixture (support/fixtures.py):
- Introduce a session-scoped
geckodriverfixture that manages its own process and reuses it across tests when the configuration is unchanged, significantly reducing Firefox restarts and improving test performance. - Use
--marionette-port 0and--websocket-port 0to avoid port conflicts with the harness-managed Firefox instance. - Create a cloned profile so the fixture runs independently of the harness session.
- Support
force_new, customprofile, and customconfigparameters for tests requiring special setup, restarting geckodriver only when necessary. - Recreate the BiDi WebSocket transport between tests to accommodate
pytest-asyncioevent loop changes.
Session fixture overrides:
- Override the
bidi_session,session, andcurrent_sessionfixtures to use the dedicatedgeckodriverfixture. - Introduce a
@pytest.mark.geckodriver(allow_system_access=True)marker to control the--allow-system-accessoption. - Introduce a
@pytest.mark.capabilities({...})marker for per-test capability overrides (for example,unhandledPromptBehavior). - Capability changes trigger only a WebDriver session restart, without restarting the geckodriver process.
Test updates:
- Remove the
@pytest.mark.allow_system_accessmarker anddefault_capabilitiesoverrides. - Update tests requiring system access to use
@pytest.mark.geckodriver(allow_system_access=True). - Switch BiDi WebExtension tests to the upstream
install_webextensionfixture. - Update classic add-on installation tests to use the new session fixture together with the
geckodrivermarker.
| Assignee | ||
Updated•1 month ago
|
| Assignee | ||
Updated•1 month ago
|
| Assignee | ||
Comment 1•1 month ago
|
||
The geckodriver process is reused across tests when command line arguments,
environment variables, and profile match. A custom profile and marionette
port are used to avoid conflicts with the harness Firefox instance. BiDi
WebSocket connections are cleaned up between tests.
Comment 2•1 month ago
|
||
Updated•1 month ago
|
| Assignee | ||
Comment 3•1 month ago
|
||
The bidi_session, session, and current_session fixtures are overridden
to use the dedicated geckodriver instance. This allows all upstream
fixtures (top_context, new_tab, install_webextension, use_pref, etc.)
to work transparently with the custom geckodriver session.
A @pytest.mark.geckodriver(allow_system_access=True) marker controls
system access, and @pytest.mark.capabilities({...}) allows per-test
capability overrides. Capability changes trigger a session restart
without restarting the geckodriver process.
All tests using @pytest.mark.allow_system_access or manual geckodriver
setup for system access are updated to use the new markers and fixtures.
Updated•1 month ago
|
Updated•1 month ago
|
Comment 5•1 month ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/183f6349e340
https://hg.mozilla.org/mozilla-central/rev/df71cbc3a7c2
Description
•