Commit f2fd90bc by Jay Zoldak

Merge pull request #1917 from MITx/fix/cale/lms-jasmine-tests

Fix/cale/lms jasmine tests
parents a537bd7f 7f93443d
...@@ -206,6 +206,8 @@ PIPELINE_CSS = { ...@@ -206,6 +206,8 @@ PIPELINE_CSS = {
}, },
} }
# test_order: Determines the position of this chunk of javascript on
# the jasmine test page
PIPELINE_JS = { PIPELINE_JS = {
'main': { 'main': {
'source_filenames': sorted( 'source_filenames': sorted(
...@@ -213,6 +215,7 @@ PIPELINE_JS = { ...@@ -213,6 +215,7 @@ PIPELINE_JS = {
rooted_glob(PROJECT_ROOT / 'static/', 'coffee/src/**/*.js') rooted_glob(PROJECT_ROOT / 'static/', 'coffee/src/**/*.js')
) + ['js/hesitate.js', 'js/base.js'], ) + ['js/hesitate.js', 'js/base.js'],
'output_filename': 'js/cms-application.js', 'output_filename': 'js/cms-application.js',
'test_order': 0
}, },
'module-js': { 'module-js': {
'source_filenames': ( 'source_filenames': (
...@@ -220,11 +223,8 @@ PIPELINE_JS = { ...@@ -220,11 +223,8 @@ PIPELINE_JS = {
rooted_glob(COMMON_ROOT / 'static/', 'xmodule/modules/js/*.js') rooted_glob(COMMON_ROOT / 'static/', 'xmodule/modules/js/*.js')
), ),
'output_filename': 'js/cms-modules.js', 'output_filename': 'js/cms-modules.js',
'test_order': 1
}, },
'spec': {
'source_filenames': sorted(rooted_glob(PROJECT_ROOT / 'static/', 'coffee/spec/**/*.js')),
'output_filename': 'js/cms-spec.js'
}
} }
PIPELINE_CSS_COMPRESSOR = None PIPELINE_CSS_COMPRESSOR = None
......
...@@ -20,7 +20,7 @@ PIPELINE_JS['js-test-source'] = { ...@@ -20,7 +20,7 @@ PIPELINE_JS['js-test-source'] = {
'source_filenames': sum([ 'source_filenames': sum([
pipeline_group['source_filenames'] pipeline_group['source_filenames']
for group_name, pipeline_group for group_name, pipeline_group
in PIPELINE_JS.items() in sorted(PIPELINE_JS.items(), key=lambda item: item[1].get('test_order', 1e100))
if group_name != 'spec' if group_name != 'spec'
], []), ], []),
'output_filename': 'js/cms-test-source.js' 'output_filename': 'js/cms-test-source.js'
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
"js/vendor/jquery.cookie.js", "js/vendor/jquery.cookie.js",
"js/vendor/json2.js", "js/vendor/json2.js",
"js/vendor/underscore-min.js", "js/vendor/underscore-min.js",
"js/vendor/backbone-min.js" "js/vendor/backbone-min.js",
"js/vendor/jquery.leanModal.min.js"
] ]
} }
...@@ -440,6 +440,9 @@ PIPELINE_CSS = { ...@@ -440,6 +440,9 @@ PIPELINE_CSS = {
}, },
} }
# test_order: Determines the position of this chunk of javascript on
# the jasmine test page
PIPELINE_JS = { PIPELINE_JS = {
'application': { 'application': {
...@@ -455,31 +458,39 @@ PIPELINE_JS = { ...@@ -455,31 +458,39 @@ PIPELINE_JS = {
'js/sticky_filter.js', 'js/sticky_filter.js',
'js/query-params.js', 'js/query-params.js',
], ],
'output_filename': 'js/lms-application.js' 'output_filename': 'js/lms-application.js',
'test_order': 1,
}, },
'courseware': { 'courseware': {
'source_filenames': courseware_js, 'source_filenames': courseware_js,
'output_filename': 'js/lms-courseware.js' 'output_filename': 'js/lms-courseware.js',
'test_order': 2,
}, },
'main_vendor': { 'main_vendor': {
'source_filenames': main_vendor_js, 'source_filenames': main_vendor_js,
'output_filename': 'js/lms-main_vendor.js', 'output_filename': 'js/lms-main_vendor.js',
'test_order': 0,
}, },
'module-js': { 'module-js': {
'source_filenames': rooted_glob(COMMON_ROOT / 'static', 'xmodule/modules/js/*.js'), 'source_filenames': rooted_glob(COMMON_ROOT / 'static', 'xmodule/modules/js/*.js'),
'output_filename': 'js/lms-modules.js', 'output_filename': 'js/lms-modules.js',
'test_order': 3,
}, },
'discussion': { 'discussion': {
'source_filenames': discussion_js, 'source_filenames': discussion_js,
'output_filename': 'js/discussion.js' 'output_filename': 'js/discussion.js',
'test_order': 4,
}, },
'staff_grading': { 'staff_grading': {
'source_filenames': staff_grading_js, 'source_filenames': staff_grading_js,
'output_filename': 'js/staff_grading.js' 'output_filename': 'js/staff_grading.js',
'test_order': 5,
}, },
'open_ended': { 'open_ended': {
'source_filenames': open_ended_js, 'source_filenames': open_ended_js,
'output_filename': 'js/open_ended.js' 'output_filename': 'js/open_ended.js',
'test_order': 6,
} }
} }
......
...@@ -20,14 +20,14 @@ PIPELINE_JS['js-test-source'] = { ...@@ -20,14 +20,14 @@ PIPELINE_JS['js-test-source'] = {
'source_filenames': sum([ 'source_filenames': sum([
pipeline_group['source_filenames'] pipeline_group['source_filenames']
for group_name, pipeline_group for group_name, pipeline_group
in PIPELINE_JS.items() in sorted(PIPELINE_JS.items(), key=lambda item: item[1].get('test_order', 1e100))
if group_name != 'spec' if group_name != 'spec'
], []), ], []),
'output_filename': 'js/lms-test-source.js' 'output_filename': 'js/lms-test-source.js'
} }
PIPELINE_JS['spec'] = { PIPELINE_JS['spec'] = {
'source_filenames': sorted(rooted_glob(PROJECT_ROOT / 'static/', 'coffee/spec/**/*.coffee')), 'source_filenames': sorted(rooted_glob(PROJECT_ROOT / 'static/', 'coffee/spec/**/*.js')),
'output_filename': 'js/lms-spec.js' 'output_filename': 'js/lms-spec.js'
} }
......
{ {
"js_files": [ "js_files": [
"/static/js/vendor/RequireJS.js",
"/static/js/vendor/jquery.min.js",
"/static/js/vendor/jquery-ui.min.js",
"/static/js/vendor/jquery.leanModal.min.js", "/static/js/vendor/jquery.leanModal.min.js",
"/static/js/vendor/flot/jquery.flot.js" "/static/js/vendor/flot/jquery.flot.js"
] ]
......
...@@ -306,6 +306,7 @@ end ...@@ -306,6 +306,7 @@ end
desc "Open jasmine tests for #{system} in your default browser" desc "Open jasmine tests for #{system} in your default browser"
task "browse_jasmine_#{system}" do task "browse_jasmine_#{system}" do
compile_assets()
django_for_jasmine(system, true) do |jasmine_url| django_for_jasmine(system, true) do |jasmine_url|
Launchy.open(jasmine_url) Launchy.open(jasmine_url)
puts "Press ENTER to terminate".red puts "Press ENTER to terminate".red
...@@ -315,6 +316,7 @@ end ...@@ -315,6 +316,7 @@ end
desc "Use phantomjs to run jasmine tests for #{system} from the console" desc "Use phantomjs to run jasmine tests for #{system} from the console"
task "phantomjs_jasmine_#{system}" do task "phantomjs_jasmine_#{system}" do
compile_assets()
phantomjs = ENV['PHANTOMJS_PATH'] || 'phantomjs' phantomjs = ENV['PHANTOMJS_PATH'] || 'phantomjs'
django_for_jasmine(system, false) do |jasmine_url| django_for_jasmine(system, false) do |jasmine_url|
sh("#{phantomjs} common/test/phantom-jasmine/lib/run_jasmine_test.coffee #{jasmine_url}") sh("#{phantomjs} common/test/phantom-jasmine/lib/run_jasmine_test.coffee #{jasmine_url}")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment