jasmine-headless-webkit-firstbanco 0.9.0.rc.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.rspec +1 -0
- data/CHANGELOG.md +89 -0
- data/Gemfile +30 -0
- data/Guardfile +41 -0
- data/README.md +44 -0
- data/Rakefile +65 -0
- data/bin/jasmine-headless-webkit +11 -0
- data/config/cucumber.yml +2 -0
- data/ext/jasmine-webkit-specrunner/Info.plist +22 -0
- data/ext/jasmine-webkit-specrunner/Makefile.dummy +5 -0
- data/ext/jasmine-webkit-specrunner/Page.cpp +15 -0
- data/ext/jasmine-webkit-specrunner/Page.h +20 -0
- data/ext/jasmine-webkit-specrunner/Runner.cpp +208 -0
- data/ext/jasmine-webkit-specrunner/Runner.h +73 -0
- data/ext/jasmine-webkit-specrunner/common.pri +8 -0
- data/ext/jasmine-webkit-specrunner/extconf.rb +10 -0
- data/ext/jasmine-webkit-specrunner/specrunner.cpp +79 -0
- data/ext/jasmine-webkit-specrunner/specrunner.pro +5 -0
- data/features/bin/failure.feature +7 -0
- data/features/bin/files.feature +7 -0
- data/features/bin/filtered_run/both_runs.feature +18 -0
- data/features/bin/filtered_run/no_full_run.feature +14 -0
- data/features/bin/help.feature +7 -0
- data/features/bin/quiet_messages.feature +8 -0
- data/features/bin/runner_out.feature +8 -0
- data/features/bin/spec_files_with_same_basename.feature +7 -0
- data/features/bin/success.feature +20 -0
- data/features/bin/success_with_js_error.feature +5 -0
- data/features/bin/tries_to_leave_page.feature +7 -0
- data/features/bin/try_to_click_a_button.feature +7 -0
- data/features/bin/two_files_from_src_files.feature +11 -0
- data/features/bin/with_coffeescript_error.feature +7 -0
- data/features/bin/with_console_log.feature +7 -0
- data/features/bin/with_server.feature +7 -0
- data/features/bin/with_window_prompt.feature +7 -0
- data/features/reporters.feature +24 -0
- data/features/runner.feature +34 -0
- data/features/steps/given/i_have_test_suite.rb +2 -0
- data/features/steps/given/no_existing_file.rb +4 -0
- data/features/steps/given/options/i_have_defaults.rb +4 -0
- data/features/steps/given/options/i_have_reporters.rb +10 -0
- data/features/steps/given/options/i_have_runner_options.rb +3 -0
- data/features/steps/then/bin/exit_status_should_be.rb +3 -0
- data/features/steps/then/bin/file_should_contain_runner.rb +4 -0
- data/features/steps/then/bin/following_files_loaded_in_order.rb +10 -0
- data/features/steps/then/bin/i_should_get_help_output.rb +4 -0
- data/features/steps/then/bin/output_should_include.rb +3 -0
- data/features/steps/then/bin/output_should_not_include.rb +4 -0
- data/features/steps/then/reporting/report_does_not_exist.rb +4 -0
- data/features/steps/then/reporting/report_should_exist.rb +3 -0
- data/features/steps/then/reporting/report_should_have.rb +7 -0
- data/features/steps/then/reporting/report_should_have_seed.rb +4 -0
- data/features/steps/then/runner/it_should_have_exit_status.rb +3 -0
- data/features/steps/then/runner/it_should_include_report_file.rb +4 -0
- data/features/steps/then/runner/it_should_not_include_report_file.rb +3 -0
- data/features/steps/then/templates/it_should_use_reporter.rb +6 -0
- data/features/steps/when/i_delete_file.rb +3 -0
- data/features/steps/when/i_get_runner.rb +4 -0
- data/features/steps/when/i_get_template_writer.rb +4 -0
- data/features/steps/when/i_run_executable.rb +4 -0
- data/features/steps/when/i_run_runner.rb +4 -0
- data/features/support/env.rb +7 -0
- data/jasmine-headless-webkit-firstbanco.gemspec +30 -0
- data/lib/autotest/discover.rb +1 -0
- data/lib/autotest/jasmine.rb +7 -0
- data/lib/autotest/jasmine_mixin.rb +111 -0
- data/lib/autotest/jasmine_rspec2.rb +7 -0
- data/lib/jasmine-headless-webkit.rb +3 -0
- data/lib/jasmine/headless.rb +61 -0
- data/lib/jasmine/headless/cacheable_action.rb +85 -0
- data/lib/jasmine/headless/coffee_script_cache.rb +20 -0
- data/lib/jasmine/headless/coffee_template.rb +36 -0
- data/lib/jasmine/headless/command_line.rb +31 -0
- data/lib/jasmine/headless/css_template.rb +19 -0
- data/lib/jasmine/headless/errors.rb +16 -0
- data/lib/jasmine/headless/file_checker.rb +25 -0
- data/lib/jasmine/headless/files_list.rb +332 -0
- data/lib/jasmine/headless/js_template.rb +23 -0
- data/lib/jasmine/headless/jst_template.rb +15 -0
- data/lib/jasmine/headless/nil_template.rb +14 -0
- data/lib/jasmine/headless/options.rb +206 -0
- data/lib/jasmine/headless/railtie.rb +12 -0
- data/lib/jasmine/headless/report.rb +81 -0
- data/lib/jasmine/headless/report_message.rb +12 -0
- data/lib/jasmine/headless/report_message/console.rb +18 -0
- data/lib/jasmine/headless/report_message/error.rb +20 -0
- data/lib/jasmine/headless/report_message/fail.rb +5 -0
- data/lib/jasmine/headless/report_message/pass.rb +5 -0
- data/lib/jasmine/headless/report_message/seed.rb +14 -0
- data/lib/jasmine/headless/report_message/spec.rb +28 -0
- data/lib/jasmine/headless/report_message/total.rb +31 -0
- data/lib/jasmine/headless/runner.rb +264 -0
- data/lib/jasmine/headless/spec_file_analyzer.rb +44 -0
- data/lib/jasmine/headless/task.rb +39 -0
- data/lib/jasmine/headless/template_writer.rb +65 -0
- data/lib/jasmine/headless/unique_asset_list.rb +16 -0
- data/lib/jasmine/headless/version.rb +5 -0
- data/lib/qt/qmake.rb +155 -0
- data/script/gemfile +11 -0
- data/script/hooks/post-commit +4 -0
- data/script/hooks/pre-commit +15 -0
- data/script/initialize-environment +35 -0
- data/script/install-git-hooks +6 -0
- data/skel/template.html.erb +77 -0
- data/spec/files/UTF-8-test.txt +0 -0
- data/spec/integration/randomization_spec.rb +13 -0
- data/spec/integration/specify_runner_file_spec.rb +22 -0
- data/spec/integration/sprockets_spec.rb +23 -0
- data/spec/jasmine/click_button/click_button.js +5 -0
- data/spec/jasmine/click_button/click_button.yml +12 -0
- data/spec/jasmine/click_button/click_button_spec.js +11 -0
- data/spec/jasmine/coffeescript_error/coffeescript_error.yml +10 -0
- data/spec/jasmine/coffeescript_error/spec.coffee +2 -0
- data/spec/jasmine/coffeescript_error/src.coffee +2 -0
- data/spec/jasmine/console_log/console_log.js +1 -0
- data/spec/jasmine/console_log/console_log.yml +10 -0
- data/spec/jasmine/console_log/console_log_spec.js +7 -0
- data/spec/jasmine/failure/failure.js +1 -0
- data/spec/jasmine/failure/failure.yml +9 -0
- data/spec/jasmine/failure/failure_spec.js +6 -0
- data/spec/jasmine/filtered_failure/failure_spec.js +6 -0
- data/spec/jasmine/filtered_failure/filtered_failure.yml +10 -0
- data/spec/jasmine/filtered_failure/src.js +0 -0
- data/spec/jasmine/filtered_failure/success_spec.js +6 -0
- data/spec/jasmine/filtered_success/filtered_success.yml +10 -0
- data/spec/jasmine/filtered_success/src.js +0 -0
- data/spec/jasmine/filtered_success/success_one_spec.js +6 -0
- data/spec/jasmine/filtered_success/success_other_file.js +7 -0
- data/spec/jasmine/filtered_success/success_two_spec.js +6 -0
- data/spec/jasmine/filtered_success_with_console/filtered_success.yml +10 -0
- data/spec/jasmine/filtered_success_with_console/src.js +0 -0
- data/spec/jasmine/filtered_success_with_console/success_one_spec.js +7 -0
- data/spec/jasmine/filtered_success_with_console/success_two_spec.js +6 -0
- data/spec/jasmine/leave_page/leave_page.js +4 -0
- data/spec/jasmine/leave_page/leave_page.yml +9 -0
- data/spec/jasmine/leave_page/leave_page_spec.js +11 -0
- data/spec/jasmine/noisy/file.js.erb +0 -0
- data/spec/jasmine/noisy/noisy.yml +8 -0
- data/spec/jasmine/noisy/other_file.js +2 -0
- data/spec/jasmine/runner_out_in_jasmine_yml/jasmine.yml +11 -0
- data/spec/jasmine/runner_out_in_jasmine_yml/test.js +2 -0
- data/spec/jasmine/runner_out_in_jasmine_yml/test_spec.coffee +4 -0
- data/spec/jasmine/success/success.js +1 -0
- data/spec/jasmine/success/success.yml +9 -0
- data/spec/jasmine/success/success_spec.js +6 -0
- data/spec/jasmine/success_with_error/success_with_error.js +3 -0
- data/spec/jasmine/success_with_error/success_with_error.yml +9 -0
- data/spec/jasmine/success_with_error/success_with_error_spec.js +6 -0
- data/spec/jasmine/two_files_from_src_files/app/app-file.js +0 -0
- data/spec/jasmine/two_files_from_src_files/app/app.js +2 -0
- data/spec/jasmine/two_files_from_src_files/jasmine.yml +7 -0
- data/spec/jasmine/two_files_from_src_files/vendor/vendor-file.js +0 -0
- data/spec/jasmine/two_files_from_src_files/vendor/vendor.js +2 -0
- data/spec/jasmine/two_spec_files_same_basename/jasmine.yml +6 -0
- data/spec/jasmine/two_spec_files_same_basename/spec.coffee +4 -0
- data/spec/jasmine/two_spec_files_same_basename/spec.js +6 -0
- data/spec/jasmine/window_prompt/source.js +2 -0
- data/spec/jasmine/window_prompt/window_prompt.yml +4 -0
- data/spec/jasmine/with_sprockets_includes/assets/application.js.erb +2 -0
- data/spec/jasmine/with_sprockets_includes/assets/things/code.js +6 -0
- data/spec/jasmine/with_sprockets_includes/assets/things/jquery.string.js +0 -0
- data/spec/jasmine/with_sprockets_includes/assets/things/required.js +3 -0
- data/spec/jasmine/with_sprockets_includes/assets/things/subcode/more_code.js +2 -0
- data/spec/jasmine/with_sprockets_includes/assets/things/templates/that.jst.ejs +1 -0
- data/spec/jasmine/with_sprockets_includes/assets/things/templates/this.jst +2 -0
- data/spec/jasmine/with_sprockets_includes/spec/spec_helper.js +1 -0
- data/spec/jasmine/with_sprockets_includes/spec/things/code_spec.js +9 -0
- data/spec/jasmine/with_sprockets_includes/with_sprockets_includes.yml +12 -0
- data/spec/javascripts/console.log_spec.coffee +15 -0
- data/spec/javascripts/headless_reporter_result_spec.coffee +30 -0
- data/spec/javascripts/helpers/spec_helper.coffee +2 -0
- data/spec/javascripts/jasmine-extensions_spec.coffee +80 -0
- data/spec/javascripts/jasmine.HeadlessReporter.ConsoleBase_spec.coffee +35 -0
- data/spec/javascripts/jasmine.HeadlessReporter.Console_spec.coffee +3 -0
- data/spec/javascripts/jasmine.HeadlessReporter.Tap_spec.coffee +19 -0
- data/spec/javascripts/jasmine.HeadlessReporter_spec.coffee +27 -0
- data/spec/javascripts/support/jasmine.yml +9 -0
- data/spec/lib/jasmine/headless/cacheable_action_spec.rb +122 -0
- data/spec/lib/jasmine/headless/coffee_script_cache_spec.rb +21 -0
- data/spec/lib/jasmine/headless/coffee_template_spec.rb +55 -0
- data/spec/lib/jasmine/headless/css_template_spec.rb +25 -0
- data/spec/lib/jasmine/headless/file_checker_spec.rb +41 -0
- data/spec/lib/jasmine/headless/files_list_spec.rb +194 -0
- data/spec/lib/jasmine/headless/js_template_spec.rb +31 -0
- data/spec/lib/jasmine/headless/jst_template_spec.rb +21 -0
- data/spec/lib/jasmine/headless/nil_template_spec.rb +31 -0
- data/spec/lib/jasmine/headless/options_spec.rb +194 -0
- data/spec/lib/jasmine/headless/report_message/seed_spec.rb +18 -0
- data/spec/lib/jasmine/headless/report_message/spec_spec.rb +20 -0
- data/spec/lib/jasmine/headless/report_spec.rb +95 -0
- data/spec/lib/jasmine/headless/runner_spec.rb +247 -0
- data/spec/lib/jasmine/headless/spec_file_analyzer_spec.rb +68 -0
- data/spec/lib/jasmine/headless/task_spec.rb +92 -0
- data/spec/lib/jasmine/headless/template_writer_spec.rb +92 -0
- data/spec/lib/jasmine/headless/unique_asset_list_spec.rb +22 -0
- data/spec/lib/jasmine/headless_spec.rb +38 -0
- data/spec/lib/qt/qmake_spec.rb +142 -0
- data/spec/skel/template.html.erb_spec.rb +8 -0
- data/spec/spec_helper.rb +113 -0
- data/vendor/assets/coffeescripts/headless_reporter_result.coffee +49 -0
- data/vendor/assets/coffeescripts/prolog.coffee +100 -0
- data/vendor/assets/javascripts/beautify-html.js +463 -0
- data/vendor/assets/javascripts/headless_reporter_result.js +79 -0
- data/vendor/assets/javascripts/intense.coffee +28 -0
- data/vendor/assets/javascripts/jasmine-extensions.coffee +97 -0
- data/vendor/assets/javascripts/jasmine.HeadlessReporter.Console.coffee +8 -0
- data/vendor/assets/javascripts/jasmine.HeadlessReporter.ConsoleBase.coffee +92 -0
- data/vendor/assets/javascripts/jasmine.HeadlessReporter.File.coffee +24 -0
- data/vendor/assets/javascripts/jasmine.HeadlessReporter.Tap.coffee +28 -0
- data/vendor/assets/javascripts/jasmine.HeadlessReporter.Verbose.coffee +64 -0
- data/vendor/assets/javascripts/jasmine.HeadlessReporter.coffee +58 -0
- data/vendor/assets/javascripts/jsDump.js +209 -0
- data/vendor/assets/javascripts/prolog.js +108 -0
- metadata +347 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c47da9f754543d8f772e08d7f710c9bf6bf511be
|
4
|
+
data.tar.gz: 90114dd467555c3a5c04a552e5d57acbc2f39c74
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4a93d4e444dd502857a248db931aaf29f16858860f782bd862d34d47406a889f4c1311158b1d618d87aa2f04dcf79c794d7701fec11dfb7f6dcf44ca61336c7a
|
7
|
+
data.tar.gz: a58e65a3ada6b5bd5e5cc78309aec8feed9c0ccd8465af83dbe40feea853494bffaed22487ef2f816656afff2aa3219933ab92832344ab215aef28e868d758b6
|
data/.gitignore
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
*.gem
|
2
|
+
.bundle
|
3
|
+
Gemfile.lock
|
4
|
+
pkg/*
|
5
|
+
Makefile
|
6
|
+
specrunner.moc
|
7
|
+
specrunner.o
|
8
|
+
ext/jasmine-webkit-specrunner/jasmine-webkit-specrunner
|
9
|
+
*.o
|
10
|
+
moc_*.*
|
11
|
+
.DS_Store
|
12
|
+
hydra-runner.log
|
13
|
+
jhw-test
|
14
|
+
.jhw-cache/
|
15
|
+
_site/
|
16
|
+
jhw.*.html
|
17
|
+
coverage/
|
18
|
+
tmp/
|
19
|
+
cache dir/
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
-c
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
## 0.7.2
|
2
|
+
|
3
|
+
* Improved finding of CoffeeScript spec line locations
|
4
|
+
* Improved Runner reporting of which expectations failed
|
5
|
+
* Initial vendored helper support, paving the way for Sprockets integratioon (maybe!)
|
6
|
+
* Add 1.9.3-rc1 test support and fixes
|
7
|
+
* Add console.peek()
|
8
|
+
|
9
|
+
## 0.7.1
|
10
|
+
|
11
|
+
* Bugfix for missing digest/sha1 import
|
12
|
+
|
13
|
+
## 0.7.0
|
14
|
+
|
15
|
+
* Major C++ cleanup, now much more modular
|
16
|
+
* Greatly improved object inspection and printing provided by jsDump and beautify-js
|
17
|
+
|
18
|
+
## 0.6.3
|
19
|
+
|
20
|
+
* Ensure Rubygems is available before doing version comparison
|
21
|
+
* Fix other build problems
|
22
|
+
* Better output for jQuery nodes
|
23
|
+
|
24
|
+
## 0.6.2
|
25
|
+
|
26
|
+
* Clean up C++ and test running
|
27
|
+
|
28
|
+
## 0.6.1
|
29
|
+
|
30
|
+
* Ensure YAML is loaded before use
|
31
|
+
* Make sure specs can't break out of the page they're running in
|
32
|
+
* Fix compilation on FreeBSD
|
33
|
+
|
34
|
+
## 0.6.0
|
35
|
+
|
36
|
+
* File and line number information for failing specs
|
37
|
+
* Try to build the runner if it's missing
|
38
|
+
* Kill warnings and streamline includes
|
39
|
+
|
40
|
+
## 0.5.0
|
41
|
+
|
42
|
+
* Run all tests after focused run if `console.log` was used
|
43
|
+
* Ensure Rake task works outside of Rails
|
44
|
+
* Ensure focused tests aren't run when CLI called with no files
|
45
|
+
* Support globs in focused test filters
|
46
|
+
* Raise exceptions on Rake task failures
|
47
|
+
* Update to use Jasmine 1.1
|
48
|
+
|
49
|
+
## 0.4.2
|
50
|
+
|
51
|
+
* Fix Rails 3.1 Railtie so it's included properly
|
52
|
+
* Fix compilation of runner on Linux
|
53
|
+
* Run files that are outside of the project's scope
|
54
|
+
|
55
|
+
## 0.4.1
|
56
|
+
|
57
|
+
* Fix CoffeeScript concatenation bug
|
58
|
+
* Report CoffeeScript errors better
|
59
|
+
|
60
|
+
## 0.4.0
|
61
|
+
|
62
|
+
* Change how tests are counted for totals
|
63
|
+
* Run targeted and full tests in the same runner instance for speed!
|
64
|
+
* Concatenate adjacent CoffeeScript files before compilation for more speed!
|
65
|
+
* Ensure files are not required twice
|
66
|
+
* Break out runner usage from CLI so that it can be resued in Rake tasks and elsewhere
|
67
|
+
* Add a Rails 3.1 task to precompile all assets with a specific "MD5 hash"
|
68
|
+
|
69
|
+
## 0.2.3
|
70
|
+
|
71
|
+
* Better messages for JavaScript errors
|
72
|
+
* `console.pp` added for more in-depth object inspection
|
73
|
+
|
74
|
+
## 0.2.2
|
75
|
+
|
76
|
+
* Write out a reporting file that can be used for Guard notification
|
77
|
+
|
78
|
+
## 0.2.1
|
79
|
+
|
80
|
+
* Avoid a Railtie so JHW works outside of Rails
|
81
|
+
|
82
|
+
## 0.2.0
|
83
|
+
|
84
|
+
* Add a Rake task and a default task for Rails
|
85
|
+
* Global runner configuration via ~/.jasmine-headless-webkit
|
86
|
+
* Custom Jasmine reporter for better user feedback
|
87
|
+
* Specify the specs to be run, instead of always running them all
|
88
|
+
* Move README to gh-pages site
|
89
|
+
|
data/Gemfile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
source :rubygems
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in jasmine-headless-webkit-firstbanco.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
gem 'rspec'
|
7
|
+
gem 'fakefs', :require => nil
|
8
|
+
gem 'guard'
|
9
|
+
|
10
|
+
gem 'guard-rspec'
|
11
|
+
gem 'guard-shell'
|
12
|
+
gem 'guard-coffeescript'
|
13
|
+
gem 'guard-cucumber'
|
14
|
+
|
15
|
+
require 'rbconfig'
|
16
|
+
case RbConfig::CONFIG['host_os']
|
17
|
+
when /darwin/
|
18
|
+
when /linux/
|
19
|
+
gem 'libnotify'
|
20
|
+
end
|
21
|
+
|
22
|
+
gem 'mocha'
|
23
|
+
|
24
|
+
gem 'cucumber'
|
25
|
+
|
26
|
+
gem 'jquery-rails', '~> 1.0.0'
|
27
|
+
gem 'ejs'
|
28
|
+
|
29
|
+
gem 'guard-jasmine-headless-webkit', :git => 'git://github.com/johnbintz/guard-jasmine-headless-webkit.git'
|
30
|
+
|
data/Guardfile
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
# Add files and commands to this file, like the example:
|
3
|
+
# watch('file/path') { `command(s)` }
|
4
|
+
#
|
5
|
+
|
6
|
+
guard 'coffeescript', :input => 'vendor/assets/coffeescripts', :output => 'vendor/assets/javascripts'
|
7
|
+
|
8
|
+
guard 'shell' do
|
9
|
+
watch(%r{ext/jasmine-webkit-specrunner/.*\.(cpp|h|pro|pri)}) { |m|
|
10
|
+
if !m[0]['moc_']
|
11
|
+
compile
|
12
|
+
end
|
13
|
+
}
|
14
|
+
end
|
15
|
+
# A sample Guardfile
|
16
|
+
# More info at https://github.com/guard/guard#readme
|
17
|
+
|
18
|
+
guard 'rspec', :version => 2, :all_on_start => false do
|
19
|
+
watch(%r{^spec/.+_spec\.rb})
|
20
|
+
watch(%r{^lib/(.+)\.rb}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
21
|
+
watch(%r{^bin/(.+)}) { |m| "spec/bin/#{m[1]}_spec.rb" }
|
22
|
+
watch('spec/spec_helper.rb') { "spec" }
|
23
|
+
end
|
24
|
+
|
25
|
+
guard 'cucumber', :cli => '-r features --format pretty' do
|
26
|
+
watch(%r{^features/.+\.feature$})
|
27
|
+
watch(%r{^features/support/.+$}) { 'features' }
|
28
|
+
watch(%r{^features/steps/(.+)_steps\.rb$}) { 'features' }
|
29
|
+
end
|
30
|
+
|
31
|
+
guard 'jasmine-headless-webkit', :all_on_start => false do
|
32
|
+
watch(%r{^spec/javascripts/.+_spec\.coffee})
|
33
|
+
watch(%r{^jasmine/(.+)\.coffee$}) { |m| "spec/javascripts/#{m[1]}_spec.coffee" }
|
34
|
+
end
|
35
|
+
|
36
|
+
def compile
|
37
|
+
system %{cd ext/jasmine-webkit-specrunner && ruby extconf.rb}
|
38
|
+
end
|
39
|
+
|
40
|
+
compile
|
41
|
+
|
data/README.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# Jasmine Headless WebKit runner
|
2
|
+
|
3
|
+
Run your specs at sonic boom speed! No pesky reload button or page rendering slowdowns!
|
4
|
+
|
5
|
+
http://johnbintz.github.com/jasmine-headless-webkit/ has the most up-to-date information on using
|
6
|
+
this project. You can see the source of that site on the gh-pages branch.
|
7
|
+
|
8
|
+
## For those who want to hack on the project...
|
9
|
+
|
10
|
+
The best way to get everything running that you need for development and testing is
|
11
|
+
to use Guard:
|
12
|
+
|
13
|
+
``` bash
|
14
|
+
bundle install
|
15
|
+
bundle exec guard
|
16
|
+
... build Qt runner ...
|
17
|
+
... compile CoffeeScript to JS ...
|
18
|
+
... run RSpec and JHW ...
|
19
|
+
```
|
20
|
+
|
21
|
+
## License
|
22
|
+
|
23
|
+
* Copyright (c) 2011 John Bintz
|
24
|
+
* Original Qt WebKit runner Copyright (c) 2010 Sencha Inc.
|
25
|
+
* Jasmine JavaScript library Copyright (c) 2008-2011 Pivotal Labs
|
26
|
+
|
27
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
28
|
+
of this software and associated documentation files (the "Software"), to deal
|
29
|
+
in the Software without restriction, including without limitation the rights
|
30
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
31
|
+
copies of the Software, and to permit persons to whom the Software is
|
32
|
+
furnished to do so, subject to the following conditions:
|
33
|
+
|
34
|
+
The above copyright notice and this permission notice shall be included in
|
35
|
+
all copies or substantial portions of the Software.
|
36
|
+
|
37
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
38
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
39
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
40
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
41
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
42
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
43
|
+
THE SOFTWARE.
|
44
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
include Rake::DSL if defined?(Rake::DSL)
|
2
|
+
|
3
|
+
require 'bundler'
|
4
|
+
Bundler::GemHelper.install_tasks
|
5
|
+
|
6
|
+
require 'rspec/core/rake_task'
|
7
|
+
|
8
|
+
RSpec::Core::RakeTask.new(:spec)
|
9
|
+
|
10
|
+
$: << File.expand_path('../lib', __FILE__)
|
11
|
+
|
12
|
+
require 'jasmine-headless-webkit'
|
13
|
+
require 'jasmine/headless/task'
|
14
|
+
|
15
|
+
Jasmine::Headless::Task.new
|
16
|
+
|
17
|
+
PLATFORMS = %w{1.9.2 1.9.3}
|
18
|
+
|
19
|
+
def rvm_bundle(command = '')
|
20
|
+
Bundler.with_clean_env do
|
21
|
+
system %{bash -c 'unset BUNDLE_BIN_PATH && unset BUNDLE_GEMFILE && rvm #{PLATFORMS.join(',')} do bundle #{command}'}
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class SpecFailure < StandardError; end
|
26
|
+
class BundleFailure < StandardError; end
|
27
|
+
|
28
|
+
namespace :spec do
|
29
|
+
desc "Run on three Rubies"
|
30
|
+
task :platforms do
|
31
|
+
rvm_bundle
|
32
|
+
rvm_bundle "exec rspec spec"
|
33
|
+
rvm_bundle "exec cucumber"
|
34
|
+
raise SpecError.new if $?.exitstatus != 0
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
task :default => [ 'spec:platforms', 'jasmine:headless' ]
|
39
|
+
|
40
|
+
desc "Build the runner"
|
41
|
+
task :build_runner do
|
42
|
+
Dir.chdir 'ext/jasmine-webkit-specrunner' do
|
43
|
+
system %{ruby extconf.rb}
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
desc "Generate vendored JS"
|
48
|
+
task :generate_js do
|
49
|
+
require 'sprockets'
|
50
|
+
|
51
|
+
source = 'vendor/assets/coffeescripts'
|
52
|
+
target = 'vendor/assets/javascripts'
|
53
|
+
|
54
|
+
env = Sprockets::Environment.new { |s| s.append_path 'vendor/assets/coffeescripts' }
|
55
|
+
|
56
|
+
Dir[File.join(File.expand_path(source), '*.coffee')].each do |file|
|
57
|
+
file_target = file.gsub(source, target).gsub('.coffee', '.js')
|
58
|
+
puts "#{file} => #{file_target}"
|
59
|
+
|
60
|
+
File.open(file_target, 'wb') do |fh|
|
61
|
+
fh.print env.find_asset(File.expand_path(file)).to_s
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
data/config/cucumber.yml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
|
3
|
+
<plist version="0.9">
|
4
|
+
<dict>
|
5
|
+
<key>CFBundleIconFile</key>
|
6
|
+
<string></string>
|
7
|
+
<key>CFBundlePackageType</key>
|
8
|
+
<string>APPL</string>
|
9
|
+
<key>CFBundleGetInfoString</key>
|
10
|
+
<string>Created by Qt/QMake</string>
|
11
|
+
<key>CFBundleSignature</key>
|
12
|
+
<string>????</string>
|
13
|
+
<key>CFBundleExecutable</key>
|
14
|
+
<string>specrunner</string>
|
15
|
+
<key>CFBundleIdentifier</key>
|
16
|
+
<string>com.yourcompany.specrunner</string>
|
17
|
+
<key>NOTE</key>
|
18
|
+
<string>This file was generated by Qt/QMake.</string>
|
19
|
+
<key>LSUIElement</key>
|
20
|
+
<string>1</string>
|
21
|
+
</dict>
|
22
|
+
</plist>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#include <QtGui>
|
2
|
+
#include <QtWebKit>
|
3
|
+
#include <iostream>
|
4
|
+
|
5
|
+
#include "Page.h"
|
6
|
+
|
7
|
+
Page::Page() : QWebPage() {}
|
8
|
+
|
9
|
+
void Page::javaScriptConsoleMessage(const QString & message, int lineNumber, const QString & sourceID) {
|
10
|
+
emit handleError(message, lineNumber, sourceID);
|
11
|
+
}
|
12
|
+
|
13
|
+
void Page::javaScriptAlert(QWebFrame *, const QString &) {}
|
14
|
+
bool Page::javaScriptConfirm(QWebFrame *, const QString &) { return false; }
|
15
|
+
bool Page::javaScriptPrompt(QWebFrame *, const QString &, const QString &, QString *) { return false; }
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#ifndef JHW_PAGE
|
2
|
+
#define JHW_PAGE
|
3
|
+
|
4
|
+
#include <QtGui>
|
5
|
+
#include <QtWebKit>
|
6
|
+
|
7
|
+
class Page: public QWebPage {
|
8
|
+
Q_OBJECT
|
9
|
+
public:
|
10
|
+
Page();
|
11
|
+
protected:
|
12
|
+
void javaScriptConsoleMessage(const QString & message, int lineNumber, const QString & sourceID);
|
13
|
+
void javaScriptAlert(QWebFrame *, const QString &);
|
14
|
+
bool javaScriptConfirm(QWebFrame *, const QString &);
|
15
|
+
bool javaScriptPrompt(QWebFrame *, const QString &, const QString &, QString *);
|
16
|
+
signals:
|
17
|
+
void handleError(const QString & message, int lineNumber, const QString & sourceID);
|
18
|
+
};
|
19
|
+
|
20
|
+
#endif
|
@@ -0,0 +1,208 @@
|
|
1
|
+
#include <QtGui>
|
2
|
+
#include <QtWebKit>
|
3
|
+
#include <QFile>
|
4
|
+
#include <QTextStream>
|
5
|
+
#include <iostream>
|
6
|
+
#include <sstream>
|
7
|
+
#include <QQueue>
|
8
|
+
|
9
|
+
#include "Runner.h"
|
10
|
+
#include "Page.h"
|
11
|
+
|
12
|
+
using namespace std;
|
13
|
+
|
14
|
+
Runner::Runner() : QObject()
|
15
|
+
, runs(0)
|
16
|
+
, hasErrors(false)
|
17
|
+
, _hasSpecFailure(false)
|
18
|
+
, usedConsole(false)
|
19
|
+
, isFinished(false)
|
20
|
+
, useColors(false)
|
21
|
+
, quiet(false)
|
22
|
+
{
|
23
|
+
page.settings()->enablePersistentStorage();
|
24
|
+
ticker.setInterval(TIMER_TICK);
|
25
|
+
|
26
|
+
connect(&ticker, SIGNAL(timeout()), this, SLOT(timerEvent()));
|
27
|
+
connect(&page, SIGNAL(loadFinished(bool)), this, SLOT(watch(bool)));
|
28
|
+
connect(&page, SIGNAL(handleError(const QString &, int, const QString &)), this, SLOT(handleError(const QString &, int, const QString &)));
|
29
|
+
connect(page.mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(addJHW()));
|
30
|
+
}
|
31
|
+
|
32
|
+
void Runner::addFile(const QString &spec) {
|
33
|
+
runnerFiles.enqueue(spec);
|
34
|
+
}
|
35
|
+
|
36
|
+
void Runner::go() {
|
37
|
+
ticker.stop();
|
38
|
+
page.setPreferredContentsSize(QSize(1024, 600));
|
39
|
+
addJHW();
|
40
|
+
|
41
|
+
loadSpec();
|
42
|
+
}
|
43
|
+
void Runner::addJHW() {
|
44
|
+
page.mainFrame()->addToJavaScriptWindowObject("JHW", this);
|
45
|
+
}
|
46
|
+
|
47
|
+
void Runner::handleError(const QString &message, int lineNumber, const QString &sourceID) {
|
48
|
+
QString messageEscaped = QString(message);
|
49
|
+
QString sourceIDEscaped = QString(sourceID);
|
50
|
+
|
51
|
+
messageEscaped.replace(QString("\""), QString("\\\""));
|
52
|
+
sourceIDEscaped.replace(QString("\""), QString("\\\""));
|
53
|
+
|
54
|
+
std::stringstream ss;
|
55
|
+
ss << lineNumber;
|
56
|
+
|
57
|
+
QString command("JHW._handleError(\"" + messageEscaped + "\", " + QString(ss.str().c_str()) + ", \"" + sourceIDEscaped + "\"); false;");
|
58
|
+
|
59
|
+
page.mainFrame()->evaluateJavaScript(command);
|
60
|
+
|
61
|
+
hasErrors = true;
|
62
|
+
}
|
63
|
+
|
64
|
+
void Runner::loadSpec()
|
65
|
+
{
|
66
|
+
QVectorIterator<QString> iterator(reportFiles);
|
67
|
+
|
68
|
+
while (iterator.hasNext()) {
|
69
|
+
QFile *outputFile = new QFile(iterator.next());
|
70
|
+
outputFile->open(QIODevice::WriteOnly);
|
71
|
+
outputFiles.enqueue(outputFile);
|
72
|
+
}
|
73
|
+
|
74
|
+
QString runnerFile = runnerFiles.dequeue();
|
75
|
+
|
76
|
+
page.mainFrame()->load(runnerFile);
|
77
|
+
ticker.start();
|
78
|
+
}
|
79
|
+
|
80
|
+
void Runner::watch(bool ok) {
|
81
|
+
if (!ok) {
|
82
|
+
std::cerr << "Can't load " << qPrintable(page.mainFrame()->url().toString()) << ", the file may be broken." << std::endl;
|
83
|
+
std::cerr << "Out of curiosity, did your tests try to submit a form and you haven't prevented that?" << std::endl;
|
84
|
+
std::cerr << "Try running your tests in your browser with the Jasmine server and see what happens." << std::endl;
|
85
|
+
QApplication::instance()->exit(1);
|
86
|
+
return;
|
87
|
+
}
|
88
|
+
|
89
|
+
page.mainFrame()->evaluateJavaScript(QString("JHW._setColors(") + (useColors ? QString("true") : QString("false")) + QString("); false;"));
|
90
|
+
}
|
91
|
+
|
92
|
+
void Runner::setColors(bool colors) {
|
93
|
+
useColors = colors;
|
94
|
+
}
|
95
|
+
|
96
|
+
void Runner::hasUsedConsole() {
|
97
|
+
usedConsole = true;
|
98
|
+
}
|
99
|
+
|
100
|
+
void Runner::hasError() {
|
101
|
+
hasErrors = true;
|
102
|
+
}
|
103
|
+
|
104
|
+
void Runner::hasSpecFailure() {
|
105
|
+
_hasSpecFailure = true;
|
106
|
+
}
|
107
|
+
|
108
|
+
void Runner::setReportFiles(QStack<QString> &files) {
|
109
|
+
reportFiles = files;
|
110
|
+
}
|
111
|
+
|
112
|
+
void Runner::timerPause() {
|
113
|
+
ticker.stop();
|
114
|
+
}
|
115
|
+
|
116
|
+
void Runner::timerDone() {
|
117
|
+
ticker.start();
|
118
|
+
}
|
119
|
+
|
120
|
+
void Runner::ping() {
|
121
|
+
runs = 0;
|
122
|
+
}
|
123
|
+
|
124
|
+
void Runner::setSeed(QString s) {
|
125
|
+
seed = s;
|
126
|
+
}
|
127
|
+
|
128
|
+
void Runner::setQuiet(bool q) {
|
129
|
+
quiet = q;
|
130
|
+
}
|
131
|
+
|
132
|
+
QString Runner::getSeed() {
|
133
|
+
return seed;
|
134
|
+
}
|
135
|
+
|
136
|
+
bool Runner::isQuiet() {
|
137
|
+
return quiet;
|
138
|
+
}
|
139
|
+
|
140
|
+
void Runner::print(const QString &fh, const QString &content) {
|
141
|
+
if (fh == "stdout") {
|
142
|
+
std::cout << qPrintable(content);
|
143
|
+
std::cout.flush();
|
144
|
+
}
|
145
|
+
|
146
|
+
if (fh == "stderr") {
|
147
|
+
std::cerr << qPrintable(content);
|
148
|
+
std::cerr.flush();
|
149
|
+
}
|
150
|
+
|
151
|
+
if (fh.contains("report")) {
|
152
|
+
int index = (int)fh.split(":").last().toUInt();
|
153
|
+
|
154
|
+
QTextStream ts(outputFiles.at(index));
|
155
|
+
ts << qPrintable(content);
|
156
|
+
ts.flush();
|
157
|
+
}
|
158
|
+
}
|
159
|
+
|
160
|
+
void Runner::finishSuite() {
|
161
|
+
isFinished = true;
|
162
|
+
runs = 0;
|
163
|
+
}
|
164
|
+
|
165
|
+
void Runner::timerEvent() {
|
166
|
+
++runs;
|
167
|
+
|
168
|
+
if (hasErrors && runs > 2)
|
169
|
+
QApplication::instance()->exit(1);
|
170
|
+
|
171
|
+
if (isFinished && runs > 2) {
|
172
|
+
while (!outputFiles.isEmpty()) {
|
173
|
+
outputFiles.dequeue()->close();
|
174
|
+
}
|
175
|
+
|
176
|
+
int exitCode = 0;
|
177
|
+
if (_hasSpecFailure || hasErrors) {
|
178
|
+
exitCode = 1;
|
179
|
+
} else {
|
180
|
+
if (usedConsole) {
|
181
|
+
exitCode = 2;
|
182
|
+
}
|
183
|
+
}
|
184
|
+
|
185
|
+
bool runAgain = true;
|
186
|
+
|
187
|
+
if (runnerFiles.count() == 0) {
|
188
|
+
runAgain = false;
|
189
|
+
} else {
|
190
|
+
if (exitCode == 1) {
|
191
|
+
runAgain = false;
|
192
|
+
}
|
193
|
+
}
|
194
|
+
|
195
|
+
if (runAgain) {
|
196
|
+
isFinished = false;
|
197
|
+
loadSpec();
|
198
|
+
} else {
|
199
|
+
QApplication::instance()->exit(exitCode);
|
200
|
+
}
|
201
|
+
}
|
202
|
+
|
203
|
+
if (runs > MAX_LOOPS) {
|
204
|
+
std::cerr << "WARNING: too many runs and the test is still not finished!" << std::endl;
|
205
|
+
QApplication::instance()->exit(1);
|
206
|
+
}
|
207
|
+
}
|
208
|
+
|