Created
February 19, 2018 17:15
-
-
Save papaponmx/b1cbd3b570694fc563650d2f3d683d0b to your computer and use it in GitHub Desktop.
Selenium webdriver assertion with chai and ES6.
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 | |
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