Created
June 15, 2014 21:54
-
-
Save kevin-miles/4b672dfe715729ee05fd to your computer and use it in GitHub Desktop.
Selenium Webdriver Node Mocha
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 BASE_URL = 'http://google.com'; | |
var assert = require('assert'), | |
webdriver = require('selenium-webdriver'), | |
colors = require('colors'); | |
//build all the drivers to be used | |
var chrome_driver = new webdriver.Builder(). | |
withCapabilities(webdriver.Capabilities.chrome()). | |
build(); | |
var firefox_driver = new webdriver.Builder(). | |
withCapabilities(webdriver.Capabilities.firefox()). | |
build(); | |
//compile an array that will be iterated over for the testing | |
var drivers = [chrome_driver, firefox_driver]; | |
//iterate over each driver and complete the test | |
drivers.forEach(function (driver, index, arr){ | |
describe('basic test', function () { | |
it('should be on correct page', function (done) { | |
driver.get(BASE_URL); | |
driver.getTitle() | |
.then(function(title) { | |
assert.equal(title, 'Google'); | |
done(); | |
}); | |
driver.quit(); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment