From 5d35b5f3c47bea613ddba74dad14bfcc32ccff6c Mon Sep 17 00:00:00 2001 From: Shuji Aoshima <47586723+aoshimash@users.noreply.github.com> Date: Sun, 27 Jul 2025 01:54:33 +0900 Subject: [PATCH 1/7] feat: Enable all Playwright tests and improve error handling - Phase 3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove all CI skip conditions from Playwright tests: - TestBrowserPool_RenderPage - TestJSClient_RenderPage - TestJSClient_Get - TestNewUnifiedClient_JSEnabled - Implement enhanced error handling with debug logging: - Add test_helpers.go with debug capture utilities - Capture console logs and network activity during tests - Log detailed error context when tests fail - Add screenshot capture capability on test failure - Add retry logic helper for potentially flaky tests - Integrate debug handlers into browser pool for automatic logging when running in test mode This completes Phase 3 of the Playwright CI integration, enabling all tests to run in CI with comprehensive debugging capabilities. Fixes #64 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- internal/client/browser_pool.go | 23 ++++ internal/client/browser_pool_test.go | 7 +- internal/client/js_client_test.go | 11 -- internal/client/test_helpers.go | 172 ++++++++++++++++++++++++- internal/client/unified_client_test.go | 4 - 5 files changed, 192 insertions(+), 25 deletions(-) diff --git a/internal/client/browser_pool.go b/internal/client/browser_pool.go index 3520b3c..c88eb98 100644 --- a/internal/client/browser_pool.go +++ b/internal/client/browser_pool.go @@ -5,6 +5,7 @@ import ( "fmt" "log/slog" "sync" + "testing" "time" "github.com/playwright-community/playwright-go" @@ -213,6 +214,12 @@ func (p *BrowserPool) RenderPage(ctx context.Context, targetURL string) (string, } defer page.Close() + // Setup debug handlers if running in test mode + var consoleLogs, networkLogs []string + if testing.Testing() { + consoleLogs, networkLogs = SetupPageDebugHandlers(page) + } + // Set timeout page.SetDefaultTimeout(float64(p.config.Timeout.Milliseconds())) @@ -234,12 +241,28 @@ func (p *BrowserPool) RenderPage(ctx context.Context, targetURL string) (string, Timeout: playwright.Float(float64(p.config.Timeout.Milliseconds())), }) if err != nil { + // Log debug info when running in test mode + if testing.Testing() && (len(consoleLogs) > 0 || len(networkLogs) > 0) { + p.logger.Error("Navigation failed with debug info", + "url", targetURL, + "error", err, + "console_logs", consoleLogs, + "network_logs", networkLogs) + } return "", fmt.Errorf("failed to navigate to URL %s: %w", targetURL, err) } // Get the final HTML content content, err := page.Content() if err != nil { + // Log debug info when running in test mode + if testing.Testing() && (len(consoleLogs) > 0 || len(networkLogs) > 0) { + p.logger.Error("Failed to get content with debug info", + "url", targetURL, + "error", err, + "console_logs", consoleLogs, + "network_logs", networkLogs) + } return "", fmt.Errorf("failed to get page content: %w", err) } diff --git a/internal/client/browser_pool_test.go b/internal/client/browser_pool_test.go index 011332e..406a174 100644 --- a/internal/client/browser_pool_test.go +++ b/internal/client/browser_pool_test.go @@ -3,7 +3,6 @@ package client import ( "context" "log/slog" - "os" "testing" "time" ) @@ -79,11 +78,6 @@ func TestBrowserPool_AcquireContext(t *testing.T) { } func TestBrowserPool_RenderPage(t *testing.T) { - // Skip this test in CI environment due to missing dependencies - if os.Getenv("CI") == "true" { - t.Skip("Skipping browser test in CI environment") - } - logger := slog.Default() config := &JSConfig{ Enabled: true, @@ -102,6 +96,7 @@ func TestBrowserPool_RenderPage(t *testing.T) { ctx := context.Background() content, err := pool.RenderPage(ctx, "https://example.com") if err != nil { + // The browser pool now logs debug info automatically t.Fatalf("Failed to render page: %v", err) } diff --git a/internal/client/js_client_test.go b/internal/client/js_client_test.go index 6a462ae..16302a3 100644 --- a/internal/client/js_client_test.go +++ b/internal/client/js_client_test.go @@ -3,7 +3,6 @@ package client import ( "context" "log/slog" - "os" "testing" "time" ) @@ -35,11 +34,6 @@ func TestNewJSClient(t *testing.T) { } func TestJSClient_RenderPage(t *testing.T) { - // Skip this test in CI environment due to missing dependencies - if os.Getenv("CI") == "true" { - t.Skip("Skipping browser test in CI environment") - } - logger := slog.Default() config := &JSConfig{ Enabled: true, @@ -73,11 +67,6 @@ func TestJSClient_RenderPage(t *testing.T) { } func TestJSClient_Get(t *testing.T) { - // Skip this test in CI environment due to missing dependencies - if os.Getenv("CI") == "true" { - t.Skip("Skipping browser test in CI environment") - } - logger := slog.Default() config := &JSConfig{ Enabled: true, diff --git a/internal/client/test_helpers.go b/internal/client/test_helpers.go index 99d1553..f9d52a4 100644 --- a/internal/client/test_helpers.go +++ b/internal/client/test_helpers.go @@ -1,8 +1,172 @@ package client -import "os" +import ( + "fmt" + "os" + "path/filepath" + "testing" + "time" -// isGitHubActions returns true if running in GitHub Actions -func isGitHubActions() bool { - return os.Getenv("GITHUB_ACTIONS") != "" + "github.com/playwright-community/playwright-go" +) + +// TestError wraps an error with additional context for better debugging +type TestError struct { + Err error + BrowserLogs []string + ConsoleLogs []string + NetworkLogs []string + ScreenshotPath string +} + +func (e *TestError) Error() string { + msg := fmt.Sprintf("Test failed: %v", e.Err) + if len(e.BrowserLogs) > 0 { + msg += fmt.Sprintf("\nBrowser logs: %v", e.BrowserLogs) + } + if len(e.ConsoleLogs) > 0 { + msg += fmt.Sprintf("\nConsole logs: %v", e.ConsoleLogs) + } + if len(e.NetworkLogs) > 0 { + msg += fmt.Sprintf("\nNetwork logs: %v", e.NetworkLogs) + } + if e.ScreenshotPath != "" { + msg += fmt.Sprintf("\nScreenshot saved to: %s", e.ScreenshotPath) + } + return msg +} + +// CapturePageDebugInfo captures debug information from a Playwright page +func CapturePageDebugInfo(t *testing.T, page playwright.Page, testName string) *TestError { + debugInfo := &TestError{} + + // Capture console logs + page.OnConsole(func(msg playwright.ConsoleMessage) { + debugInfo.ConsoleLogs = append(debugInfo.ConsoleLogs, + fmt.Sprintf("[%s] %s", msg.Type(), msg.Text())) + }) + + // Capture network requests + page.OnRequest(func(req playwright.Request) { + debugInfo.NetworkLogs = append(debugInfo.NetworkLogs, + fmt.Sprintf("Request: %s %s", req.Method(), req.URL())) + }) + + page.OnResponse(func(resp playwright.Response) { + debugInfo.NetworkLogs = append(debugInfo.NetworkLogs, + fmt.Sprintf("Response: %d %s", resp.Status(), resp.URL())) + }) + + // Capture screenshot on failure + if t.Failed() { + screenshotDir := filepath.Join(os.TempDir(), "urlmap-test-screenshots") + if err := os.MkdirAll(screenshotDir, 0755); err == nil { + screenshotPath := filepath.Join(screenshotDir, fmt.Sprintf("%s.png", testName)) + if _, err := page.Screenshot(playwright.PageScreenshotOptions{ + Path: playwright.String(screenshotPath), + FullPage: playwright.Bool(true), + }); err == nil { + debugInfo.ScreenshotPath = screenshotPath + } + } + } + + return debugInfo +} + +// SetupPageDebugHandlers sets up debug handlers for a page +func SetupPageDebugHandlers(page playwright.Page) (consoleLogs []string, networkLogs []string) { + // Capture console logs + page.OnConsole(func(msg playwright.ConsoleMessage) { + consoleLogs = append(consoleLogs, + fmt.Sprintf("[%s] %s", msg.Type(), msg.Text())) + }) + + // Capture network activity + page.OnRequest(func(req playwright.Request) { + networkLogs = append(networkLogs, + fmt.Sprintf("Request: %s %s", req.Method(), req.URL())) + }) + + page.OnResponse(func(resp playwright.Response) { + networkLogs = append(networkLogs, + fmt.Sprintf("Response: %d %s", resp.Status(), resp.URL())) + }) + + return consoleLogs, networkLogs +} + +// LogTestDebugInfo logs debug information when a test fails +func LogTestDebugInfo(t *testing.T, testName string, consoleLogs, networkLogs []string, err error) { + if err == nil { + return + } + + t.Errorf("Test %s failed: %v", testName, err) + + if len(consoleLogs) > 0 { + t.Logf("Console logs:") + for _, log := range consoleLogs { + t.Logf(" %s", log) + } + } + + if len(networkLogs) > 0 { + t.Logf("Network activity:") + for _, log := range networkLogs { + t.Logf(" %s", log) + } + } +} + +// CaptureScreenshotOnFailure captures a screenshot if the test has failed +func CaptureScreenshotOnFailure(t *testing.T, page playwright.Page, testName string) string { + if !t.Failed() { + return "" + } + + screenshotDir := filepath.Join(os.TempDir(), "urlmap-test-screenshots") + if err := os.MkdirAll(screenshotDir, 0755); err != nil { + t.Logf("Failed to create screenshot directory: %v", err) + return "" + } + + screenshotPath := filepath.Join(screenshotDir, fmt.Sprintf("%s.png", testName)) + if _, err := page.Screenshot(playwright.PageScreenshotOptions{ + Path: playwright.String(screenshotPath), + FullPage: playwright.Bool(true), + }); err != nil { + t.Logf("Failed to capture screenshot: %v", err) + return "" + } + + t.Logf("Screenshot saved to: %s", screenshotPath) + return screenshotPath +} + +// RetryTest runs a test function with retry logic for potentially flaky tests +func RetryTest(t *testing.T, maxAttempts int, testFunc func() error) { + var lastErr error + for attempt := 1; attempt <= maxAttempts; attempt++ { + lastErr = testFunc() + if lastErr == nil { + return // Test passed + } + + if attempt < maxAttempts { + t.Logf("Test attempt %d/%d failed: %v. Retrying...", attempt, maxAttempts, lastErr) + // Small delay between retries + time.Sleep(time.Second) + } + } + + // All attempts failed + t.Errorf("Test failed after %d attempts. Last error: %v", maxAttempts, lastErr) +} + +// time import for RetryTest +func init() { + // Ensure time is imported + _ = time.Second } + diff --git a/internal/client/unified_client_test.go b/internal/client/unified_client_test.go index 6c9ca9e..b49da6f 100644 --- a/internal/client/unified_client_test.go +++ b/internal/client/unified_client_test.go @@ -36,10 +36,6 @@ func TestNewUnifiedClient_HTTPOnly(t *testing.T) { } func TestNewUnifiedClient_JSEnabled(t *testing.T) { - // Skip this test in GitHub Actions where Playwright may not be available - if isGitHubActions() { - t.Skip("Skipping Playwright test in GitHub Actions") - } config := &UnifiedConfig{ UserAgent: "test-agent", From 5716335bf386c6f570cfa3bf774bbaf2a74ccb15 Mon Sep 17 00:00:00 2001 From: Shuji Aoshima <47586723+aoshimash@users.noreply.github.com> Date: Sun, 27 Jul 2025 01:59:57 +0900 Subject: [PATCH 2/7] fix: Remove unnecessary init function and fix formatting - Remove unused init function from test_helpers.go - Fix file formatting to pass gofmt -s check --- internal/client/test_helpers.go | 7 ------- 1 file changed, 7 deletions(-) diff --git a/internal/client/test_helpers.go b/internal/client/test_helpers.go index f9d52a4..b418bb9 100644 --- a/internal/client/test_helpers.go +++ b/internal/client/test_helpers.go @@ -163,10 +163,3 @@ func RetryTest(t *testing.T, maxAttempts int, testFunc func() error) { // All attempts failed t.Errorf("Test failed after %d attempts. Last error: %v", maxAttempts, lastErr) } - -// time import for RetryTest -func init() { - // Ensure time is imported - _ = time.Second -} - From 50f7fd7a039907a26b5d71d30fa08064b86bd781 Mon Sep 17 00:00:00 2001 From: Shuji Aoshima <47586723+aoshimash@users.noreply.github.com> Date: Sun, 27 Jul 2025 02:12:27 +0900 Subject: [PATCH 3/7] fix: Revert Playwright test enablement in CI due to missing system dependencies The CI environment is missing critical system dependencies for Playwright: - GTK4 libraries - GStreamer libraries - Various multimedia codecs - And many more These dependencies should be addressed in Phase 2 (issue #63) before enabling Playwright tests in CI. For now, we're keeping the enhanced error handling but skipping tests in CI. The tests still run locally where dependencies are available. --- .claude/settings.local.json | 4 +++- internal/client/browser_pool_test.go | 7 +++++++ internal/client/js_client_test.go | 13 +++++++++++++ internal/client/unified_client_test.go | 6 ++++++ 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/.claude/settings.local.json b/.claude/settings.local.json index cfc635a..a63955f 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -1,7 +1,9 @@ { "permissions": { "allow": [ - "Bash(find:*)" + "Bash(find:*)", + "Bash(touch:*)", + "Bash(gh pr checks:*)" ], "deny": [] } diff --git a/internal/client/browser_pool_test.go b/internal/client/browser_pool_test.go index 406a174..c19f7aa 100644 --- a/internal/client/browser_pool_test.go +++ b/internal/client/browser_pool_test.go @@ -3,6 +3,7 @@ package client import ( "context" "log/slog" + "os" "testing" "time" ) @@ -78,6 +79,12 @@ func TestBrowserPool_AcquireContext(t *testing.T) { } func TestBrowserPool_RenderPage(t *testing.T) { + // Skip this test in CI environment due to missing Playwright dependencies + // This should be addressed in Phase 2 (issue #63) + if os.Getenv("CI") == "true" { + t.Skip("Skipping browser test in CI environment - missing system dependencies") + } + logger := slog.Default() config := &JSConfig{ Enabled: true, diff --git a/internal/client/js_client_test.go b/internal/client/js_client_test.go index 16302a3..27f7e34 100644 --- a/internal/client/js_client_test.go +++ b/internal/client/js_client_test.go @@ -3,6 +3,7 @@ package client import ( "context" "log/slog" + "os" "testing" "time" ) @@ -34,6 +35,12 @@ func TestNewJSClient(t *testing.T) { } func TestJSClient_RenderPage(t *testing.T) { + // Skip this test in CI environment due to missing Playwright dependencies + // This should be addressed in Phase 2 (issue #63) + if os.Getenv("CI") == "true" { + t.Skip("Skipping browser test in CI environment - missing system dependencies") + } + logger := slog.Default() config := &JSConfig{ Enabled: true, @@ -67,6 +74,12 @@ func TestJSClient_RenderPage(t *testing.T) { } func TestJSClient_Get(t *testing.T) { + // Skip this test in CI environment due to missing Playwright dependencies + // This should be addressed in Phase 2 (issue #63) + if os.Getenv("CI") == "true" { + t.Skip("Skipping browser test in CI environment - missing system dependencies") + } + logger := slog.Default() config := &JSConfig{ Enabled: true, diff --git a/internal/client/unified_client_test.go b/internal/client/unified_client_test.go index b49da6f..a49ea40 100644 --- a/internal/client/unified_client_test.go +++ b/internal/client/unified_client_test.go @@ -2,6 +2,7 @@ package client import ( "log/slog" + "os" "testing" "time" @@ -36,6 +37,11 @@ func TestNewUnifiedClient_HTTPOnly(t *testing.T) { } func TestNewUnifiedClient_JSEnabled(t *testing.T) { + // Skip this test in CI environment due to missing Playwright dependencies + // This should be addressed in Phase 2 (issue #63) + if os.Getenv("CI") == "true" { + t.Skip("Skipping browser test in CI environment - missing system dependencies") + } config := &UnifiedConfig{ UserAgent: "test-agent", From 508d5ed44cfdd2fdd20fc90352a39cfca9f1068f Mon Sep 17 00:00:00 2001 From: Shuji Aoshima <47586723+aoshimash@users.noreply.github.com> Date: Sun, 27 Jul 2025 12:15:37 +0900 Subject: [PATCH 4/7] feat: Enable all Playwright tests in CI environment Now that Phase 2 (#68) has been completed with Docker-based CI setup, we can enable all Playwright tests to run in the CI environment. - Remove CI skip conditions from all Playwright tests - Tests now run in Docker container with all dependencies pre-installed - Enhanced error handling and debugging capabilities remain in place Completes Phase 3 (#64) --- internal/client/browser_pool_test.go | 6 ------ internal/client/js_client_test.go | 12 ------------ internal/client/unified_client_test.go | 5 ----- 3 files changed, 23 deletions(-) diff --git a/internal/client/browser_pool_test.go b/internal/client/browser_pool_test.go index c19f7aa..9e22fe8 100644 --- a/internal/client/browser_pool_test.go +++ b/internal/client/browser_pool_test.go @@ -79,12 +79,6 @@ func TestBrowserPool_AcquireContext(t *testing.T) { } func TestBrowserPool_RenderPage(t *testing.T) { - // Skip this test in CI environment due to missing Playwright dependencies - // This should be addressed in Phase 2 (issue #63) - if os.Getenv("CI") == "true" { - t.Skip("Skipping browser test in CI environment - missing system dependencies") - } - logger := slog.Default() config := &JSConfig{ Enabled: true, diff --git a/internal/client/js_client_test.go b/internal/client/js_client_test.go index 27f7e34..23e2f30 100644 --- a/internal/client/js_client_test.go +++ b/internal/client/js_client_test.go @@ -35,12 +35,6 @@ func TestNewJSClient(t *testing.T) { } func TestJSClient_RenderPage(t *testing.T) { - // Skip this test in CI environment due to missing Playwright dependencies - // This should be addressed in Phase 2 (issue #63) - if os.Getenv("CI") == "true" { - t.Skip("Skipping browser test in CI environment - missing system dependencies") - } - logger := slog.Default() config := &JSConfig{ Enabled: true, @@ -74,12 +68,6 @@ func TestJSClient_RenderPage(t *testing.T) { } func TestJSClient_Get(t *testing.T) { - // Skip this test in CI environment due to missing Playwright dependencies - // This should be addressed in Phase 2 (issue #63) - if os.Getenv("CI") == "true" { - t.Skip("Skipping browser test in CI environment - missing system dependencies") - } - logger := slog.Default() config := &JSConfig{ Enabled: true, diff --git a/internal/client/unified_client_test.go b/internal/client/unified_client_test.go index a49ea40..18969f2 100644 --- a/internal/client/unified_client_test.go +++ b/internal/client/unified_client_test.go @@ -37,11 +37,6 @@ func TestNewUnifiedClient_HTTPOnly(t *testing.T) { } func TestNewUnifiedClient_JSEnabled(t *testing.T) { - // Skip this test in CI environment due to missing Playwright dependencies - // This should be addressed in Phase 2 (issue #63) - if os.Getenv("CI") == "true" { - t.Skip("Skipping browser test in CI environment - missing system dependencies") - } config := &UnifiedConfig{ UserAgent: "test-agent", From 279a031f008617fda08232a8a248b4b4cc260915 Mon Sep 17 00:00:00 2001 From: Shuji Aoshima <47586723+aoshimash@users.noreply.github.com> Date: Sun, 27 Jul 2025 12:21:07 +0900 Subject: [PATCH 5/7] fix: Remove unused os imports from test files Fix go vet error by removing unused os package imports --- internal/client/browser_pool_test.go | 1 - internal/client/js_client_test.go | 1 - internal/client/unified_client_test.go | 1 - 3 files changed, 3 deletions(-) diff --git a/internal/client/browser_pool_test.go b/internal/client/browser_pool_test.go index 9e22fe8..406a174 100644 --- a/internal/client/browser_pool_test.go +++ b/internal/client/browser_pool_test.go @@ -3,7 +3,6 @@ package client import ( "context" "log/slog" - "os" "testing" "time" ) diff --git a/internal/client/js_client_test.go b/internal/client/js_client_test.go index 23e2f30..16302a3 100644 --- a/internal/client/js_client_test.go +++ b/internal/client/js_client_test.go @@ -3,7 +3,6 @@ package client import ( "context" "log/slog" - "os" "testing" "time" ) diff --git a/internal/client/unified_client_test.go b/internal/client/unified_client_test.go index 18969f2..b49da6f 100644 --- a/internal/client/unified_client_test.go +++ b/internal/client/unified_client_test.go @@ -2,7 +2,6 @@ package client import ( "log/slog" - "os" "testing" "time" From 2917e5b85bd637fd4a0db30dfdf921b0f9459afc Mon Sep 17 00:00:00 2001 From: Shuji Aoshima <47586723+aoshimash@users.noreply.github.com> Date: Sun, 27 Jul 2025 12:25:11 +0900 Subject: [PATCH 6/7] fix: Update Playwright Docker image to v1.52.0 Match Docker image version with project's Playwright version to resolve compatibility issues --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a1247b..162bf39 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: name: Test runs-on: ubuntu-latest container: - image: mcr.microsoft.com/playwright:v1.48.0-noble + image: mcr.microsoft.com/playwright:v1.52.0-noble strategy: matrix: From c217e75bbd5ee5a21852ac1c59f2306ec60ed0ed Mon Sep 17 00:00:00 2001 From: Shuji Aoshima <47586723+aoshimash@users.noreply.github.com> Date: Sun, 27 Jul 2025 12:29:38 +0900 Subject: [PATCH 7/7] fix: Increase Playwright test timeout to 60s for CI environment The CI Docker environment may have slower network access, causing timeouts when navigating to external URLs --- .claude/settings.local.json | 3 ++- internal/client/browser_pool_test.go | 14 +++++++------- internal/client/js_client_test.go | 10 +++++----- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.claude/settings.local.json b/.claude/settings.local.json index a63955f..adc11d8 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -3,7 +3,8 @@ "allow": [ "Bash(find:*)", "Bash(touch:*)", - "Bash(gh pr checks:*)" + "Bash(gh pr checks:*)", + "Bash(grep:*)" ], "deny": [] } diff --git a/internal/client/browser_pool_test.go b/internal/client/browser_pool_test.go index 406a174..34dd267 100644 --- a/internal/client/browser_pool_test.go +++ b/internal/client/browser_pool_test.go @@ -22,7 +22,7 @@ func TestNewBrowserPool(t *testing.T) { Enabled: true, BrowserType: "chromium", Headless: true, - Timeout: 30 * time.Second, + Timeout: 60 * time.Second, } pool2, err := NewBrowserPool(config, logger) @@ -38,7 +38,7 @@ func TestBrowserPool_AcquireContext(t *testing.T) { Enabled: true, BrowserType: "chromium", Headless: true, - Timeout: 30 * time.Second, + Timeout: 60 * time.Second, } pool, err := NewBrowserPool(config, logger) @@ -83,7 +83,7 @@ func TestBrowserPool_RenderPage(t *testing.T) { Enabled: true, BrowserType: "chromium", Headless: true, - Timeout: 30 * time.Second, + Timeout: 60 * time.Second, } pool, err := NewBrowserPool(config, logger) @@ -116,7 +116,7 @@ func TestBrowserPool_GetPoolStats(t *testing.T) { Enabled: true, BrowserType: "chromium", Headless: true, - Timeout: 30 * time.Second, + Timeout: 60 * time.Second, WaitFor: "networkidle", } @@ -156,7 +156,7 @@ func TestBrowserPool_ConcurrentAccess(t *testing.T) { Enabled: true, BrowserType: "chromium", Headless: true, - Timeout: 30 * time.Second, + Timeout: 60 * time.Second, WaitFor: "networkidle", } @@ -203,7 +203,7 @@ func TestBrowserPool_Close(t *testing.T) { Enabled: true, BrowserType: "chromium", Headless: true, - Timeout: 30 * time.Second, + Timeout: 60 * time.Second, WaitFor: "networkidle", } @@ -237,7 +237,7 @@ func TestBrowserContext_ReleaseContext(t *testing.T) { Enabled: true, BrowserType: "chromium", Headless: true, - Timeout: 30 * time.Second, + Timeout: 60 * time.Second, WaitFor: "networkidle", } diff --git a/internal/client/js_client_test.go b/internal/client/js_client_test.go index 16302a3..534f982 100644 --- a/internal/client/js_client_test.go +++ b/internal/client/js_client_test.go @@ -22,7 +22,7 @@ func TestNewJSClient(t *testing.T) { Enabled: true, BrowserType: "chromium", Headless: true, - Timeout: 30 * time.Second, + Timeout: 60 * time.Second, WaitFor: "networkidle", } @@ -39,7 +39,7 @@ func TestJSClient_RenderPage(t *testing.T) { Enabled: true, BrowserType: "chromium", Headless: true, - Timeout: 30 * time.Second, + Timeout: 60 * time.Second, WaitFor: "networkidle", } @@ -72,7 +72,7 @@ func TestJSClient_Get(t *testing.T) { Enabled: true, BrowserType: "chromium", Headless: true, - Timeout: 30 * time.Second, + Timeout: 60 * time.Second, WaitFor: "networkidle", } @@ -116,7 +116,7 @@ func TestJSClient_GetPoolStats(t *testing.T) { Enabled: true, BrowserType: "chromium", Headless: true, - Timeout: 30 * time.Second, + Timeout: 60 * time.Second, WaitFor: "networkidle", } @@ -146,7 +146,7 @@ func TestJSClient_Disabled(t *testing.T) { Enabled: false, BrowserType: "chromium", Headless: true, - Timeout: 30 * time.Second, + Timeout: 60 * time.Second, } client, err := NewJSClient(config, logger)