Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/appium_Android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

strategy:
matrix:
node-version: [20.x]
node-version: [22.x]
test-suite: ['other', 'quick']

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/appium_iOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

strategy:
matrix:
node-version: [20.x]
node-version: [22.x]
test-suite: ['other', 'quick']

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/doc-generation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

strategy:
matrix:
node-version: [20.x]
node-version: [22.x]

steps:
- name: Check out the repo
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dtslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
node-version: [20.x]
node-version: [22.x]
steps:
- uses: actions/checkout@v6
- name: Use Node.js ${{ matrix.node-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/obscura.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

strategy:
matrix:
node-version: [20.x]
node-version: [22.x]

steps:
- uses: actions/checkout@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

strategy:
matrix:
node-version: [20.x]
node-version: [22.x]

steps:
- uses: actions/checkout@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

strategy:
matrix:
node-version: [20.x]
node-version: [22.x]

steps:
- uses: actions/checkout@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/puppeteer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

strategy:
matrix:
node-version: [20.x]
node-version: [22.x]

steps:
- uses: actions/checkout@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sharding-demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 20
node-version: 22

- name: Install dependencies
run: npm install --ignore-scripts
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:

strategy:
matrix:
node-version: [ 20.x ]
node-version: [ 22.x ]

steps:
- uses: actions/checkout@v6
Expand All @@ -81,7 +81,7 @@ jobs:

strategy:
matrix:
node-version: [20.x]
node-version: [22.x]

steps:
- uses: actions/checkout@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/webdriver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
timeout-minutes: 25
strategy:
matrix:
node-version: [20.x]
node-version: [22.x]

steps:
- run: docker run -d --net=host --shm-size=2g selenium/standalone-chrome:4.27
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
| 🌐 Web | Playwright | [![Playwright Tests](https://github.com/codeceptjs/CodeceptJS/actions/workflows/playwright.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/playwright.yml) |
| 🌐 Web | Puppeteer | [![Puppeteer Tests](https://github.com/codeceptjs/CodeceptJS/actions/workflows/puppeteer.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/puppeteer.yml) |
| 🌐 Web | WebDriver | [![WebDriver Tests](https://github.com/codeceptjs/CodeceptJS/actions/workflows/webdriver.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/webdriver.yml) |
| 🌐 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) |
| 📱 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) |

# CodeceptJS [![Made in Ukraine](https://img.shields.io/badge/made_in-ukraine-ffd700.svg?labelColor=0057b7)](https://stand-with-ukraine.pp.ua)
Expand Down Expand Up @@ -42,6 +43,7 @@ CodeceptJS uses **Helper** modules to provide actions to `I` object. Currently,
- [**Playwright**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Playwright.md) - is a Node library to automate the Chromium, WebKit and Firefox browsers with a single API.
- [**Puppeteer**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Puppeteer.md) - uses Google Chrome's Puppeteer for fast headless testing.
- [**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.
- [**Obscura**](https://codecept.io/helpers/Obscura) - drives the lightweight Obscura browser through Chrome DevTools Protocol. See [Alternative Browser Engines](https://codecept.io/alternative-browsers).
- [**Appium**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Appium.md) - for **mobile testing** with Appium
- [**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.

Expand Down Expand Up @@ -102,7 +104,7 @@ Later you can even automagically update Type Definitions to include your own cus

Note:

- CodeceptJS requires Node.js version `12+` or later.
- CodeceptJS 4.2 requires Node.js `22.12.0` or later.

## Usage

Expand Down
25 changes: 15 additions & 10 deletions docs/alternative-browsers.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ title: Alternative Browser Engines

# Alternative Browser Engines

::: warning Experimental
The `CDPBrowser`, `Obscura`, and `Kitesurf` helpers are experimental in CodeceptJS 4.2. Pin browser versions in CI and retain Playwright or WebDriver coverage for compatibility-critical tests.
:::

Playwright and Puppeteer drive full Chromium — the most accurate way to test what users see.
But a new class of lightweight, agent-era browsers has appeared, and CodeceptJS can drive them
through the `CDPBrowser` helper family:

- **[Obscura](https://github.com/h4ckf0r0day/obscura)** — an open-source Rust browser with a real
V8 engine. From v0.2.0, the default release build also renders — real layout, computed styles,
and screenshots — with `-no-render` builds still available for pure-speed, nothing-painted
scraping mode. A single 70 MB binary, ~30 MB RAM per instance, page loads in tens of
milliseconds.
scraping mode. Release archives are available for Linux, macOS, and Windows.
- **[Kitesurf](https://blog.cloudflare.com/kitesurf/)** — Cloudflare's browser that runs in V8
isolates on Cloudflare Workers, with a real layout and rendering pipeline. Cloud-only,
free in beta, planned to be open-sourced.
Expand All @@ -24,10 +27,9 @@ on navigation races.

## When are they better than Playwright?

**Smoke suites where seconds matter.** An Obscura scenario (navigate, fill a form, submit,
assert) completes in 150–500 ms. There is no browser binary to download in CI — a 70 MB
static binary starts instantly. If your PR gate runs 50 smoke scenarios, Obscura turns
minutes into seconds.
**Smoke suites where startup and execution time matter.** Obscura is distributed as a standalone
binary and is designed for lightweight browser automation. Benchmark it against your own pages and
CI environment before choosing it for a PR gate.

**Massive parallel scale.** Kitesurf sessions are Cloudflare Workers — they spawn in about a
second, cost nothing while idle, and there is no practical ceiling on how many you run at once.
Expand Down Expand Up @@ -57,9 +59,8 @@ app's real JavaScript in real V8; it only skips painting. For API-adjacent flows
**Constrained environments.** ARM CI runners, thin containers, air-gapped machines:
a static binary with no system dependencies goes where Chromium will not.

**Scraping-grade network realism.** Obscura's stealth mode presents a consistent Chrome TLS
fingerprint — useful when your tests must pass through bot-protection layers that block
headless Chromium.
**Optional stealth builds.** Obscura publishes separate `-stealth` archives. Treat their behaviour
as an Obscura capability rather than a browser-compatibility guarantee from CodeceptJS.

## When to stay with Playwright

Expand All @@ -77,6 +78,10 @@ headless Chromium.

## Configuration

CodeceptJS 4.2 is tested in CI with Obscura 0.2.2. Obscura 0.2.x is recommended; 0.1.x and
`-no-render` builds operate without layout, visibility assertions, or screenshots. See
[Installation](/installation#obscura-experimental) for platform-specific archive names.

helpers: {
Obscura: {
url: 'http://localhost:3000',
Expand Down Expand Up @@ -144,7 +149,7 @@ process — there is nothing to start by hand in the common case:
| Screenshots | yes | yes (v0.2.0+ default builds); no on `-no-render`/v0.1.x | yes |
| Visibility assertions | yes | yes (v0.2.0+ default builds); no, DOM-presence only, on `-no-render`/v0.1.x | yes |
| Screencast / video (`screencast` plugin) | yes — WebM via `page.screencast`, with caption burn-in | yes — APNG via CDP `Page.startScreencast`, assembled in-process (v0.2.0+ default builds; verified PNG frames on the live server); no caption burn-in | untested |
| Startup cost | seconds + ~300 MB install | instant, 70 MB binary | ~1 s, zero local |
| Startup model | local browser process | standalone local binary | remote cloud session |
| Parallel scale | machine-bound | machine-bound (light) | near-unlimited (cloud) |
| Where it runs | local/grid | local | Cloudflare only |
| License / cost | open source | Apache-2.0 | proprietary, free beta |
Expand Down
28 changes: 14 additions & 14 deletions docs/continuous-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CodeceptJS runs in any CI that can install Node.js. This page covers the setup,

## Setup

- **Node.js** — install it on the runner (`actions/setup-node`, the `node:20` image, `NodeTool@0` on Azure). Examples below use Node 20.
- **Node.js 22.12 or newer** — install it on the runner (`actions/setup-node`, the `node:22` image, `NodeTool@0` on Azure). Examples below use Node 22.
- **Headless** — `codecept.conf.js` must contain `setHeadlessWhen(process.env.HEADLESS || process.env.CI)`. `codeceptjs init` adds it; since CI sets `CI=true`, the suite runs headless automatically.

```js
Expand Down Expand Up @@ -61,7 +61,7 @@ Use [`@testomatio/reporter`](https://github.com/testomatio/reporter). It ships p

## CI examples

Each example uses Playwright by default; a WebDriver variant follows where it differs. WebdriverIO 9 downloads its own browser and driver, so the WebDriver variants run on a plain `node:20` image with no Selenium service and no browser-install step. For Playwright, a `node:20` base image plus `npx playwright install --with-deps` keeps these configs free of version pins.
Each example uses Playwright by default; a WebDriver variant follows where it differs. WebdriverIO 9 downloads its own browser and driver, so the WebDriver variants run on a plain `node:22` image with no Selenium service and no browser-install step. For Playwright, a `node:22` base image plus `npx playwright install --with-deps` keeps these configs free of version pins.

### GitHub Actions — Playwright

Expand All @@ -85,7 +85,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
cache: npm
- run: npm ci
- run: npx playwright install --with-deps chromium
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
- run: npm ci
- run: npx codeceptjs check
- run: npx codeceptjs run-workers 2 --by pool
Expand All @@ -142,7 +142,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
- run: npm ci
- run: npx playwright install --with-deps chromium
- run: npx codeceptjs check
Expand Down Expand Up @@ -173,7 +173,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
- run: npm ci
- run: npx playwright install --with-deps
- run: npx codeceptjs check
Expand All @@ -194,7 +194,7 @@ stages: [test]

playwright:
stage: test
image: node:20
image: node:22
variables:
FORCE_COLOR: "1"
parallel: 4
Expand All @@ -211,7 +211,7 @@ playwright:

webdriver:
stage: test
image: node:20 # WebdriverIO 9 downloads its own browser and driver
image: node:22 # WebdriverIO 9 downloads its own browser and driver
script:
- npm ci
- npx codeceptjs check
Expand All @@ -228,7 +228,7 @@ webdriver:
`bitbucket-pipelines.yml`:

```yaml
image: node:20
image: node:22

definitions:
caches:
Expand Down Expand Up @@ -260,7 +260,7 @@ pipelines:
For WebDriver, no Selenium service or browser image is needed — WebdriverIO 9 downloads its own browser and driver:

```yaml
image: node:20
image: node:22

pipelines:
default:
Expand All @@ -280,7 +280,7 @@ pipelines:
pipeline {
agent {
docker {
image 'node:20'
image 'node:22'
args '-u root'
}
}
Expand Down Expand Up @@ -311,7 +311,7 @@ pipeline {
}
```

For WebDriver, keep the same `node:20` agent — WebdriverIO 9 downloads its own browser and driver, so no Selenium container is needed:
For WebDriver, keep the same `node:22` agent — WebdriverIO 9 downloads its own browser and driver, so no Selenium container is needed:

```groovy
stage('Test') {
Expand All @@ -332,7 +332,7 @@ version: 2.1
jobs:
test:
docker:
- image: cimg/node:20.18-browsers
- image: cimg/node:22.14-browsers
parallelism: 4
steps:
- checkout
Expand All @@ -350,7 +350,7 @@ jobs:
webdriver:
docker:
# WebdriverIO 9 downloads its own browser and driver
- image: cimg/node:20.18
- image: cimg/node:22.14
steps:
- checkout
- run: npm ci
Expand Down
27 changes: 25 additions & 2 deletions docs/helpers/Obscura.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ This helper is a thin `CDPBrowser` subclass: it changes nothing about how locati
elements works, it only pins the config presets Obscura requires and manages the `obscura serve`
process lifecycle, the same way Playwright manages its own browser process.

> Obscura support is experimental in CodeceptJS 4.2. Pin the browser version in CI and keep a
> Playwright/WebDriver job for browser-compatibility coverage.

## Compatibility

| CodeceptJS | Recommended Obscura | Notes |
| --- | --- | --- |
| 4.2.x | 0.2.2 | Version used by the CodeceptJS Obscura CI workflow |
| 4.2.x | 0.2.x | Supported; capabilities are detected at runtime |
| 4.2.x | 0.1.x / `-no-render` | DOM-only mode; no layout, visibility assertions, or screenshots |

## Modes

* **ATTACH** — `endpoint` is set explicitly in the config. The helper only connects to it; it
Expand All @@ -39,8 +50,20 @@ process lifecycle, the same way Playwright manages its own browser process.

## Install

Download a release binary and put it on your `PATH` (or point `binaryPath`/`OBSCURA_PATH` at
it directly) and the helper launches and tears it down for you automatically:
Download a release archive from [Obscura releases](https://github.com/h4ckf0r0day/obscura/releases).
CodeceptJS 4.2 is tested with Obscura 0.2.2. Rendering archives are available for:

| platform | archive |
| --- | --- |
| Linux x64 | `obscura-x86_64-linux.tar.gz` |
| Linux ARM64 | `obscura-aarch64-linux.tar.gz` |
| macOS Intel | `obscura-x86_64-macos.tar.gz` |
| macOS Apple Silicon | `obscura-aarch64-macos.tar.gz` |
| Windows x64 | `obscura-x86_64-windows.zip` |

Extract the archive and put `obscura` (`obscura.exe` on Windows) on your `PATH`, or point
`binaryPath`/`OBSCURA_PATH` at it. The helper then launches and tears it down automatically.
For example, on Linux x64:

```sh
curl -sL https://github.com/h4ckf0r0day/obscura/releases/download/v0.2.2/obscura-x86_64-linux.tar.gz | tar xz
Expand Down
Loading
Loading