Skip to content

Instantly share code, notes, and snippets.

@sebv
Created May 2, 2013 09:37
Show Gist options
  • Save sebv/5501204 to your computer and use it in GitHub Desktop.
Save sebv/5501204 to your computer and use it in GitHub Desktop.
calling test helper using chain using `next` method within helper
var wd;
try {
wd = require('wd');
} catch( err ) {
wd = require('../lib/main');
}
var assert = require('assert');
var test = require('./test');
var browser = wd.remote();
browser.on('status', function(info){
console.log('\x1b[36m%s\x1b[0m', info);
});
browser.on('command', function(meth, path, data){
console.log(' > \x1b[33m%s\x1b[0m: %s', meth, path, data || '');
});
browser.chain()
.init({
browserName:'chrome'
, tags : ["examples"]
, name: "This is an example test"
})
.get("http://admc.io/wd/test-pages/guinea-pig.html", function (err) {
if(err) throw err;
test(browser, assert);
})
.quit();
var wd;
try {
wd = require('wd');
} catch( err ) {
wd = require('../lib/main');
}
var assert = require('assert');
var test = require('./test');
var browser = wd.remote();
browser.noop = function (cb) {
cb(null);
};
browser.on('status', function(info){
console.log('\x1b[36m%s\x1b[0m', info);
});
browser.on('command', function(meth, path, data){
console.log(' > \x1b[33m%s\x1b[0m: %s', meth, path, data || '');
});
browser.chain()
.init({
browserName:'chrome'
, tags : ["examples"]
, name: "This is an example test"
})
.get("http://admc.io/wd/test-pages/guinea-pig.html", function (err) {
if(err) throw err;
})
.noop(function (err) {
if(err) throw err;
test(browser, assert);
})
.quit();
module.exports = function(browser, assert) {
browser
.next( 'elementById' , 'i am a link', function(error, element) {
if (error) throw error;
browser.next( 'moveTo',element, function() {
if (error) throw error;
});
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment