capybara-lightpanda 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ad9d7f3b8897578e98e75f2b27f35ec4f2178c4ef884d9b69b79ad8d60378a42
4
- data.tar.gz: ce602d8d708904f4f2f5dced507f838445fccb6693df8350779cf544c6871fa4
3
+ metadata.gz: d1c82db6d6a5d5662098021d24688d5ff16592b1cb6de95c2c422307487d91d0
4
+ data.tar.gz: 0f21620cae5dc33e640712565a64071a47d78e906520770bef8e2aa593b230ca
5
5
  SHA512:
6
- metadata.gz: 05d437473e7f35d10af8b8d65e460f9808e395df438881fdb6eac5e0d8af3cfce36cee4fb156e17803889645411508778c927570987d85fb7512190a7af49dfe
7
- data.tar.gz: edb94ac9d172c62b61496d3a92f9c408406642c9053517f053ba8829a4c704847f9c9d1903a5b79fb0acdb743aa26f476a092e8b3050b9677d2896fae0e637e1
6
+ metadata.gz: 27f0ce27958fdbb057b68b684429222cae534d0b32f06521608862a6407a5ceb89935cbfeb4ebfee7de70d7d7d78a92a6a36d547ffdae27171bef1a731606728
7
+ data.tar.gz: 492a709cf1117444126ac9429586dc861af46e8e52d779106478e7d96d4c3aff13c1756f9c6ece4d96f41610e4f79f3b7861d02d11eaf294cbc22594c5d28001
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.7.0] - 2026-06-12
4
+
5
+ ### Changed
6
+
7
+ - The driver now lets the OS pick a free port by default instead of always binding `9222`. Parallel test suites (`parallel_tests`, `parallel_rspec`) work with zero configuration — each worker gets its own ephemeral port instead of every worker fighting over `9222` and all but one dying with a startup timeout — and a Lightpanda you started by hand on `9222` no longer collides with the one the driver spawns. If you rely on a fixed port (external tooling attaching to the browser, for instance), pin it with `Capybara::Lightpanda.configure { |c| c.port = 9222 }`.
8
+
9
+ ### Fixed
10
+
11
+ - Turbo's `turbo:load` now fires on every visit. Lightpanda advances `document.readyState` and fires `DOMContentLoaded`/`load` correctly, but never dispatched `readystatechange` — the single event Turbo's page observer waits on — so on Turbo Drive pages `turbo:load` never ran, and any Stimulus controller or initializer hanging off it stayed dormant. The driver now emits `readystatechange` itself, so Hotwire apps behave the way they do in a real browser. (Caught by a beta tester running real Turbo 8.0.23.)
12
+
3
13
  ## [0.6.0] - 2026-06-11
4
14
 
5
15
  > **Update Lightpanda before upgrading.** Requires a nightly build ≥ 6699 (published 2026-06-11). The driver refuses to start against older binaries.
data/README.md CHANGED
@@ -35,13 +35,16 @@ In your test setup:
35
35
  ```ruby
36
36
  require "capybara-lightpanda"
37
37
  Capybara.javascript_driver = :lightpanda
38
+
39
+ # Rails system tests don't read Capybara.javascript_driver — use driven_by:
40
+ driven_by :lightpanda
38
41
  ```
39
42
 
40
43
  > [!TIP]
41
44
  > The Lightpanda binary is auto-downloaded on first use — no separate install step needed.
42
45
 
43
46
  > [!IMPORTANT]
44
- > Lightpanda is a headless agentic browser, not a layout engine. By design it does **not** fetch external `<link rel="stylesheet">`, evaluate `@media` rules, or implement `window.matchMedia()`. Any spec whose visibility depends on responsive CSS — for example a mobile/desktop CTA pair hidden via `@media (min-width: …)` — should stay on Cuprite (or whichever full-browser driver you were already using). The [dual-driver setup](https://navidemad.github.io/capybara-lightpanda/#docs) routes the layout-sensitive minority to Cuprite and the structural majority to Lightpanda for speed.
47
+ > Lightpanda is a headless agentic browser, not a layout engine. External `<link rel="stylesheet">` **are** fetched and applied (the gem enables this by default), but `@media` rules and `window.matchMedia()` evaluate against a fixed 1920×1080 viewport — there is no resize emulation. Any spec whose visibility depends on a non-desktop viewport — for example a mobile-only CTA shown via `@media (max-width: …)` — should stay on Cuprite (or whichever full-browser driver you were already using). The [dual-driver setup](https://navidemad.github.io/capybara-lightpanda/#docs) routes the layout-sensitive minority to Cuprite and the structural majority to Lightpanda for speed.
45
48
 
46
49
  ## Credits
47
50
 
@@ -1,6 +1,19 @@
1
1
  (function() {
2
2
  if (window._lightpanda) return;
3
3
 
4
+ // --- readystatechange re-dispatch (upstream gap, wishlist A36) ---
5
+ // Lightpanda transitions document.readyState correctly but never fires the
6
+ // readystatechange event. Turbo's PageObserver listens ONLY for that event
7
+ // to reach pageLoaded() — without it, turbo:load never fires. Re-dispatch
8
+ // from the two lifecycle events Lightpanda does fire: DOMContentLoaded
9
+ // (readyState=interactive) and window load (readyState=complete).
10
+ // Drop this block once the upstream fix is covered by MINIMUM_NIGHTLY_BUILD.
11
+ function _fireReadyStateChange() {
12
+ document.dispatchEvent(new Event('readystatechange'));
13
+ }
14
+ document.addEventListener('DOMContentLoaded', _fireReadyStateChange);
15
+ window.addEventListener('load', _fireReadyStateChange);
16
+
4
17
  // --- Turbo activity tracking ---
5
18
  // Tracks pending Turbo operations so the driver can wait for Turbo to settle.
6
19
  // Inspired by the CapybaraLockstep approach for stabilizing Turbo integration tests.
@@ -13,7 +13,13 @@ module Capybara
13
13
  # it just delays the eventual failure.
14
14
  DEFAULT_HANDSHAKE_TIMEOUT = ENV.fetch("LIGHTPANDA_HANDSHAKE_TIMEOUT", 5).to_i
15
15
  DEFAULT_HOST = "127.0.0.1"
16
- DEFAULT_PORT = 9222
16
+ # 0 = OS-assigned ephemeral port. Lightpanda logs the address it
17
+ # actually bound and Process#wait_for_ready parses it back, so every
18
+ # driver instance — including each parallel test worker — gets its own
19
+ # free port with zero configuration. Pin a fixed port via
20
+ # `Capybara::Lightpanda.configure { |c| c.port = 9222 }` when external
21
+ # tooling needs a known address.
22
+ DEFAULT_PORT = 0
17
23
  DEFAULT_WINDOW_SIZE = [1024, 768].freeze
18
24
 
19
25
  attr_accessor :host, :port, :timeout, :handshake_timeout, :process_timeout,
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Capybara
4
4
  module Lightpanda
5
- VERSION = "0.6.0"
5
+ VERSION = "0.7.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-lightpanda
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Navid Emad