capybara-simulated 0.0.4 → 0.0.6

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: edfc03fddab459b5cace9bb3bb3b05ba0ff48adc978eb2c8b401d9311f62d569
4
- data.tar.gz: 74237a169f1ce04b4fa579936f86622fab1f6fa98190d81bf98caf72974cbcb5
3
+ metadata.gz: 999617de5641feceb00fff9d815cb9afeac95fc885c2d9893681a0e8a2be3905
4
+ data.tar.gz: fb61725ff06cb94851337b4b818d2fdeef2fdf130d00617b02aaed0b13d2799d
5
5
  SHA512:
6
- metadata.gz: 80e00f33f9994046daaa5e62b6b08e1b5db4ac425bb94761f8aaa0d9be328fd9ff292f43459d1dd51a2e10a0f20e217f399ce71815d2076cbe121cda0ed29791
7
- data.tar.gz: 8d0d3309b0bfb141040005a535bef99fa97a01aaf81b7f1e6b247997f9d13b0ae821d6ce53c8ba3ea62e2c10c2aa7b140a0d369e7ebe6bf77c331a58cc5de3ae
6
+ metadata.gz: c7643ae9ebd341be18df9b7cfea6b21ef2fa4c6c83fd9904010d253ffaae4b3680a173961990522c1c39b259e5130d459ecc734145da186d6a4678c47de5458c
7
+ data.tar.gz: '09e4ea2fa27a537ddf0c7d11e2292e420dd468de4ec2607723cb9c23b39ca4a480d44a5b6d2871e66f882b445aa59875c5e56855078adcb0d53eb2adb7fb5f72'
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  A lightweight Capybara driver that runs JavaScript in a long-lived
4
4
  [mini_racer](https://github.com/rubyjs/mini_racer) V8 context against a
5
5
  [happy-dom](https://github.com/capricorn86/happy-dom) DOM. XPath queries
6
- are powered by [fontoxpath](https://github.com/FontoXML/fontoxpath).
6
+ are powered by [Wicked Good XPath](https://github.com/google/wicked-good-xpath).
7
7
 
8
8
  The goal is the middle ground between `rack-test` (zero JS) and full
9
9
  headless browsers like cuprite/selenium: in-process tests, no Chrome,
@@ -16,17 +16,18 @@ Used in production by a Rails 8 app to run ~200 `js: true` system specs
16
16
  without spawning a headless Chrome.
17
17
 
18
18
  Against Capybara 3.40's shared `Capybara::SpecHelper.spec` suite the
19
- driver passes **1337 / 1357 examples (98.5%)** with the unsupported-
20
- capability tags `about_scheme`, `css`, `download`, `frames`, `hover`,
21
- `screenshot`, `scroll`, `server`, `spatial`, `windows` filtered out.
22
- The remaining 20 failures all need capabilities the driver intentionally
23
- does not implement:
19
+ driver passes **1335 / 1357 examples** with 0 failures and 22 pending,
20
+ once the unsupported-capability tags `about_scheme`, `css`, `download`,
21
+ `frames`, `hover`, `screenshot`, `scroll`, `server`, `spatial`, `windows`
22
+ are filtered out. The 22 pending all need capabilities the driver
23
+ intentionally does not implement:
24
24
 
25
25
  - 19 `#drag_to` tests — Dragula / SortableJS / jsTree resolve drop
26
26
  targets through `elementFromPoint(clientX, clientY)`, which needs a
27
27
  real layout engine with stacking-context awareness.
28
28
  - 1 `#click should not retry clicking when wait is disabled` — depends
29
29
  on the same `elementFromPoint`-based obscured-element detection.
30
+ - 2 unrelated upstream-pending specs.
30
31
 
31
32
  `evaluate_async_script` is supported by polling the Ruby↔V8 bridge while
32
33
  draining the virtual clock until the user callback fires (or
@@ -75,6 +76,15 @@ out of the box:
75
76
  swapped `<turbo-frame>`. We patch `MutationObserver.prototype.observe`
76
77
  per Window to swap each WeakRef out for a strong-reference shim with
77
78
  the same `.deref()` shape, so listeners survive the next GC.
79
+ - happy-dom 20's `Attr` class doesn't override `Node.nodeValue`, which
80
+ the [DOM spec](https://dom.spec.whatwg.org/#dom-node-nodevalue)
81
+ defines as the attribute's `value`. The default getter inherited
82
+ from `Node` returns `null`, so any XPath engine reading attribute
83
+ string-values via `nodeValue` (wgxpath included) collapses every
84
+ attribute compare to `"null" === "null"` and predicates like
85
+ `[@id = //label/@for]` match every element with any `@id`. We install
86
+ a per-Window `Attr.prototype.nodeValue` getter / setter that mirrors
87
+ `value`.
78
88
 
79
89
  WebSocket, frames and multi-window remain explicitly out of scope — they
80
90
  need a real browser (Selenium / Cuprite) or a separate transport that
@@ -88,7 +98,7 @@ torn down between specs. This keeps `reset!` cheap.
88
98
 
89
99
  ```
90
100
  npm install
91
- npm run build # produces vendor/js/csim.bundle.js (~3.3MB)
101
+ npm run build # produces vendor/js/csim.bundle.js (~2.9MB)
92
102
  bundle install
93
103
  bundle exec rspec
94
104
  ```
@@ -202,12 +212,17 @@ puts page.text
202
212
  - `vendor/js/prelude.js` — minimal Web Platform polyfills (TextEncoder,
203
213
  atob/btoa, crypto.getRandomValues, performance, timers, process).
204
214
  - `vendor/js/csim.bundle.js` — bundled happy-dom + whatwg-url +
205
- fontoxpath. Built via `build.mjs` with esbuild, with shims for the
206
- Node built-ins happy-dom imports (`url`, `buffer`, `vm`, `path`, etc.).
215
+ Wicked Good XPath. Built via `build.mjs` with esbuild, with shims
216
+ for the Node built-ins happy-dom imports (`url`, `buffer`, `vm`,
217
+ `path`, etc.).
207
218
  - `vendor/js/runtime.js` — driver glue exposed on `globalThis.__csim`.
208
219
  Manages the active happy-dom `Window`, an integer→DOM-node handle
209
220
  table, modal capture, form serialization, click/submit dispatch, and
210
- XPath via fontoxpath with a custom DOM facade.
221
+ XPath through `document.evaluate` (installed by wgxpath). Fast-paths
222
+ Capybara's hot xpath shapes (`:option`, `:select`, `:link_or_button`)
223
+ to native `querySelectorAll` + `getElementById`.
224
+ - `vendor/esbuild-wasm/` — vendored copy of esbuild-wasm so the gem can
225
+ bundle Rails importmap modules without a runtime npm dependency.
211
226
  - `lib/capybara/simulated/browser.rb` — owns the `MiniRacer::Context`,
212
227
  drives HTTP via `Rack::MockRequest`, fetches `<script src>` inline,
213
228
  and routes form submissions back through Rack.
@@ -1,5 +1,5 @@
1
1
  module Capybara
2
2
  module Simulated
3
- VERSION = '0.0.4'
3
+ VERSION = '0.0.6'
4
4
  end
5
5
  end