Skip to content

Instantly share code, notes, and snippets.

@poeticninja
Created May 20, 2014 14:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save poeticninja/b64cd3fa602c414f3407 to your computer and use it in GitHub Desktop.
Save poeticninja/b64cd3fa602c414f3407 to your computer and use it in GitHub Desktop.
Simple example of chai and selenium webdriver for node.js.
// 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");
})
});
});
@webarthur
Copy link

There is a open string in the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment