High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
fix: correct type signatures in integration test helpers
Mario9204a5dcaa99
diff --git a/tests/integration/helpers_test.go b/tests/integration/helpers_test.goindex fd3fc7bf..9d369a4a 100644--- a/tests/integration/helpers_test.go+++ b/tests/integration/helpers_test.go@@ -12,11 +12,11 @@ import ()// httpPostWithRetry attempts a POST request with retries for flaky tests-func httpPostWithRetry(t *testing.T, path string, body map[string]any, maxRetries int) (int, string) {+func httpPostWithRetry(t *testing.T, path string, body any, maxRetries int) (int, []byte) {t.Helper()var lastCode int- var lastBody string+ var lastBody []bytevar lastErr errorfor i := 0; i <= maxRetries; i++ {@@ -25,20 +25,20 @@ func httpPostWithRetry(t *testing.T, path string, body map[string]any, maxRetrietime.Sleep(2 * time.Second) // Wait before retry}- code, body, err := doPost(serverURL+path, body)+ code, respBody, err := doPost(serverURL+path, body)lastCode = code- lastBody = body+ lastBody = respBodylastErr = errif err == nil && code == 200 {- return code, body+ return code, respBody}// Log the failure for debuggingif err != nil {t.Logf("Request failed with error: %v", err)} else {- t.Logf("Request failed with status %d: %s", code, body)+ t.Logf("Request failed with status %d: %s", code, string(respBody))}}@@ -50,11 +50,16 @@ func httpPostWithRetry(t *testing.T, path string, body map[string]any, maxRetrie}// doPost performs the actual HTTP POST-func doPost(url string, body map[string]any) (int, string, error) {- jsonBody, _ := json.Marshal(body)- req, err := http.NewRequest("POST", url, strings.NewReader(string(jsonBody)))+func doPost(url string, body any) (int, []byte, error) {+ var reader io.Reader+ if body != nil {+ jsonBody, _ := json.Marshal(body)+ reader = strings.NewReader(string(jsonBody))+ }++ req, err := http.NewRequest("POST", url, reader)if err != nil {- return 0, "", err+ return 0, nil, err}req.Header.Set("Content-Type", "application/json")@@ -68,16 +73,16 @@ func doPost(url string, body map[string]any) (int, string, error) {resp, err := client.Do(req)if err != nil {- return 0, "", err+ return 0, nil, err}defer resp.Body.Close()respBody, err := io.ReadAll(resp.Body)if err != nil {- return resp.StatusCode, "", err+ return resp.StatusCode, nil, err}- return resp.StatusCode, string(respBody), nil+ return resp.StatusCode, respBody, nil}// getAuthToken returns the auth token if configureddiff --git a/tests/integration/main_test.go b/tests/integration/main_test.goindex 4c2e205c..f64c2cae 100644--- a/tests/integration/main_test.go+++ b/tests/integration/main_test.go@@ -235,8 +235,8 @@ func jsonField(t *testing.T, data []byte, key string) string {func navigate(t *testing.T, url string) {t.Helper()// Use retry logic for better stability- code, body := httpPostWithRetry(t, "/navigate", map[string]string{"url": url}, 2)+ code, body := httpPostWithRetry(t, "/navigate", map[string]any{"url": url}, 2)if code != 200 {- t.Fatalf("navigate to %s failed with %d: %s", url, code, body)+ t.Fatalf("navigate to %s failed with %d: %s", url, code, string(body))}}diff --git a/tests/integration/navigate_test.go b/tests/integration/navigate_test.goindex ad89a436..a62893e2 100644--- a/tests/integration/navigate_test.go+++ b/tests/integration/navigate_test.go@@ -85,7 +85,7 @@ func TestNavigate_Timeout(t *testing.T) {func TestNavigate_SPATitle(t *testing.T) {// Use a page that definitely has a title - example.com has "Example Domain" as title// Use retry logic for stability in CI/slow environments- code, body := httpPostWithRetry(t, "/navigate", map[string]string{"url": "https://example.com"}, 2)+ code, body := httpPostWithRetry(t, "/navigate", map[string]any{"url": "https://example.com"}, 2)if code != 200 {t.Fatalf("expected 200, got %d", code)}