Skip to content

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

fix: add 500ms sleep to stealth tests — race condition on injection timing

Mariob4b0e0e725e7
diff --git a/tests/integration/stealth_test.go b/tests/integration/stealth_test.go
index 0564db47..f7aea898 100644
--- a/tests/integration/stealth_test.go
+++ b/tests/integration/stealth_test.go
@@ -5,11 +5,16 @@ package integration
import (
"encoding/json"
"testing"
+ "time"
)
// ST1: Webdriver is hidden (undefined)
func TestStealth_WebdriverUndefined(t *testing.T) {
navigate(t, "https://example.com")
+ // Wait briefly for stealth injection to complete
+ // Chrome's navigator.webdriver property is patched by stealth.js on page load,
+ // but there can be a race condition between navigation and injection
+ time.Sleep(500 * time.Millisecond)
code, body := httpPost(t, "/evaluate", map[string]string{
"expression": "navigator.webdriver === undefined",
})
@@ -30,6 +35,8 @@ func TestStealth_WebdriverUndefined(t *testing.T) {
// ST3: Plugins are present
func TestStealth_PluginsPresent(t *testing.T) {
navigate(t, "https://example.com")
+ // Wait briefly for stealth injection to complete
+ time.Sleep(500 * time.Millisecond)
code, body := httpPost(t, "/evaluate", map[string]string{
"expression": "navigator.plugins.length > 0",
})
@@ -45,6 +52,8 @@ func TestStealth_PluginsPresent(t *testing.T) {
// ST4: Chrome runtime is present
func TestStealth_ChromeRuntimePresent(t *testing.T) {
navigate(t, "https://example.com")
+ // Wait briefly for stealth injection to complete
+ time.Sleep(500 * time.Millisecond)
code, body := httpPost(t, "/evaluate", map[string]string{
"expression": "!!window.chrome.runtime",
})