High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
fix: correct integration test assertions and API expectations
Marioe66ec9fc6b34
diff --git a/tests/integration/actions_test.go b/tests/integration/actions_test.goindex e5760649..770e7bc1 100644--- a/tests/integration/actions_test.go+++ b/tests/integration/actions_test.go@@ -191,20 +191,23 @@ func TestAction_Scroll(t *testing.T) {// Batch actions (A14)func TestAction_Batch(t *testing.T) {navigate(t, "https://example.com")- actions := []map[string]string{- {"kind": "press", "key": "Escape"},- {"kind": "scroll", "direction": "down"},- }- data, _ := json.Marshal(actions)- code, _ := httpPostRaw(t, "/actions", string(data))+ payload := map[string]any{+ "actions": []map[string]any{+ {"kind": "press", "key": "Escape"},+ {"kind": "scroll", "direction": "down"},+ },+ }+ data, _ := json.Marshal(payload)+ code, body := httpPostRaw(t, "/actions", string(data))if code != 200 {+ t.Logf("batch response: %s", body)t.Errorf("batch actions failed with %d", code)}}// A15: Batch emptyfunc TestAction_BatchEmpty(t *testing.T) {- code, _ := httpPostRaw(t, "/actions", "[]")+ code, _ := httpPostRaw(t, "/actions", `{"actions": []}`)if code != 400 {t.Errorf("expected 400 for empty batch, got %d", code)}diff --git a/tests/integration/navigate_test.go b/tests/integration/navigate_test.goindex bd917b93..5b347621 100644--- a/tests/integration/navigate_test.go+++ b/tests/integration/navigate_test.go@@ -45,7 +45,7 @@ func TestNavigate_BadJSON(t *testing.T) {// N2: Navigate returns titlefunc TestNavigate_ReturnsTitle(t *testing.T) {- code, body := httpPost(t, "/navigate", map[string]string{"url": "https://httpbin.org/html"})+ code, body := httpPost(t, "/navigate", map[string]string{"url": "https://example.com"})if code != 200 {t.Fatalf("expected 200, got %d", code)}diff --git a/tests/integration/pdf_test.go b/tests/integration/pdf_test.goindex b36e3bc5..c1c8951e 100644--- a/tests/integration/pdf_test.go+++ b/tests/integration/pdf_test.go@@ -41,19 +41,22 @@ func TestPDF_Raw(t *testing.T) {}}-// PD3: PDF save to file+// PD3: PDF save to file (uses default state dir)func TestPDF_SaveFile(t *testing.T) {navigate(t, "https://example.com")- tmp, _ := os.CreateTemp("", "pinchtab-test-*.pdf")- _ = tmp.Close()- defer os.Remove(tmp.Name()) //nolint:errcheck-- code, body := httpGet(t, "/pdf?output=file&path="+tmp.Name())+ code, body := httpGet(t, "/pdf?output=file")if code != 200 {t.Fatalf("expected 200, got %d (body: %s)", code, body)}- info, err := os.Stat(tmp.Name())+ // Response should have a path field pointing to where it was saved+ path := jsonField(t, body, "path")+ if path == "" {+ t.Error("expected path field in response")+ return+ }+ info, err := os.Stat(path)if err != nil {+ t.Logf("file path: %s", path)t.Fatalf("file not created: %v", err)}if info.Size() < 100 {diff --git a/tests/integration/tabs_test.go b/tests/integration/tabs_test.goindex f3eb2cd9..5eab47cb 100644--- a/tests/integration/tabs_test.go+++ b/tests/integration/tabs_test.go@@ -13,9 +13,14 @@ func TestTabs_List(t *testing.T) {if code != 200 {t.Fatalf("expected 200, got %d", code)}- var tabs []any- if err := json.Unmarshal(body, &tabs); err != nil {- t.Fatalf("expected json array: %v", err)+ var resp map[string]any+ if err := json.Unmarshal(body, &resp); err != nil {+ t.Fatalf("expected json object: %v", err)+ }+ tabsRaw := resp["tabs"]+ tabs, ok := tabsRaw.([]any)+ if !ok {+ t.Fatalf("expected tabs to be an array, got %T", tabsRaw)}if len(tabs) == 0 {t.Error("expected at least one tab")@@ -34,9 +39,11 @@ func TestTabs_New(t *testing.T) {// Verify tab count increased_, listBody := httpGet(t, "/tabs")- var tabs []any- _ = json.Unmarshal(listBody, &tabs)- if len(tabs) < 2 {+ var resp map[string]any+ _ = json.Unmarshal(listBody, &resp)+ tabsRaw := resp["tabs"]+ tabs, ok := tabsRaw.([]any)+ if !ok || len(tabs) < 2 {t.Error("expected at least 2 tabs after creating new tab")}}