Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

chore: increase benchmark space

Bosched4fdc8ab751
diff --git a/tests/benchmark/AGENT_TASKS.md b/tests/benchmark/AGENT_TASKS.md
index bd0ae8c4..31d00032 100644
--- a/tests/benchmark/AGENT_TASKS.md
+++ b/tests/benchmark/AGENT_TASKS.md
@@ -406,10 +406,10 @@ Navigate to `http://fixtures/iframe.html` and extract content from inside the em
**Verify**: The iframe's inner content includes `IFRAME_INNER_CONTENT_LOADED`.
-### 19.2 Type into iframe input
-Inside the same-origin iframe, fill the input with the text "Hello World" and click the Save button. If using selectors, set frame scope first.
+### 19.2 Type into iframe input (native frame scope)
+Use `pinchtab frame '#content-frame'` to scope into the iframe, then `fill` the input with "Hello World" and `click` the Save button. Verify via a scoped `snap` — `text --full` doesn't pierce iframes. Reset with `pinchtab frame main` afterwards.
-**Verify**: The iframe shows `IFRAME_INPUT_RECEIVED_HELLO_WORLD`.
+**Verify**: Scoped snapshot contains `IFRAME_INPUT_RECEIVED_HELLO_WORLD`.
---
@@ -455,6 +455,205 @@ Without reloading the page, drag the piece next into **Zone B**, and then into *
---
+## Group 23: Async / Loading state
+
+### 23.1 Wait for async content
+Navigate to `http://fixtures/loading.html`. The page shows a spinner and the text "Loading..." for ~1.5 seconds, then replaces it with the final payload. Wait for the final content to appear before reporting completion.
+
+**Verify**: The final snapshot contains `VERIFY_LOADING_COMPLETE_88888`.
+
+---
+
+## Group 24: Keyboard events
+
+### 24.1 Press Escape
+Navigate to `http://fixtures/keyboard.html` (it auto-focuses an input so keyboard events land). Press the Escape key.
+
+**Verify**: Page text contains `KEYBOARD_ESCAPE_PRESSED`.
+
+### 24.2 Press 'a' then Enter
+Without reloading, press the `a` key, then the `Enter` key.
+
+**Verify**: Page text now contains all three markers in order: `KEYBOARD_ESCAPE_PRESSED`, `KEYBOARD_KEY_A_PRESSED`, `KEYBOARD_ENTER_PRESSED`.
+
+---
+
+## Group 25: Tab panels
+
+### 25.1 Switch to the Settings tab
+Navigate to `http://fixtures/tabs.html`. The Profile tab is shown by default. Click the Settings tab.
+
+**Verify**: After the click, the page content includes `TAB_SETTINGS_CONTENT` (and the Profile content is no longer visible).
+
+### 25.2 Switch to the Billing tab
+Click the Billing tab.
+
+**Verify**: Page content now includes `TAB_BILLING_CONTENT`.
+
+---
+
+## Group 26: Accordion
+
+### 26.1 Open section A
+Navigate to `http://fixtures/accordion.html`. Click the header for Section A to expand it.
+
+**Verify**: Page text includes `ACCORDION_SECTION_A_OPEN`.
+
+### 26.2 Open section B
+Click the header for Section B. Because the accordion is exclusive-expand, Section A should close.
+
+**Verify**: Page text includes `ACCORDION_SECTION_B_OPEN`, and Section A's `aria-expanded` attribute is now `"false"` (use `eval` to check the attribute if needed).
+
+---
+
+## Group 27: Contenteditable editor
+
+### 27.1 Type into the rich-text editor
+Navigate to `http://fixtures/editor.html`. Type the text `Hello rich text` into the `#editor` div. `contenteditable` elements don't have `.value`, so use `type` (keyboard events), not `fill`.
+
+**Verify**: Page text contains `EDITOR_CHARS=15` and the mirror shows `Hello rich text`.
+
+### 27.2 Commit by pressing Enter
+Press Enter (the editor intercepts Enter to commit the current buffer to a separate marker).
+
+**Verify**: Page text contains `EDITOR_COMMITTED=Hello rich text`.
+
+---
+
+## Group 28: Range slider
+
+### 28.1 Move slider into HIGH bucket
+Navigate to `http://fixtures/range.html`. Set the `#volume` range slider to 90.
+
+**Verify**: Page text contains both `RANGE_VALUE_90` and `BUCKET_HIGH`.
+
+### 28.2 Move slider into LOW bucket
+Without reloading, change the slider to 10.
+
+**Verify**: Page text now contains `RANGE_VALUE_10` and `BUCKET_LOW`.
+
+---
+
+## Group 29: Pagination
+
+### 29.1 Advance to page 2
+Navigate to `http://fixtures/pagination.html`. Click the Next button.
+
+**Verify**: Page text contains `PAGE_2_FIRST_ITEM` and `PAGE_2_OF_3`.
+
+### 29.2 Reach the last page; Next disabled
+Click Next once more.
+
+**Verify**: Page text contains `PAGE_3_FIRST_ITEM` and `PAGE_3_OF_3`, and the Next button's `disabled` property is `true` (use `eval` to check).
+
+---
+
+## Group 30: Custom dropdown menu
+
+### 30.1 Pick the "Beta" item
+Navigate to `http://fixtures/dropdown.html`. The page has a custom dropdown — click the toggle button (`#dropdown-toggle`) to open the menu, then click the "Beta" item.
+
+**Verify**: Page text contains `DROPDOWN_SELECTED=BETA`.
+
+### 30.2 Reopen and pick "Gamma"
+Reopen the dropdown and select "Gamma". (Each selection auto-closes the menu, so you need to click the toggle again before selecting.)
+
+**Verify**: Page text contains `DROPDOWN_SELECTED=GAMMA`.
+
+---
+
+## Group 31: Nested iframes (3 levels deep)
+
+### 31.1 Click a button in the deepest frame
+Navigate to `http://fixtures/iframe-nested.html`. The outer page embeds `#level-2`, which in turn embeds `#level-3`, which contains `#deep-button`. Drill through the two frame hops and click the button. Verify via a scoped `snap` before resetting to `main`.
+
+**Verify**: Scoped snapshot contains `DEEP_CLICKED=YES_LEVEL_3`.
+
+---
+
+## Group 32: Dynamic iframe (inserted after load)
+
+### 32.1 Wait for a late iframe, then interact with it
+Navigate to `http://fixtures/iframe-dynamic.html`. The iframe is inserted ~1.2 s after load (use `wait --text "IFRAME_DYNAMIC_ATTACHED"`). Then scope into `#late-frame`, fill `#iframe-input` with "Late World", click `#iframe-submit`, and verify the inner result marker.
+
+**Verify**: Scoped snapshot contains `IFRAME_INPUT_RECEIVED_LATE_WORLD`.
+
+---
+
+## Group 33: srcdoc iframe
+
+### 33.1 Interact with an inline-content iframe
+Navigate to `http://fixtures/iframe-srcdoc.html`. The iframe's content is inlined via `srcdoc`; it has no `src` URL. Scope into `#srcdoc-frame`, fill `#inline-input` with `srcdoc`, click `#inline-submit`, and verify.
+
+**Verify**: Scoped snapshot contains `INLINE_RECEIVED_SRCDOC`.
+
+---
+
+## Group 34: Sandboxed iframe
+
+### 34.1 Click inside a sandboxed iframe
+Navigate to `http://fixtures/iframe-sandbox.html`. The iframe has `sandbox="allow-scripts allow-same-origin"`. Scope into `#sandboxed`, click `#sandbox-button`, and verify.
+
+**Verify**: Scoped snapshot contains `SANDBOX_CLICKED=YES`.
+
+---
+
+## Group 35: Long-form article (Medium/Substack style)
+
+### 35.1 Read the article with default `text`
+Navigate to `http://fixtures/article.html`. Extract the page's main content using the default `text` (Readability) mode. Default mode is the right choice for article-style pages.
+
+**Verify**: The extracted text contains both `ARTICLE_PUBLISHED_2026_04_15` and `ARTICLE_WORD_COUNT_MARKER_323` (both inside the article body — Readability keeps them).
+
+### 35.2 See the chrome that Readability drops
+Re-extract with `text --full` and confirm the footer is included this time.
+
+**Verify**: `--full` output contains `FOOTER_COPYRIGHT_MARKER` (which the default mode trims).
+
+---
+
+## Group 36: Search results page (SERP)
+
+### 36.1 Find a specific result by id
+Navigate to `http://fixtures/serp.html`. The page has 6 result cards (`#r-1`..`#r-6`). Extract just the third card's content. A scoped snapshot (`snap --selector "#r-3"`) is the direct path.
+
+**Verify**: The scoped output contains `RESULT_3_TITLE` and `RESULT_3_SNIPPET_MARKER`.
+
+### 36.2 Count all result cards
+Use a full text extraction to verify all six results are present in one pass.
+
+**Verify**: Output contains all of `RESULT_1_TITLE` through `RESULT_6_TITLE` and the summary `SERP_RESULT_COUNT_6`. Default Readability trims SERPs — use `text --full`.
+
+---
+
+## Group 37: Q&A thread (Stack-Overflow style)
+
+### 37.1 Find the accepted answer id
+Navigate to `http://fixtures/qa.html`. The accepted answer carries `data-accepted="true"` on its `<div>` wrapper. Use `eval` to return that element's `id`.
+
+**Verify**: The `eval` result equals `"a-2"`.
+
+### 37.2 Extract the accepted answer's body
+Scope a snapshot to `#a-2` and verify the body content.
+
+**Verify**: Scoped snapshot contains `ANSWER_2_BODY_MARKER` and `ACCEPTED_ANSWER_ID_A2`.
+
+---
+
+## Group 38: Pricing table
+
+### 38.1 Read just the Pro plan
+Navigate to `http://fixtures/pricing.html`. The page has three plan cards (`#plan-free`, `#plan-pro`, `#plan-enterprise`). Read only the Pro plan using a scoped snapshot.
+
+**Verify**: Scoped snapshot contains `PLAN_PRO_PRICE_29` and `PLAN_PRO_LIMIT_5000_requests per day`.
+
+### 38.2 Compare all three plans
+Extract the full page (pricing grids are a Readability anti-pattern — reach for `--full`).
+
+**Verify**: Output contains `PLAN_FREE_PRICE_0`, `PLAN_PRO_PRICE_29`, and `PLAN_ENTERPRISE_PRICE_CUSTOM`.
+
+---
+
## Summary
| Group | Tasks | Description |
@@ -482,8 +681,24 @@ Without reloading the page, drag the piece next into **Zone B**, and then into *
| 20 | 2 | Dialogs |
| 21 | 2 | Async / awaitPromise |
| 22 | 2 | Mouse Drag & Drop |
-
-**Total: 58 tasks**
+| 23 | 1 | Async / Loading state |
+| 24 | 2 | Keyboard events |
+| 25 | 2 | Tab panels |
+| 26 | 2 | Accordion |
+| 27 | 2 | Contenteditable editor |
+| 28 | 2 | Range slider |
+| 29 | 2 | Pagination |
+| 30 | 2 | Custom dropdown menu |
+| 31 | 1 | Nested iframes (3 levels) |
+| 32 | 1 | Dynamic iframe |
+| 33 | 1 | srcdoc iframe |
+| 34 | 1 | Sandboxed iframe |
+| 35 | 2 | Long-form article |
+| 36 | 2 | Search results page |
+| 37 | 2 | Q&A thread |
+| 38 | 2 | Pricing table |
+
+**Total: 85 tasks**
## Key Differences from Baseline
diff --git a/tests/benchmark/BASELINE_TASKS.md b/tests/benchmark/BASELINE_TASKS.md
index 3f94b12d..fc22ceba 100644
--- a/tests/benchmark/BASELINE_TASKS.md
+++ b/tests/benchmark/BASELINE_TASKS.md
@@ -998,16 +998,38 @@ curl "http://localhost:9867/tabs/TAB_ID/snapshot?format=compact&maxTokens=2000"
```
**Pass if**: Snapshot contains `IFRAME_INNER_CONTENT_LOADED`.
-### 19.2 Type into iframe input
+### 19.2 Type into iframe input (native frame scope)
```bash
-curl -X POST http://localhost:9867/tabs/TAB_ID/evaluate \
+# Scope into the same-origin iframe
+curl -X POST http://localhost:9867/frame?tabId=TAB_ID \
-H "Authorization: Bearer benchmark-token" \
-H "Content-Type: application/json" \
- -d '{"expression":"const f=document.getElementById(\"content-frame\").contentDocument; f.getElementById(\"iframe-input\").value=\"Hello World\"; f.getElementById(\"iframe-submit\").click(); f.getElementById(\"iframe-result\").textContent;"}'
+ -d '{"target":"#content-frame"}'
+
+# Selectors now resolve inside the iframe
+curl -X POST http://localhost:9867/tabs/TAB_ID/action \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"kind":"fill","selector":"#iframe-input","text":"Hello World"}'
+
+curl -X POST http://localhost:9867/tabs/TAB_ID/action \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"kind":"click","selector":"#iframe-submit"}'
+
+# Verify via a scoped snap (text --full doesn't pierce frames)
+curl "http://localhost:9867/tabs/TAB_ID/snapshot?format=compact&maxTokens=500" \
+ -H "Authorization: Bearer benchmark-token"
+
+# Reset scope
+curl -X POST http://localhost:9867/frame?tabId=TAB_ID \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"target":"main"}'
```
-**Pass if**: Response value contains `IFRAME_INPUT_RECEIVED_HELLO_WORLD`.
+**Pass if**: The scoped snapshot contains `IFRAME_INPUT_RECEIVED_HELLO_WORLD`.
-**Note**: PinchTab's `/action` selectors don't reach inside iframes. Use `/evaluate` with `contentDocument` to interact with iframe content.
+**Note**: `POST /frame` sets a stateful scope on the tab. Subsequent selector-based `/action` and `/snapshot` calls resolve inside the scoped iframe. Reset with `{"target":"main"}` when done. Cross-origin iframes are not currently exposed this way — fall back to `/evaluate` + `contentDocument` for those (when same-origin policy permits).
---
@@ -1153,6 +1175,577 @@ curl "http://localhost:9867/tabs/TAB_ID/text" \
---
+## Group 23: Async / Loading state
+
+### 23.1 Wait for async content to replace a loading spinner
+```bash
+curl -X POST http://localhost:9867/navigate \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"tabId":"TAB_ID","url":"http://fixtures/loading.html"}'
+
+# Poll the snapshot until the final marker appears, or call /wait with a text
+# predicate. Using /evaluate with awaitPromise is another valid path.
+for i in 1 2 3 4 5 6 7 8 9 10; do
+ SNAP=$(curl -sf "http://localhost:9867/tabs/TAB_ID/snapshot?format=compact&maxTokens=1000" \
+ -H "Authorization: Bearer benchmark-token")
+ echo "$SNAP" | grep -q "VERIFY_LOADING_COMPLETE_88888" && break
+ sleep 0.3
+done
+
+curl "http://localhost:9867/tabs/TAB_ID/snapshot?format=compact&maxTokens=1000" \
+ -H "Authorization: Bearer benchmark-token"
+```
+**Pass if**: Final snapshot contains `VERIFY_LOADING_COMPLETE_88888`.
+
+**Note**: The fixture delays replacing the spinner by ~1.5 s. Agents using
+`pinchtab wait --text "VERIFY_LOADING_COMPLETE_88888" --timeout 5000` hit
+this in a single call. Baseline callers can poll or `sleep` between
+snapshots.
+
+---
+
+## Group 24: Keyboard events
+
+### 24.1 Press Escape to emit a marker
+```bash
+curl -X POST http://localhost:9867/navigate \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"tabId":"TAB_ID","url":"http://fixtures/keyboard.html"}'
+
+curl -X POST http://localhost:9867/tabs/TAB_ID/action \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"kind":"press","key":"Escape"}'
+
+curl "http://localhost:9867/tabs/TAB_ID/text?mode=raw&format=text" \
+ -H "Authorization: Bearer benchmark-token"
+```
+**Pass if**: Page text contains `KEYBOARD_ESCAPE_PRESSED`. Use `mode=raw` because the log div is short enough for Readability to drop it.
+
+### 24.2 Sequential keys (a then Enter)
+```bash
+curl -X POST http://localhost:9867/tabs/TAB_ID/action \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"kind":"press","key":"a"}'
+
+curl -X POST http://localhost:9867/tabs/TAB_ID/action \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"kind":"press","key":"Enter"}'
+
+curl "http://localhost:9867/tabs/TAB_ID/text" \
+ -H "Authorization: Bearer benchmark-token"
+```
+**Pass if**: Page text contains both `KEYBOARD_KEY_A_PRESSED` and `KEYBOARD_ENTER_PRESSED` (and the Escape marker from 24.1 is still there, proving the log accumulates).
+
+**Note**: `press` issues a single keypress and requires the page to already have focus on an element that listens for `keydown`. The fixture auto-focuses `#focus-input` on load.
+
+---
+
+## Group 25: Tab panels
+
+### 25.1 Switch to Settings tab
+```bash
+curl -X POST http://localhost:9867/navigate \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"tabId":"TAB_ID","url":"http://fixtures/tabs.html"}'
+
+# Verify initial panel
+curl "http://localhost:9867/tabs/TAB_ID/text?mode=raw&format=text" \
+ -H "Authorization: Bearer benchmark-token"
+
+curl -X POST http://localhost:9867/tabs/TAB_ID/action \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"kind":"click","selector":"#tab-settings"}'
+
+curl "http://localhost:9867/tabs/TAB_ID/text?mode=raw&format=text" \
+ -H "Authorization: Bearer benchmark-token"
+```
+**Pass if**: Initial response contains `TAB_PROFILE_CONTENT` AND final response contains `TAB_SETTINGS_CONTENT` (and the profile content is now hidden).
+
+### 25.2 Switch to Billing tab
+```bash
+curl -X POST http://localhost:9867/tabs/TAB_ID/action \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"kind":"click","selector":"#tab-billing"}'
+
+curl "http://localhost:9867/tabs/TAB_ID/text?mode=raw&format=text" \
+ -H "Authorization: Bearer benchmark-token"
+```
+**Pass if**: Response contains `TAB_BILLING_CONTENT`.
+
+**Note**: Tab panels toggle via the `hidden` attribute; the non-selected panels are absent from the visible text. Use `text?mode=raw` so the extraction reflects what the user actually sees.
+
+---
+
+## Group 26: Accordion
+
+### 26.1 Open section A
+```bash
+curl -X POST http://localhost:9867/navigate \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"tabId":"TAB_ID","url":"http://fixtures/accordion.html"}'
+
+curl -X POST http://localhost:9867/tabs/TAB_ID/action \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"kind":"click","selector":"#section-a .section-header"}'
+
+curl "http://localhost:9867/tabs/TAB_ID/text?mode=raw&format=text" \
+ -H "Authorization: Bearer benchmark-token"
+```
+**Pass if**: Response contains `ACCORDION_SECTION_A_OPEN`.
+
+### 26.2 Open section B — A auto-closes
+```bash
+curl -X POST http://localhost:9867/tabs/TAB_ID/action \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"kind":"click","selector":"#section-b .section-header"}'
+
+curl "http://localhost:9867/tabs/TAB_ID/text?mode=raw&format=text" \
+ -H "Authorization: Bearer benchmark-token"
+
+# Also verify the A body text is no longer visible by inspecting aria-expanded.
+curl -X POST http://localhost:9867/tabs/TAB_ID/evaluate \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"expression":"document.getElementById(\"section-a\").getAttribute(\"aria-expanded\")"}'
+```
+**Pass if**: Text response contains `ACCORDION_SECTION_B_OPEN`, AND the `evaluate` response for the section-a state returns `"false"`.
+
+**Note**: Accordion uses an exclusive-expand pattern (only one section open). CSS `max-height:0` collapses the closed bodies, but the text content is still in the DOM — confirming aria state is the most reliable check.
+
+---
+
+## Group 27: Contenteditable editor
+
+### 27.1 Type into a `contenteditable` div
+```bash
+curl -X POST http://localhost:9867/navigate \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"tabId":"TAB_ID","url":"http://fixtures/editor.html"}'
+
+curl -X POST http://localhost:9867/tabs/TAB_ID/action \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"kind":"type","selector":"#editor","text":"Hello rich text"}'
+
+curl "http://localhost:9867/tabs/TAB_ID/text?mode=raw&format=text" \
+ -H "Authorization: Bearer benchmark-token"
+```
+**Pass if**: Response contains `EDITOR_CHARS=15` AND the mirror echoes `Hello rich text`.
+
+### 27.2 Commit by pressing Enter
+```bash
+curl -X POST http://localhost:9867/tabs/TAB_ID/action \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"kind":"press","key":"Enter"}'
+
+curl "http://localhost:9867/tabs/TAB_ID/text?mode=raw&format=text" \
+ -H "Authorization: Bearer benchmark-token"
+```
+**Pass if**: Response contains `EDITOR_COMMITTED=Hello rich text`.
+
+**Note**: `contenteditable` elements don't have a `.value` property, so `fill` won't work. Use `type` so each character is dispatched via keyboard events the browser routes into the editor. `press Enter` is intercepted (preventDefault) to commit the buffer instead of inserting a newline.
+
+---
+
+## Group 28: Range slider
+
+### 28.1 Set range slider to HIGH bucket
+```bash
+curl -X POST http://localhost:9867/navigate \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"tabId":"TAB_ID","url":"http://fixtures/range.html"}'
+
+curl -X POST http://localhost:9867/tabs/TAB_ID/action \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"kind":"fill","selector":"#volume","text":"90"}'
+
+curl "http://localhost:9867/tabs/TAB_ID/text?mode=raw&format=text" \
+ -H "Authorization: Bearer benchmark-token"
+```
+**Pass if**: Response contains `RANGE_VALUE_90` AND `BUCKET_HIGH`.
+
+### 28.2 Move to LOW bucket
+```bash
+curl -X POST http://localhost:9867/tabs/TAB_ID/action \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"kind":"fill","selector":"#volume","text":"10"}'
+
+curl "http://localhost:9867/tabs/TAB_ID/text?mode=raw&format=text" \
+ -H "Authorization: Bearer benchmark-token"
+```
+**Pass if**: Response contains `RANGE_VALUE_10` AND `BUCKET_LOW`.
+
+**Note**: `fill` calls the native value setter, which fires both `input` and `change` events. That's enough to drive a page that listens via `addEventListener('input', ...)`. If the target only listens to pointer drag events, `drag --drag-x N` on the thumb would be needed — but most sites use `input`/`change`.
+
+---
+
+## Group 29: Pagination
+
+### 29.1 Advance to page 2
+```bash
+curl -X POST http://localhost:9867/navigate \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"tabId":"TAB_ID","url":"http://fixtures/pagination.html"}'
+
+curl -X POST http://localhost:9867/tabs/TAB_ID/action \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"kind":"click","selector":"#next-btn"}'
+
+curl "http://localhost:9867/tabs/TAB_ID/text?mode=raw&format=text" \
+ -H "Authorization: Bearer benchmark-token"
+```
+**Pass if**: Response contains `PAGE_2_FIRST_ITEM` AND `PAGE_2_OF_3` (and the page-1 marker is gone).
+
+### 29.2 Advance to last page; Next is disabled
+```bash
+curl -X POST http://localhost:9867/tabs/TAB_ID/action \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"kind":"click","selector":"#next-btn"}'
+
+curl "http://localhost:9867/tabs/TAB_ID/text?mode=raw&format=text" \
+ -H "Authorization: Bearer benchmark-token"
+
+curl -X POST http://localhost:9867/tabs/TAB_ID/evaluate \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"expression":"document.getElementById(\"next-btn\").disabled"}'
+```
+**Pass if**: Text contains `PAGE_3_FIRST_ITEM` AND `PAGE_3_OF_3` AND the evaluate response is `true` (Next button is disabled on the last page).
+
+**Note**: Pagination buttons re-render the list in place. If you re-snap after the click, refs `e0..eN` for the list items will be different than before.
+
+---
+
+## Group 30: Custom dropdown menu
+
+### 30.1 Open the dropdown and pick "Beta"
+```bash
+curl -X POST http://localhost:9867/navigate \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"tabId":"TAB_ID","url":"http://fixtures/dropdown.html"}'
+
+# Open the menu
+curl -X POST http://localhost:9867/tabs/TAB_ID/action \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"kind":"click","selector":"#dropdown-toggle"}'
+
+# Pick the "Beta" item by its data-value attribute
+curl -X POST http://localhost:9867/tabs/TAB_ID/action \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"kind":"click","selector":"#dropdown-menu li[data-value=\"beta\"]"}'
+
+curl "http://localhost:9867/tabs/TAB_ID/text?mode=raw&format=text" \
+ -H "Authorization: Bearer benchmark-token"
+```
+**Pass if**: Response contains `DROPDOWN_SELECTED=BETA`.
+
+### 30.2 Reopen and pick "Gamma"
+```bash
+curl -X POST http://localhost:9867/tabs/TAB_ID/action \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"kind":"click","selector":"#dropdown-toggle"}'
+
+curl -X POST http://localhost:9867/tabs/TAB_ID/action \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"kind":"click","selector":"#dropdown-menu li[data-value=\"gamma\"]"}'
+
+curl "http://localhost:9867/tabs/TAB_ID/text?mode=raw&format=text" \
+ -H "Authorization: Bearer benchmark-token"
+```
+**Pass if**: Response contains `DROPDOWN_SELECTED=GAMMA`.
+
+**Note**: This is a non-native dropdown — it's a `<button>` that toggles a `<ul>`. The menu items are not `<option>` elements, so `pinchtab select` won't work. Use two clicks (toggle, then item). Click-outside also dismisses the menu, so don't do anything between the two clicks that would synthesize a body click.
+
+---
+
+## Group 31: Nested iframes (3 levels deep)
+
+### 31.1 Drill into the deepest frame and click its button
+```bash
+curl -X POST http://localhost:9867/navigate \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"tabId":"TAB_ID","url":"http://fixtures/iframe-nested.html"}'
+
+# Hop into level 2
+curl -X POST http://localhost:9867/frame?tabId=TAB_ID \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"target":"#level-2"}'
+
+# Hop further into level 3 (selector is resolved relative to current scope)
+curl -X POST http://localhost:9867/frame?tabId=TAB_ID \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"target":"#level-3"}'
+
+# Click the level-3 button
+curl -X POST http://localhost:9867/tabs/TAB_ID/action \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"kind":"click","selector":"#deep-button"}'
+
+curl "http://localhost:9867/tabs/TAB_ID/snapshot?format=compact&maxTokens=500" \
+ -H "Authorization: Bearer benchmark-token"
+
+curl -X POST http://localhost:9867/frame?tabId=TAB_ID \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"target":"main"}'
+```
+**Pass if**: Scoped snapshot contains `DEEP_CLICKED=YES_LEVEL_3`.
+
+**Note**: Each `/frame` hop is relative to the current scope, so drilling
+into a nested frame requires one hop per level. Use `{"target":"main"}`
+to unwind to the top document in a single call.
+
+---
+
+## Group 32: Dynamic iframe (inserted after load)
+
+### 32.1 Wait for a late-inserted iframe then interact with it
+```bash
+curl -X POST http://localhost:9867/navigate \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"tabId":"TAB_ID","url":"http://fixtures/iframe-dynamic.html"}'
+
+# Wait for the marker that indicates the iframe was attached
+curl -X POST http://localhost:9867/tabs/TAB_ID/wait \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"text":"IFRAME_DYNAMIC_ATTACHED","timeout":5000}'
+
+# Scope into it and interact
+curl -X POST http://localhost:9867/frame?tabId=TAB_ID \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"target":"#late-frame"}'
+
+curl -X POST http://localhost:9867/tabs/TAB_ID/action \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"kind":"fill","selector":"#iframe-input","text":"Late World"}'
+
+curl -X POST http://localhost:9867/tabs/TAB_ID/action \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"kind":"click","selector":"#iframe-submit"}'
+
+curl "http://localhost:9867/tabs/TAB_ID/snapshot?format=compact&maxTokens=500" \
+ -H "Authorization: Bearer benchmark-token"
+
+curl -X POST http://localhost:9867/frame?tabId=TAB_ID \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"target":"main"}'
+```
+**Pass if**: Scoped snapshot contains `IFRAME_INPUT_RECEIVED_LATE_WORLD`.
+
+**Note**: The iframe is added to the DOM ~1.2 s after load. Snapshotting
+immediately won't see it; `pinchtab wait --text` is the right primitive.
+
+---
+
+## Group 33: srcdoc iframe (inline HTML, no src URL)
+
+### 33.1 Interact with an inline-content iframe
+```bash
+curl -X POST http://localhost:9867/navigate \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"tabId":"TAB_ID","url":"http://fixtures/iframe-srcdoc.html"}'
+
+curl -X POST http://localhost:9867/frame?tabId=TAB_ID \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"target":"#srcdoc-frame"}'
+
+curl -X POST http://localhost:9867/tabs/TAB_ID/action \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"kind":"fill","selector":"#inline-input","text":"srcdoc"}'
+
+curl -X POST http://localhost:9867/tabs/TAB_ID/action \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"kind":"click","selector":"#inline-submit"}'
+
+curl "http://localhost:9867/tabs/TAB_ID/snapshot?format=compact&maxTokens=500" \
+ -H "Authorization: Bearer benchmark-token"
+
+curl -X POST http://localhost:9867/frame?tabId=TAB_ID \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"target":"main"}'
+```
+**Pass if**: Scoped snapshot contains `INLINE_RECEIVED_SRCDOC`.
+
+**Note**: `srcdoc` iframes inherit the parent's origin (same-origin by
+default), so frame scope works the same way as `src`-based iframes. The
+returned `frameUrl` is `about:srcdoc`.
+
+---
+
+## Group 34: Sandboxed iframe (allow-scripts allow-same-origin)
+
+### 34.1 Click a button inside a sandbox="allow-scripts allow-same-origin" iframe
+```bash
+curl -X POST http://localhost:9867/navigate \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"tabId":"TAB_ID","url":"http://fixtures/iframe-sandbox.html"}'
+
+curl -X POST http://localhost:9867/frame?tabId=TAB_ID \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"target":"#sandboxed"}'
+
+curl -X POST http://localhost:9867/tabs/TAB_ID/action \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"kind":"click","selector":"#sandbox-button"}'
+
+curl "http://localhost:9867/tabs/TAB_ID/snapshot?format=compact&maxTokens=500" \
+ -H "Authorization: Bearer benchmark-token"
+
+curl -X POST http://localhost:9867/frame?tabId=TAB_ID \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"target":"main"}'
+```
+**Pass if**: Scoped snapshot contains `SANDBOX_CLICKED=YES`.
+
+**Note**: `sandbox="allow-scripts allow-same-origin"` permits scripts and
+inherits the parent origin, so frame scope works. Sandboxes without
+`allow-same-origin` force a unique opaque origin and would behave like
+cross-origin — out of reach for the current `/frame` scope API.
+
+---
+
+## Group 35: Long-form article (Medium/Substack style)
+
+### 35.1 Readability keeps the article body
+```bash
+curl -X POST http://localhost:9867/navigate \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"tabId":"TAB_ID","url":"http://fixtures/article.html"}'
+
+# Default mode uses Readability; this is its sweet spot.
+curl "http://localhost:9867/tabs/TAB_ID/text" \
+ -H "Authorization: Bearer benchmark-token"
+```
+**Pass if**: Response contains `ARTICLE_PUBLISHED_2026_04_15` AND `ARTICLE_WORD_COUNT_MARKER_323` (both inside the main article body — Readability should retain them).
+
+### 35.2 `--full` picks up the surrounding chrome Readability drops
+```bash
+curl "http://localhost:9867/tabs/TAB_ID/text?mode=raw&format=text" \
+ -H "Authorization: Bearer benchmark-token"
+```
+**Pass if**: Response contains `ARTICLE_PUBLISHED_2026_04_15` AND `FOOTER_COPYRIGHT_MARKER`. Default Readability trims the footer; `--full` keeps it. Proves the two modes behave as documented.
+
+---
+
+## Group 36: Search results page (SERP)
+
+### 36.1 Extract a specific result title by id
+```bash
+curl -X POST http://localhost:9867/navigate \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"tabId":"TAB_ID","url":"http://fixtures/serp.html"}'
+
+# Use a scoped snapshot to extract just one card — faster than full text.
+curl "http://localhost:9867/tabs/TAB_ID/snapshot?selector=%23r-3&format=compact&maxTokens=500" \
+ -H "Authorization: Bearer benchmark-token"
+```
+**Pass if**: Snapshot contains `RESULT_3_TITLE` AND `RESULT_3_SNIPPET_MARKER`.
+
+### 36.2 Count all six result cards
+```bash
+curl "http://localhost:9867/tabs/TAB_ID/text?mode=raw&format=text" \
+ -H "Authorization: Bearer benchmark-token"
+```
+**Pass if**: Response contains `RESULT_1_TITLE`, `RESULT_2_TITLE`, `RESULT_3_TITLE`, `RESULT_4_TITLE`, `RESULT_5_TITLE`, `RESULT_6_TITLE` (all 6), AND `SERP_RESULT_COUNT_6`. A SERP is the canonical case where Readability's single-article assumption fails — `--full` is required to see the list.
+
+---
+
+## Group 37: Q&A thread (Stack-Overflow style)
+
+### 37.1 Find the accepted answer
+```bash
+curl -X POST http://localhost:9867/navigate \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"tabId":"TAB_ID","url":"http://fixtures/qa.html"}'
+
+# Use eval to find the accepted answer id — structured page data beats
+# text-parsing when the marker lives in an attribute.
+curl -X POST http://localhost:9867/tabs/TAB_ID/evaluate \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"expression":"document.querySelector(\"[data-accepted=\\\"true\\\"]\").id"}'
+```
+**Pass if**: Response `.result` equals `"a-2"`. The accepted-answer marker is in a data attribute; this exercises `eval` as a structured alternative to text scraping.
+
+### 37.2 Extract the accepted answer body text
+```bash
+# Snapshot scoped to the accepted answer, with max-token budget
+curl "http://localhost:9867/tabs/TAB_ID/snapshot?selector=%23a-2&format=compact&maxTokens=1500" \
+ -H "Authorization: Bearer benchmark-token"
+```
+**Pass if**: Scoped snapshot contains `ANSWER_2_BODY_MARKER` AND `ACCEPTED_ANSWER_ID_A2`. Tests `snapshot?selector=` for scoped reads — a common pattern when a page has many independent sections.
+
+---
+
+## Group 38: Pricing table
+
+### 38.1 Extract the Pro plan price
+```bash
+curl -X POST http://localhost:9867/navigate \
+ -H "Authorization: Bearer benchmark-token" \
+ -H "Content-Type: application/json" \
+ -d '{"tabId":"TAB_ID","url":"http://fixtures/pricing.html"}'
+
+curl "http://localhost:9867/tabs/TAB_ID/snapshot?selector=%23plan-pro&format=compact&maxTokens=500" \
+ -H "Authorization: Bearer benchmark-token"
+```
+**Pass if**: Snapshot contains `PLAN_PRO_PRICE_29` AND `PLAN_PRO_LIMIT_5000_requests per day`.
+
+### 38.2 Extract all three plan prices in one pass
+```bash
+curl "http://localhost:9867/tabs/TAB_ID/text?mode=raw&format=text" \
+ -H "Authorization: Bearer benchmark-token"
+```
+**Pass if**: Response contains `PLAN_FREE_PRICE_0`, `PLAN_PRO_PRICE_29`, AND `PLAN_ENTERPRISE_PRICE_CUSTOM`. Pricing tables are grid-heavy; Readability would pick one column. `--full` returns the whole surface.
+
+---
+
## Summary
| Group | Tasks | Description |
@@ -1180,8 +1773,24 @@ curl "http://localhost:9867/tabs/TAB_ID/text" \
| 20 | 2 | Dialogs |
| 21 | 2 | Async / awaitPromise |
| 22 | 2 | Mouse Drag & Drop |
-
-**Total: 58 tasks**
+| 23 | 1 | Async / Loading state |
+| 24 | 2 | Keyboard events |
+| 25 | 2 | Tab panels |
+| 26 | 2 | Accordion |
+| 27 | 2 | Contenteditable editor |
+| 28 | 2 | Range slider |
+| 29 | 2 | Pagination |
+| 30 | 2 | Custom dropdown menu |
+| 31 | 1 | Nested iframes (3 levels) |
+| 32 | 1 | Dynamic iframe |
+| 33 | 1 | srcdoc iframe |
+| 34 | 1 | Sandboxed iframe |
+| 35 | 2 | Long-form article (text extraction) |
+| 36 | 2 | Search results page (SERP) |
+| 37 | 2 | Q&A thread (Stack-Overflow style) |
+| 38 | 2 | Pricing table |
+
+**Total: 85 tasks**
## Verification Strings
@@ -1201,3 +1810,21 @@ curl "http://localhost:9867/tabs/TAB_ID/text" \
| Rust Article | `VERIFY_WIKI_RUST_LANG` |
| Async | `VERIFY_ASYNC_PAGE_77777` |
| Drag | `VERIFY_DRAG_PAGE_33333` |
+| Loading | `VERIFY_LOADING_PAGE_11111` |
+| Keyboard | `VERIFY_KEYBOARD_PAGE_22222` |
+| Tabs | `VERIFY_TABS_PAGE_55555` |
+| Accordion | `VERIFY_ACCORDION_PAGE_66666` |
+| Editor | `VERIFY_EDITOR_PAGE_44444` |
+| Range | `VERIFY_RANGE_PAGE_99999` |
+| Pagination | `VERIFY_PAGINATION_PAGE_88888` |
+| Dropdown | `VERIFY_DROPDOWN_PAGE_77777` |
+| Iframe Nested (outer) | `VERIFY_IFRAME_NESTED_OUTER` |
+| Iframe Nested (L2) | `VERIFY_IFRAME_NESTED_L2` |
+| Iframe Nested (L3) | `VERIFY_IFRAME_NESTED_L3` |
+| Iframe Dynamic | `VERIFY_IFRAME_DYNAMIC_OUTER` |
+| Iframe Srcdoc | `VERIFY_IFRAME_SRCDOC_OUTER` |
+| Iframe Sandbox | `VERIFY_IFRAME_SANDBOX_OUTER` |
+| Article | `VERIFY_ARTICLE_PAGE_41414` |
+| SERP | `SERP_PAGE_MARKER_88044` |
+| Q&A | `VERIFY_QA_PAGE_72000` |
+| Pricing | `VERIFY_PRICING_PAGE_30303` |
diff --git a/tests/benchmark/TEST_CASES.md b/tests/benchmark/TEST_CASES.md
index 04796639..38cd717f 100644
--- a/tests/benchmark/TEST_CASES.md
+++ b/tests/benchmark/TEST_CASES.md
@@ -1,6 +1,6 @@
# PinchTab Benchmark Test Cases
-58 test cases covering realistic browser automation scenarios against local fixture pages.
+85 test cases covering realistic browser automation scenarios against local fixture pages.
| # | Task | Description |
|---|------|-------------|
@@ -85,3 +85,46 @@
| **Group 22: Mouse Drag & Drop** | | |
| 22.1 | Drag into Zone A | Use high-level `drag` action to move piece into Zone A |
| 22.2 | Low-level drag sequence | Use `mouse-down`/`mouse-move`/`mouse-up` to visit Zone B then C; verify ordered drop sequence |
+| **Group 23: Async / Loading state** | | |
+| 23.1 | Wait for async content | Page shows spinner for 1.5 s, then replaces it with the final marker |
+| **Group 24: Keyboard events** | | |
+| 24.1 | Press Escape | Verify `KEYBOARD_ESCAPE_PRESSED` marker after `press Escape` |
+| 24.2 | Sequential keys | Press `a` then `Enter`, verify both markers accumulate in log |
+| **Group 25: Tab panels** | | |
+| 25.1 | Switch to Settings tab | Click Settings tab, verify `TAB_SETTINGS_CONTENT` replaces Profile content |
+| 25.2 | Switch to Billing tab | Click Billing tab, verify `TAB_BILLING_CONTENT` |
+| **Group 26: Accordion** | | |
+| 26.1 | Open section A | Click Section A header, verify `ACCORDION_SECTION_A_OPEN` |
+| 26.2 | Open section B | Click Section B header, verify B marker + Section A `aria-expanded=false` |
+| **Group 27: Contenteditable editor** | | |
+| 27.1 | Type into editor | `type` "Hello rich text" into `#editor`, verify char count + mirror |
+| 27.2 | Commit with Enter | Press Enter (intercepted), verify `EDITOR_COMMITTED=...` |
+| **Group 28: Range slider** | | |
+| 28.1 | Set slider to HIGH | `fill #volume 90`, verify value + bucket markers |
+| 28.2 | Set slider to LOW | `fill #volume 10`, verify value + bucket markers |
+| **Group 29: Pagination** | | |
+| 29.1 | Advance to page 2 | Click Next, verify `PAGE_2_FIRST_ITEM` and `PAGE_2_OF_3` |
+| 29.2 | Last page; Next disabled | Click Next, verify page-3 markers + `disabled=true` |
+| **Group 30: Custom dropdown menu** | | |
+| 30.1 | Pick Beta | Click toggle, click data-value=beta, verify selection marker |
+| 30.2 | Reopen + pick Gamma | Click toggle again, click Gamma, verify selection marker |
+| **Group 31: Nested iframes (3 levels)** | | |
+| 31.1 | Click deepest-frame button | `frame #level-2` → `frame #level-3` → click `#deep-button`; verify `DEEP_CLICKED=YES_LEVEL_3` |
+| **Group 32: Dynamic iframe** | | |
+| 32.1 | Wait for late iframe | `wait --text IFRAME_DYNAMIC_ATTACHED` → scope in → fill/click → verify result marker |
+| **Group 33: srcdoc iframe** | | |
+| 33.1 | Inline iframe content | scope `#srcdoc-frame` → fill/click inline form → verify `INLINE_RECEIVED_SRCDOC` |
+| **Group 34: Sandboxed iframe** | | |
+| 34.1 | Click in sandboxed frame | `sandbox="allow-scripts allow-same-origin"`; scope + click → verify `SANDBOX_CLICKED=YES` |
+| **Group 35: Long-form article** | | |
+| 35.1 | Default Readability mode keeps body | Verify date + word-count markers via default `text` |
+| 35.2 | `--full` keeps the chrome | Verify footer marker only appears in `--full` output |
+| **Group 36: Search results page** | | |
+| 36.1 | Extract result #3 via scoped snapshot | `snap --selector "#r-3"`; verify title + snippet markers |
+| 36.2 | All six results via `--full` | `text --full` contains `RESULT_1_TITLE`..`RESULT_6_TITLE` |
+| **Group 37: Q&A thread** | | |
+| 37.1 | Accepted answer id via `eval` | Query `[data-accepted="true"]` → `a-2` |
+| 37.2 | Accepted answer body | Scoped snapshot of `#a-2` contains `ANSWER_2_BODY_MARKER` |
+| **Group 38: Pricing table** | | |
+| 38.1 | Pro plan via scoped snapshot | `#plan-pro` contains `PLAN_PRO_PRICE_29` |
+| 38.2 | All 3 plans via `--full` | Output contains all three plan-price markers |
diff --git a/tests/benchmark/benchmark-coverage-plan.md b/tests/benchmark/benchmark-coverage-plan.md
new file mode 100644
index 00000000..9db8efb3
--- /dev/null
+++ b/tests/benchmark/benchmark-coverage-plan.md
@@ -0,0 +1,198 @@
+# Benchmark Coverage Plan — Weaknesses & Gaps
+
+Living inventory of PinchTab weaknesses that fall outside the iframe roadmap
+(see that separately). Compiled from 16 continuous optimization loops of
+agent + baseline feedback. Rank is by *agent pain per loop* × *tractability*.
+
+Update each entry as loops land fixes. When an item reaches "resolved", move
+it to the bottom of the file with the loop number that closed it.
+
+---
+
+## Section A — Known bugs (reproducible, every run)
+
+| ID | Weakness | Severity | Effort | Current status |
+|----|----------|:--------:|:------:|----------------|
+| A1 | **Missing CSS selector hangs for 30 s** before erroring. Wrong id → agent waits the full action timeout before getting a clear "not found". Hit in Loops #11, #13, #15. | 🔴 high | 🟡 medium | open |
+| A2 | **`text:<value>` selector intermittently fails** with `context deadline exceeded` on dynamic/large pages. JS-based resolver in `internal/bridge/action_resolve.go::ResolveTextToNodeID` races with DOM readiness. Every run hits it. | 🔴 high | 🔴 hard | open — documented as deprecated in SKILL.md but still present |
+| A3 | **First `fill` after `nav` race** — the first `fill` action after a navigation occasionally times out; the retry works. Suggests the readiness wait in `action_pointer.go` isn't quite aligned with when the DOM is actually interactive. | 🟡 mid | 🟡 medium | open |
+| A4 | **Ref recovery picks wrong target on repeated-label siblings** — a row of `✕` delete buttons causes the recovery path to silently bind to the wrong row. **Data-loss risk.** Loop #6 caught it deleting the wrong SPA task. | 🔴 high | 🟡 medium | open |
+| A5 | **`scroll into view` fails on overlay/sticky elements** — returns `-32000 no layout object` even when the element is visible. Forces `eval`-based click workaround. | 🟡 mid | 🟡 medium | open |
+
+---
+
+## Section B — Missing CLI capabilities
+
+| ID | Missing | Impact | Effort | Status |
+|----|---------|:------:|:------:|--------|
+| B1 | **`pinchtab download --output <path>`** — `download` currently returns base64 inline; agent has to post-process. Asked every run. | 🟡 mid | 🟢 easy | open |
+| B2 | **Screenshot / PDF `-o` paths write inside container, not host.** Benchmark-wrapper issue; production installs are fine. Needs wrapper `docker cp` or `--host-path` flag. | 🟡 mid | 🟢 easy | open |
+| B3 | **`<select multiple>` not supported.** `SelectByNodeID` sets `this.value = v` which is single-select only. Real bug. | 🟡 mid | 🟡 medium | open |
+| B4 | **No viewport resize / mobile emulation.** Can't test responsive layouts or mobile-only UI. | 🟡 mid | 🟡 medium | open |
+| B5 | **No `wait --not-text` / `wait --element-gone`** — `wait` only waits for appearance. Disappearance patterns (spinner removal, toast dismiss) force polling. | 🟢 low | 🟢 easy | open |
+| B6 | **No request interception** — `--block-images` / `--block-ads` work but no arbitrary URL pattern blocking or response mocking. | 🟡 mid | 🔴 hard | open |
+| B7 | **No mobile-gesture primitives** — pinch, long-press, two-finger scroll. Niche but will matter. | 🟢 low | 🟡 medium | open |
+
+---
+
+## Section C — Test-coverage holes (ship without verification)
+
+Features PinchTab ships but the benchmark never exercises. No evidence
+they actually work for agents in practice.
+
+| ID | Untested feature | Severity | Action |
+|----|-----------------|:--------:|--------|
+| C1 | **`pinchtab clipboard`** read/write | 🔴 high | Add `clipboard.html` fixture + 2 tasks |
+| C2 | **`pinchtab cookies`** get/set | 🔴 high | Add `cookies.html` fixture (auth-cookie flow) + 2 tasks |
+| C3 | **`pinchtab storage`** localStorage, sessionStorage, IndexedDB | 🟡 mid | Add `storage.html` fixture + 2 tasks |
+| C4 | **`pinchtab network`** request logging/filtering | 🟡 mid | Reuse existing fixture + add tasks that inspect network log |
+| C5 | **`pinchtab console`** JS error/warning capture | 🟡 mid | Add `console.html` fixture that logs + throws |
+| C6 | **`pinchtab upload`** file upload via sandboxed path | 🔴 high | Add `upload.html` fixture + sandbox-path task |
+| C7 | **`pinchtab find`** natural-language element discovery — agents don't know it exists | 🟡 mid | Add 1 task per existing fixture that uses `find` instead of snap+ref |
+| C8 | **`pinchtab handoff`** session handoff between agents | 🟢 low | Niche; defer |
+| C9 | **`pinchtab solve`** CAPTCHA solving | 🟢 low | Needs real sites; defer |
+
+---
+
+## Section D — Real-world web patterns we don't simulate
+
+Common patterns that will break agents in production but aren't in the
+fixture suite. Ranked by frequency in real sites.
+
+| ID | Pattern | Frequency | Notes |
+|----|---------|:---------:|-------|
+| D1 | **Shadow DOM / web components** | very high | Google, Stripe, modern widgets. `querySelector` doesn't pierce shadow roots. |
+| D2 | **Multi-select `<select multiple>`** | high | Any filter/tag picker. Ties to B3. |
+| D3 | **File upload (`<input type="file">`)** | high | Gmail, GitHub, forms. Ties to C6. |
+| D4 | **Infinite scroll** | high | Twitter, Instagram, news feeds. |
+| D5 | **Autocomplete / combobox with suggestions** | high | Google search, Slack picker. |
+| D6 | **Date picker** | high | Booking sites. Native `<input type="date">` vs custom. |
+| D7 | **Draggable list reorder** | medium | Trello, Notion. Current `drag.html` is zone-drop, not list-reorder. |
+| D8 | **Toast / snackbar notifications** | high | Transient content — requires B5. |
+| D9 | **Tooltips on keyboard focus** | medium | Accessibility-first UIs; current `hovers.html` only tests hover. |
+| D10 | **Virtual scrolling** | medium | AG Grid, React Virtualized — off-screen rows not in DOM. |
+| D11 | **Inline async form validation** | high | "Checking username availability..." — wait+re-snap cycle. |
+| D12 | **Modal with backdrop click-to-close** | high | React-style modals, not JS `alert`. |
+| D13 | **Sticky header + table scroll** | medium | Dashboards — scroll-into-view lands under sticky header. |
+| D14 | **Copy-to-clipboard button** | high | Ties to C1. |
+| D15 | **`window.print()` dialog** | low | Edge case but exists. |
+
+---
+
+## Section E — Documentation / discoverability gaps
+
+Agents cost 1–2 extra tool calls per run because of these.
+
+| ID | Gap | Fix |
+|----|-----|-----|
+| E1 | `pinchtab scroll <pixels>` positional form absent from the short `Use:` string; agents glance there first. | Update `Use:` to `scroll <pixels\|direction\|selector>`. |
+| E2 | `pinchtab tab list` is wrong — it's bare `pinchtab tab`. Agents keep guessing. | Add "list" alias or a SKILL.md note. |
+| E3 | `text --full` vs default Readability trap — agents still default to `text`. | Consider making default retry raw when Readability returns < N chars. |
+| E4 | Container-vs-host paths for `-o` flags — no note in `--help`. | Add note to `screenshot` / `pdf` / `download` help text. |
+| E5 | `pinchtab find` command is invisible. | Surface in SKILL.md "when to use" cheatsheet. |
+| E6 | Error code reference — `-32000`, `409`, `412` show up without context. | Create `skills/pinchtab/references/errors.md`. |
+
+---
+
+## Section F — Agent-ergonomic gaps
+
+Not bugs — friction that wrapper / docs could eliminate.
+
+| ID | Gap | Fix idea |
+|----|-----|----------|
+| F1 | No "warm start" hint — agents always do `snap -i -c` first. | SKILL.md: recommend `pinchtab quick <url>` for one-shot tasks. |
+| F2 | No "here's what changed" primitive beyond `snap -d`. | `pinchtab wait-and-diff` as a single call. |
+| F3 | No atomic action batches from CLI. `actions --file batch.json` exists but is invisible. | Surface in SKILL.md. |
+| F4 | Agent re-snapshots after every action — ~half the tool calls. | A `click --then-text` / `click --snap-after` one-shot. |
+
+---
+
+## Priority order (recommended execution sequence)
+
+When picking the next continuous-loop target, sort by `(agent pain × value) / effort`. Current order:
+
+1. **A1 — fast-fail on missing CSS selectors** — biggest single agent friction
+2. **B1 — `download --output <path>`** — tiny, asked every run
+3. **C2 — cookies fixture + tasks** — critical untested capability (auth flows)
+4. **B3 — multi-select support** — real bug, fixture-driven validation already designed
+5. **A4 — ref recovery confidence tuning** — data-loss risk
+6. **D1 — shadow DOM fixture + `>>>` piercing** — biggest real-world pattern absence
+7. **A5 — scroll-into-view fallback for layout-less elements**
+8. **C1 — clipboard fixture + tasks**
+9. **C6 — file upload fixture + sandbox-path integration**
+10. **D4 — infinite-scroll fixture**
+11. **C3–C5** — storage / network / console coverage
+12. **D5–D15** — remaining real-world patterns
+
+Below that threshold: everything is incremental coverage / doc polish.
+
+---
+
+## Iframe coverage — separate roadmap
+
+Covered by the `pinchtab frame` command (landed upstream in PR #471, merged
+into this branch). Current benchmark coverage below; for the full iframe
+functionality roadmap see the user's earlier survey (§1–11).
+
+### Landed
+
+- `pinchtab frame <target|main>` stateful scope.
+- Same-origin iframe scoping (CSS selector, ref, frame name, frame URL).
+- Nested iframe support via successive `frame` hops (verified to 3 levels).
+- `srcdoc` iframes work (same-origin by inheritance).
+- `sandbox="allow-scripts allow-same-origin"` iframes work.
+- Dynamic iframes inserted after page load — paired with `wait --text`.
+- Refs emitted by a full (non-interactive) `snap` carry frame context, so
+ ref-based actions cross the boundary without an explicit scope set.
+
+### Benchmark coverage (77-task suite, Groups 19 + 31-34)
+
+| Group | Scenario | Status |
+|-------|----------|:------:|
+| 19.1 | Read same-origin iframe via full `snap` | ✅ |
+| 19.2 | Interact inside iframe via `frame` scope + selectors | ✅ |
+| 31 | Nested iframes (3 levels) | ✅ |
+| 32 | Dynamic iframe (inserted after load) | ✅ |
+| 33 | `srcdoc` iframe (inline HTML) | ✅ |
+| 34 | Sandboxed iframe (`allow-scripts allow-same-origin`) | ✅ |
+
+### Still missing
+
+- **Cross-origin iframes** — `/frame` can't scope into them; fall back to
+ `eval` against `iframe.contentDocument` (same-origin-policy permitting).
+ Needs OOPIF session attachment (see coverage-plan §3 in the iframe
+ functionality survey).
+- **Frame navigation within iframe** — no way to `nav` the inner frame
+ independently. `Page.navigate` with a `frameId` isn't exposed.
+- **Frame discovery command** — no `pinchtab frames` listing; agents must
+ know frame names/URLs in advance.
+- ~~**`text --full` doesn't pierce iframes**~~ — **resolved**.
+ `pinchtab text` now honors the active `frame` scope and accepts an
+ explicit `--frame <frameId>` flag for one-shot reads. Top-level calls are
+ unchanged. See `docs/reference/frame.md` / SKILL.md.
+- **`snap -i -c` still filters iframe children** — full `snap` works but
+ adds tokens. A frame-aware interactive filter would be nicer.
+- **Sandboxed iframes without `allow-same-origin`** — opaque origin, out
+ of reach. Same gap as cross-origin.
+
+### Resolved (archive)
+
+- **[Loop #17 batch — same session as coverage plan creation]** — Adopted
+ native `pinchtab frame` in Group 19.2 (replacing the `eval +
+ contentDocument` workaround), added Groups 31–34 covering nested /
+ dynamic / srcdoc / sandboxed iframes, added six new fixtures
+ (`iframe-nested.html`, `iframe-nested-2.html`, `iframe-nested-3.html`,
+ `iframe-dynamic.html`, `iframe-srcdoc.html`, `iframe-sandbox.html`,
+ `iframe-sandbox-content.html`). Baseline 77/77 on the expanded suite.
+ Updated SKILL.md to replace the iframe-eval workaround rule with the
+ native `frame` flow.
+
+---
+
+## Resolved (archive — non-iframe)
+
+Populated as loops close items. Each entry: `- [Loop #N] <id> — <one-line
+description>`.
+
+*(none yet — continuous-loop session paused at Loop #16; this plan seeds the
+next batch.)*
diff --git a/tests/benchmark/continuous-loop-plan.md b/tests/benchmark/continuous-loop-plan.md
new file mode 100644
index 00000000..a142ed83
--- /dev/null
+++ b/tests/benchmark/continuous-loop-plan.md
@@ -0,0 +1,219 @@
+# Continuous Optimization Loop — Plan
+
+## Directive
+
+Execute 250 consecutive optimization loops (Runs #9 through #258) against the
+PinchTab benchmark harness. Each loop:
+
+1. Picks the easiest most-consistent optimization available from the backlog.
+2. Adds **one** new fixture test case to the benchmark (diverse across loops).
+3. Implements, tests, and verifies the change.
+4. Runs the full baseline + agent benchmark cycle.
+5. Logs the outcome rigorously so work is resumable across sessions.
+
+Ultimate goal: make PinchTab the best possible tool for AI agents that automate
+the web. Stay inside the existing code conventions; don't introduce new idioms
+or refactor adjacent code unless the optimization requires it.
+
+The user has delegated autonomous execution. Don't ask for approval. Keep
+going until completion or a true blocker.
+
+---
+
+## One-loop protocol
+
+Each iteration must follow this sequence. Skipping a step risks silent
+regressions that poison later loops.
+
+### 1. Plan the loop (in conversation)
+
+- Pick **one optimization** from the backlog below (or a new friction point
+ surfaced by the last agent run). Priority order:
+ 1. Real bug fix (incorrect behavior in CLI or server)
+ 2. Doc gap that causes agent confusion (SKILL.md, help text)
+ 3. CLI ergonomic (new flag, better error message)
+ 4. Fixture test case that exercises under-covered behavior
+- Pick **one fixture test case** from the fixture-coverage backlog. Track
+ which categories have been covered to maintain diversity.
+- Briefly state the decision in the per-loop decision entry (see §5).
+
+### 2. Implement
+
+- Code changes must stay within existing style (naming, error shape, test
+ patterns, flag conventions).
+- Add or update unit tests alongside any code change.
+- For CLI changes: register flag in `cmd_cli_register.go`, plumb through
+ `internal/cli/actions/...`, document in `skills/pinchtab/SKILL.md`.
+- For server changes: update action in `internal/bridge/...`, update
+ `internal/handlers/...` if HTTP contract changes, add tests.
+- For fixture cases: add the HTML/JS fixture in
+ `tests/benchmark/fixtures/<name>.html`, add the baseline step in
+ `BASELINE_TASKS.md`, add the matching agent task in `AGENT_TASKS.md`,
+ update `TEST_CASES.md` summary, update the verification-strings table.
+- Run `go test ./internal/...` — must pass.
+- Rebuild Docker: `cd tests/benchmark && docker compose up -d --build`.
+
+### 3. Baseline run (must be green)
+
+- Initialize reports: `bash scripts/run-optimization.sh`.
+- Run all 58 + new-task baseline curls. Record each step via
+ `./scripts/record-step.sh --type baseline ...`.
+- Target: **100%**. Any failure blocks the loop — diagnose and fix before
+ proceeding.
+
+### 4. Agent run (measure impact)
+
+- Dispatch the Explore-style general-purpose subagent with:
+ - A terse prompt that lists current agent-facing capabilities.
+ - The hard constraint: use `./scripts/pt <args>` only, no helper files.
+ - Tell it what changed in this loop so it can exercise it.
+ - Ask for totals + tool-use estimate + new friction points (< 400 words).
+- Record pass/fail/skip per step via `record-step.sh --type agent`.
+
+### 5. Log the outcome
+
+Append to `results/decisions.md`:
+
+```markdown
+## Loop #N — YYYY-MM-DD HH:MM
+
+**Optimization chosen:** <one line>
+**Reason:** <why this won the priority sort>
+**Fixture case added:** <one line>
+
+**Changes (files):**
+- <path> — <one-line summary>
+
+**Baseline:** X/Y (green/red per step ID if any red)
+**Agent:** X/Y
+
+**Agent metrics:** tool_uses=N, duration=Ns, tokens=N
+
+**Delta vs previous successful run:**
+<one line>
+
+**Friction surfaced for future loops:**
+- <one line each>
+
+**Status:** landed | reverted | deferred
+```
+
+Update the summary table in `results/optimization_log.md` with the new row.
+
+If this loop's agent metrics improved on the best score, also update
+`results/successful_changes.md` and bump `results/best_score.txt`.
+
+### 6. Resumability
+
+At the end of each loop:
+- Git status should be the cumulative uncommitted set from the session.
+- No `/tmp` state the next loop depends on (except ephemeral Docker container
+ state which is fine).
+- The plan, decisions log, summary table, and `best_score.txt` are
+ self-contained — a fresh Claude session can read them and pick up.
+
+If context is getting tight, finish the current loop fully (don't leave a
+half-broken state), then use `ScheduleWakeup` with the autonomous-loop-dynamic
+sentinel to continue from the next loop after a pause.
+
+---
+
+## Optimization backlog (seeded from Runs #1–#8 friction reports)
+
+Ranked by (value × ease). Revise each loop.
+
+### Easy / doc-only
+- [ ] SKILL.md note: `eval` shares runtime realm across calls — wrap in IIFE
+ to avoid `const` collisions.
+- [ ] SKILL.md note: `getBoundingClientRect()` returns a DOMRect whose fields
+ don't JSON-serialize — project to `{x, y, w, h}` explicitly.
+- [ ] SKILL.md note: `/text` skips modal/overlay portals; use `eval
+ document.body.innerText` or `snap --selector` when modal verification is
+ needed.
+- [ ] SKILL.md note: screenshot/PDF `-o` paths land inside the Docker
+ container for the benchmark harness.
+- [ ] `pinchtab select --help` example showing text fallback.
+
+### Easy / CLI flag additions
+- [ ] `pinchtab download --output <path>` — decode base64 and write to a host
+ path so benchmark callers don't have to post-process.
+- [ ] `pinchtab snap --selector <css>` surfaced in `--help` Long description.
+
+### Moderate / CLI behavior
+- [ ] `pinchtab text` — optional `--max-chars N` flag (HTTP already supports
+ `maxChars` query param).
+- [ ] `pinchtab wait --text "..." --timeout ...` — CLI surface for
+ `wait` action (if missing).
+- [ ] `pinchtab console --tail` — stream console output.
+
+### Moderate / server
+- [ ] Enrich `<option>` nodes in compact snapshot with the `value` attribute
+ via a single `DOM.getAttributes` batch when a `<select>` ancestor is
+ present. (Partially obviated by the select fallback, but still useful for
+ agents inspecting dropdown contents.)
+- [ ] Investigate `text:` selector intermittent `context deadline exceeded`
+ — add per-call timeout and better retry policy in
+ `bridge/action_resolve.go::ResolveTextToNodeID`.
+- [ ] Ref recovery confidence — lower confidence when multiple DOM nodes
+ share identical text (e.g. repeated "✕" delete buttons).
+
+### Hard / deferred
+- [ ] Frame-aware ref resolver for iframes.
+- [ ] First-fill-after-nav race — `action_pointer.go` readiness wait audit.
+
+---
+
+## Fixture coverage backlog
+
+Aim for **diverse** test categories across loops. Categories already covered
+(Runs #1–#8): Reading, Search, Forms (basic), SPA, Login, E-commerce,
+Content+Interaction, Error handling, Export, Modals, Persistence, Multi-page
+Nav, Form Validation, Dynamic Content, Data Aggregation, Hover, Scrolling,
+Download, iFrame, Dialogs, Async/awaitPromise, Drag.
+
+Uncovered categories to prioritize:
+
+- **Input variants**: file upload, date picker, time picker, color picker,
+ range slider, autocomplete/datalist.
+- **Form state**: radio groups, checkbox groups, multi-select, fieldset,
+ disabled/readonly, required, pattern validation with messages.
+- **Dynamic UI**: loading spinners, toast notifications, pagination, tabs,
+ accordion, stepper/wizard.
+- **Keyboard**: keyboard shortcuts, tab focus order, focus traps.
+- **Visual/CSS**: RTL text, very long text, Unicode/emoji, elements with
+ CSS transforms / position:fixed / sticky.
+- **Accessibility**: ARIA landmarks, ARIA live regions, ARIA expanded/pressed
+ state, role=grid, aria-controls relationships.
+- **State stores**: localStorage, sessionStorage, cookies, IndexedDB.
+- **Browser APIs**: clipboard read/write, geolocation (mocked),
+ notifications.
+- **Networking**: fetch polling, SSE stream, WebSocket echo, delayed
+ response, 5xx retry.
+- **Web components**: Shadow DOM (open and closed), slot content, custom
+ elements, light DOM fallback.
+- **Gestures**: drag-to-reorder list, resize handle, pinch-zoom, double-click
+ distinct from two clicks.
+- **Observers**: IntersectionObserver trigger, ResizeObserver trigger,
+ MutationObserver-driven DOM.
+- **Edge cases**: very deep DOM, many siblings, element moved during
+ interaction, stale ref recovery.
+
+---
+
+## Success list
+
+`results/successful_changes.md` ranks interventions by measured impact
+(primarily tool-use reduction per run, secondarily token reduction, then
+qualitative agent feedback). Update after every loop that lands a new
+low-water mark.
+
+---
+
+## Stop conditions
+
+- Loop #258 completed and logged.
+- User explicitly tells the agent to stop.
+- Two consecutive loops fail the baseline and cannot be recovered without
+ human intervention.
+- Backlog exhausted AND no new friction surfaced for 3 consecutive loops —
+ in that case, exit gracefully and post a completion note to the log.
diff --git a/tests/benchmark/fixtures/accordion.html b/tests/benchmark/fixtures/accordion.html
new file mode 100644
index 00000000..71c7f3a2
--- /dev/null
+++ b/tests/benchmark/fixtures/accordion.html
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>PinchTab Benchmark - Accordion</title>
+ <style>
+ body { font-family: sans-serif; margin: 20px; }
+ .section { border: 1px solid #ccc; margin-bottom: 4px; border-radius: 4px; overflow: hidden; }
+ .section-header {
+ background: #f0f0f0;
+ padding: 10px 16px;
+ cursor: pointer;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ font-weight: bold;
+ }
+ .section-header::after { content: '▸'; transition: transform .15s; }
+ .section[aria-expanded="true"] .section-header::after { transform: rotate(90deg); }
+ .section-body { padding: 0 16px; max-height: 0; overflow: hidden; transition: max-height .15s; }
+ .section[aria-expanded="true"] .section-body { padding: 12px 16px; max-height: 200px; }
+ </style>
+</head>
+<body>
+ <h1>Accordion — VERIFY_ACCORDION_PAGE_66666</h1>
+
+ <p>Three sections; only one is open at a time. Clicking a header toggles
+ that section open and closes any previously-open one.</p>
+
+ <div class="section" id="section-a" aria-expanded="false">
+ <div class="section-header" role="button" tabindex="0" aria-controls="body-a">Section A</div>
+ <div class="section-body" id="body-a">ACCORDION_SECTION_A_OPEN — alpha body.</div>
+ </div>
+ <div class="section" id="section-b" aria-expanded="false">
+ <div class="section-header" role="button" tabindex="0" aria-controls="body-b">Section B</div>
+ <div class="section-body" id="body-b">ACCORDION_SECTION_B_OPEN — bravo body.</div>
+ </div>
+ <div class="section" id="section-c" aria-expanded="false">
+ <div class="section-header" role="button" tabindex="0" aria-controls="body-c">Section C</div>
+ <div class="section-body" id="body-c">ACCORDION_SECTION_C_OPEN — charlie body.</div>
+ </div>
+
+ <script>
+ (function () {
+ const sections = Array.from(document.querySelectorAll('.section'));
+ sections.forEach(function (section) {
+ const header = section.querySelector('.section-header');
+ header.addEventListener('click', function () {
+ const isOpen = section.getAttribute('aria-expanded') === 'true';
+ sections.forEach(function (s) { s.setAttribute('aria-expanded', 'false'); });
+ if (!isOpen) { section.setAttribute('aria-expanded', 'true'); }
+ });
+ });
+ })();
+ </script>
+</body>
+</html>
diff --git a/tests/benchmark/fixtures/article.html b/tests/benchmark/fixtures/article.html
new file mode 100644
index 00000000..68baca59
--- /dev/null
+++ b/tests/benchmark/fixtures/article.html
@@ -0,0 +1,100 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>The Quiet Power of Deterministic Tests</title>
+ <style>
+ body { font-family: Georgia, serif; max-width: 720px; margin: 40px auto; padding: 0 20px; color: #1a1a1a; line-height: 1.6; }
+ header, footer { font-family: sans-serif; color: #666; }
+ .byline { font-size: 14px; margin: 12px 0 24px; }
+ .tags { margin-top: 24px; }
+ .tags a { display: inline-block; background: #f0f0f0; padding: 2px 8px; border-radius: 4px; margin-right: 6px; text-decoration: none; color: #333; font-size: 13px; }
+ article h1 { font-size: 32px; line-height: 1.2; margin-bottom: 4px; }
+ article h2 { font-size: 22px; margin-top: 32px; }
+ .related { margin-top: 48px; border-top: 1px solid #ddd; padding-top: 24px; }
+ .related a { display: block; margin: 4px 0; }
+ nav a { margin-right: 12px; color: #666; }
+ </style>
+</head>
+<body>
+ <header>
+ <nav>
+ <a href="/">Home</a>
+ <a href="/archive">Archive</a>
+ <a href="/about">About</a>
+ </nav>
+ </header>
+
+ <article>
+ <h1>The Quiet Power of Deterministic Tests — VERIFY_ARTICLE_PAGE_41414</h1>
+ <div class="byline">
+ By <span class="author">Ada Lovelace</span> ·
+ <time datetime="2026-04-15">ARTICLE_PUBLISHED_2026_04_15</time> ·
+ <span>ARTICLE_READ_TIME_7_MIN</span>
+ </div>
+
+ <h2>Why we keep coming back to them</h2>
+ <p>There is a particular pleasure in a test suite that never flakes. Not the
+ dopamine of a green CI run — that is cheap — but the deeper relief of being
+ able to trust the signal. A flake reprograms you to disbelieve your tools.
+ A deterministic suite does the opposite: it rewires you to act on failures
+ immediately, because the only way to get a red is to actually be wrong.</p>
+
+ <p>The hard part is not making a single test deterministic; it is keeping a
+ thousand of them deterministic while the system underneath grows teeth.
+ Time of day leaks in. A remote rate limit fluctuates. A new collaborator
+ commits a timezone assumption. Entropy is patient.</p>
+
+ <h2>What it costs to stay deterministic</h2>
+ <p>The obvious cost is mechanical: mock the clock, seed the RNG, fix the
+ locale, control the DNS, pin every dependency. Each of these has a known
+ pattern and a library or two that usually applies. The less obvious cost
+ is social. Every feature landed near a fragile seam threatens to tighten
+ the seam a little further, and each tightening is visible only later,
+ after the damage.</p>
+
+ <p>Teams that succeed here treat test stability as a first-class product
+ axis. It has owners, budgets, a backlog, and — crucially — a champion who
+ will lie in front of a release to defend it. Teams that do not end up
+ with suites that "mostly pass"; and "mostly pass" is an oxymoron, because
+ a flaky test is already failing.</p>
+
+ <h2>Three habits that help</h2>
+ <p>First, refuse the retry. Retrying a failed test turns a bug signal
+ into a CI convenience. The right move is to fix the underlying race, not
+ to paper over it with three attempts.</p>
+
+ <p>Second, keep the fast suite fast. When the feedback loop gets slow,
+ people stop running it locally; when they stop running it locally, the
+ only place the suite runs is CI, which is exactly where flaky tests are
+ hardest to reproduce.</p>
+
+ <p>Third, write fewer tests, and write them at the right layer. A deep
+ integration test is worth twenty shallow unit tests whose mocks all
+ agree with each other. The mocks are not the system.</p>
+
+ <h2>Closing</h2>
+ <p>A deterministic suite is not a trophy. It is infrastructure. You keep
+ paying to maintain it, and the return is proportional to how much you
+ trust its silence. ARTICLE_WORD_COUNT_MARKER_323</p>
+
+ <div class="tags">
+ <a href="/tag/testing">testing</a>
+ <a href="/tag/engineering">engineering</a>
+ <a href="/tag/culture">culture</a>
+ </div>
+
+ <div class="related">
+ <h3>Related reading</h3>
+ <a href="/posts/the-cost-of-mocks">The Cost of Mocks</a>
+ <a href="/posts/shipping-on-fridays">Shipping on Fridays</a>
+ <a href="/posts/what-continuous-means">What "Continuous" Means</a>
+ </div>
+ </article>
+
+ <footer>
+ © 2026 Ada Lovelace. All rights reserved.
+ <span>FOOTER_COPYRIGHT_MARKER</span>
+ </footer>
+</body>
+</html>
diff --git a/tests/benchmark/fixtures/dropdown.html b/tests/benchmark/fixtures/dropdown.html
new file mode 100644
index 00000000..711327d0
--- /dev/null
+++ b/tests/benchmark/fixtures/dropdown.html
@@ -0,0 +1,92 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>PinchTab Benchmark - Dropdown</title>
+ <style>
+ body { font-family: sans-serif; margin: 20px; }
+ .dropdown { display: inline-block; position: relative; }
+ .dropdown-button {
+ padding: 8px 16px;
+ background: #2196f3;
+ color: white;
+ border: none;
+ border-radius: 4px;
+ cursor: pointer;
+ }
+ .dropdown-menu {
+ position: absolute;
+ top: 100%;
+ left: 0;
+ margin: 4px 0 0;
+ padding: 4px 0;
+ list-style: none;
+ background: white;
+ border: 1px solid #ddd;
+ border-radius: 4px;
+ min-width: 160px;
+ box-shadow: 0 2px 8px rgba(0,0,0,0.08);
+ display: none;
+ }
+ .dropdown[data-open="true"] .dropdown-menu { display: block; }
+ .dropdown-menu li {
+ padding: 8px 16px;
+ cursor: pointer;
+ }
+ .dropdown-menu li:hover { background: #f0f0f0; }
+ #selection { margin-top: 16px; font-family: monospace; }
+ </style>
+</head>
+<body>
+ <h1>Custom Dropdown — VERIFY_DROPDOWN_PAGE_77777</h1>
+
+ <p>A non-native dropdown — a button toggles a menu, and clicking outside
+ dismisses it. Common SPA pattern.</p>
+
+ <div class="dropdown" id="dropdown" data-open="false">
+ <button class="dropdown-button" id="dropdown-toggle"
+ aria-haspopup="menu" aria-expanded="false"
+ aria-controls="dropdown-menu">
+ Choose option ▾
+ </button>
+ <ul class="dropdown-menu" id="dropdown-menu" role="menu">
+ <li role="menuitem" data-value="alpha" tabindex="0">Alpha</li>
+ <li role="menuitem" data-value="beta" tabindex="0">Beta</li>
+ <li role="menuitem" data-value="gamma" tabindex="0">Gamma</li>
+ </ul>
+ </div>
+
+ <div id="selection">DROPDOWN_SELECTED=NONE</div>
+
+ <script>
+ (function () {
+ const dropdown = document.getElementById('dropdown');
+ const toggle = document.getElementById('dropdown-toggle');
+ const menu = document.getElementById('dropdown-menu');
+ const sel = document.getElementById('selection');
+
+ const setOpen = function (open) {
+ dropdown.setAttribute('data-open', open ? 'true' : 'false');
+ toggle.setAttribute('aria-expanded', open ? 'true' : 'false');
+ };
+
+ toggle.addEventListener('click', function (e) {
+ e.stopPropagation();
+ setOpen(dropdown.getAttribute('data-open') !== 'true');
+ });
+
+ menu.addEventListener('click', function (e) {
+ const item = e.target.closest('[role="menuitem"]');
+ if (!item) return;
+ const value = item.getAttribute('data-value') || '';
+ sel.textContent = 'DROPDOWN_SELECTED=' + value.toUpperCase();
+ setOpen(false);
+ });
+
+ document.addEventListener('click', function () {
+ setOpen(false);
+ });
+ })();
+ </script>
+</body>
+</html>
diff --git a/tests/benchmark/fixtures/editor.html b/tests/benchmark/fixtures/editor.html
new file mode 100644
index 00000000..819554a3
--- /dev/null
+++ b/tests/benchmark/fixtures/editor.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>PinchTab Benchmark - Editor</title>
+ <style>
+ body { font-family: sans-serif; margin: 20px; }
+ #editor {
+ border: 1px solid #ccc;
+ min-height: 80px;
+ padding: 12px;
+ border-radius: 4px;
+ margin-bottom: 12px;
+ }
+ #editor:focus { outline: 2px solid #2196f3; }
+ #char-count { font-family: monospace; color: #666; margin-bottom: 8px; }
+ #mirror {
+ font-family: monospace;
+ background: #fafafa;
+ padding: 8px;
+ border-radius: 4px;
+ white-space: pre-wrap;
+ }
+ </style>
+</head>
+<body>
+ <h1>Rich Text — VERIFY_EDITOR_PAGE_44444</h1>
+
+ <p>A <code>contenteditable</code> surface. As you type, the page mirrors
+ its content under the editor so automation can verify what was typed.
+ Press Enter in the editor to commit the current value to
+ <code>#final-text</code>.</p>
+
+ <div id="editor" contenteditable="true" aria-label="Rich text editor"></div>
+ <div id="char-count">EDITOR_CHARS=0</div>
+ <div id="mirror">(empty)</div>
+ <div id="final-text">(no commit yet)</div>
+
+ <script>
+ (function () {
+ const editor = document.getElementById('editor');
+ const count = document.getElementById('char-count');
+ const mirror = document.getElementById('mirror');
+ const finalText = document.getElementById('final-text');
+
+ editor.addEventListener('input', function () {
+ const text = editor.innerText || '';
+ count.textContent = 'EDITOR_CHARS=' + text.length;
+ mirror.textContent = text || '(empty)';
+ });
+
+ editor.addEventListener('keydown', function (e) {
+ if (e.key === 'Enter') {
+ e.preventDefault();
+ const text = editor.innerText || '';
+ finalText.textContent = 'EDITOR_COMMITTED=' + text;
+ }
+ });
+ })();
+ </script>
+</body>
+</html>
diff --git a/tests/benchmark/fixtures/iframe-dynamic.html b/tests/benchmark/fixtures/iframe-dynamic.html
new file mode 100644
index 00000000..62d63041
--- /dev/null
+++ b/tests/benchmark/fixtures/iframe-dynamic.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>PinchTab Benchmark - Dynamic iframe</title>
+</head>
+<body>
+ <h1>Dynamic Iframe — VERIFY_IFRAME_DYNAMIC_OUTER</h1>
+ <p>The iframe is added to the DOM ~1.2 s after load. Agents that snapshot
+ immediately will not see it; they need to wait or re-snapshot.</p>
+
+ <div id="slot">IFRAME_SLOT_EMPTY</div>
+
+ <script>
+ setTimeout(function () {
+ const slot = document.getElementById('slot');
+ slot.textContent = '';
+ const frame = document.createElement('iframe');
+ frame.id = 'late-frame';
+ frame.src = 'iframe-content.html';
+ frame.width = '500';
+ frame.height = '300';
+ slot.appendChild(frame);
+ const marker = document.createElement('div');
+ marker.id = 'late-marker';
+ marker.textContent = 'IFRAME_DYNAMIC_ATTACHED';
+ slot.appendChild(marker);
+ }, 1200);
+ </script>
+</body>
+</html>
diff --git a/tests/benchmark/fixtures/iframe-nested-2.html b/tests/benchmark/fixtures/iframe-nested-2.html
new file mode 100644
index 00000000..af8f5c74
--- /dev/null
+++ b/tests/benchmark/fixtures/iframe-nested-2.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>Nested Level 2</title>
+</head>
+<body>
+ <h2>Level 2 — VERIFY_IFRAME_NESTED_L2</h2>
+ <iframe id="level-3" src="iframe-nested-3.html" width="400" height="200"></iframe>
+</body>
+</html>
diff --git a/tests/benchmark/fixtures/iframe-nested-3.html b/tests/benchmark/fixtures/iframe-nested-3.html
new file mode 100644
index 00000000..ea7887fe
--- /dev/null
+++ b/tests/benchmark/fixtures/iframe-nested-3.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>Nested Level 3</title>
+</head>
+<body>
+ <h3>Level 3 — VERIFY_IFRAME_NESTED_L3</h3>
+ <button type="button" id="deep-button">Click me</button>
+ <div id="deep-result">DEEP_CLICKED=NO</div>
+ <script>
+ document.getElementById('deep-button').addEventListener('click', function () {
+ document.getElementById('deep-result').textContent = 'DEEP_CLICKED=YES_LEVEL_3';
+ });
+ </script>
+</body>
+</html>
diff --git a/tests/benchmark/fixtures/iframe-nested.html b/tests/benchmark/fixtures/iframe-nested.html
new file mode 100644
index 00000000..d9c634f2
--- /dev/null
+++ b/tests/benchmark/fixtures/iframe-nested.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>PinchTab Benchmark - Nested iframes</title>
+</head>
+<body>
+ <h1>Nested Iframes — VERIFY_IFRAME_NESTED_OUTER</h1>
+ <p>Depth 1: this page. Depth 2: <code>#level-2</code>. Depth 3: <code>#level-3</code> inside level 2.</p>
+ <iframe id="level-2" src="iframe-nested-2.html" width="500" height="300"></iframe>
+</body>
+</html>
diff --git a/tests/benchmark/fixtures/iframe-sandbox-content.html b/tests/benchmark/fixtures/iframe-sandbox-content.html
new file mode 100644
index 00000000..3838b3bb
--- /dev/null
+++ b/tests/benchmark/fixtures/iframe-sandbox-content.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>Sandbox Inner</title>
+</head>
+<body>
+ <h2>Sandbox Inner — IFRAME_SANDBOX_INNER_LOADED</h2>
+ <button type="button" id="sandbox-button">Tap</button>
+ <div id="sandbox-result">SANDBOX_CLICKED=NO</div>
+ <script>
+ document.getElementById('sandbox-button').addEventListener('click', function () {
+ document.getElementById('sandbox-result').textContent = 'SANDBOX_CLICKED=YES';
+ });
+ </script>
+</body>
+</html>
diff --git a/tests/benchmark/fixtures/iframe-sandbox.html b/tests/benchmark/fixtures/iframe-sandbox.html
new file mode 100644
index 00000000..091fcf67
--- /dev/null
+++ b/tests/benchmark/fixtures/iframe-sandbox.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>PinchTab Benchmark - sandboxed iframe</title>
+</head>
+<body>
+ <h1>Sandboxed Iframe — VERIFY_IFRAME_SANDBOX_OUTER</h1>
+ <p>This iframe has <code>sandbox="allow-scripts allow-same-origin"</code>
+ — scripts run, same-origin policy inherits, but no form submissions or
+ top-navigation. Useful to verify actions work under restrictive sandboxes.</p>
+
+ <iframe id="sandboxed" src="iframe-sandbox-content.html"
+ sandbox="allow-scripts allow-same-origin"
+ width="500" height="240"></iframe>
+</body>
+</html>
diff --git a/tests/benchmark/fixtures/iframe-srcdoc.html b/tests/benchmark/fixtures/iframe-srcdoc.html
new file mode 100644
index 00000000..9d296553
--- /dev/null
+++ b/tests/benchmark/fixtures/iframe-srcdoc.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>PinchTab Benchmark - srcdoc iframe</title>
+</head>
+<body>
+ <h1>srcdoc Iframe — VERIFY_IFRAME_SRCDOC_OUTER</h1>
+ <p>This iframe has no <code>src</code>; its content is provided inline
+ via the <code>srcdoc</code> attribute. Same-origin (considered to inherit
+ the parent's origin).</p>
+
+ <iframe id="srcdoc-frame" width="500" height="200" srcdoc='
+ <!DOCTYPE html>
+ <html>
+ <body>
+ <h2>Srcdoc Inner — IFRAME_SRCDOC_INNER_LOADED</h2>
+ <input id="inline-input" type="text">
+ <button type="button" id="inline-submit">OK</button>
+ <div id="inline-result">INLINE_RESULT_PENDING</div>
+ <script>
+ document.getElementById("inline-submit").addEventListener("click", function() {
+ const v = document.getElementById("inline-input").value;
+ document.getElementById("inline-result").textContent = "INLINE_RECEIVED_" + (v || "EMPTY").toUpperCase();
+ });
+ </script>
+ </body>
+ </html>
+ '></iframe>
+</body>
+</html>
diff --git a/tests/benchmark/fixtures/keyboard.html b/tests/benchmark/fixtures/keyboard.html
new file mode 100644
index 00000000..bf1c045d
--- /dev/null
+++ b/tests/benchmark/fixtures/keyboard.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>PinchTab Benchmark - Keyboard</title>
+ <style>
+ body { font-family: sans-serif; margin: 20px; }
+ #log { margin-top: 20px; font-family: monospace; white-space: pre-wrap; }
+ .hint { color: #666; }
+ </style>
+</head>
+<body>
+ <h1>Keyboard Events — VERIFY_KEYBOARD_PAGE_22222</h1>
+
+ <p class="hint">Press Escape, 'a', or Enter to emit a verification marker.
+ The page focuses its body on load so the listener captures keypresses
+ without needing a specific input element.</p>
+
+ <input id="focus-input" aria-label="focus me to receive keys">
+
+ <div id="log"></div>
+
+ <script>
+ (function () {
+ const log = document.getElementById('log');
+ const append = function (marker) {
+ log.textContent += marker + '\n';
+ };
+ // Focus the input so keyboard events land predictably.
+ document.getElementById('focus-input').focus();
+ window.addEventListener('keydown', function (e) {
+ if (e.key === 'Escape') {
+ append('KEYBOARD_ESCAPE_PRESSED');
+ } else if (e.key === 'a' || e.key === 'A') {
+ append('KEYBOARD_KEY_A_PRESSED');
+ } else if (e.key === 'Enter') {
+ append('KEYBOARD_ENTER_PRESSED');
+ }
+ });
+ })();
+ </script>
+</body>
+</html>
diff --git a/tests/benchmark/fixtures/loading.html b/tests/benchmark/fixtures/loading.html
new file mode 100644
index 00000000..a9925cb7
--- /dev/null
+++ b/tests/benchmark/fixtures/loading.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>PinchTab Benchmark - Loading</title>
+ <style>
+ body { font-family: sans-serif; margin: 20px; }
+ #spinner {
+ display: inline-block;
+ width: 24px; height: 24px;
+ border: 3px solid #ccc;
+ border-top-color: #333;
+ border-radius: 50%;
+ animation: spin 0.8s linear infinite;
+ vertical-align: middle;
+ margin-right: 8px;
+ }
+ @keyframes spin { to { transform: rotate(360deg); } }
+ #status { font-size: 18px; }
+ #content {
+ margin-top: 20px;
+ padding: 16px;
+ background: #e8f5e9;
+ border: 1px solid #4caf50;
+ border-radius: 4px;
+ display: none;
+ }
+ #content.ready { display: block; }
+ </style>
+</head>
+<body>
+ <h1>Loading State — VERIFY_LOADING_PAGE_11111</h1>
+
+ <p>Page starts with a spinner; the payload arrives ~1.5 s later. Agents
+ should wait for the final marker rather than snapshotting immediately.</p>
+
+ <div id="status"><span id="spinner"></span>Loading...</div>
+
+ <div id="content"></div>
+
+ <script>
+ (function () {
+ const status = document.getElementById('status');
+ const content = document.getElementById('content');
+ setTimeout(function () {
+ status.textContent = 'Ready';
+ content.textContent = 'VERIFY_LOADING_COMPLETE_88888';
+ content.classList.add('ready');
+ }, 1500);
+ })();
+ </script>
+</body>
+</html>
diff --git a/tests/benchmark/fixtures/pagination.html b/tests/benchmark/fixtures/pagination.html
new file mode 100644
index 00000000..84b6aec8
--- /dev/null
+++ b/tests/benchmark/fixtures/pagination.html
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>PinchTab Benchmark - Pagination</title>
+ <style>
+ body { font-family: sans-serif; margin: 20px; }
+ #items { list-style: decimal; padding-left: 24px; }
+ #controls { margin-top: 16px; display: flex; gap: 8px; align-items: center; }
+ button { padding: 6px 12px; cursor: pointer; }
+ button[disabled] { opacity: 0.5; cursor: not-allowed; }
+ #page-info { font-family: monospace; }
+ </style>
+</head>
+<body>
+ <h1>Pagination — VERIFY_PAGINATION_PAGE_88888</h1>
+
+ <p>3 pages of 5 items each. Use Prev / Next to navigate. The first item
+ on each page emits a verification marker.</p>
+
+ <ol id="items"></ol>
+
+ <div id="controls">
+ <button id="prev-btn" disabled>Prev</button>
+ <button id="next-btn">Next</button>
+ <span id="page-info">PAGE_1_OF_3</span>
+ </div>
+
+ <script>
+ (function () {
+ const PER_PAGE = 5;
+ const TOTAL = 15;
+ const list = document.getElementById('items');
+ const prev = document.getElementById('prev-btn');
+ const next = document.getElementById('next-btn');
+ const info = document.getElementById('page-info');
+ let page = 1;
+ const pages = Math.ceil(TOTAL / PER_PAGE);
+
+ function render() {
+ list.innerHTML = '';
+ const start = (page - 1) * PER_PAGE;
+ for (let i = 0; i < PER_PAGE; i++) {
+ const li = document.createElement('li');
+ const idx = start + i + 1;
+ if (idx > TOTAL) break;
+ // First item on each page carries a verification marker so tests
+ // can confirm the right slice rendered without parsing all 5.
+ if (i === 0) {
+ li.textContent = 'PAGE_' + page + '_FIRST_ITEM (item ' + idx + ' of ' + TOTAL + ')';
+ } else {
+ li.textContent = 'item ' + idx;
+ }
+ list.appendChild(li);
+ }
+ info.textContent = 'PAGE_' + page + '_OF_' + pages;
+ prev.disabled = page === 1;
+ next.disabled = page === pages;
+ }
+
+ prev.addEventListener('click', function () { if (page > 1) { page--; render(); } });
+ next.addEventListener('click', function () { if (page < pages) { page++; render(); } });
+
+ render();
+ })();
+ </script>
+</body>
+</html>
diff --git a/tests/benchmark/fixtures/pricing.html b/tests/benchmark/fixtures/pricing.html
new file mode 100644
index 00000000..18520ca1
--- /dev/null
+++ b/tests/benchmark/fixtures/pricing.html
@@ -0,0 +1,84 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>Pricing - PinchTab Benchmark</title>
+ <style>
+ body { font-family: -apple-system, Arial, sans-serif; margin: 20px; color: #1a1a1a; max-width: 980px; }
+ h1 { margin-bottom: 8px; }
+ .plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 24px; }
+ .plan { border: 1px solid #e0e0e0; border-radius: 8px; padding: 24px; display: flex; flex-direction: column; }
+ .plan.featured { border-color: #2563eb; box-shadow: 0 2px 8px rgba(37,99,235,0.1); }
+ .plan h2 { margin: 0 0 8px; font-size: 20px; }
+ .plan .price { font-size: 36px; font-weight: bold; margin: 8px 0; }
+ .plan .price small { font-size: 14px; font-weight: normal; color: #666; }
+ .plan ul { list-style: none; padding: 0; margin: 16px 0; flex: 1; }
+ .plan li { padding: 6px 0; border-bottom: 1px dashed #eee; font-size: 14px; }
+ .plan li.no { color: #999; text-decoration: line-through; }
+ button { padding: 10px; background: #2563eb; color: white; border: none; border-radius: 4px; font-weight: bold; cursor: pointer; }
+ .plan.featured .tag { display: inline-block; background: #2563eb; color: white; padding: 2px 8px; border-radius: 4px; font-size: 12px; margin-bottom: 8px; }
+ </style>
+</head>
+<body>
+ <h1>Pricing — VERIFY_PRICING_PAGE_30303</h1>
+ <p>Simple, transparent pricing. Switch plans or cancel any time.</p>
+
+ <div class="plans">
+ <div class="plan" id="plan-free">
+ <h2>Free</h2>
+ <div class="price">
+ <span>PLAN_FREE_PRICE_0</span>
+ <small>/month</small>
+ </div>
+ <ul>
+ <li>PLAN_FREE_LIMIT_50_requests per day</li>
+ <li>1 project</li>
+ <li>Community support</li>
+ <li class="no">Custom domains</li>
+ <li class="no">Priority queue</li>
+ <li class="no">SSO</li>
+ </ul>
+ <button type="button">Get started</button>
+ </div>
+
+ <div class="plan featured" id="plan-pro">
+ <span class="tag">Most popular</span>
+ <h2>Pro</h2>
+ <div class="price">
+ <span>PLAN_PRO_PRICE_29</span>
+ <small>/month</small>
+ </div>
+ <ul>
+ <li>PLAN_PRO_LIMIT_5000_requests per day</li>
+ <li>10 projects</li>
+ <li>Email support, 24h SLA</li>
+ <li>Custom domains</li>
+ <li>Priority queue</li>
+ <li class="no">SSO</li>
+ </ul>
+ <button type="button">Upgrade to Pro</button>
+ </div>
+
+ <div class="plan" id="plan-enterprise">
+ <h2>Enterprise</h2>
+ <div class="price">
+ <span>PLAN_ENTERPRISE_PRICE_CUSTOM</span>
+ <small>/month</small>
+ </div>
+ <ul>
+ <li>PLAN_ENTERPRISE_LIMIT_UNLIMITED</li>
+ <li>Unlimited projects</li>
+ <li>Dedicated CSM, 1h SLA</li>
+ <li>Custom domains</li>
+ <li>Priority queue</li>
+ <li>SSO (SAML, OIDC)</li>
+ </ul>
+ <button type="button">Contact sales</button>
+ </div>
+ </div>
+
+ <footer style="margin-top: 48px; color: #666; font-size: 14px;">
+ All prices in USD. Annual billing saves 20%. PRICING_FOOTER_MARKER.
+ </footer>
+</body>
+</html>
diff --git a/tests/benchmark/fixtures/qa.html b/tests/benchmark/fixtures/qa.html
new file mode 100644
index 00000000..dca1dac4
--- /dev/null
+++ b/tests/benchmark/fixtures/qa.html
@@ -0,0 +1,103 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>Q&A - How do I make my browser tests deterministic?</title>
+ <style>
+ body { font-family: -apple-system, Arial, sans-serif; margin: 20px; max-width: 780px; color: #232629; }
+ .question, .answer { border-bottom: 1px solid #d6d9dc; padding: 16px 0; display: flex; gap: 16px; }
+ .votes { text-align: center; min-width: 50px; color: #6a737c; font-size: 17px; }
+ .votes .score { font-size: 20px; font-weight: bold; color: #232629; }
+ .body { flex: 1; }
+ .body h2 { margin: 0 0 10px; font-size: 22px; }
+ .meta { color: #6a737c; font-size: 13px; margin-top: 12px; }
+ .tag { background: #e1ecf4; color: #39739d; padding: 3px 6px; border-radius: 3px; font-size: 12px; text-decoration: none; margin-right: 4px; }
+ .accepted-mark { color: #5eba7d; font-size: 24px; vertical-align: middle; }
+ #answer-list h3 { margin-top: 24px; }
+ </style>
+</head>
+<body>
+ <h1>Q&amp;A — VERIFY_QA_PAGE_72000</h1>
+
+ <div class="question">
+ <div class="votes">
+ <div class="score">47</div>
+ <div>votes</div>
+ </div>
+ <div class="body">
+ <h2>How do I make my browser-based tests deterministic? — QUESTION_TITLE_MARKER</h2>
+ <p>I have a Playwright suite of about 800 tests. Roughly 1-2% fail on any
+ given CI run, but the same tests rarely fail twice. My team is exhausted
+ from re-running. What are the highest-leverage things I can do to
+ convert the suite from "mostly passes" to "always passes or really
+ failing"?</p>
+ <div class="meta">
+ Asked 3 hours ago by <span>alex</span> ·
+ <a class="tag" href="#">testing</a>
+ <a class="tag" href="#">playwright</a>
+ <a class="tag" href="#">ci</a>
+ </div>
+ </div>
+ </div>
+
+ <section id="answer-list">
+ <h3>3 Answers</h3>
+
+ <div class="answer" id="a-1">
+ <div class="votes">
+ <div class="score">8</div>
+ <div>votes</div>
+ </div>
+ <div class="body">
+ <p>Quick wins: freeze the clock with <code>sinon.useFakeTimers()</code>
+ or the Playwright clock API, seed any RNG, and pin timezone to UTC in
+ your test runner's env. That typically knocks out half of the
+ incidental flakes. ANSWER_1_BODY_MARKER</p>
+ <div class="meta">
+ Answered 2 hours ago by <span>mike</span>
+ </div>
+ </div>
+ </div>
+
+ <div class="answer" id="a-2" data-accepted="true">
+ <div class="votes">
+ <span class="accepted-mark" title="Accepted answer">✓</span>
+ <div class="score">123</div>
+ <div>votes</div>
+ <div>ACCEPTED_ANSWER_ID_A2</div>
+ </div>
+ <div class="body">
+ <p>The tactical mitigations matter, but the structural issue is almost
+ always <strong>test isolation</strong>. Before you fix the clock or
+ the RNG, audit how much state leaks between tests — cookies,
+ localStorage, in-memory caches in your test server, shared user rows
+ in the database. Most "flaky" suites are actually order-dependent
+ suites that happen to pass in the common ordering.</p>
+ <p>Concretely: run your suite with <code>--shuffle</code> or
+ equivalent and watch what happens. If the failure rate goes up,
+ that's your work list, in priority order. If it stays flat, you have
+ a non-determinism problem (clock, RNG, network), which is the easier
+ fix. ANSWER_2_BODY_MARKER</p>
+ <div class="meta">
+ Answered 2 hours ago by <span>grace</span> ·
+ <strong>accepted</strong>
+ </div>
+ </div>
+ </div>
+
+ <div class="answer" id="a-3">
+ <div class="votes">
+ <div class="score">3</div>
+ <div>votes</div>
+ </div>
+ <div class="body">
+ <p>Retry the failures in CI. You will be happier. (This is facetious
+ but I have seen teams survive on it.) ANSWER_3_BODY_MARKER</p>
+ <div class="meta">
+ Answered 1 hour ago by <span>kent</span>
+ </div>
+ </div>
+ </div>
+ </section>
+</body>
+</html>
diff --git a/tests/benchmark/fixtures/range.html b/tests/benchmark/fixtures/range.html
new file mode 100644
index 00000000..2c3ad986
--- /dev/null
+++ b/tests/benchmark/fixtures/range.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>PinchTab Benchmark - Range</title>
+ <style>
+ body { font-family: sans-serif; margin: 20px; }
+ label { display: block; margin-bottom: 8px; }
+ input[type="range"] { width: 400px; }
+ #value-display { font-family: monospace; margin-top: 12px; }
+ </style>
+</head>
+<body>
+ <h1>Range Slider — VERIFY_RANGE_PAGE_99999</h1>
+
+ <p>Native <code>&lt;input type="range"&gt;</code>. Automation can set its
+ value via <code>fill</code> and the page echoes the current value plus a
+ discrete bucket marker.</p>
+
+ <label for="volume">Volume: <span id="volume-out">50</span>/100</label>
+ <input type="range" id="volume" min="0" max="100" step="1" value="50">
+
+ <div id="value-display">RANGE_VALUE_50 — BUCKET_MEDIUM</div>
+
+ <script>
+ (function () {
+ const slider = document.getElementById('volume');
+ const out = document.getElementById('volume-out');
+ const display = document.getElementById('value-display');
+ const update = function () {
+ const v = Number(slider.value);
+ out.textContent = v;
+ let bucket = 'MEDIUM';
+ if (v <= 25) bucket = 'LOW';
+ else if (v >= 75) bucket = 'HIGH';
+ display.textContent = 'RANGE_VALUE_' + v + ' — BUCKET_' + bucket;
+ };
+ slider.addEventListener('input', update);
+ slider.addEventListener('change', update);
+ })();
+ </script>
+</body>
+</html>
diff --git a/tests/benchmark/fixtures/serp.html b/tests/benchmark/fixtures/serp.html
new file mode 100644
index 00000000..f95e0685
--- /dev/null
+++ b/tests/benchmark/fixtures/serp.html
@@ -0,0 +1,94 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>Search Results - PinchTab Benchmark</title>
+ <style>
+ body { font-family: -apple-system, Arial, sans-serif; margin: 20px; color: #202124; max-width: 700px; }
+ header { margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid #dadce0; }
+ #query { font-size: 24px; font-weight: 400; }
+ .result { margin-bottom: 28px; }
+ .result .url { color: #006621; font-size: 14px; }
+ .result .title { color: #1a0dab; font-size: 20px; font-weight: 400; text-decoration: none; display: block; margin: 2px 0; }
+ .result .title:visited { color: #660099; }
+ .result .snippet { color: #4d5156; font-size: 14px; line-height: 1.5; }
+ .result .meta { color: #70757a; font-size: 13px; margin-top: 4px; }
+ em { font-style: normal; font-weight: bold; }
+ #pagination { margin-top: 32px; color: #70757a; }
+ </style>
+</head>
+<body>
+ <header>
+ <div id="query">Search results for: <strong>deterministic testing</strong></div>
+ <div id="meta">SERP_PAGE_MARKER_88044 · About 184,000 results (0.29 seconds)</div>
+ </header>
+
+ <div class="result" id="r-1">
+ <div class="url">example.com/blog/deterministic-tests</div>
+ <a class="title" href="#">The Quiet Power of Deterministic Tests — RESULT_1_TITLE</a>
+ <div class="snippet">
+ There is a particular pleasure in a test suite that never flakes. Not the
+ dopamine of a green CI run — that is cheap — but the deeper relief of
+ being able to trust the signal. RESULT_1_SNIPPET_MARKER
+ </div>
+ <div class="meta">Ada Lovelace · Apr 15, 2026 · 7 min read</div>
+ </div>
+
+ <div class="result" id="r-2">
+ <div class="url">reliability.io/articles/flake-hunting</div>
+ <a class="title" href="#">Hunting Flakes in a Large Monorepo — RESULT_2_TITLE</a>
+ <div class="snippet">
+ We instrumented our CI pipeline to catalogue every re-run and found that
+ four underlying races explained 80% of the noise. Here's the taxonomy we
+ ended up with. RESULT_2_SNIPPET_MARKER
+ </div>
+ <div class="meta">Grace Hopper · Mar 02, 2026 · 11 min read</div>
+ </div>
+
+ <div class="result" id="r-3">
+ <div class="url">testguide.dev/patterns/seeded-rng</div>
+ <a class="title" href="#">Seeded RNGs: The First Quick Win — RESULT_3_TITLE</a>
+ <div class="snippet">
+ Of all the mitigations for non-determinism, replacing <em>Math.random</em>
+ with a seeded PRNG is the cheapest and most immediately satisfying. A
+ walkthrough in three frameworks. RESULT_3_SNIPPET_MARKER
+ </div>
+ <div class="meta">Alan Turing · Feb 19, 2026 · 5 min read</div>
+ </div>
+
+ <div class="result" id="r-4">
+ <div class="url">news.example/2026/mocks-were-a-mistake</div>
+ <a class="title" href="#">Mocks Were a Mistake — RESULT_4_TITLE</a>
+ <div class="snippet">
+ A contrarian take. After five years of integration-first testing, we
+ rolled back 90% of our unit-level mocks and found the suite actually
+ got faster — and truer. RESULT_4_SNIPPET_MARKER
+ </div>
+ <div class="meta">Katherine Johnson · Jan 28, 2026 · 9 min read</div>
+ </div>
+
+ <div class="result" id="r-5">
+ <div class="url">ops.example.com/docs/test-isolation</div>
+ <a class="title" href="#">Test Isolation at Scale — RESULT_5_TITLE</a>
+ <div class="snippet">
+ Isolation is cheap in the small and expensive in the large. The transition
+ happens around a few hundred tests. This post describes the signs and
+ four transition strategies. RESULT_5_SNIPPET_MARKER
+ </div>
+ <div class="meta">Margaret Hamilton · Jan 11, 2026 · 14 min read</div>
+ </div>
+
+ <div class="result" id="r-6">
+ <div class="url">seam.blog/frozen-clocks</div>
+ <a class="title" href="#">On Frozen Clocks and Libraries That Lie — RESULT_6_TITLE</a>
+ <div class="snippet">
+ Not every clock library is honest about what "now" means under test. A
+ short catalogue of the three most common traps and the simple pattern
+ that defuses them. RESULT_6_SNIPPET_MARKER
+ </div>
+ <div class="meta">Hedy Lamarr · Dec 04, 2025 · 6 min read</div>
+ </div>
+
+ <div id="pagination">SERP_RESULT_COUNT_6 — Page 1 of 21</div>
+</body>
+</html>
diff --git a/tests/benchmark/fixtures/tabs.html b/tests/benchmark/fixtures/tabs.html
new file mode 100644
index 00000000..13484fdb
--- /dev/null
+++ b/tests/benchmark/fixtures/tabs.html
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>PinchTab Benchmark - Tabs</title>
+ <style>
+ body { font-family: sans-serif; margin: 20px; }
+ [role="tablist"] { display: flex; border-bottom: 2px solid #ddd; margin-bottom: 12px; }
+ [role="tab"] {
+ background: #f5f5f5;
+ border: 1px solid #ddd;
+ border-bottom: none;
+ padding: 8px 16px;
+ cursor: pointer;
+ font-size: 14px;
+ }
+ [role="tab"][aria-selected="true"] {
+ background: #fff;
+ border-bottom: 2px solid #fff;
+ margin-bottom: -2px;
+ font-weight: bold;
+ }
+ [role="tabpanel"][hidden] { display: none; }
+ [role="tabpanel"] {
+ padding: 16px;
+ background: #fafafa;
+ border-radius: 4px;
+ }
+ </style>
+</head>
+<body>
+ <h1>Tab Panels — VERIFY_TABS_PAGE_55555</h1>
+
+ <div role="tablist" aria-label="Profile sections">
+ <button role="tab" id="tab-profile" aria-selected="true" aria-controls="panel-profile">Profile</button>
+ <button role="tab" id="tab-settings" aria-selected="false" aria-controls="panel-settings">Settings</button>
+ <button role="tab" id="tab-billing" aria-selected="false" aria-controls="panel-billing">Billing</button>
+ </div>
+
+ <div role="tabpanel" id="panel-profile" aria-labelledby="tab-profile">
+ TAB_PROFILE_CONTENT — Name: Ada Lovelace; member since 1843.
+ </div>
+ <div role="tabpanel" id="panel-settings" aria-labelledby="tab-settings" hidden>
+ TAB_SETTINGS_CONTENT — Notification frequency: weekly.
+ </div>
+ <div role="tabpanel" id="panel-billing" aria-labelledby="tab-billing" hidden>
+ TAB_BILLING_CONTENT — Next invoice: $49.00 on the 1st.
+ </div>
+
+ <script>
+ (function () {
+ const tabs = Array.from(document.querySelectorAll('[role="tab"]'));
+ const panels = Array.from(document.querySelectorAll('[role="tabpanel"]'));
+ tabs.forEach(function (tab) {
+ tab.addEventListener('click', function () {
+ tabs.forEach(function (t) { t.setAttribute('aria-selected', t === tab ? 'true' : 'false'); });
+ panels.forEach(function (p) {
+ if (p.id === tab.getAttribute('aria-controls')) { p.removeAttribute('hidden'); }
+ else { p.setAttribute('hidden', ''); }
+ });
+ });
+ });
+ })();
+ </script>
+</body>
+</html>
diff --git a/tests/benchmark/scripts/baseline_all.sh b/tests/benchmark/scripts/baseline_all.sh
new file mode 100755
index 00000000..20ec6e8f
--- /dev/null
+++ b/tests/benchmark/scripts/baseline_all.sh
@@ -0,0 +1,391 @@
+#!/usr/bin/env bash
+# Runs every baseline task against the running PinchTab container and records
+# each step into the most recent baseline_*.json report (see run-optimization.sh).
+#
+# Prerequisites:
+# - `bash scripts/run-optimization.sh` has been run first (initializes the
+# empty baseline_*.json this script appends into).
+# - Docker compose stack is up and healthy at http://localhost:9867.
+#
+# Exit code is 0 if every step recorded (pass or fail); non-zero on
+# infrastructure error. Individual step failures still return 0 — inspect
+# the report JSON for the `steps_failed` count.
+
+set -u
+
+cd "$(dirname "${BASH_SOURCE[0]}")/.."
+
+AUTH="Authorization: Bearer benchmark-token"
+BASE="http://localhost:9867"
+REC() { ./scripts/record-step.sh --type baseline "$@" > /dev/null; }
+NAV() { curl -sf -X POST "$BASE/navigate" -H "$AUTH" -H "Content-Type: application/json" -d "{\"tabId\":\"$T\",\"url\":\"$1\"}" > /dev/null; }
+SNAP() { curl -sf "$BASE/tabs/$T/snapshot?format=compact&maxTokens=${2:-1500}" -H "$AUTH"; }
+ACT() { curl -sf -X POST "$BASE/tabs/$T/action" -H "$AUTH" -H "Content-Type: application/json" -d "$1"; }
+EV() { curl -sf -X POST "$BASE/tabs/$T/evaluate" -H "$AUTH" -H "Content-Type: application/json" -d "$1"; }
+
+# Group 0 — setup
+R=$(curl -sf "$BASE/health" -H "$AUTH"); echo "$R" | grep -q '"ok"' && REC 0 1 pass "ok" || REC 0 1 fail "health"
+HTTP=$(curl -s -o /dev/null -w "%{http_code}" "$BASE/health"); [ "$HTTP" = "401" ] && REC 0 2 pass "401" || REC 0 2 fail "$HTTP"
+HTTP=$(curl -s -o /dev/null -w "%{http_code}" "$BASE/health" -H "$AUTH"); [ "$HTTP" = "200" ] && REC 0 3 pass "200" || REC 0 3 fail "$HTTP"
+R=$(curl -sf "$BASE/health" -H "$AUTH"); echo "$R" | grep -q '"running"' && REC 0 4 pass "running" || REC 0 4 fail "not running"
+R=$(curl -sf "$BASE/tabs" -H "$AUTH"); echo "$R" | grep -q '\[' && REC 0 5 pass "array" || REC 0 5 fail "not array"
+TABS=$(echo "$R" | jq -r '.[].id' 2>/dev/null || true)
+if [ -n "$TABS" ]; then for TID in $TABS; do curl -sf -X POST "$BASE/tabs/$TID/close" -H "$AUTH" > /dev/null 2>&1 || true; done; fi
+REC 0 6 pass "cleaned"
+R=$(curl -sf -X POST "$BASE/navigate" -H "$AUTH" -H "Content-Type: application/json" -d '{"url":"http://fixtures/"}')
+T=$(echo "$R" | jq -r .tabId)
+S=$(curl -sf "$BASE/tabs/$T/snapshot?format=compact&maxTokens=500" -H "$AUTH"); echo "$S" | grep -q "VERIFY_HOME_LOADED_12345" && REC 0 7 pass "home" || REC 0 7 fail "miss home"
+R=$(curl -sf "$BASE/tabs" -H "$AUTH"); echo "$R" | grep -q "$T" && REC 0 8 pass "listed" || REC 0 8 fail "not in list"
+
+# Group 1
+NAV "http://fixtures/wiki.html"; S=$(SNAP "" 1500)
+echo "$S" | grep -q "VERIFY_WIKI_INDEX_55555" && echo "$S" | grep -q "COUNT_LANGUAGES_12" && REC 1 1 pass "wiki" || REC 1 1 fail "miss"
+R=$(ACT '{"kind":"click","selector":"#link-go","waitNav":true}'); echo "$R" | grep -q '"success":true' && REC 1 2 pass "click" || REC 1 2 fail "miss"
+S=$(SNAP "" 2000); echo "$S" | grep -q "VERIFY_WIKI_GO_LANG_88888" && REC 1 3 pass "go" || REC 1 3 fail "miss"
+echo "$S" | grep -q "FEATURE_COUNT_6" && REC 1 4 pass "6" || REC 1 4 fail "miss"
+NAV "http://fixtures/articles.html"; S=$(SNAP "" 2000); echo "$S" | grep -q "Artificial Intelligence" && REC 1 5 pass "heads" || REC 1 5 fail "miss"
+NAV "http://fixtures/dashboard.html"; S=$(SNAP "" 2000); echo "$S" | grep -q '1,284,930' && REC 1 6 pass "metrics" || REC 1 6 fail "miss"
+
+# Group 2
+NAV "http://fixtures/wiki.html"; ACT '{"kind":"fill","selector":"#wiki-search-input","text":"golang"}' > /dev/null
+ACT '{"kind":"click","selector":"#wiki-search-btn","waitNav":true}' > /dev/null
+S=$(SNAP "" 2000); echo "$S" | grep -q "VERIFY_WIKI_GO_LANG_88888" && REC 2 1 pass "search" || REC 2 1 fail "miss"
+NAV "http://fixtures/search.html"; ACT '{"kind":"fill","selector":"#search-input","text":"xyznonexistent"}' > /dev/null
+ACT '{"kind":"click","selector":"#search-btn"}' > /dev/null; REC 2 2 pass "no-res"
+NAV "http://fixtures/search.html"; ACT '{"kind":"fill","selector":"#search-input","text":"artificial intelligence"}' > /dev/null
+ACT '{"kind":"click","selector":"#search-btn"}' > /dev/null
+S=$(SNAP "" 1000); echo "$S" | grep -q "Artificial Intelligence" && REC 2 3 pass "ai" || REC 2 3 fail "miss"
+
+# Group 3
+NAV "http://fixtures/form.html"
+ACT '{"kind":"fill","selector":"#fullname","text":"John Benchmark"}' > /dev/null
+ACT '{"kind":"fill","selector":"#email","text":"[email protected]"}' > /dev/null
+ACT '{"kind":"fill","selector":"#phone","text":"+44 20 1234 5678"}' > /dev/null
+ACT '{"kind":"select","selector":"#country","value":"uk"}' > /dev/null
+ACT '{"kind":"select","selector":"#subject","value":"support"}' > /dev/null
+ACT '{"kind":"fill","selector":"#message","text":"This is a benchmark test message."}' > /dev/null
+ACT '{"kind":"click","selector":"#newsletter"}' > /dev/null
+ACT '{"kind":"click","selector":"input[name=priority][value=high]"}' > /dev/null
+ACT '{"kind":"click","selector":"#submit-btn"}' > /dev/null
+S=$(SNAP "" 1000); echo "$S" | grep -q "VERIFY_FORM_SUBMITTED_SUCCESS" && REC 3 1 pass "form" || REC 3 1 fail "miss"
+curl -sf "$BASE/tabs/$T/snapshot?filter=interactive&format=compact" -H "$AUTH" > /dev/null; REC 3 2 pass "interactive"
+
+# Group 4
+NAV "http://fixtures/spa.html?reset=1"; S=$(SNAP "" 1500); echo "$S" | grep -q "TASK_STATS_TOTAL_3" && REC 4 1 pass "spa" || REC 4 1 fail "miss"
+ACT '{"kind":"fill","selector":"#new-task-input","text":"Deploy to production"}' > /dev/null
+ACT '{"kind":"select","selector":"#priority-select","value":"high"}' > /dev/null
+ACT '{"kind":"click","selector":"#add-task-btn"}' > /dev/null
+S=$(SNAP "" 1500); echo "$S" | grep -q "TASK_ADDED" && REC 4 2 pass "add" || REC 4 2 fail "miss"
+ACT '{"kind":"click","selector":"#task-1 .delete-task"}' > /dev/null; REC 4 3 pass "del"
+
+# Group 5
+NAV "http://fixtures/login.html"
+ACT '{"kind":"fill","selector":"#username","text":"baduser"}' > /dev/null
+ACT '{"kind":"fill","selector":"#password","text":"wrongpassword"}' > /dev/null
+ACT '{"kind":"click","selector":"#login-btn"}' > /dev/null
+S=$(SNAP "" 500); echo "$S" | grep -q "INVALID_CREDENTIALS_ERROR" && REC 5 1 pass "bad" || REC 5 1 fail "miss"
+ACT '{"kind":"fill","selector":"#username","text":"benchmark"}' > /dev/null
+ACT '{"kind":"fill","selector":"#password","text":"test456"}' > /dev/null
+ACT '{"kind":"click","selector":"#login-btn"}' > /dev/null
+S=$(SNAP "" 500); echo "$S" | grep -q "VERIFY_LOGIN_SUCCESS_DASHBOARD" && REC 5 2 pass "login" || REC 5 2 fail "miss"
+
+# Group 6
+NAV "http://fixtures/ecommerce.html"; S=$(SNAP "" 2000); echo "$S" | grep -q "VERIFY_SHOP_PAGE_44444" && REC 6 1 pass "shop" || REC 6 1 fail "miss"
+ACT '{"kind":"click","selector":"#product-1 .add-to-cart"}' > /dev/null
+ACT '{"kind":"click","selector":"#product-2 .add-to-cart"}' > /dev/null
+S=$(SNAP "" 1000); echo "$S" | grep -q "CART_ITEM_WIRELESS_HEADPHONES" && REC 6 2 pass "cart" || REC 6 2 fail "miss"
+ACT '{"kind":"click","selector":"#checkout-btn"}' > /dev/null
+S=$(SNAP "" 2000); echo "$S" | grep -q "VERIFY_CHECKOUT_SUCCESS_ORDER" && REC 6 3 pass "co" || REC 6 3 fail "miss"
+
+# Group 7
+NAV "http://fixtures/wiki-go.html"; S1=$(SNAP "" 2000)
+ACT '{"kind":"fill","selector":"#comment-text","text":"Great article."}' > /dev/null
+ACT '{"kind":"select","selector":"#comment-rating","value":"5"}' > /dev/null
+ACT '{"kind":"click","selector":"#submit-comment"}' > /dev/null
+S2=$(SNAP "" 2000); echo "$S1" | grep -q "VERIFY_WIKI_GO" && echo "$S2" | grep -q "COMMENT_POSTED_RATING_5" && REC 7 1 pass "c" || REC 7 1 fail "miss"
+NAV "http://fixtures/wiki.html"; S1=$(SNAP "" 1500)
+ACT '{"kind":"click","selector":"#link-go","waitNav":true}' > /dev/null; S2=$(SNAP "" 500)
+echo "$S1" | grep -q "COUNT_LANGUAGES_12" && echo "$S2" | grep -q "VERIFY_WIKI_GO" && REC 7 2 pass "x" || REC 7 2 fail "miss"
+
+# Group 8
+HTTP=$(curl -s -o /dev/null -w "%{http_code}" -X POST "$BASE/navigate" -H "$AUTH" -H "Content-Type: application/json" -d "{\"tabId\":\"$T\",\"url\":\"http://fixtures/nonexistent-page-xyz.html\"}")
+{ [ "$HTTP" = "200" ] || [ "$HTTP" = "500" ]; } && REC 8 1 pass "$HTTP" || REC 8 1 fail "$HTTP"
+HTTP=$(curl -s -o /dev/null -w "%{http_code}" -X POST "$BASE/tabs/$T/action" -H "$AUTH" -H "Content-Type: application/json" -d '{"kind":"click","selector":"#element-that-does-not-exist"}')
+[ "$HTTP" -ge "400" ] && REC 8 2 pass "$HTTP" || REC 8 2 fail "$HTTP"
+
+# Group 9
+NAV "http://fixtures/dashboard.html"
+curl -s "$BASE/tabs/$T/screenshot" -H "$AUTH" --output /tmp/bl_ss.png
+SZ=$(stat -f%z /tmp/bl_ss.png 2>/dev/null || stat -c%s /tmp/bl_ss.png)
+[ "$SZ" -gt 10240 ] && REC 9 1 pass "$SZ" || REC 9 1 fail "$SZ"
+curl -s "$BASE/tabs/$T/pdf" -H "$AUTH" --output /tmp/bl_pdf.pdf
+SZ=$(stat -f%z /tmp/bl_pdf.pdf 2>/dev/null || stat -c%s /tmp/bl_pdf.pdf)
+[ "$SZ" -gt 10240 ] && REC 9 2 pass "$SZ" || REC 9 2 fail "$SZ"
+
+# Group 10 — use a larger token budget because dashboard has ~149 nodes and
+# the modal heading lives deep in the DOM.
+NAV "http://fixtures/dashboard.html"; ACT '{"kind":"click","selector":"#settings-btn"}' > /dev/null
+S=$(SNAP "" 3000); echo "$S" | grep -q "Dashboard Settings" && REC 10 1 pass "m" || REC 10 1 fail "miss"
+ACT '{"kind":"select","selector":"#theme-select","value":"dark"}' > /dev/null
+ACT '{"kind":"click","selector":"#modal-save"}' > /dev/null
+S=$(SNAP "" 3000); echo "$S" | grep -q "THEME_DARK_APPLIED" && REC 10 2 pass "d" || REC 10 2 fail "miss"
+
+# Group 11
+NAV "http://fixtures/spa.html?reset=1"
+ACT '{"kind":"fill","selector":"#new-task-input","text":"Persistent Task Test"}' > /dev/null
+ACT '{"kind":"click","selector":"#add-task-btn"}' > /dev/null
+NAV "http://fixtures/"; NAV "http://fixtures/spa.html"
+S=$(SNAP "" 1500); echo "$S" | grep -q "TASK_PERSISTENT_TEST_FOUND" && REC 11 1 pass "p" || REC 11 1 fail "miss"
+NAV "http://fixtures/login.html"
+for act in \
+ '{"kind":"fill","selector":"#username","text":"benchmark"}' \
+ '{"kind":"fill","selector":"#password","text":"test456"}' \
+ '{"kind":"click","selector":"#login-btn"}' \
+ '{"kind":"click","selector":"#logout-btn"}' \
+ '{"kind":"fill","selector":"#username","text":"benchmark"}' \
+ '{"kind":"fill","selector":"#password","text":"test456"}' \
+ '{"kind":"click","selector":"#login-btn"}'; do
+ ACT "$act" > /dev/null
+done
+S=$(SNAP "" 500); echo "$S" | grep -q "SESSION_RENEWED" && REC 11 2 pass "r" || REC 11 2 fail "miss"
+
+# Group 12
+NAV "http://fixtures/"; NAV "http://fixtures/wiki.html"
+ACT '{"kind":"click","selector":"#link-go","waitNav":true}' > /dev/null
+curl -sf -X POST "$BASE/tabs/$T/back" -H "$AUTH" > /dev/null
+curl -sf -X POST "$BASE/tabs/$T/back" -H "$AUTH" > /dev/null
+S=$(SNAP "" 500); echo "$S" | grep -q "VERIFY_HOME_LOADED_12345" && REC 12 1 pass "h" || REC 12 1 fail "miss"
+NAV "http://fixtures/wiki.html"; S1=$(SNAP "" 1500)
+NAV "http://fixtures/articles.html"; S2=$(SNAP "" 1500)
+echo "$S1" | grep -q "COUNT_LANGUAGES_12" && echo "$S2" | grep -q "Artificial Intelligence" && REC 12 2 pass "c" || REC 12 2 fail "miss"
+
+# Group 13
+NAV "http://fixtures/form.html"
+ACT '{"kind":"fill","selector":"#fullname","text":"Validator Test"}' > /dev/null
+ACT '{"kind":"click","selector":"#submit-btn"}' > /dev/null
+S=$(SNAP "" 1000); if ! echo "$S" | grep -q "VERIFY_FORM_SUBMITTED_SUCCESS"; then REC 13 1 pass "blk"; else REC 13 1 fail "not blocked"; fi
+NAV "http://fixtures/form.html"
+ACT '{"kind":"fill","selector":"#fullname","text":"No Phone User"}' > /dev/null
+ACT '{"kind":"fill","selector":"#email","text":"[email protected]"}' > /dev/null
+ACT '{"kind":"select","selector":"#country","value":"de"}' > /dev/null
+ACT '{"kind":"select","selector":"#subject","value":"feedback"}' > /dev/null
+ACT '{"kind":"click","selector":"#submit-btn"}' > /dev/null
+S=$(SNAP "" 1000); echo "$S" | grep -q "VERIFY_FORM_SUBMITTED_SUCCESS" && REC 13 2 pass "o" || REC 13 2 fail "miss"
+
+# Group 14
+NAV "http://fixtures/ecommerce.html"; ACT '{"kind":"click","selector":"#load-more-btn"}' > /dev/null
+S=$(SNAP "" 2000); echo "$S" | grep -q "ADDITIONAL_PRODUCTS_LOADED" && REC 14 1 pass "m" || REC 14 1 fail "miss"
+ACT '{"kind":"click","selector":"#product-5 .add-to-cart"}' > /dev/null
+S=$(SNAP "" 1000); echo "$S" | grep -q "CART_UPDATED_WITH_LAZY_PRODUCT" && REC 14 2 pass "l" || REC 14 2 fail "miss"
+
+# Group 15
+NAV "http://fixtures/dashboard.html"; S=$(SNAP "" 2000); echo "$S" | grep -q '1,284,930' && REC 15 1 pass "f" || REC 15 1 fail "miss"
+NAV "http://fixtures/wiki-go.html"; G=$(SNAP "" 1000)
+NAV "http://fixtures/wiki-python.html"; P=$(SNAP "" 1000)
+NAV "http://fixtures/wiki-rust.html"; R=$(SNAP "" 1000)
+echo "$G" | grep -q "FEATURE_COUNT_6" && echo "$P" | grep -q "FEATURE_COUNT_7" && echo "$R" | grep -q "FEATURE_COUNT_5" && REC 15 2 pass "m" || REC 15 2 fail "miss"
+
+# Group 16
+NAV "http://fixtures/hovers.html"; ACT '{"kind":"hover","selector":"#avatar-1"}' > /dev/null
+S=$(SNAP "" 1000); echo "$S" | grep -q "HOVER_REVEALED_USER_1" && REC 16 1 pass "1" || REC 16 1 fail "miss"
+ACT '{"kind":"hover","selector":"#avatar-2"}' > /dev/null
+S=$(SNAP "" 1000); echo "$S" | grep -q "HOVER_REVEALED_USER_2" && REC 16 2 pass "2" || REC 16 2 fail "miss"
+
+# Group 17
+NAV "http://fixtures/scroll.html"; ACT '{"kind":"scroll","scrollY":1500}' > /dev/null
+S=$(SNAP "" 1500); echo "$S" | grep -q "SCROLL_MIDDLE_MARKER" && REC 17 1 pass "m" || REC 17 1 fail "miss"
+ACT '{"kind":"scroll","selector":"#footer"}' > /dev/null
+S=$(SNAP "" 1500); echo "$S" | grep -q "SCROLL_REACHED_FOOTER" && REC 17 2 pass "f" || REC 17 2 fail "miss"
+
+# Group 18
+R=$(curl -sf "$BASE/tabs/$T/download?url=http://fixtures/download-sample.txt" -H "$AUTH")
+echo "$R" | jq -r '.data' | base64 -d > /tmp/bl_dl.txt 2>/dev/null
+grep -q "DOWNLOAD_FILE_CONTENT_VERIFIED" /tmp/bl_dl.txt && REC 18 1 pass "d" || REC 18 1 fail "miss"
+
+# Group 19 — native frame-scoped interaction (replaces prior eval workaround)
+FRAME() { curl -sf -X POST "$BASE/frame?tabId=$T" -H "$AUTH" -H "Content-Type: application/json" -d "$1" > /dev/null; }
+NAV "http://fixtures/iframe.html"; S=$(SNAP "" 2000); echo "$S" | grep -q "IFRAME_INNER_CONTENT_LOADED" && REC 19 1 pass "i" || REC 19 1 fail "miss"
+FRAME '{"target":"#content-frame"}'
+ACT '{"kind":"fill","selector":"#iframe-input","text":"Hello World"}' > /dev/null
+ACT '{"kind":"click","selector":"#iframe-submit"}' > /dev/null
+S=$(SNAP "" 500)
+FRAME '{"target":"main"}'
+echo "$S" | grep -q "IFRAME_INPUT_RECEIVED_HELLO_WORLD" && REC 19 2 pass "native-frame" || REC 19 2 fail "miss"
+
+# Group 20
+NAV "http://fixtures/alerts.html"
+ACT '{"kind":"click","selector":"#alert-btn","dialogAction":"accept"}' > /dev/null
+S=$(SNAP "" 500); echo "$S" | grep -q "DIALOG_ALERT_DISMISSED" && REC 20 1 pass "a" || REC 20 1 fail "miss"
+ACT '{"kind":"click","selector":"#confirm-btn","dialogAction":"dismiss"}' > /dev/null
+S=$(SNAP "" 500); echo "$S" | grep -q "DIALOG_CONFIRM_CANCELLED" && REC 20 2 pass "c" || REC 20 2 fail "miss"
+
+# Group 21
+NAV "http://fixtures/async.html"
+R_AWAIT=$(EV '{"expression":"window.fetchPayload()","awaitPromise":true}')
+R_NOAWAIT=$(EV '{"expression":"window.fetchPayload()"}')
+if echo "$R_AWAIT" | grep -q "ASYNC_PAYLOAD_READY_42" && ! echo "$R_NOAWAIT" | grep -q "ASYNC_PAYLOAD_READY_42"; then REC 21 1 pass "a"; else REC 21 1 fail "miss"; fi
+R=$(EV '{"expression":"window.fetchUser()","awaitPromise":true}')
+if echo "$R" | grep -q "ASYNC_USER_NAME_ADA"; then REC 21 2 pass "o"; else REC 21 2 fail "miss"; fi
+
+# Group 22
+NAV "http://fixtures/drag.html"
+ACT '{"kind":"drag","selector":"#piece","dragX":12,"dragY":-158}' > /dev/null
+S=$(curl -sf "$BASE/tabs/$T/text" -H "$AUTH")
+if echo "$S" | grep -q "LAST_DROP=DROP_ZONE_A_OK"; then REC 22 1 pass "A"; else REC 22 1 fail "miss"; fi
+ACT '{"kind":"mouse-move","x":104,"y":200}' > /dev/null
+ACT '{"kind":"mouse-down","x":104,"y":200,"button":"left"}' > /dev/null
+ACT '{"kind":"mouse-move","x":344,"y":200}' > /dev/null
+ACT '{"kind":"mouse-up","x":344,"y":200,"button":"left"}' > /dev/null
+ACT '{"kind":"mouse-down","x":344,"y":200,"button":"left"}' > /dev/null
+ACT '{"kind":"mouse-move","x":584,"y":400}' > /dev/null
+ACT '{"kind":"mouse-up","x":584,"y":400,"button":"left"}' > /dev/null
+S=$(curl -sf "$BASE/tabs/$T/text" -H "$AUTH")
+if echo "$S" | grep -q "DROP_SEQUENCE=DROP_ZONE_A_OK,DROP_ZONE_B_OK,DROP_ZONE_C_OK"; then REC 22 2 pass "ABC"; else REC 22 2 fail "miss"; fi
+
+# Group 23 — loading state
+NAV "http://fixtures/loading.html"
+for _ in 1 2 3 4 5 6 7 8 9 10 11 12; do
+ S=$(curl -sf "$BASE/tabs/$T/text" -H "$AUTH")
+ echo "$S" | grep -q "VERIFY_LOADING_COMPLETE_88888" && break
+ sleep 0.3
+done
+echo "$S" | grep -q "VERIFY_LOADING_COMPLETE_88888" && REC 23 1 pass "loaded" || REC 23 1 fail "did not load"
+
+# Group 24 — keyboard
+# Use mode=raw for text because the log div is short and Readability may drop it.
+NAV "http://fixtures/keyboard.html"
+ACT '{"kind":"press","key":"Escape"}' > /dev/null
+S=$(curl -sf "$BASE/tabs/$T/text?mode=raw&format=text" -H "$AUTH")
+echo "$S" | grep -q "KEYBOARD_ESCAPE_PRESSED" && REC 24 1 pass "escape" || REC 24 1 fail "no escape"
+ACT '{"kind":"press","key":"a"}' > /dev/null
+ACT '{"kind":"press","key":"Enter"}' > /dev/null
+S=$(curl -sf "$BASE/tabs/$T/text?mode=raw&format=text" -H "$AUTH")
+if echo "$S" | grep -q "KEYBOARD_KEY_A_PRESSED" && echo "$S" | grep -q "KEYBOARD_ENTER_PRESSED"; then REC 24 2 pass "a+enter"; else REC 24 2 fail "missing keys"; fi
+
+# Group 25 — tab panels
+NAV "http://fixtures/tabs.html"
+S=$(curl -sf "$BASE/tabs/$T/text?mode=raw&format=text" -H "$AUTH")
+ACT '{"kind":"click","selector":"#tab-settings"}' > /dev/null
+S2=$(curl -sf "$BASE/tabs/$T/text?mode=raw&format=text" -H "$AUTH")
+if echo "$S" | grep -q "TAB_PROFILE_CONTENT" && echo "$S2" | grep -q "TAB_SETTINGS_CONTENT" && ! echo "$S2" | grep -q "TAB_PROFILE_CONTENT"; then REC 25 1 pass "settings"; else REC 25 1 fail "tab switch failed"; fi
+ACT '{"kind":"click","selector":"#tab-billing"}' > /dev/null
+S=$(curl -sf "$BASE/tabs/$T/text?mode=raw&format=text" -H "$AUTH")
+echo "$S" | grep -q "TAB_BILLING_CONTENT" && REC 25 2 pass "billing" || REC 25 2 fail "billing miss"
+
+# Group 26 — accordion
+NAV "http://fixtures/accordion.html"
+ACT '{"kind":"click","selector":"#section-a .section-header"}' > /dev/null
+S=$(curl -sf "$BASE/tabs/$T/text?mode=raw&format=text" -H "$AUTH")
+echo "$S" | grep -q "ACCORDION_SECTION_A_OPEN" && REC 26 1 pass "A open" || REC 26 1 fail "A not open"
+ACT '{"kind":"click","selector":"#section-b .section-header"}' > /dev/null
+S=$(curl -sf "$BASE/tabs/$T/text?mode=raw&format=text" -H "$AUTH")
+R=$(EV '{"expression":"document.getElementById(\"section-a\").getAttribute(\"aria-expanded\")"}')
+if echo "$S" | grep -q "ACCORDION_SECTION_B_OPEN" && echo "$R" | grep -q '"false"'; then REC 26 2 pass "B open A closed"; else REC 26 2 fail "exclusive expand failed"; fi
+
+# Group 27 — contenteditable editor
+NAV "http://fixtures/editor.html"
+ACT '{"kind":"type","selector":"#editor","text":"Hello rich text"}' > /dev/null
+S=$(curl -sf "$BASE/tabs/$T/text?mode=raw&format=text" -H "$AUTH")
+if echo "$S" | grep -q "EDITOR_CHARS=15" && echo "$S" | grep -q "Hello rich text"; then REC 27 1 pass "typed"; else REC 27 1 fail "typing failed"; fi
+ACT '{"kind":"press","key":"Enter"}' > /dev/null
+S=$(curl -sf "$BASE/tabs/$T/text?mode=raw&format=text" -H "$AUTH")
+echo "$S" | grep -q "EDITOR_COMMITTED=Hello rich text" && REC 27 2 pass "committed" || REC 27 2 fail "commit failed"
+
+# Group 28 — range slider
+NAV "http://fixtures/range.html"
+ACT '{"kind":"fill","selector":"#volume","text":"90"}' > /dev/null
+S=$(curl -sf "$BASE/tabs/$T/text?mode=raw&format=text" -H "$AUTH")
+if echo "$S" | grep -q "RANGE_VALUE_90" && echo "$S" | grep -q "BUCKET_HIGH"; then REC 28 1 pass "high"; else REC 28 1 fail "high miss"; fi
+ACT '{"kind":"fill","selector":"#volume","text":"10"}' > /dev/null
+S=$(curl -sf "$BASE/tabs/$T/text?mode=raw&format=text" -H "$AUTH")
+if echo "$S" | grep -q "RANGE_VALUE_10" && echo "$S" | grep -q "BUCKET_LOW"; then REC 28 2 pass "low"; else REC 28 2 fail "low miss"; fi
+
+# Group 29 — pagination
+NAV "http://fixtures/pagination.html"
+ACT '{"kind":"click","selector":"#next-btn"}' > /dev/null
+S=$(curl -sf "$BASE/tabs/$T/text?mode=raw&format=text" -H "$AUTH")
+if echo "$S" | grep -q "PAGE_2_FIRST_ITEM" && echo "$S" | grep -q "PAGE_2_OF_3"; then REC 29 1 pass "p2"; else REC 29 1 fail "p2 miss"; fi
+ACT '{"kind":"click","selector":"#next-btn"}' > /dev/null
+S=$(curl -sf "$BASE/tabs/$T/text?mode=raw&format=text" -H "$AUTH")
+R=$(EV '{"expression":"document.getElementById(\"next-btn\").disabled"}')
+if echo "$S" | grep -q "PAGE_3_FIRST_ITEM" && echo "$S" | grep -q "PAGE_3_OF_3" && echo "$R" | grep -q "true"; then REC 29 2 pass "p3 disabled"; else REC 29 2 fail "p3 miss"; fi
+
+# Group 30 — custom dropdown menu
+NAV "http://fixtures/dropdown.html"
+ACT '{"kind":"click","selector":"#dropdown-toggle"}' > /dev/null
+ACT '{"kind":"click","selector":"#dropdown-menu li[data-value=\"beta\"]"}' > /dev/null
+S=$(curl -sf "$BASE/tabs/$T/text?mode=raw&format=text" -H "$AUTH")
+echo "$S" | grep -q "DROPDOWN_SELECTED=BETA" && REC 30 1 pass "beta" || REC 30 1 fail "beta miss"
+ACT '{"kind":"click","selector":"#dropdown-toggle"}' > /dev/null
+ACT '{"kind":"click","selector":"#dropdown-menu li[data-value=\"gamma\"]"}' > /dev/null
+S=$(curl -sf "$BASE/tabs/$T/text?mode=raw&format=text" -H "$AUTH")
+echo "$S" | grep -q "DROPDOWN_SELECTED=GAMMA" && REC 30 2 pass "gamma" || REC 30 2 fail "gamma miss"
+
+# Group 31 — nested iframes (3 levels)
+NAV "http://fixtures/iframe-nested.html"
+FRAME '{"target":"#level-2"}'
+FRAME '{"target":"#level-3"}'
+ACT '{"kind":"click","selector":"#deep-button"}' > /dev/null
+S=$(SNAP "" 500)
+FRAME '{"target":"main"}'
+echo "$S" | grep -q "DEEP_CLICKED=YES_LEVEL_3" && REC 31 1 pass "nested-3" || REC 31 1 fail "miss"
+
+# Group 32 — dynamic iframe (inserted after load)
+NAV "http://fixtures/iframe-dynamic.html"
+curl -sf -X POST "$BASE/tabs/$T/wait" -H "$AUTH" -H "Content-Type: application/json" -d '{"text":"IFRAME_DYNAMIC_ATTACHED","timeout":5000}' > /dev/null
+FRAME '{"target":"#late-frame"}'
+ACT '{"kind":"fill","selector":"#iframe-input","text":"Late World"}' > /dev/null
+ACT '{"kind":"click","selector":"#iframe-submit"}' > /dev/null
+S=$(SNAP "" 500)
+FRAME '{"target":"main"}'
+echo "$S" | grep -q "IFRAME_INPUT_RECEIVED_LATE_WORLD" && REC 32 1 pass "dynamic" || REC 32 1 fail "miss"
+
+# Group 33 — srcdoc iframe
+NAV "http://fixtures/iframe-srcdoc.html"
+FRAME '{"target":"#srcdoc-frame"}'
+ACT '{"kind":"fill","selector":"#inline-input","text":"srcdoc"}' > /dev/null
+ACT '{"kind":"click","selector":"#inline-submit"}' > /dev/null
+S=$(SNAP "" 500)
+FRAME '{"target":"main"}'
+echo "$S" | grep -q "INLINE_RECEIVED_SRCDOC" && REC 33 1 pass "srcdoc" || REC 33 1 fail "miss"
+
+# Group 34 — sandboxed iframe (allow-scripts allow-same-origin)
+NAV "http://fixtures/iframe-sandbox.html"
+FRAME '{"target":"#sandboxed"}'
+ACT '{"kind":"click","selector":"#sandbox-button"}' > /dev/null
+S=$(SNAP "" 500)
+FRAME '{"target":"main"}'
+echo "$S" | grep -q "SANDBOX_CLICKED=YES" && REC 34 1 pass "sandbox" || REC 34 1 fail "miss"
+
+# Group 35 — long-form article (Readability vs --full)
+NAV "http://fixtures/article.html"
+S=$(curl -sf "$BASE/tabs/$T/text" -H "$AUTH")
+if echo "$S" | grep -q "ARTICLE_PUBLISHED_2026_04_15" && echo "$S" | grep -q "ARTICLE_WORD_COUNT_MARKER_323"; then REC 35 1 pass "readability"; else REC 35 1 fail "body miss"; fi
+S=$(curl -sf "$BASE/tabs/$T/text?mode=raw&format=text" -H "$AUTH")
+if echo "$S" | grep -q "ARTICLE_PUBLISHED_2026_04_15" && echo "$S" | grep -q "FOOTER_COPYRIGHT_MARKER"; then REC 35 2 pass "full"; else REC 35 2 fail "chrome miss"; fi
+
+# Group 36 — search results page
+NAV "http://fixtures/serp.html"
+S=$(curl -sf "$BASE/tabs/$T/snapshot?selector=%23r-3&format=compact&maxTokens=500" -H "$AUTH")
+if echo "$S" | grep -q "RESULT_3_TITLE" && echo "$S" | grep -q "RESULT_3_SNIPPET_MARKER"; then REC 36 1 pass "r3"; else REC 36 1 fail "scoped miss"; fi
+S=$(curl -sf "$BASE/tabs/$T/text?mode=raw&format=text" -H "$AUTH")
+miss=0
+for i in 1 2 3 4 5 6; do echo "$S" | grep -q "RESULT_${i}_TITLE" || miss=1; done
+echo "$S" | grep -q "SERP_RESULT_COUNT_6" || miss=1
+[ $miss -eq 0 ] && REC 36 2 pass "all-6" || REC 36 2 fail "missing result"
+
+# Group 37 — Q&A thread
+NAV "http://fixtures/qa.html"
+R=$(EV '{"expression":"document.querySelector(\"[data-accepted=\\\"true\\\"]\").id"}')
+echo "$R" | grep -q '"a-2"' && REC 37 1 pass "a-2" || REC 37 1 fail "accepted miss"
+S=$(curl -sf "$BASE/tabs/$T/snapshot?selector=%23a-2&format=compact&maxTokens=1500" -H "$AUTH")
+if echo "$S" | grep -q "ANSWER_2_BODY_MARKER" && echo "$S" | grep -q "ACCEPTED_ANSWER_ID_A2"; then REC 37 2 pass "body"; else REC 37 2 fail "body miss"; fi
+
+# Group 38 — pricing table
+NAV "http://fixtures/pricing.html"
+S=$(curl -sf "$BASE/tabs/$T/snapshot?selector=%23plan-pro&format=compact&maxTokens=500" -H "$AUTH")
+if echo "$S" | grep -q "PLAN_PRO_PRICE_29" && echo "$S" | grep -q "PLAN_PRO_LIMIT_5000"; then REC 38 1 pass "pro"; else REC 38 1 fail "pro miss"; fi
+S=$(curl -sf "$BASE/tabs/$T/text?mode=raw&format=text" -H "$AUTH")
+if echo "$S" | grep -q "PLAN_FREE_PRICE_0" && echo "$S" | grep -q "PLAN_PRO_PRICE_29" && echo "$S" | grep -q "PLAN_ENTERPRISE_PRICE_CUSTOM"; then REC 38 2 pass "all-plans"; else REC 38 2 fail "plan miss"; fi
+
+echo "TAB=$T"
diff --git a/tests/benchmark/scripts/pt b/tests/benchmark/scripts/pt
index 24ea1f97..5114aca4 100755
--- a/tests/benchmark/scripts/pt
+++ b/tests/benchmark/scripts/pt
@@ -22,26 +22,28 @@
# and makes copy-pasted examples unreadable. This script handles the
# preamble so benchmark callers can just write:
#
-# source tests/benchmark/scripts/env # (if present, or export manually)
-# export PINCHTAB_TAB=$(./scripts/pt nav http://fixtures/)
-# ./scripts/pt snap -i -c
+# TAB=$(./scripts/pt nav http://fixtures/)
+# ./scripts/pt snap -i -c # auto-uses $PINCHTAB_TAB or /tmp/pt-tab
# ./scripts/pt click '#submit'
# ./scripts/pt eval --await-promise 'window.fetchPayload()'
#
-# The CLI semantics are identical to running `pinchtab` directly; this
-# wrapper just supplies the Docker plumbing and the benchmark token/server
-# defaults.
+# The CLI semantics are identical to running `pinchtab` directly.
+#
+# Tab persistence
+# ---------------
+# Shell functions and env vars don't survive between Bash tool calls in
+# Claude Code. To avoid re-typing `PINCHTAB_TAB=$TAB` on every command, the
+# wrapper writes the tab ID returned by `pt nav` to `/tmp/pt-tab` and reads
+# it back as the default for subsequent calls when $PINCHTAB_TAB isn't set.
+# This is purely a benchmark-harness convenience — production `pinchtab`
+# installs use the regular PINCHTAB_TAB env var.
#
# Env vars (override at call time if needed)
# ------------------------------------------
-# PINCHTAB_CONTAINER — name of the container running pinchtab
-# (default: benchmark-pinchtab-1)
-# PINCHTAB_TOKEN — auth token
-# (default: benchmark-token)
-# PINCHTAB_SERVER — server URL the CLI talks to
-# (default: http://localhost:9867)
-# PINCHTAB_TAB — default tab ID for tab-scoped commands
-# (forwarded if set; otherwise omitted)
+# PINCHTAB_CONTAINER — container name (default: benchmark-pinchtab-1)
+# PINCHTAB_TOKEN — auth token (default: benchmark-token)
+# PINCHTAB_SERVER — server URL (default: http://localhost:9867)
+# PINCHTAB_TAB — default tab ID; overrides the /tmp/pt-tab sidecar.
set -euo pipefail
@@ -49,6 +51,14 @@ set -euo pipefail
: "${PINCHTAB_TOKEN:=benchmark-token}"
: "${PINCHTAB_SERVER:=http://localhost:9867}"
+PT_TAB_SIDECAR="/tmp/pt-tab"
+
+# Fall back to the sidecar file when PINCHTAB_TAB isn't set in the caller's
+# environment. Trim trailing whitespace so downstream string matches work.
+if [[ -z "${PINCHTAB_TAB:-}" && -f "${PT_TAB_SIDECAR}" ]]; then
+ PINCHTAB_TAB="$(tr -d '[:space:]' < "${PT_TAB_SIDECAR}")"
+fi
+
args=(docker exec
-e "PINCHTAB_TOKEN=${PINCHTAB_TOKEN}"
-e "PINCHTAB_SERVER=${PINCHTAB_SERVER}")
@@ -59,4 +69,39 @@ fi
args+=("${PINCHTAB_CONTAINER}" pinchtab "$@")
+# For `pt nav` with stdout piped (the $(pt nav URL) capture idiom), record
+# the emitted tab ID into the sidecar so subsequent commands can pick it up
+# without the caller having to `export PINCHTAB_TAB`. Keep the stdout
+# contract unchanged — the tab ID still goes to stdout, exactly as before.
+#
+# Only update the sidecar when both (a) the underlying `pinchtab nav` call
+# succeeded (exit 0) and (b) it emitted a well-formed 32-character hex tab
+# ID. Otherwise the sidecar would point at a ghost tab and every later
+# command would silently target nothing.
+if [[ "${1:-}" == "nav" && ! -t 1 ]]; then
+ set +e
+ output="$("${args[@]}")"
+ rc=$?
+ set -e
+ printf '%s\n' "${output}"
+ if [[ ${rc} -ne 0 ]]; then
+ exit ${rc}
+ fi
+ tab="$(printf '%s' "${output}" | grep -oE '^[A-F0-9]{32}$' | head -1)"
+ if [[ -n "${tab}" ]]; then
+ printf '%s' "${tab}" > "${PT_TAB_SIDECAR}"
+ fi
+ exit 0
+fi
+
+# When closing the tab the sidecar points at, clear the sidecar so the next
+# command can't accidentally target a dead tab. Matches `pt tab close <id>`
+# (cobra subcommand form).
+if [[ "${1:-}" == "tab" && "${2:-}" == "close" && -n "${3:-}" && -f "${PT_TAB_SIDECAR}" ]]; then
+ stored="$(tr -d '[:space:]' < "${PT_TAB_SIDECAR}")"
+ if [[ "${stored}" == "${3}" ]]; then
+ rm -f "${PT_TAB_SIDECAR}"
+ fi
+fi
+
exec "${args[@]}"