Skip to content

Instantly share code, notes, and snippets.

@papaponmx
Created February 19, 2018 17:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save papaponmx/b1cbd3b570694fc563650d2f3d683d0b to your computer and use it in GitHub Desktop.
Save papaponmx/b1cbd3b570694fc563650d2f3d683d0b to your computer and use it in GitHub Desktop.
Selenium webdriver assertion with chai and ES6.
// Require chai.js expect module for assertions
const chai = require('chai');
const expect = require('chai').expect;
// Application Server
const serverUri = '0.0.0.0:3000';
// Official selenium webdriver testing setup
const webdriver = require('selenium-webdriver');
describe('basic test', function () {
let driver;
before(() => {
// 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