High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
test: add tab cleanup to action tests
Mario056b086fa70e
diff --git a/tests/integration/actions_test.go b/tests/integration/actions_test.goindex d0ac56b3..ca75e82e 100644--- a/tests/integration/actions_test.go+++ b/tests/integration/actions_test.go@@ -34,6 +34,8 @@ func TestAction_Click(t *testing.T) {// A4: Press keyfunc TestAction_Press(t *testing.T) {navigate(t, "https://example.com")+ defer closeCurrentTab(t)+code, _ := httpPost(t, "/action", map[string]any{"tabId": currentTabID,"kind": "press",@@ -77,6 +79,8 @@ func TestAction_RefNotFound(t *testing.T) {// A12: CSS selector clickfunc TestAction_CSSSelector(t *testing.T) {navigate(t, "https://example.com")+ defer closeCurrentTab(t)+code, _ := httpPost(t, "/action", map[string]any{"tabId": currentTabID,"kind": "click",@@ -182,6 +186,8 @@ func TestAction_Focus(t *testing.T) {// A8: Scrollfunc TestAction_Scroll(t *testing.T) {navigate(t, "https://example.com")+ defer closeCurrentTab(t)+code, _ := httpPost(t, "/action", map[string]any{"tabId": currentTabID,"kind": "scroll",@@ -239,6 +245,8 @@ func TestAction_Hover(t *testing.T) {if code != 200 {t.Errorf("hover failed with %d", code)}++ closeCurrentTab(t)}// A7: Selectdiff --git a/tests/integration/main_test.go b/tests/integration/main_test.goindex d26e496b..5c737fde 100644--- a/tests/integration/main_test.go+++ b/tests/integration/main_test.go@@ -264,6 +264,20 @@ func navigate(t *testing.T, url string) {}}+// closeCurrentTab closes the current tab to clean up resources+func closeCurrentTab(t *testing.T) {+ t.Helper()+ if currentTabID == "" {+ return+ }+ // Close the tab+ _ = httpPost(t, "/tab", map[string]any{+ "tabId": currentTabID,+ "action": "close",+ })+ currentTabID = ""+}+// waitForInstanceReady waits for an instance to be ready for navigation// Uses a simple navigate to about:blank to check readinessfunc waitForInstanceReady(t *testing.T, instID string) {