Skip to content

Commit 983a845

Browse files
DavertMikDavertMikclaudeDenysKuchma
authored
feat(kitesurf): test against a local open-source Kitesurf engine (#5805)
* feat(kitesurf): test against a local open-source Kitesurf engine Kitesurf is now open source and runs locally with wrangler dev. The helper connects to any engine set in `endpoint` (local or self-deployed, with optional Access headers) and only uses Cloudflare Browser Run without it. - run the shared webapi suite against a local engine, skip verified engine gaps - tag acceptance scenarios with @kitesurf and add codecept.Kitesurf.js - add kitesurf.yml: build the pinned engine with Bazel, cache the build output - document the local engine and its limitations Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(kitesurf): skip link cursor check, Kitesurf computes cursor auto Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(bench): benchmark all alternative engines, record results run-bench.mjs now covers Playwright, Obscura, Lightpanda, Moli and Kitesurf (BENCH_ENGINES picks a subset) and reports each against Playwright. examples/bench/README.md records how to run it, the 2026-11-15 timings, raw CDP navigation costs and CI feature coverage. Docs note Kitesurf's ~200 ms per-navigation cost. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: DavertMik <davert@testomat.io> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Denys Kuchma <den.kuchma@ukr.net>
1 parent 638c134 commit 983a845

17 files changed

Lines changed: 671 additions & 310 deletions

‎.github/workflows/kitesurf.yml‎

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Kitesurf Helper Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- 4.x
7+
pull_request:
8+
branches:
9+
- '**'
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
13+
cancel-in-progress: true
14+
15+
permissions:
16+
contents: read
17+
18+
env:
19+
CI: true
20+
FORCE_COLOR: 1
21+
KITESURF_VERSION: 2026.11.9
22+
KITESURF_ENDPOINT: http://127.0.0.1:8787
23+
24+
jobs:
25+
build:
26+
runs-on: ubuntu-24.04
27+
timeout-minutes: 90
28+
29+
steps:
30+
- uses: actions/checkout@v6
31+
with:
32+
persist-credentials: false
33+
- name: Checkout Kitesurf
34+
uses: actions/checkout@v6
35+
with:
36+
repository: cloudflare/kitesurf
37+
ref: ${{ env.KITESURF_VERSION }}
38+
path: kitesurf
39+
persist-credentials: false
40+
- name: Use Node.js
41+
uses: actions/setup-node@v6
42+
with:
43+
node-version-file: '.nvmrc'
44+
- uses: pnpm/action-setup@v4
45+
with:
46+
version: 9.15.4
47+
run_install: false
48+
- uses: shivammathur/setup-php@v2
49+
with:
50+
php-version: 8.0
51+
- name: npm install
52+
run: npm i --force
53+
- name: Install Kitesurf dependencies
54+
working-directory: kitesurf
55+
run: pnpm install --frozen-lockfile
56+
- name: Cache Kitesurf build
57+
id: kitesurf-build
58+
uses: actions/cache@v6
59+
with:
60+
path: |
61+
kitesurf/packages/core/pkg
62+
kitesurf/packages/renderer-core/pkg
63+
kitesurf/packages/engine/public/rbi
64+
kitesurf/packages/dom-shim/dist
65+
kitesurf/packages/page-script/dist
66+
kitesurf/packages/page-renderer/dist
67+
kitesurf/packages/worker-script/dist
68+
key: kitesurf-build-${{ env.KITESURF_VERSION }}-x86_64-linux
69+
- name: Build Kitesurf
70+
if: steps.kitesurf-build.outputs.cache-hit != 'true'
71+
working-directory: kitesurf
72+
run: |
73+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /usr/local/.ghcup /opt/hostedtoolcache/CodeQL
74+
bazel run //packages/engine:dev_build
75+
- name: start Kitesurf
76+
working-directory: kitesurf/packages/engine
77+
run: |
78+
npx wrangler dev --env local -c wrangler.jsonc -c test/fixtures-worker/wrangler.jsonc --port 8787 > ~/kitesurf.log 2>&1 &
79+
for i in $(seq 1 90); do curl -sf http://127.0.0.1:8787/health && break; sleep 2; done
80+
curl -sf http://127.0.0.1:8787/json/version
81+
- name: start test server
82+
run: |
83+
php -S 127.0.0.1:8000 -t test/data/app &
84+
sleep 1
85+
curl -sf http://127.0.0.1:8000/info > /dev/null
86+
- name: run kitesurf helper tests
87+
run: npm run test:unit:webbapi:kitesurf
88+
- name: run kitesurf acceptance tests
89+
run: ./bin/codecept.js run -c test/acceptance/codecept.Kitesurf.js --grep @Kitesurf --debug
90+
- name: Kitesurf log
91+
if: failure()
92+
run: tail -200 ~/kitesurf.log

‎Bunoshfile.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ const inheritedHelperDocs = {
342342
Obscura: { parent: 'CDPBrowser' },
343343
Lightpanda: { parent: 'CDPBrowser' },
344344
Moli: { parent: 'CDPBrowser' },
345-
Kitesurf: { parent: 'CDPBrowser', excludeConfig: ['endpoint', 'headers'] },
345+
Kitesurf: { parent: 'CDPBrowser' },
346346
}
347347

348348
const abstractHelpers = ['CDPBrowser']

‎docs/alternative-browsers.md‎

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ title: Alternative Browser Engines
99
The `Obscura`, `Lightpanda`, `Moli` and `Kitesurf` helpers are experimental. Keep a Playwright or WebDriver job for compatibility-critical tests.
1010
:::
1111

12-
Playwright drives full Chromium, Firefox and WebKit: the most accurate way to test what users see, at the cost of a heavy browser per worker. Alternative engines trade part of that accuracy for speed, a small footprint, or cloud scale. They are a good fit for functional tests (text appears, form submits, redirect happens, cookie is set) and a poor one for anything visual.
12+
Playwright drives full Chromium, Firefox and WebKit: the most accurate way to test what users see, at the cost of a heavy browser per worker. Alternative engines trade part of that accuracy for speed, a small footprint, or cloud scale. Obscura, Lightpanda, Moli and Kitesurf are open source and run on your machine; Kitesurf also runs in Cloudflare's cloud. They are a good fit for functional tests (text appears, form submits, redirect happens, cookie is set) and a poor one for anything visual.
1313

1414
Your tests do not change. `I.amOnPage`, `I.click`, `I.fillField`, `I.see`, `I.seeElement` and the rest of the `I.*` web API work the same; you only swap the helper in the config. All engines below speak Chrome DevTools Protocol, so there is no `npx playwright install` step.
1515

@@ -200,14 +200,53 @@ All options: [Moli helper reference](/helpers/moli).
200200

201201
## Kitesurf
202202

203-
[Kitesurf](https://blog.cloudflare.com/kitesurf/) is Cloudflare's browser running on Cloudflare Workers, with a real layout and rendering pipeline. Sessions start in about a second and nothing runs on your machine, so the number of parallel browsers is limited only by how far your suite splits.
203+
[Kitesurf](https://github.com/cloudflare/kitesurf) is Cloudflare's open-source browser engine built on Cloudflare Workers, with real layout and rendering: screenshots and the `screencast` plugin work. Run it locally for development and CI, or use it in the cloud through Cloudflare Browser Run, where sessions start in about a second and the number of parallel browsers is limited only by how far your suite splits.
204+
205+
Page JavaScript runs in Boa, a JavaScript engine written in Rust, not V8, so some libraries fail to start.
206+
207+
Kitesurf starts a fresh isolated worker for every page, so each navigation costs about 200 ms on a local engine. A suite runs about 4 times slower than on Lightpanda, Moli or Obscura, close to Playwright. In exchange, it is the only engine here with real layout and screenshots.
204208

205209
Limitations:
206210

207-
- Cloud only, currently a free beta.
208-
- The browser cannot reach `localhost`: test a deployed environment or expose your app with a tunnel such as `cloudflared tunnel --url http://localhost:3000`.
211+
- `attachFile` does not upload files.
212+
- Clipboard actions do not work: pages are never a secure context, even on `localhost`.
213+
- A click can hit the wrong element when a child overflows a container with `overflow: hidden`.
214+
- Rich text editors Quill, Trix and ACE do not work; TinyMCE does not start on a pre-filled element.
215+
- A Base UI radio group does not uncheck the previously selected radio.
216+
- Links compute `cursor: auto` instead of `pointer`.
209217

210-
### Setup
218+
### Local engine
219+
220+
Build and start the engine following the [Kitesurf README](https://github.com/cloudflare/kitesurf#run-locally). It listens on `http://127.0.0.1:8787`. Point the helper at it with `endpoint`; the helper connects but never starts or stops the engine:
221+
222+
```js
223+
// codecept.conf.js
224+
export const config = {
225+
helpers: {
226+
Kitesurf: {
227+
url: 'http://localhost:3000',
228+
endpoint: 'http://127.0.0.1:8787',
229+
},
230+
},
231+
}
232+
```
233+
234+
The same `endpoint` works for an engine you deploy to your own Cloudflare account. If it sits behind Cloudflare Access, pass the service token in `headers`:
235+
236+
```js
237+
Kitesurf: {
238+
url: 'https://staging.myapp.com',
239+
endpoint: 'https://kitesurf.example.com',
240+
headers: {
241+
'CF-Access-Client-Id': process.env.CF_ACCESS_CLIENT_ID,
242+
'CF-Access-Client-Secret': process.env.CF_ACCESS_CLIENT_SECRET,
243+
},
244+
}
245+
```
246+
247+
### Cloudflare Browser Run
248+
249+
Without `endpoint`, the helper opens a Kitesurf session in Cloudflare Browser Run, currently a free beta. A cloud browser cannot reach `localhost`: test a deployed environment or expose your app with a tunnel such as `cloudflared tunnel --url http://localhost:3000`.
211250

212251
Enable [Cloudflare Browser Run](https://developers.cloudflare.com/browser-run/) and create an API token with the **Browser Rendering → Edit** permission. Export the credentials:
213252

@@ -229,8 +268,6 @@ export const config = {
229268
}
230269
```
231270

232-
### Usage
233-
234271
Every worker opens its own cloud session:
235272

236273
```sh

0 commit comments

Comments
 (0)