Skip to content

Commit 3042ae3

Browse files
DavertMikDavertMikclaudeDenysKuchma
authored
feat(helpers): add experimental Lightpanda helper (#5730)
* feat(helpers): add Lightpanda helper, share server lifecycle in CDPBrowser Lightpanda is a thin CDPBrowser subclass that self-launches `lightpanda serve` with telemetry disabled. The spawn/free-port/wait/kill lifecycle moves from Obscura into CDPBrowser so both helpers share it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(typings): keep helper config types in types.d.ts only An eighth duplicated *Config typedef makes TypeScript report the conflicts as one file-level error that @ts-ignore cannot suppress. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: add Lightpanda getting-started guide for Playwright users Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: show how to point the Lightpanda helper at its binary Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: rewrite alternative browsers guide, drop pinned Lightpanda version Install steps per engine and platform, one config to switch engines, and latest-release download links instead of a hardcoded version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: link to official install instructions instead of copying them Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: one section per engine in alternative browsers guide Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: list only engine limitations confirmed by the test suite Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(CDPBrowser): bound poll request timeout, prevent orphaned server process on failed start - _waitForServer: each /json/version poll is bounded by a 1s (or remaining deadline) axios timeout, so a port held by something that never responds can not hang the run forever - _connect: self-managed resolution is attempted exactly once; on failure the error is stored and rethrown on subsequent connects instead of spawning a second process Co-Authored-By: Claude <noreply@anthropic.com> * ci(lightpanda): pin browser to 1.0.0 release releases/latest resolves to a nightly build; the suite is tested against stable releases and attachFile (DOM.setFileInputFiles) fails on the current nightly Co-Authored-By: Claude <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 b90f04a commit 3042ae3

19 files changed

Lines changed: 4375 additions & 306 deletions

‎.github/workflows/lightpanda.yml‎

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Lightpanda 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+
LIGHTPANDA_DISABLE_TELEMETRY: true
22+
23+
jobs:
24+
build:
25+
runs-on: ubuntu-22.04
26+
timeout-minutes: 15
27+
28+
strategy:
29+
matrix:
30+
node-version: [22.x]
31+
32+
steps:
33+
- uses: actions/checkout@v6
34+
with:
35+
persist-credentials: false
36+
- name: Use Node.js ${{ matrix.node-version }}
37+
uses: actions/setup-node@v6
38+
with:
39+
node-version: ${{ matrix.node-version }}
40+
- uses: shivammathur/setup-php@v2
41+
with:
42+
php-version: 8.0
43+
- name: npm install
44+
run: npm i --force
45+
- name: Download Lightpanda
46+
run: |
47+
mkdir -p ~/lightpanda-bin
48+
# pinned: releases/latest resolves to a nightly build; the suite is tested against stable releases
49+
curl -sfL --retry 3 -o ~/lightpanda-bin/lightpanda https://github.com/lightpanda-io/browser/releases/download/1.0.0/lightpanda-x86_64-linux
50+
chmod +x ~/lightpanda-bin/lightpanda
51+
~/lightpanda-bin/lightpanda version
52+
- name: start test server
53+
run: |
54+
php -S 127.0.0.1:8000 -t test/data/app &
55+
sleep 1
56+
curl -sf http://127.0.0.1:8000/info > /dev/null
57+
- name: run lightpanda helper tests
58+
run: |
59+
export LIGHTPANDA_PATH="$HOME/lightpanda-bin/lightpanda"
60+
npm run test:unit:webbapi:lightpanda
61+
- name: run lightpanda acceptance tests
62+
run: |
63+
export LIGHTPANDA_PATH="$HOME/lightpanda-bin/lightpanda"
64+
./bin/codecept.js run -c test/acceptance/codecept.Lightpanda.js --grep @Lightpanda --debug

‎Bunoshfile.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@ const inheritedHelperDocs = {
399399
exclude: [/Title/, /Popup/, /Cookie/, /Url/, /^press/, /^refreshPage/, /^resizeWindow/, /Script$/, /cursor/, /Css/, /Tab$/, /^wait/],
400400
},
401401
Obscura: { parent: 'CDPBrowser' },
402+
Lightpanda: { parent: 'CDPBrowser' },
402403
Kitesurf: { parent: 'CDPBrowser', excludeConfig: ['endpoint', 'headers'] },
403404
}
404405

@@ -430,8 +431,7 @@ async function docsHelperMarkdown(name, { parent, exclude = [], excludeConfig =
430431

431432
if (parent) {
432433
const parentDoc = await documentation.build([`docs/build/${parent}.js`], buildOptions)
433-
const parentClass = parentDoc.find(c => c.kind === 'class')
434-
for (const method of parentClass.members.instance) {
434+
for (const method of parentDoc.find(c => c.kind === 'class').members.instance) {
435435
if (exclude.some(f => method.name.match(f))) continue
436436
if (members.some(m => m.name === method.name)) continue
437437
members.push(method)

‎README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
| 🌐 Web | Puppeteer | [![Puppeteer Tests](https://github.com/codeceptjs/CodeceptJS/actions/workflows/puppeteer.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/puppeteer.yml) |
1212
| 🌐 Web | WebDriver | [![WebDriver Tests](https://github.com/codeceptjs/CodeceptJS/actions/workflows/webdriver.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/webdriver.yml) |
1313
| 🌐 Web | Obscura | [![Obscura Helper Tests](https://github.com/codeceptjs/CodeceptJS/actions/workflows/obscura.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/obscura.yml) |
14+
| 🌐 Web | Lightpanda | [![Lightpanda Helper Tests](https://github.com/codeceptjs/CodeceptJS/actions/workflows/lightpanda.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/lightpanda.yml) |
1415
| 📱 Mobile | Appium | [![Appium Tests - Android](https://github.com/codeceptjs/CodeceptJS/actions/workflows/appium_Android.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/appium_Android.yml) |
1516

1617
# CodeceptJS [![Made in Ukraine](https://img.shields.io/badge/made_in-ukraine-ffd700.svg?labelColor=0057b7)](https://stand-with-ukraine.pp.ua)
@@ -44,6 +45,7 @@ CodeceptJS uses **Helper** modules to provide actions to `I` object. Currently,
4445
- [**Puppeteer**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Puppeteer.md) - uses Google Chrome's Puppeteer for fast headless testing.
4546
- [**WebDriver**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/WebDriver.md) - uses [webdriverio](http://webdriver.io/) to run tests via WebDriver or Devtools protocol.
4647
- [**Obscura**](https://codecept.io/helpers/Obscura) - drives the lightweight Obscura browser through Chrome DevTools Protocol. See [Alternative Browser Engines](https://codecept.io/alternative-browsers).
48+
- [**Lightpanda**](https://codecept.io/helpers/Lightpanda) - drives the Lightpanda headless browser through Chrome DevTools Protocol. See [Alternative Browser Engines](https://codecept.io/alternative-browsers).
4749
- [**Appium**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Appium.md) - for **mobile testing** with Appium
4850
- [**Detox**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Detox.md) - This is a wrapper on top of Detox library, aimed to unify testing experience for CodeceptJS framework. Detox provides a grey box testing for mobile applications, playing especially well for React Native apps.
4951

0 commit comments

Comments
 (0)