Kernel
Run web tests in Kernel cloud browsers, created for each test or taken warm from a browser pool.
The Kernel plugin, @vostride/agent-qa-plugin-kernel, gives each web test a Kernel cloud browser. Before the test connects, it creates a browser, or takes one from a browser pool, and hands agent-qa the browser's CDP address. After the test it deletes the browser, or returns it to the pool.
Kernel runs Chromium only, so tests on a Kernel remote use use.browser.name: chromium.
Install
Install the plugin at exactly the version of agent-qa your project runs:
npm install --save-dev --save-exact @vostride/agent-qa-plugin-kernel@$(npx agent-qa --version)Configure
plugins:
- name: kernel
package: "@vostride/agent-qa-plugin-kernel"
options:
apiKey: "{{secret:KERNEL_API_KEY}}"
registry:
remotes:
- name: kernel
plugin: kernel
settings:
headless: true
timeoutSeconds: 60
use:
browser:
name: chromium
headless: true
remote: kernelPut the key in your secrets file, .env.secrets.local by default, as KERNEL_API_KEY=.... Set use.browser.remote in the config to run every web test on Kernel, or in a suite or test to move only those.
Options
Options belong to the plugins entry and describe the account.
| Option | Default | Meaning |
|---|---|---|
apiKey | required | The Kernel API key, a credential. Write it as a {{secret:NAME}} reference. |
apiUrl | https://api.onkernel.com | Kernel's API. It must use https:// with no user or password, unless it points at this machine. |
The key is sent only as the Authorization: Bearer header, and never appears in logs or run records.
Settings
Settings belong to each remote and describe one place.
| Setting | Default | Meaning |
|---|---|---|
headless | true | false gives a headful browser. Kernel's own default is headful. |
timeoutSeconds | 60 | Seconds Kernel keeps the browser after agent-qa's connection drops, from 10 to 259200. |
stealth | Kernel's stealth mode. | |
region | The Kernel region, such as eu-west. | |
proxy | Kernel's proxy object, sent as given. | |
viewport | width, height and an optional refreshRate. | |
pool | A browser pool's ID or name, to take a browser from instead of creating one. | |
profile | A profile's name, or { id: <profile id> }, loaded read-only. Needs context: reuse. | |
extra | Any other field of Kernel's create request, merged last. |
How the request is built
The plugin builds Kernel's create request in three layers, each overriding the one before:
- its defaults,
headless: trueandtimeout_seconds: 60; - the settings above, in Kernel's field names, so
timeoutSecondsis sent astimeout_secondsandviewport.refreshRateasviewport.refresh_rate; extra, last, so a field there overrides both a default and a setting.
For example, settings: { headless: true, extra: { headless: false, kiosk_mode: true } } creates a headful browser in kiosk mode.
Browser pools
A pool keeps browsers warm, so a test does not wait for one to start. Name the pool on a remote:
registry:
remotes:
- name: kernel-pool
plugin: kernel
settings:
pool: shop-tests- While the pool is empty, the plugin keeps asking, at most once a second, and agent-qa prints
waiting for pool shop-testswhile it waits. The wait ends when a browser is free or at the remote'sconnectTimeout, five minutes by default. - The pool's own configuration decides the browser, so
stealth,region,proxyandviewportare refused on a remote withpool, andheadlessandtimeoutSecondsdo not apply. Onlyprofileandextraare sent. - After a test in a new context, the browser goes back to the pool for the next test. After a test with
context: reuse, it is discarded, so the next test gets a clean one.
Signed-in profiles
profile loads a Kernel profile, such as one saved with a signed-in test user. It loads read-only: nothing a test does is saved back. A profile lives in the browser's first context, so the remote needs context: reuse:
registry:
remotes:
- name: kernel-signed-in
plugin: kernel
context: reuse
settings:
profile: shop-test-userWithout context: reuse, the remote is refused with kind refused at settings.profile. With pool, the profile goes into the pool request, and Kernel discards that browser after the test.
Links and the live view
Kernel has no page per session, so a Kernel test shows no session link. A headful browser's live view URL carries a token, so agent-qa masks it along with the CDP address, and never shows it as a link.
Account check
agent-qa doctor runs the plugin's account check, which creates no browser:
- it lists your browsers to confirm the key works, and warns
the API key was refusedwhen Kernel refuses it; - it reports free sessions, such as
3 of 5 concurrent sessions free, when the key may read the organization's limits; - it looks up each pool a remote names, and warns
pool <pool> not foundwhen Kernel has none by that name.
When a remote is refused
| Kind | Cause | Fix |
|---|---|---|
auth | Kernel responded with 401 or 403. | Check the key in your secrets file. |
capacity | Kernel responded with 429 or 529: no free sessions, or a rate limit. | Wait, lower use.workers, or use a pool. |
refused at settings.profile | The remote sets profile without context: reuse. | Add context: reuse to the remote. |
refused at another settings. path | That setting is wrong for this remote, such as region with pool. | Fix the setting the line names. |
unreachable | Kernel did not respond. | Check the network and apiUrl. |
Each refusal is one line with Kernel's status, the request and Kernel's message, and the wait Kernel asked for on a 429. A browser that is already gone when the plugin deletes it counts as released.
npx agent-qa plugins describe kernel --json lists every option and setting with its type, default and description.