-
Notifications
You must be signed in to change notification settings - Fork 66
Running Javascript Tests
jodosha edited this page Sep 14, 2010
·
5 revisions
How to use
====
From the adva_cms
root:
How to setup
==
Each plugin should have the following structure:
- …
public/
javascripts/
admin/
calendar.js
calendar.js - …
test/ - …
javascript/
fixtures/
admin/
calendar_fixtures.html
calendar_fixtures.html
functional/
admin/
calendar_test.js
calendar_test.js
unit/
admin/
calendar_test.js
calendar_test.js
As you can see you have to reflect the public/javascripts
structure under unit
or functional
.
NOTICE: functional tests aren’t related to Webrat integration tests.
Behind the scenes
======
What really happen when we start the Rake task?
- The system detect the plugins to test and the browsers, accoding to the
PLUGINS
andBROWSERS
env vars. - For each plugin:
- Temp dirs are created:
adva_calendar/javascript/tmp
adva_calendar/javascript/tmp/unit
adva_calendar/javascript/tmp/functional
- Each test case will be compiled with a template, merged with relative html fixtures and copied under the proper temp path:
adva_calendar/javascript/unit/calendar_test.js => adva_calendar/javascript/tmp/unit/calendar_test.html
-
public
,assets
andtmp
folders are mounted on the test webserveradva_calendar/public => /adva_calendar
adva_calendar/test/javascript/assets => /adva_calendar/assets
adva_calendar/test/javascript/tmp => /adva_calendar/test
- Each file which match
<plugin_root>/test/javascript/assets/**/*_controller.rb
is mounted as controlleradva_calendar/test/javascript/assets/upload_controller.rb => /adva_calendar/controllers/upload
- Temp dirs are created:
- The
adva_cms/test/javascript/assets
is mounted as/
(root path) on the test webserver - For each browser selected tests will be run
- Clean up of all the tmp folders