Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preload Selenium driver_path before parallelizing system tests #49908

Merged

Commits on Nov 7, 2023

  1. Preload Selenium driver_path before parallelizing system tests

    When the webdrivers gem is not present (which is the default scenario in
    Rails 7.1+), the Selenium `driver_path` starts out as `nil`. This means
    the driver is located lazily, and deferred until a system test is run.
    
    If parallel testing is used, this leads to a race condition, where each
    worker process tries to resolve the driver simultaneously. The result is
    an error as described in rails#49906.
    
    This commit fixes the race condition by changing the implementation of
    `Browser#preload`. The previous implementation worked when `driver_path`
    was set to a Proc by the `webdrivers` gem, but doesn't work when the
    `webdrivers` gem is not being used and the `driver_path` is `nil`.
    
    `Browser#preload` now uses the `DriverFinder` utility provided by the
    `selenium-webdriver` gem to eagerly resolve the driver path if needed.
    This will ensures that `driver_path` is set before parallel test workers
    are forked.
    
    Fixes rails#49906.
    
    Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>
    mattbrictson and jonathanhefner committed Nov 7, 2023
    Configuration menu
    Copy the full SHA
    e7d743b View commit details
    Browse the repository at this point in the history