Closed Bug 2050357 Opened 1 month ago Closed 1 month ago

[wdspec] Use a dedicated geckodriver instance for Mozilla-specific tests

Categories

(Remote Protocol :: Agent, task, P3)

task
Points:
3

Tracking

(firefox154 fixed)

RESOLVED FIXED
154 Branch
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 geckodriver fixture 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 0 and --websocket-port 0 to 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, custom profile, and custom config parameters for tests requiring special setup, restarting geckodriver only when necessary.
  • Recreate the BiDi WebSocket transport between tests to accommodate pytest-asyncio event loop changes.

Session fixture overrides:

  • Override the bidi_session, session, and current_session fixtures to use the dedicated geckodriver fixture.
  • Introduce a @pytest.mark.geckodriver(allow_system_access=True) marker to control the --allow-system-access option.
  • 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_access marker and default_capabilities overrides.
  • Update tests requiring system access to use @pytest.mark.geckodriver(allow_system_access=True).
  • Switch BiDi WebExtension tests to the upstream install_webextension fixture.
  • Update classic add-on installation tests to use the new session fixture together with the geckodriver marker.
Assignee: nobody → hskupin
Status: NEW → ASSIGNED
Points: --- → 3
Priority: -- → P3
Whiteboard: [webdriver:m20]

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.

Attachment #9601400 - Attachment is obsolete: true

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.

Whiteboard: [webdriver:m20] → [webdriver:m21]
Blocks: 2051526
Attachment #9601255 - Attachment description: Bug 2050357 - [wdspec] Make geckodriver fixture session-scoped to avoid unnecessary restarts. → Bug 2050357 - [wdspec] Make geckodriver fixture module-scoped to avoid unnecessary restarts.
Pushed by hskupin@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/f0c596bff6ba https://hg.mozilla.org/integration/autoland/rev/183f6349e340 [wdspec] Make geckodriver fixture module-scoped to avoid unnecessary restarts. r=jdescottes https://github.com/mozilla-firefox/firefox/commit/8421ed468d6e https://hg.mozilla.org/integration/autoland/rev/df71cbc3a7c2 [wdspec] Update Mozilla-specific tests for the new geckodriver fixture handling. r=jdescottes
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 154 Branch
Regressions: 2052557
Regressions: 2052383
Regressions: 2053338
No longer regressions: 2056676
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: