This repository contains skeleton example on how to use mocha and webdriverjs to write UI functional tests. Tests are written with mocha, and webdriverjs is used to inject the mocha tests to the page.
Prerequisites
- node.js
- grunt.js (run
npm install -g grunt
to install it) - have firefox installed
- have java installed (and added to the PATH for Windows)
Steps
- Open your bash console.
If use windows cmd, make sure to change the path in grunt.js.
- Navigate to the root folder, and then run
npm install
. - Download Selenium server and put in
C:/Utilities/selenium/selenium-server-standalone-2.28.0.jar
.
In the root folder, run the following grunt commands sequentially in separate console window. Run grunt.cmd
for Window cmd.
grunt startTestServer
grunt startSeleniumServer
grunt runTests
After running step 3, webdriver will open jquery.com and inject the mocha test to the page, and you should be able to see the test result at the bottom of the page.
If the test doesn't show up the browser, clear the cache of the browser, and then re-step 3 should fix it.