WebdriverIO lets you use your favorite testing framework (Jasmine, Mocha, Cucumber) and assertion library (Chai for Mocha). Other projects implement their own testing and assertion APIs, for example Nightwatch, Intern.
It should be mentioned though that v4.2.16 has an incompatibility with at least tap v7.1.2: stdout/stderr written during a run gets lost.
Chimp.js, is an emerging web application test framework that implements easy sync tests using WebdriverIO, CucumberJS and Chai. Features include:
synchronous style
built-in "widget framework" (an implementation of the PageObject pattern)
automatically downloads dependencies (ChromeDriver, PhantomJS etc.)
works with SauceLabs and BrowserStack (CrossBrowserTesting TBD)
automatically takes screenshots on failures
works on Windows in addition to Linux and OS X
automatically produces boilerplate code for step definitions, which you can copy, paste and edit
file watcher reuses the browser sessions and can run only the tests you tag, to maximize development speed
Run wdio config and WebdriverIO will generate a config file for testing locally vs. in the cloud, specifying the test framework (Jasmine, Cucumber, Mocha), where to find tests and store screenshots etc.
If you develop web applications with Meteor.js, you might want to use the xlovio:webdriver wrapper, because it's the Selenium binding behind the preferred testing framework (Chimp) promoted by the Velocity (Meteor's official testing framework) team for using BDD via Cucumber.
Service is provided by WebdriverIO which over comes the con of starting selenium server independently.
Reference: http://webdriver.io/guide/services/selenium-standalone.html
Tasks written in this beautiful Selenium API can only be debugged using the provided WDIO task runner. You can't set breakpoints within tasks, but you can have WDIO pause the run between Selenium commands.
selenium-webdriverjs starts the Selenium server automatically, and actually manages to achieve a faster startup time (4 seconds vs. 5.5) than WebdriverIO.
PageObject is a very useful pattern for making tests more robust when the UI changes. WebdriverIO doesn't yet have clear documentation on PageObjects but keep an eye on this issue.
There's a workaround using yield, which kinda amounts to sync usage.
However, check out Chimp.js, a web app test framework that implements sync tests using WebdriverIO and CucumberJS.
Since it always uses Promise objects every time an asynchronous operation needs to occur, the test system pauses until that Promise object is resolved, or until a timeout occurs. Suite, test and reporter functions can return a Promise.
Intern is a complete testing framework that's designed to work well for enterprise applications. For small projects, the complexity of Intern can be unnecessary.
webdriver-sync avoids this
browser.get("http://foo.html", function() {
browser.title(function(err, title) {
assert.ok(~title.indexOf('foo title'), 'Wrong title!');
browser.elementById('i am a link', function(err, el) {
browser.clickElement(el, function() {
browser.eval("window.location.href", function(err, href) {
assert.ok(~href.indexOf('foo title 2'));
browser.quit();
});
});
});
});
});
in favor of this - completely synchronous API! No promises or callbacks needed:
driver.get("http://foo.html");
title = driver.getTitle();
link = driver.findElement(By.id('i am a link'));
link.click();
assert(driver.getCurrentUrl().indexOf('foo title 2') > -1);
title.should.equal('foo title');
console.log(title);
driver.quit();
The documentation covers all the modules (including browser-specific ones) and data types. It also includes a change log. There is also a Wiki on GitHub.
Nightwatch solves the Paradox of Choice among testing frameworks such as Jasmine, Cucumber or Mocha+Chai, by including its own BDD-style assertion library, based on Chai.
Unlike WebdriverIO, which lets you use various test frameworks and assertion libraries (e.g. Jasmine, Cucumber, Mocha + Chai), Nightwatch comes with its own BDD-style interface for performing assertions, based on Chai.
Here's a simple test example:
module.exports = {
'Demo test Google' : function (browser) {
browser
.url('http://www.google.com')
.waitForElementVisible('body', 1000)
.setValue('input[type=text]', 'nightwatch')
.waitForElementVisible('button[name=btnG]', 1000)
.click('button[name=btnG]')
.pause(1000)
.assert.containsText('#main', 'Night Watch')
.end();
}
};
webdriver-http-sync is a synchronous HTTP implementation of the WebDriver protocol for Node.js. As of August 2015, the majority of the 97 WebDriver methods aren't yet implemented, for example "forward", "back" and "submit".
By comparison, WebdriveIO has implemented all JSONWire methods.
There is no need to pass the 'driver' instance around, and not as many parentheses.
Using WD.js
function login(username, password) {
return this
.waitForElementByCss('.loginForm', asserters.isDisplayed, seconds(explicit_wait))
.elementById('emailAddress').sendKeys(username)
.elementById('password').sendKeys(password)
.elementById('signInButton').click()
}
Using WebDriverJS
function login(driver, username, password) {
driver.wait(until.elementIsVisible(driver.findElement({css: '.loginForm'})), seconds(explicit_wait));
driver.findElement({id: 'emailAddress'}).sendKeys(username);
driver.findElement({id: 'password'}).sendKeys(password);
driver.findElement({id: 'signInButton'}).click();
}