Created
May 2, 2013 09:37
-
-
Save sebv/5501204 to your computer and use it in GitHub Desktop.
calling test helper using chain using `next` method within helper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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