node package manager


Synchronous Javascript integration tests does a great job providing intuitive Selenium bindings for NodeJS. It provides also a test runner allowing to write tests in a synchronous way. The problem with this test runner is that it does not work well with IntelliJ IDEA (e.g. you can't set a breakpoint and debug your code).

With this library you can write tests in a synchronous manner while still using your favourite test runner.

To preview how this library makes your life easier in IDE like IntelliJ IDEA or Webstorm watch this video.

Shameless cross-selling

I've recently created a free npm package improving terminal experience for developers. It's called howto-cli and you can check it out here ūüėČ


const wdio = require('wdio');
const assert = require('chai').assert;
describe('Google web search engine', function() {
    // Create a 'browser' object. Now you can call on this object every
    // method described on
    var browser = wdio.getBrowser({
        desiredCapabilities: {
            browserName: 'firefox'
    // Initialize selenium standalone server if it is not started yet
    // Every code using the 'browser' object has to be wrapped by wdio.wrap
    before(wdio.wrap(function() {
    after(wdio.wrap(function() {
    // If you use Mocha test framework then wrap every single test by wdio.wrap
    // Important: Using wdio.wrap on 'describe' method is invalid.
    // Use it only for: 'it', 'before', 'after', 'beforeEach' and 'afterEach'
    it('Should return "Google" when asked about page title', wdio.wrap(function () {
        assert.equal('Google', browser.getTitle());


* Run selenium standalone server. If port 4444 is busy it does nothing.
* Othwerwise it uses npm package `selenium-standalone` to run selenium
* standalone process. The parameter 'option' is optional. If it exists
* then options.install is passed to the method selenium.install and
* options.start is passed to the method selenium.start.
* Selenium.install and selenium.start are described on:
wdio.initSelenium = function([options], callback) { ... }
 * Return a browser instance. The options object as described on
 * Returned object has all methods described on
wdio.getBrowser = function(options) { ... }
 * Wrapper for synchronous code. It returns another function
 * taking a callback as an argument.
 * The provided callback will be called once a test is done.
 * In case of error it will be called with the error as an argument.
 * This API makes wdio compatible with Mocha test framework.
wdio.wrap = function(code) { ... }
 * Runs synchronous code and calls a callbkack when finished
 */ = function(code, callback) { ... }

Errors description

It seems you've forgotten to wrap a call to method into w wdio.wrap

Each call to API has to be wrapped by wdio.wrap. If you use Mocha check that it, before, after, beforeEach and afterEach calls are wrapped by wdio.wrap like on the example above.

No callback for the wdio.wrap provided.

It basically means you used wdio.wrap in a wrong place (like describe if you use Mocha). For Mocha ensure that wdio.wrap was used in it, before, after, beforeEach or afterEach.

No callback for the provided

If you use you have to pass two parameters - the code to run and a callback to call once finished. Double check if you've passed both parameters.