All the things you expect from a robust testing framework by neatly packaging: WebDriverJS, mocha, and should chai with a little glue and zero magic:
var fiveby = require('fiveby');
fiveby(function (browser) {
return describe('Google Search in ' + browser.name, function () {
it('should work', function () {
browser.get('http://www.google.com');
var searchBox = browser.findElement(by.name('q'));
searchBox.sendKeys('awesome');
return searchBox.getAttribute('value').then(function (value) {
'awesome'.should.equal(value);
});
});
});
});
npx mocha tests/** --delay --timeout 30000
Add gulp and some convention to make it even more powerful: slush-fiveby. slush-fiveby is a simple fiveby project generator/example.
- Cleanly allows mocha and webdriverjs to coexist
- MUCH simpler configuration and less boilerplate code
- environment properties
- conveniences: api cleanup, spins up a selenium server if not provided, closes the browser for you, etc ...
- Sends test traffic to a HAR file
- more
{
"implicitWait": 5000,
"hubUrl": null,
"browsers": {
"firefox": true,
"chrome": {
"version": "37.0.2062.103",
"chromeOptions": {
"args": ["--disable-extensions", "--headless"]
}
},
"phantomjs": true
},
"disableBrowsers": false
}
disableBrowsers
and hubUrl
are optional, disableBrowser
defaults to false
.
- Use phantomjs 2.0: http://phantomjs.org/download.html (support exists but new users should use --headless)
Ok, this tool will allow you to write a bit of javascript that will open any browser (or mobile app), emulate user behavior via a few simple commands, and then verify what's displayed onscreen is correct. You can compile large suites of these tests and easily run them against many different browsers at once and get nice reports. It can be run with something like jenkins to automate further. Or use any of the popular SaaS providers like:
- node.js
- mocha cli (you can use npm scripts to avoid this)
- java (for selenium)
- the appropriate webdriver
- you can avoid installing the server, webdriver, and browser deps by using docker, see docker-compose.yaml @slush-fiveby
See docs folder for even more details!