In the rapid evolving world of Web standards, libraries, and browsers testing is of paramount importance. We need to make sure our widgets continue to function as we upgrade the various libraries that make up our project.
RichWidgets uses jasmine and jasmine-jquery, using karma as our test runner. Widget tests must go beyond simple setup/takedown of the widgets, and must also test all widget options and user interactions. In this way we will be able to keep our widgets both current and stable.
The Karma tool can be easily installed with NPM as:
npm install -g karma
Run all tests on particular browsers:
karma start karma.conf.js --browsers=PhantomJS,Chrome,Firefox
karma start karma.conf.js --single-run=false --auto-watch=true --browsers=Chrome
debugger;anywhere in your test to set a breakpoint.
Tests are configured in two files:
karma.conf.js- configuration for Karma runner
test/test-main.js- configuration for Module Loading (AMD)
In order to run tests on browsers you don't normally have access to, or for purposes of continous integration, we leverage Karma - SauceLabs runner.
In order to set it up locally, you have to setup environmental variables:
export SAUCE_USERNAME=your_username export SAUCE_ACCESS_KEY=your_generated_access_key
Then you can start one of browsers:
karma start --single-run=false --auto-watch=true --browsers=SL_Firefox_latest
customLaunchers section in
karma.conf.js for all the configured browsers.