Add example: live Playwright browser feed via noVNC#95
Open
Desperado wants to merge 2 commits into
Open
Conversation
Run a headed Playwright test inside an E2B sandbox and watch the browser drive itself in real time from any tab. Boots Xvfb + x11vnc + websockify + noVNC inside the sandbox, exposes port 6080 via sandbox.getHost(6080), returns a https:// URL the operator opens in a browser tab. Two runnable scripts: - examples/01-watch-live-test.ts -- passing test against playwright.dev, prints URL, holds sandbox after the run so the final state stays visible in the noVNC tab. - examples/02-hold-on-failure.ts -- pause-on-failure pattern. Deliberately failing test, sandbox kept alive long enough for the operator to reload the noVNC URL and visually diagnose what went wrong. Same VNC stack that powers the qualitymax.io execution-view "Live" tab, trimmed to a self-contained cookbook example. Complements the self-healing example (PR e2b-dev#93): the snapshot pattern tells the LLM what the DOM was at failure, the live feed tells the human watching what the page looked like. typecheck clean.
|
We require contributors to sign our Contributor License Agreement, and we don't have @Desperado on file. You can sign our CLA at https://e2b.dev/docs/cla . Once you've signed, post a comment here that says '@cla-bot check' |
Author
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
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.
Adds a second cookbook example showing how to stream a headed Playwright test from an E2B sandbox to a browser tab via noVNC.
What it shows
Xvfb + x11vnc + websockify + noVNCinside a freshplaywright-chromiumsandbox.sandbox.getHost(6080)— TLS terminates at E2B's edge, so the URL is alwayshttps://.DISPLAY=:99so x11vnc captures the rendered surface.Structure
src/vnc-setup.ts— sandbox creation + VNC stack boot, returns the noVNC URL.src/runner.ts— headed Playwright runner targeting the live display (headless: false,slowMo: 250, viewport matched to the Xvfb screen size).examples/01-watch-live-test.ts— happy-path demo against playwright.dev.examples/02-hold-on-failure.ts— pause-on-failure pattern: sandbox stays alive long enough for the operator to reload the noVNC URL and visually diagnose what went wrong.Related
Complements #93 (self-healing-playwright-tests). The two patterns are complementary:
The self-healing example's README cross-links here for users who want both.
Verified
npm installclean.npm run typecheckclean.Also adds one bullet to the root README's "Example use cases" section.