Five locator tests and two agent tests on Campfire Commerce, a demo store
page that loads its product with XMLHttpRequest and its reviews with
fetch(). The tests run in Lightpanda, the
open-source headless browser, on your machine, and on Lightpanda Cloud when
you have a token.
Run
Use Node 22.22.3+ or 24.8+, and install Lightpanda:
brew install lightpanda-io/browser/lightpandaOn Linux, follow the installation guide. Then clone this repository and run the tests from this folder:
git clone https://github.com/lightpanda-io/demo
cd demo/e2e
npm install
npm run test:e2eNo Chrome is needed. Results are in .e2e/report.json.
What Lightpanda changes
e2e.config.ts sets the browser to lightpanda() from
@e2e-dev/lightpanda.
Each worker starts its own lightpanda serve on a free port and stops it
when the run ends. loadResources: ['stylesheet'] makes the server fetch
linked stylesheets, so a node that a stylesheet hides is hidden to a query.
The tests target https://demo-browser.lightpanda.io/campfire-commerce/,
which Lightpanda's own CI also tests. Set APP_URL to run them against
another copy of the page.
Lightpanda CDP commands
Lightpanda adds its own CDP commands, the LP domain, such as LP.dump
for the page as markdown or LP.getInteractiveElements for what a user can
act on. e2e tests don't open CDP sessions; from Playwright, send them on the
page's session:
const client = await context.newCDPSession(page);
const { content } = await client.send('LP.dump', { format: 'markdown' });
const { elements } = await client.send('LP.getInteractiveElements');See the LP domain reference and Playwright with Lightpanda.
Lightpanda Cloud
Set a Lightpanda Cloud token to add a
lightpanda-cloud target, which connects to a hosted browser over CDP:
LPD_TOKEN="your-token" npm run test:e2e -- --target lightpanda-cloudAgent tests
Set a Vercel AI Gateway key:
AI_GATEWAY_API_KEY="your-key" npm run test:e2eWithout the key, the agent tests skip. The default model needs AI Gateway
credits; on a free Vercel account, set a free model such as
nvidia/nemotron-3.5-lightning-free in e2e.config.ts.
Last checked with e2e 0.23.1, @e2e-dev/web 0.16.0, @e2e-dev/lightpanda 0.0.2, Lightpanda 1.0.4, and Node 22.
