Skip to content

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

test: fix opt benchmark scoring and wiki fixtures

Luigi Agosti52db1d11ce5c
diff --git a/tests/tools/fixtures/wiki-browser.html b/tests/tools/fixtures/wiki-browser.html
new file mode 100644
index 00000000..eee1e83e
--- /dev/null
+++ b/tests/tools/fixtures/wiki-browser.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>Browser Automation — Encyclopedia</title>
+</head>
+<body>
+ <header>
+ <nav><a href="/">Home</a> | <a href="/wiki.html">Encyclopedia</a> | Browser Automation</nav>
+ </header>
+ <main>
+ <h1>Browser Automation — VERIFY_WIKI_BROWSER_77777</h1>
+
+ <div id="infobox">
+ <table>
+ <tr><th>Category</th><td id="category">Developer Tools</td></tr>
+ <tr><th>Common uses</th><td id="uses">Testing, scraping, monitoring</td></tr>
+ <tr><th>Protocols</th><td id="protocols">CDP, WebDriver BiDi</td></tr>
+ </table>
+ </div>
+
+ <p>Browser automation drives a real browser programmatically to reproduce
+ user interactions such as navigation, clicks, and form input. It underpins
+ end-to-end testing, content extraction, and synthetic monitoring.</p>
+
+ <p class="data-marker">ARTICLE_UNDER_LARGEST_CATEGORY</p>
+ </main>
+</body>
+</html>
diff --git a/tests/tools/fixtures/wiki-http.html b/tests/tools/fixtures/wiki-http.html
new file mode 100644
index 00000000..60daa7cf
--- /dev/null
+++ b/tests/tools/fixtures/wiki-http.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>HTTP Protocol — Encyclopedia</title>
+</head>
+<body>
+ <header>
+ <nav><a href="/">Home</a> | <a href="/wiki.html">Encyclopedia</a> | HTTP Protocol</nav>
+ </header>
+ <main>
+ <h1>HTTP/2 — VERIFY_WIKI_HTTP_66666</h1>
+
+ <div id="infobox">
+ <table>
+ <tr><th>Category</th><td id="category">Network Protocols</td></tr>
+ <tr><th>Published</th><td id="published">2015</td></tr>
+ <tr><th>Transport</th><td id="transport">TCP, TLS</td></tr>
+ <tr><th>Successor</th><td id="successor">HTTP/3 (QUIC)</td></tr>
+ </table>
+ </div>
+
+ <p>HTTP/2 is a binary, multiplexed revision of the Hypertext Transfer
+ Protocol. It reduces latency through header compression and concurrent
+ streams over a single connection.</p>
+
+ <p class="data-marker">HTTP_ARTICLE_LOADED</p>
+ </main>
+</body>
+</html>
diff --git a/tests/tools/fixtures/wiki.html b/tests/tools/fixtures/wiki.html
index f791a2ec..12e56667 100644
--- a/tests/tools/fixtures/wiki.html
+++ b/tests/tools/fixtures/wiki.html
@@ -46,7 +46,7 @@
<div class="category" id="cat-tools">
<h3>Developer Tools</h3>
<p>COUNT_TOOLS_15 articles</p>
- Browser automation, CI/CD, Package managers
+ <a href="/wiki-browser.html" id="link-browser-tool">Browser automation</a>, CI/CD, Package managers
</div>
</section>
</main>
diff --git a/tests/tools/runner/internal/opt/summarize.go b/tests/tools/runner/internal/opt/summarize.go
index 77499d21..820bd02f 100644
--- a/tests/tools/runner/internal/opt/summarize.go
+++ b/tests/tools/runner/internal/opt/summarize.go
@@ -144,7 +144,7 @@ func RunSummarize(argv []string, stdout, stderr io.Writer) int {
baselineOps = countBaselineOps()
}
- ptRe := regexp.MustCompile(`\./scripts/pt\s+(\w+)`)
+ ptRe := regexp.MustCompile(`\./scripts/pt\s+((?:--?\S+(?:\s+"?[^"\s-]\S*"?)?\s+)*)(\w+)`)
var totalOps int
cmdTypes := make(map[string]int)
var hasTranscripts bool
@@ -189,8 +189,15 @@ func RunSummarize(argv []string, stdout, stderr io.Writer) int {
for _, b := range blocks {
if b.Type == "tool_use" && b.Name == "Bash" {
for _, m := range ptRe.FindAllStringSubmatch(b.Input.Command, -1) {
+ verb := m[2]
+ // Skip the recorder itself; `./scripts/runner step-end`
+ // is not a browser op. (pt and runner are distinct
+ // wrappers, but guard against any pt-routed runner call.)
+ if verb == "runner" {
+ continue
+ }
totalOps++
- cmdTypes[m[1]]++
+ cmdTypes[verb]++
}
}
}
diff --git a/tests/tools/runner/internal/opt/verifyanswers.go b/tests/tools/runner/internal/opt/verifyanswers.go
index ce19bb49..6e67fe9d 100644
--- a/tests/tools/runner/internal/opt/verifyanswers.go
+++ b/tests/tools/runner/internal/opt/verifyanswers.go
@@ -15,11 +15,11 @@ import (
// Ported from verify-answers.sh — patterns are case-insensitive.
var expectPatterns = map[string]string{
// Group 0: Setup & diagnosis
- "0.1": `status.*ok|^ok$|"ok"`,
+ "0.1": `status.*ok|\bok\b|"ok"`,
"0.2": `401|missing_token|unauth|bad_token|rejected`,
- "0.3": `200|authed.*200|status.*ok|^ok$|"ok"`,
+ "0.3": `200|authed.*200|status.*ok|\bok\b|"ok"`,
"0.4": `running`,
- "0.5": `tab.*list|tabs.*returned|active tab|listed.*tab|\d+ tabs? (found|open)|tabs:|tab.*id`,
+ "0.5": `tab.*list|tabs.*returned|active tab|listed.*tab|\d+ tabs? (found|open)|tabs:|tab.*id|"tabs"\s*:|\bno (open )?tabs\b|empty`,
"0.6": `cleaned|closed|no stale|reused.*tab|no cleanup|single active|is empty|already empty|clean.*state|cannot close last|one tab`,
"0.7": `VERIFY_HOME_LOADED_12345|navigated to fixtures|fixtures.*home|PinchTab Benchmark|fixtures/`,
"0.8": `[0-9A-F]{32}|tab.*id.*captured`,