Skip to content

Add Installer::Chrome for automatic Chrome for Testing installation#5

Merged
samuel-williams-shopify merged 25 commits into
mainfrom
feature/installer
Apr 29, 2026
Merged

Add Installer::Chrome for automatic Chrome for Testing installation#5
samuel-williams-shopify merged 25 commits into
mainfrom
feature/installer

Conversation

@samuel-williams-shopify

Copy link
Copy Markdown
Contributor

Summary

Adds automatic browser installation and management for Chrome for Testing, eliminating the need to manually download Chrome or chromedriver before running tests.

New API

# Convenience shorthand — installs if needed, returns a configured bridge:
bridge = Async::WebDriver::Bridge::Chrome.for(:stable)

# Explicit install (useful in CI setup / bake tasks before the reactor starts):
installation = Async::WebDriver::Bridge::Chrome.install(:stable)
# => #<Async::WebDriver::Installer::Chrome::Installation ...>
installation.chrome_path       # => ~/.local/state/async-webdriver/mac-arm64/148.x/chrome/...
installation.chromedriver_path # => ~/.local/state/async-webdriver/mac-arm64/148.x/chromedriver/...

# Or call the installer directly:
installation = Async::WebDriver::Installer::Chrome.install(:stable)

Version specifiers

Specifier Meaning
:stable, :beta, :dev, :canary Named release channel
"148" Latest patch for major version 148
"148.0.7778.56" Exact version

Structure

lib/async/webdriver/
  installer.rb                    # top-level namespace, documents future browsers
  installer/
    chrome.rb                     # Installer::Chrome — .install, .find, DEFAULT_STATE
    chrome/
      platform.rb                 # RUBY_PLATFORM → platform string + binary paths
      releases.rb                 # Chrome for Testing JSON API queries
      installation.rb             # on-disk state, download + extract

The Installer:: namespace is designed to accommodate Installer::Firefox and others in the future without structural changes.

Bug fix

Bridge::Chrome#start was not forwarding @options (including :path) to the Driver, so setting a custom chromedriver path on the bridge had no effect on the actual process. Fixed by merging @options in start.

Installation details

  • Binaries are cached in ~/.local/state/async-webdriver/{platform}/{version}/ (XDG $XDG_STATE_HOME-compliant)
  • Downloads use async-http (already a dependency)
  • Extraction via unzip / tar (standard on macOS and Linux)
  • macOS quarantine attributes (com.apple.quarantine) are removed automatically after extraction

@samuel-williams-shopify samuel-williams-shopify force-pushed the main branch 2 times, most recently from badce47 to 2d815e0 Compare April 29, 2026 06:24
@samuel-williams-shopify samuel-williams-shopify force-pushed the feature/installer branch 2 times, most recently from fef5b97 to 0c7798d Compare April 29, 2026 06:31
…ss all bridges.

- Add Async::WebDriver::Installer::Chrome for automatic Chrome for Testing
  installation and management. Installer::Chrome.install(version) resolves
  the version via the Chrome for Testing JSON API, caches binaries under
  ~/.local/state/async-webdriver/ (XDG $XDG_STATE_HOME), and returns an
  Installation with browser_path and driver_path attributes.

  Version specifiers: :stable, :beta, :dev, :canary (channels), "148"
  (latest patch for major), or "148.0.7778.56" (exact version).

  The Installer:: namespace is structured to accommodate Installer::Firefox
  and other browsers in the future without structural changes.

- Add Bridge::Chrome.for(version) as a convenience shorthand that installs
  if needed and returns a fully configured Chrome bridge.

- Add Bridge::Chrome.install(version) for explicit pre-downloading in CI
  setup steps or bake tasks, before entering the Async reactor.

- Rename path: to driver_path: and binary: to browser_path: on Bridge::Chrome,
  and rename path: to driver_path: on Bridge::Firefox and Bridge::Safari,
  for clarity and cross-bridge consistency.

- Fix Bridge::Chrome#start, Bridge::Firefox#start, and Bridge::Safari#start
  not forwarding the bridge's own options (including :driver_path) to the
  Driver process — custom driver paths were silently ignored.
… calls.

- install(:stable) hits the API, downloads if needed, then creates/updates
  a symlink at {state}/{platform}/stable -> {version}/.
- find(:stable) resolves the symlink locally — no network request.
- Chrome.for(:stable) calls find first; only falls through to install if
  the symlink doesn't exist yet.
@samuel-williams-shopify samuel-williams-shopify merged commit 1df973d into main Apr 29, 2026
16 of 22 checks passed
@samuel-williams-shopify samuel-williams-shopify deleted the feature/installer branch April 29, 2026 07:33
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.

1 participant