Skip to content

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

test: pin that /capture serialises checked state on the wire, the one surface of the criterion no run had exercised (PIN-102)

Luigi Agosti9938eb6872fe
diff --git a/internal/handlers/capture_test.go b/internal/handlers/capture_test.go
index 9ec18fe8..9ea3513e 100644
--- a/internal/handlers/capture_test.go
+++ b/internal/handlers/capture_test.go
@@ -132,6 +132,9 @@ func TestHandleCapture_OpenAPIExposes(t *testing.T) {
const capturePairFixtureHTML = `<body style="margin:0;height:4000px">
<button id="top" style="position:absolute;top:0;left:0">TopBtn</button>
<button id="bottom" style="position:absolute;top:2500px;left:0">BotBtn</button>
+<input type="checkbox" checked aria-label="OnBox" style="position:absolute;top:2600px;left:0">
+<input type="checkbox" aria-label="OffBox" style="position:absolute;top:2640px;left:0">
+<div role="checkbox" aria-checked="mixed" tabindex="0" aria-label="MixedBox" style="position:absolute;top:2680px;left:0"></div>
</body>`
const capturePairTabID = "tab-capture-visible"
@@ -269,6 +272,22 @@ func TestCaptureWithoutBoundsPublishesNoVisibleKey(t *testing.T) {
}
}
+func TestCaptureSerialisesCheckedStateForCheckableControls(t *testing.T) {
+ nodes := newCaptureFixture(t).capture(t, "&"+captureBoundsParam+"=true")
+
+ for name, want := range map[string]string{"OnBox": "true", "OffBox": "false", "MixedBox": "mixed"} {
+ if got := nodeByName(t, nodes, name)["checked"]; got != want {
+ t.Errorf("%s checked = %v, want %q", name, got, want)
+ }
+ }
+
+ for _, name := range []string{"TopBtn", "BotBtn"} {
+ if value, ok := nodeByName(t, nodes, name)["checked"]; ok {
+ t.Errorf("%s has no checkedness but published checked = %v", name, value)
+ }
+ }
+}
+
// A skipped test asserts nothing, so the query key the two tests above depend on is pinned
// where no browser is involved: the handler must read this exact parameter, or bounds are
// computed regardless of what the query says and the unmeasured case is never exercised.