Created
May 20, 2014 14:59
-
-
Save poeticninja/b64cd3fa602c414f3407 to your computer and use it in GitHub Desktop.
Simple example of chai and selenium webdriver for node.js.
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
// Require chai.js expect module for assertions | |
var chai = require('chai'); | |
var expect = require('chai').expect; | |
// Application Server | |
var serverUri = '0.0.0.0:3000'; | |
// Official selenium webdriver testing setup | |
var webdriver = require('selenium-webdriver'); | |
describe('basic test', function () { | |
var driver; | |
before(function(){ | |
// Start of test use this | |
driver = new webdriver.Builder(). | |
withCapabilities(webdriver.Capabilities.chrome()). | |
build(); | |
console.log("Selenium Webdriver Chrome Started"); | |
}); | |
after(function(){ | |
// End of test use this. | |
driver.quit(); | |
}); | |
it('should be on correct page', function (done) { | |
this.timeout(10000); | |
driver.get(serverUri); | |
driver.getTitle().then(function(title) { | |
expect(title).to.equal('Some String Here); | |
done(); | |
console.log("Selenium Webdriver Chrome Shutdown"); | |
}) | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is a open string in the code.