Created
September 2, 2013 20:15
-
-
Save christian-bromann/6416873 to your computer and use it in GitHub Desktop.
run WebdriverJS with Mocha and Chai
This file contains 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 chai = require('chai'), | |
assert = chai.assert, | |
expect = chai.expect, | |
webdriverjs = require('webdriverjs'); | |
describe('my webdriverjs tests', function(){ | |
this.timeout(99999999); | |
var client = {}; | |
before(function(){ | |
client = webdriverjs.remote({ desiredCapabilities: {browserName: 'phantomjs'} }); | |
client.init(); | |
}); | |
it('Github test',function(done) { | |
client | |
.url('https://github.com/') | |
.getElementSize('.header-logo-wordmark', function(err, result) { | |
expect(err).to.be.null; | |
assert.strictEqual(result.height , 32); | |
assert.strictEqual(result.width, 89); | |
}) | |
.getTitle(function(err, title) { | |
expect(err).to.be.null; | |
assert.strictEqual(title,'GitHub · Build software better, together.'); | |
}) | |
.getElementCssProperty('css selector','a[href="/plans"]', 'color', function(err, result){ | |
expect(err).to.be.null; | |
assert.strictEqual(result, 'rgba(65,131,196,1)'); | |
}) | |
.call(done); | |
}); | |
after(function(done) { | |
client.end(done); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment