Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

This package has been deprecated

Author message:

The cybernaut package is not developed any further. Please use one of the new @cybernaut packages.


10.0.0 • Public • Published


npm build coverage Greenkeeper TypeScript Prettier

Reliable, automated web UI testing in BDD-style.


WYSIWYM—the above human-readable test output corresponds to what is programmed:

const {browser, it, test} = require('cybernaut');
test('This is an example test', async t => {
  await t.perform(browser.loadPage(''), {retries: 0});
  await t.assert(browser.pageTitle, it.should.equal('Example Domain'));
  const moreInformationLink = browser.defineElement(
  await t.perform(;
  await t.assert(browser.pageTitle, it.should.contain('IANA'));

Getting started

Although it is possible to run your tests locally, it is recommended to run them on Docker. For this, only Docker has to be installed, no further dependencies are required.

To get started, put a test file (e.g. test.e2e.js) into a directory:

mkdir -p tests && vi tests/test.e2e.js

and run it on Chrome with Docker:

docker run -it --rm \
  -v "$(pwd)"/tests:/opt/cybernaut-tests \
  -v /dev/shm:/dev/shm \

For further information, please consult the documentation.


Cybernaut is built on top of selenium-webdriver and lets you control a browser with just a few lines of code. Your test code will look simple, concise and easy to read and is automatically output line by line in a human-readable form (WYSIWYM). It provides a Promise-based API and allows the use of async/await to write your code without nesting and with the possibility of using control-flow primitives such as if...else.

Additionally, there are pre-built Docker containers to run your tests effortlessly in any environment such as Travis CI.

Writing reliable tests will be easy

Let's say we want to write a test which checks the text of a headline element.

A test written with, for example, selenium-webdriver consists of three test steps. Each of these test steps can go wrong:

// Fails if the headline element does not yet exist.
const headline = await driver.findElement(By.css('h1'));
// Fails if the headline element is stale.
const text = await headline.getText();
// Fails if the actual text does not equal the expected text.
assert.equal(text, 'Lorem ipsum');

Cybernaut allows all these test steps to be implemented in a single test step. This single test step is executed in an atomic way. This means that if one part of this test step fails, the entire test step fails and can then be repeated as a whole by the integrated test runner:

// Can not fail because it is just a definition of an element.
const headline = defineElement('headline', 'h1');
// Can fail but only after several attempts.
await t.assert(headline.text, it.should.equal('Lorem ipsum'));

By this mechanism, a high reliability and thus stability of your tests can be ensured.

Built by (c) Clemens Akens. Released under the MIT license.


npm i cybernaut

Downloadsweekly downloads









last publish


  • avatar
Report a vulnerability