High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
fix: add tabId tracking to integration tests
Marioc24fceefefd0
diff --git a/tests/integration/actions_test.go b/tests/integration/actions_test.goindex 62bde5f8..d0ac56b3 100644--- a/tests/integration/actions_test.go+++ b/tests/integration/actions_test.go@@ -34,9 +34,10 @@ func TestAction_Click(t *testing.T) {// A4: Press keyfunc TestAction_Press(t *testing.T) {navigate(t, "https://example.com")- code, _ := httpPost(t, "/action", map[string]string{- "kind": "press",- "key": "Escape",+ code, _ := httpPost(t, "/action", map[string]any{+ "tabId": currentTabID,+ "kind": "press",+ "key": "Escape",})if code != 200 {t.Errorf("press failed with %d", code)@@ -62,9 +63,10 @@ func TestAction_MissingKind(t *testing.T) {// A11: Ref not foundfunc TestAction_RefNotFound(t *testing.T) {navigate(t, "https://example.com")- code, _ := httpPost(t, "/action", map[string]string{- "kind": "click",- "ref": "e9999",+ code, _ := httpPost(t, "/action", map[string]any{+ "tabId": currentTabID,+ "kind": "click",+ "ref": "e9999",})// Should be an error (400 or 500)if code == 200 {@@ -75,7 +77,8 @@ func TestAction_RefNotFound(t *testing.T) {// A12: CSS selector clickfunc TestAction_CSSSelector(t *testing.T) {navigate(t, "https://example.com")- code, _ := httpPost(t, "/action", map[string]string{+ code, _ := httpPost(t, "/action", map[string]any{+ "tabId": currentTabID,"kind": "click","selector": "a",})@@ -179,7 +182,8 @@ func TestAction_Focus(t *testing.T) {// A8: Scrollfunc TestAction_Scroll(t *testing.T) {navigate(t, "https://example.com")- code, _ := httpPost(t, "/action", map[string]string{+ code, _ := httpPost(t, "/action", map[string]any{+ "tabId": currentTabID,"kind": "scroll","direction": "down",})@@ -227,9 +231,10 @@ func TestAction_Hover(t *testing.T) {t.Skip("no link ref found in snapshot")}- code, _ := httpPost(t, "/action", map[string]string{- "kind": "hover",- "ref": ref,+ code, _ := httpPost(t, "/action", map[string]any{+ "tabId": currentTabID,+ "kind": "hover",+ "ref": ref,})if code != 200 {t.Errorf("hover failed with %d", code)diff --git a/tests/integration/main_test.go b/tests/integration/main_test.goindex 44b60d5c..acfa34f7 100644--- a/tests/integration/main_test.go+++ b/tests/integration/main_test.go@@ -14,7 +14,10 @@ import ("time")-var serverURL string+var (+ serverURL string+ currentTabID string // Track current tab for action operations+)// removeEnvPrefix removes all environment variables starting with the given prefixfunc removeEnvPrefix(env []string, prefix string) []string {@@ -247,6 +250,18 @@ func navigate(t *testing.T, url string) {if code != 200 {t.Fatalf("navigate to %s failed with %d: %s", url, code, string(body))}++ // Extract tabId from response for subsequent action calls+ var result map[string]any+ if err := json.Unmarshal(body, &result); err != nil {+ t.Logf("warning: failed to parse navigate response: %v", err)+ return+ }++ if id, ok := result["tabId"].(string); ok {+ currentTabID = id+ t.Logf("current tab: %s", currentTabID)+ }}// launchTestInstance launches a default test instance for orchestrator-mode tests