Skip to content

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

Add remaining easy-win integration tests

Marioa4a5b1735577
diff --git a/tests/integration/actions_test.go b/tests/integration/actions_test.go
index 770e7bc1..62bde5f8 100644
--- a/tests/integration/actions_test.go
+++ b/tests/integration/actions_test.go
@@ -212,3 +212,65 @@ func TestAction_BatchEmpty(t *testing.T) {
t.Errorf("expected 400 for empty batch, got %d", code)
}
}
+
+// A6: Hover
+func TestAction_Hover(t *testing.T) {
+ navigate(t, "https://example.com")
+
+ // Get snapshot to find a link ref
+ _, snapBody := httpGet(t, "/snapshot?filter=interactive&format=text")
+ s := string(snapBody)
+
+ // Find a link ref
+ ref := findRef(s, "link")
+ if ref == "" {
+ t.Skip("no link ref found in snapshot")
+ }
+
+ code, _ := httpPost(t, "/action", map[string]string{
+ "kind": "hover",
+ "ref": ref,
+ })
+ if code != 200 {
+ t.Errorf("hover failed with %d", code)
+ }
+}
+
+// A7: Select
+func TestAction_Select(t *testing.T) {
+ navigate(t, "https://httpbin.org/forms/post")
+
+ // Get snapshot to find a select element
+ _, snapBody := httpGet(t, "/snapshot?filter=interactive&format=text")
+ ref := findRef(string(snapBody), "combobox")
+ if ref == "" {
+ ref = findRef(string(snapBody), "select")
+ }
+ if ref == "" {
+ t.Skip("no select ref found in snapshot")
+ }
+
+ code, _ := httpPost(t, "/action", map[string]any{
+ "kind": "select",
+ "ref": ref,
+ "value": "opt1",
+ })
+ if code != 200 {
+ t.Errorf("select failed with %d", code)
+ }
+}
+
+// A13: No tab
+func TestAction_NoTab(t *testing.T) {
+ navigate(t, "https://example.com")
+
+ code, _ := httpPost(t, "/action", map[string]string{
+ "kind": "click",
+ "ref": "e0",
+ "tabId": "nonexistent_xyz",
+ })
+ // Should be an error (not 200)
+ if code == 200 {
+ t.Error("expected error for nonexistent tab")
+ }
+}
diff --git a/tests/integration/error_handling_test.go b/tests/integration/error_handling_test.go
new file mode 100644
index 00000000..1e826602
--- /dev/null
+++ b/tests/integration/error_handling_test.go
@@ -0,0 +1,68 @@
+//go:build integration
+
+package integration
+
+import (
+ "encoding/json"
+ "testing"
+)
+
+// ER5: Unicode content handling
+func TestError_UnicodeContent(t *testing.T) {
+ // Navigate to a page with Unicode (CJK/emoji/RTL)
+ navigate(t, "https://www.wikipedia.org")
+
+ // Test snapshot
+ code, snapBody := httpGet(t, "/snapshot")
+ if code != 200 {
+ t.Errorf("snapshot failed with %d", code)
+ }
+
+ // Verify response is valid JSON
+ var snapData map[string]any
+ if err := json.Unmarshal(snapBody, &snapData); err != nil {
+ t.Errorf("snapshot response is not valid JSON: %v", err)
+ }
+
+ // Test text
+ code, textBody := httpGet(t, "/text")
+ if code != 200 {
+ t.Errorf("text failed with %d", code)
+ }
+
+ // Verify response is valid JSON
+ var textData map[string]any
+ if err := json.Unmarshal(textBody, &textData); err != nil {
+ t.Errorf("text response is not valid JSON: %v", err)
+ }
+}
+
+// ER6: Empty page handling
+func TestError_EmptyPage(t *testing.T) {
+ // Navigate to about:blank (empty page)
+ navigate(t, "about:blank")
+
+ // Test snapshot
+ code, snapBody := httpGet(t, "/snapshot")
+ if code != 200 {
+ t.Errorf("snapshot on empty page failed with %d", code)
+ }
+
+ // Verify response is valid JSON
+ var snapData map[string]any
+ if err := json.Unmarshal(snapBody, &snapData); err != nil {
+ t.Errorf("snapshot response is not valid JSON: %v", err)
+ }
+
+ // Test text
+ code, textBody := httpGet(t, "/text")
+ if code != 200 {
+ t.Errorf("text on empty page failed with %d", code)
+ }
+
+ // Verify response is valid JSON
+ var textData map[string]any
+ if err := json.Unmarshal(textBody, &textData); err != nil {
+ t.Errorf("text response is not valid JSON: %v", err)
+ }
+}