Enable browser action tests in E2E suite and CI#149
Merged
Conversation
- Uncomment browser tests in testdata/e2e-test.yml - Add Chromium browser installation to CI workflow - Ensure browser tests can run in both local and CI environments Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Replace chromium-browser package installation with browser-actions/setup-chrome action to properly configure Chrome for chromedp in GitHub Actions. This resolves the "Missing X server or $DISPLAY" error by ensuring Chrome is correctly installed and configured for headless execution. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
Replace probe-action with direct probe execution wrapped in xvfb-action to provide a virtual display for chromedp browser tests in CI. This resolves the "Missing X server or $DISPLAY" error by running tests under Xvfb (X Virtual Framebuffer). Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Increase timeout from 10s to 30s for the "Get element text" test to account for slower network access to external sites in CI environment. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Add 2-minute timeout to the browser test shell command to prevent premature termination when browser tests take longer to complete. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
The pkg.go.dev site can be slow to load in CI environments. Increase timeout to 60s to allow sufficient time for page load and element interactions. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Change the first browser test to use www.google.com instead of pkg.go.dev to avoid network timeout issues in CI. Simplify the test to just verify text extraction functionality with a title element check. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Add FORCE_COLOR=1 environment variable to preserve color output when running probe under xvfb-run, which disables TTY detection. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Change env.CI to CI for correct environment variable access. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Replace xvfb-action with probe-action for consistency - Install xvfb and x11-utils packages for browser tests - Add FORCE_COLOR=1 to preserve color output in CI Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Add CI variable to examples/browser.yml and set headless mode conditionally based on CI environment. This allows: - CI: headless=true (works with Xvfb) - Local: headless=false (displays browser window) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
No longer needed since we're using probe-action directly instead of xvfb-action which was wrapping the command with xvfb-run. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Apply timeout to allocator context to fix "websocket url timeout reached" error. The timeout now applies to both Chrome startup/WebSocket connection and chromedp operations. Previously, the timeout was only applied to chromedp operations, causing Chrome startup and WebSocket connection to use the default ~20s timeout. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Extend timeout to 1 minute to allow more time for Chrome startup, WebSocket connection, and external site access in CI environments. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
- Use example.com which is simpler, faster, and more reliable
- Extract h1 element text ("Example Domain") instead of title
- Add validation that extracted text is not empty
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Make the job name more concise while keeping it descriptive. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Code Metrics Report
Details | | main (28add9a) | #149 (a233c14) | +/- |
|---------------------|----------------|----------------|-------|
+ | Coverage | 48.7% | 48.8% | +0.0% |
| Files | 52 | 52 | 0 |
| Lines | 5249 | 5251 | +2 |
+ | Covered | 2560 | 2563 | +3 |
- | Code to Test Ratio | 1:1.1 | 1:1.1 | -0.1 |
| Code | 10573 | 10575 | +2 |
| Test | 12109 | 12109 | 0 |
+ | Test Execution Time | 1m24s | 22s | -1m2s |Code coverage of files in pull request scope (55.6% → 56.3%)
Reported by octocov |
1 similar comment
Code Metrics Report
Details | | main (28add9a) | #149 (a233c14) | +/- |
|---------------------|----------------|----------------|-------|
+ | Coverage | 48.7% | 48.8% | +0.0% |
| Files | 52 | 52 | 0 |
| Lines | 5249 | 5251 | +2 |
+ | Covered | 2560 | 2563 | +3 |
- | Code to Test Ratio | 1:1.1 | 1:1.1 | -0.1 |
| Code | 10573 | 10575 | +2 |
| Test | 12109 | 12109 | 0 |
+ | Test Execution Time | 1m24s | 22s | -1m2s |Code coverage of files in pull request scope (55.6% → 56.3%)
Reported by octocov |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Enable browser action tests in the E2E test suite using probe's native features to manage Xvfb, making tests work in both CI and local environments without external GitHub Action dependencies.
Key Changes
1. Enable Browser Tests in E2E Suite (
testdata/e2e-test.yml)background: true- Start Xvfb in backgroundretryliteral - Wait for Xvfb readiness with retriesskipif: vars.ci == ""- Run Xvfb only in CI environmentsDISPLAY=:99environment variable for browser tests2. Update CI Workflow (
.github/workflows/end-to-end-test.yml)xvfbandx11-utilspackages for browser supportbrowser-actions/setup-chrometo install Chromeprobe-action(no xvfb-action wrapper needed)3. Improve Browser Examples (
examples/browser.yml)vars.ci: "{{ CI ?? '' }}"headless: "{{ vars.ci != '' }}"Implementation Highlights
Self-Contained Solution:
Environment-Aware:
Why Xvfb?:
Even in headless mode, Chrome requires an X11 display server for rendering. Xvfb (X Virtual FrameBuffer) provides a virtual display in CI environments where no physical display exists.
Test Results
All CI checks passing:
🤖 Generated with Claude Code