It's well and good to write tests to verify your server-side and client-side logic, but do you know that the whole solution really is working?
You can of course test your service manually after deploying, but that becomes tedious. By using Selenium, we can test that the solution works end-to-end.
This project explores how to get the whole set of tools up and running for a NodeJs-based stack.
How to use
- Check out the code
npm installto install dependencies
npm testto run the test
npm startto start the server at http://localhost:3000
Check out the test at test/simpleWebTest.js and the server at app.js.
- Environment variable URL tests with manually started server instead of running embedded
- Environment variable BROWSER uses another browser than PhantomJs. Try "chrome" or "firefox"
- npm init
- npm install --save express
- Create server.js and public/index.js
- Manual test in browser by doing npm start
- npm install --save-dev mocha
- npm install selenium-standalone webdriverjs chai phantomjs
- Create test/simpleWebTest.js
- Change the test to start up the server
- Selenium doesn't correctly fork PhantomJS on Windows
- Workaround: Submit phantomjs.binary.path as desiredCapabilities
- Submitted patch to Selenium team: https://code.google.com/p/selenium/issues/detail?id=7514
- PhantomJS sometimes don't install correct on Windows?
Check out alternative webdriver API at https://github.com/admc/wd