capybara-simulated 0.10.0 → 0.11.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 +4 -4
- data/README.md +1 -1
- data/lib/capybara/simulated/asset_cache.rb +6 -3
- data/lib/capybara/simulated/browser.rb +407 -27
- data/lib/capybara/simulated/js/bridge.bundle.js +36424 -26793
- data/lib/capybara/simulated/quickjs_runtime.rb +11 -10
- data/lib/capybara/simulated/runtime_shared.rb +7 -0
- data/lib/capybara/simulated/v8_runtime.rb +4 -1
- data/lib/capybara/simulated/version.rb +1 -1
- metadata +15 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b21cf25ccc5ea5f71a58a5f90574e5eef7c3d4aa1c98130903a8544e909ae8c3
|
|
4
|
+
data.tar.gz: df8dee2d6b76a7d1169528be7bea9e7388c5cdd53d72c5132fd1b3202bc2a301
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bb4a36189857d7415215ccf693b9a9cb14432a2dc8ed2bc48c229bdbea935ef686b05335e72fdec1c9293b552818193f9c201b8a73ed8f6f745b00094e6ae902
|
|
7
|
+
data.tar.gz: 289fb6ab851e0e300df8f558777e18822b3f5478730c35e37095504e86e479091b8c1bdb08c5e7440fb03ff08c4c4a68532538e6c74976f8053099a11b24c8d6
|
data/README.md
CHANGED
|
@@ -20,7 +20,7 @@ capybara-simulated is not a complete replacement for real-browser testing. But i
|
|
|
20
20
|
- **Deterministic** — a virtual clock and synchronous in-process execution remove the wall-clock timing, network, and rendering races that make headless-browser suites flaky.
|
|
21
21
|
- **Real front-end JS runs**: inline `<script>` + event handlers, MutationObserver, custom elements, `<template>`, Shadow DOM, ES modules importmap, **Hotwire (Stimulus + Turbo)**, Trix.
|
|
22
22
|
- **Drop-in**: the Capybara DSL is unchanged — register `:simulated` and go. Just this gem plus one JS-engine gem.
|
|
23
|
-
- **Held to spec**: a vendored [web-platform-tests](https://github.com/web-platform-tests/wpt) conformance gate
|
|
23
|
+
- **Held to spec**: a vendored [web-platform-tests](https://github.com/web-platform-tests/wpt) conformance gate — the same DOM / HTML tests Chromium and Firefox hold themselves to, their reference tests included (the driver renders both the test and its reference and compares the two images) — plus the full system suites of five real apps — Redmine / Forem / Avo / Mastodon / Discourse — run against the driver in [capybara-simulated-vs-world](https://github.com/ursm/capybara-simulated-vs-world).
|
|
24
24
|
|
|
25
25
|
**Reach for a real browser** (Selenium / Cuprite) **when** your tests need what this driver doesn't simulate **by design** — there's no rendering engine, so **pixel-accurate rendering** (glyph shaping — kerning, ligatures, bidi — the real line-breaking algorithm, multi-line `flex-wrap`) is out. `save_screenshot` does paint a real PNG, but it paints what the layout engine believes — enough to see what a test saw, not a visual-regression baseline. There *is* a coarse box-layout engine — enough that `getBoundingClientRect()`, `elementFromPoint()`, `obscured?`, the spatial selectors, scrolling, and drag-and-drop all work against real boxes — but it answers "where is this, roughly, and what's on top", not "how would this render".
|
|
26
26
|
|
|
@@ -42,7 +42,9 @@ module Capybara
|
|
|
42
42
|
# racing reader sees is a partial `stored_at`/`max_age` pair on `refresh`: freshness
|
|
43
43
|
# computed against a transient mix, never a corrupted structure.
|
|
44
44
|
class AssetCache
|
|
45
|
-
|
|
45
|
+
# `encoded`: the body's size on the wire before a Content-Encoding was undone — what a
|
|
46
|
+
# cache hit's Resource Timing entry reports as `encodedBodySize`.
|
|
47
|
+
Entry = Struct.new(:status, :headers, :body, :stored_at, :max_age, :no_cache, :immutable, :encoded, keyword_init: true) do
|
|
46
48
|
# `must-revalidate` (RFC 9111 §5.2.2.2) only forbids reusing a
|
|
47
49
|
# response *once it has become stale* without revalidation — it
|
|
48
50
|
# does NOT force revalidation while the entry is still fresh, and
|
|
@@ -111,7 +113,7 @@ module Capybara
|
|
|
111
113
|
@entries.select! {|_, e| e.immutable }
|
|
112
114
|
end
|
|
113
115
|
|
|
114
|
-
def store(url, status, headers, body)
|
|
116
|
+
def store(url, status, headers, body, encoded: nil)
|
|
115
117
|
return unless CACHEABLE_STATUSES.include?(status)
|
|
116
118
|
h = ensure_lowercase(headers)
|
|
117
119
|
return unless vary_compatible?(h['vary'])
|
|
@@ -136,7 +138,8 @@ module Capybara
|
|
|
136
138
|
stored_at: Time.now,
|
|
137
139
|
max_age: max_age,
|
|
138
140
|
no_cache: cc[:no_cache],
|
|
139
|
-
immutable: cc[:immutable] == true
|
|
141
|
+
immutable: cc[:immutable] == true,
|
|
142
|
+
encoded: encoded
|
|
140
143
|
)
|
|
141
144
|
end
|
|
142
145
|
|