test(e2e): live test honors samples/annotate/upscale knobs

This commit is contained in:
2026-06-07 17:44:03 +01:00
parent f42282d70e
commit eabebcf89b
+26 -9
View File
@@ -12,6 +12,7 @@ import (
"image/png" "image/png"
"os" "os"
"os/exec" "os/exec"
"strconv"
"testing" "testing"
"time" "time"
@@ -51,16 +52,32 @@ func TestLiveSolveGrid(t *testing.T) {
} }
defer func() { _ = session.Close() }() defer func() { _ = session.Close() }()
args := map[string]any{
"screenshot": b64,
"instruction": "Select every tile that is solid red.",
"rows": rows,
"cols": cols,
"image_width": size,
"image_height": size,
}
// Optional accuracy knobs, settable for live tuning.
if v := os.Getenv("CAPTCHA_E2E_SAMPLES"); v != "" {
if n, err := strconv.Atoi(v); err == nil && n > 0 {
args["samples"] = n
}
}
if v := os.Getenv("CAPTCHA_E2E_UPSCALE"); v != "" {
if n, err := strconv.Atoi(v); err == nil && n > 0 {
args["upscale"] = n
}
}
if os.Getenv("CAPTCHA_E2E_ANNOTATE") == "1" {
args["annotate"] = true
}
res, err := session.CallTool(ctx, &mcp.CallToolParams{ res, err := session.CallTool(ctx, &mcp.CallToolParams{
Name: "solve_grid_captcha", Name: "solve_grid_captcha",
Arguments: map[string]any{ Arguments: args,
"screenshot": b64,
"instruction": "Select every tile that is solid red.",
"rows": rows,
"cols": cols,
"image_width": size,
"image_height": size,
},
}) })
if err != nil { if err != nil {
t.Fatalf("call: %v", err) t.Fatalf("call: %v", err)