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.
Files changed (216) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/.rspec +1 -0
  4. data/CHANGELOG.md +89 -0
  5. data/Gemfile +30 -0
  6. data/Guardfile +41 -0
  7. data/README.md +44 -0
  8. data/Rakefile +65 -0
  9. data/bin/jasmine-headless-webkit +11 -0
  10. data/config/cucumber.yml +2 -0
  11. data/ext/jasmine-webkit-specrunner/Info.plist +22 -0
  12. data/ext/jasmine-webkit-specrunner/Makefile.dummy +5 -0
  13. data/ext/jasmine-webkit-specrunner/Page.cpp +15 -0
  14. data/ext/jasmine-webkit-specrunner/Page.h +20 -0
  15. data/ext/jasmine-webkit-specrunner/Runner.cpp +208 -0
  16. data/ext/jasmine-webkit-specrunner/Runner.h +73 -0
  17. data/ext/jasmine-webkit-specrunner/common.pri +8 -0
  18. data/ext/jasmine-webkit-specrunner/extconf.rb +10 -0
  19. data/ext/jasmine-webkit-specrunner/specrunner.cpp +79 -0
  20. data/ext/jasmine-webkit-specrunner/specrunner.pro +5 -0
  21. data/features/bin/failure.feature +7 -0
  22. data/features/bin/files.feature +7 -0
  23. data/features/bin/filtered_run/both_runs.feature +18 -0
  24. data/features/bin/filtered_run/no_full_run.feature +14 -0
  25. data/features/bin/help.feature +7 -0
  26. data/features/bin/quiet_messages.feature +8 -0
  27. data/features/bin/runner_out.feature +8 -0
  28. data/features/bin/spec_files_with_same_basename.feature +7 -0
  29. data/features/bin/success.feature +20 -0
  30. data/features/bin/success_with_js_error.feature +5 -0
  31. data/features/bin/tries_to_leave_page.feature +7 -0
  32. data/features/bin/try_to_click_a_button.feature +7 -0
  33. data/features/bin/two_files_from_src_files.feature +11 -0
  34. data/features/bin/with_coffeescript_error.feature +7 -0
  35. data/features/bin/with_console_log.feature +7 -0
  36. data/features/bin/with_server.feature +7 -0
  37. data/features/bin/with_window_prompt.feature +7 -0
  38. data/features/reporters.feature +24 -0
  39. data/features/runner.feature +34 -0
  40. data/features/steps/given/i_have_test_suite.rb +2 -0
  41. data/features/steps/given/no_existing_file.rb +4 -0
  42. data/features/steps/given/options/i_have_defaults.rb +4 -0
  43. data/features/steps/given/options/i_have_reporters.rb +10 -0
  44. data/features/steps/given/options/i_have_runner_options.rb +3 -0
  45. data/features/steps/then/bin/exit_status_should_be.rb +3 -0
  46. data/features/steps/then/bin/file_should_contain_runner.rb +4 -0
  47. data/features/steps/then/bin/following_files_loaded_in_order.rb +10 -0
  48. data/features/steps/then/bin/i_should_get_help_output.rb +4 -0
  49. data/features/steps/then/bin/output_should_include.rb +3 -0
  50. data/features/steps/then/bin/output_should_not_include.rb +4 -0
  51. data/features/steps/then/reporting/report_does_not_exist.rb +4 -0
  52. data/features/steps/then/reporting/report_should_exist.rb +3 -0
  53. data/features/steps/then/reporting/report_should_have.rb +7 -0
  54. data/features/steps/then/reporting/report_should_have_seed.rb +4 -0
  55. data/features/steps/then/runner/it_should_have_exit_status.rb +3 -0
  56. data/features/steps/then/runner/it_should_include_report_file.rb +4 -0
  57. data/features/steps/then/runner/it_should_not_include_report_file.rb +3 -0
  58. data/features/steps/then/templates/it_should_use_reporter.rb +6 -0
  59. data/features/steps/when/i_delete_file.rb +3 -0
  60. data/features/steps/when/i_get_runner.rb +4 -0
  61. data/features/steps/when/i_get_template_writer.rb +4 -0
  62. data/features/steps/when/i_run_executable.rb +4 -0
  63. data/features/steps/when/i_run_runner.rb +4 -0
  64. data/features/support/env.rb +7 -0
  65. data/jasmine-headless-webkit-firstbanco.gemspec +30 -0
  66. data/lib/autotest/discover.rb +1 -0
  67. data/lib/autotest/jasmine.rb +7 -0
  68. data/lib/autotest/jasmine_mixin.rb +111 -0
  69. data/lib/autotest/jasmine_rspec2.rb +7 -0
  70. data/lib/jasmine-headless-webkit.rb +3 -0
  71. data/lib/jasmine/headless.rb +61 -0
  72. data/lib/jasmine/headless/cacheable_action.rb +85 -0
  73. data/lib/jasmine/headless/coffee_script_cache.rb +20 -0
  74. data/lib/jasmine/headless/coffee_template.rb +36 -0
  75. data/lib/jasmine/headless/command_line.rb +31 -0
  76. data/lib/jasmine/headless/css_template.rb +19 -0
  77. data/lib/jasmine/headless/errors.rb +16 -0
  78. data/lib/jasmine/headless/file_checker.rb +25 -0
  79. data/lib/jasmine/headless/files_list.rb +332 -0
  80. data/lib/jasmine/headless/js_template.rb +23 -0
  81. data/lib/jasmine/headless/jst_template.rb +15 -0
  82. data/lib/jasmine/headless/nil_template.rb +14 -0
  83. data/lib/jasmine/headless/options.rb +206 -0
  84. data/lib/jasmine/headless/railtie.rb +12 -0
  85. data/lib/jasmine/headless/report.rb +81 -0
  86. data/lib/jasmine/headless/report_message.rb +12 -0
  87. data/lib/jasmine/headless/report_message/console.rb +18 -0
  88. data/lib/jasmine/headless/report_message/error.rb +20 -0
  89. data/lib/jasmine/headless/report_message/fail.rb +5 -0
  90. data/lib/jasmine/headless/report_message/pass.rb +5 -0
  91. data/lib/jasmine/headless/report_message/seed.rb +14 -0
  92. data/lib/jasmine/headless/report_message/spec.rb +28 -0
  93. data/lib/jasmine/headless/report_message/total.rb +31 -0
  94. data/lib/jasmine/headless/runner.rb +264 -0
  95. data/lib/jasmine/headless/spec_file_analyzer.rb +44 -0
  96. data/lib/jasmine/headless/task.rb +39 -0
  97. data/lib/jasmine/headless/template_writer.rb +65 -0
  98. data/lib/jasmine/headless/unique_asset_list.rb +16 -0
  99. data/lib/jasmine/headless/version.rb +5 -0
  100. data/lib/qt/qmake.rb +155 -0
  101. data/script/gemfile +11 -0
  102. data/script/hooks/post-commit +4 -0
  103. data/script/hooks/pre-commit +15 -0
  104. data/script/initialize-environment +35 -0
  105. data/script/install-git-hooks +6 -0
  106. data/skel/template.html.erb +77 -0
  107. data/spec/files/UTF-8-test.txt +0 -0
  108. data/spec/integration/randomization_spec.rb +13 -0
  109. data/spec/integration/specify_runner_file_spec.rb +22 -0
  110. data/spec/integration/sprockets_spec.rb +23 -0
  111. data/spec/jasmine/click_button/click_button.js +5 -0
  112. data/spec/jasmine/click_button/click_button.yml +12 -0
  113. data/spec/jasmine/click_button/click_button_spec.js +11 -0
  114. data/spec/jasmine/coffeescript_error/coffeescript_error.yml +10 -0
  115. data/spec/jasmine/coffeescript_error/spec.coffee +2 -0
  116. data/spec/jasmine/coffeescript_error/src.coffee +2 -0
  117. data/spec/jasmine/console_log/console_log.js +1 -0
  118. data/spec/jasmine/console_log/console_log.yml +10 -0
  119. data/spec/jasmine/console_log/console_log_spec.js +7 -0
  120. data/spec/jasmine/failure/failure.js +1 -0
  121. data/spec/jasmine/failure/failure.yml +9 -0
  122. data/spec/jasmine/failure/failure_spec.js +6 -0
  123. data/spec/jasmine/filtered_failure/failure_spec.js +6 -0
  124. data/spec/jasmine/filtered_failure/filtered_failure.yml +10 -0
  125. data/spec/jasmine/filtered_failure/src.js +0 -0
  126. data/spec/jasmine/filtered_failure/success_spec.js +6 -0
  127. data/spec/jasmine/filtered_success/filtered_success.yml +10 -0
  128. data/spec/jasmine/filtered_success/src.js +0 -0
  129. data/spec/jasmine/filtered_success/success_one_spec.js +6 -0
  130. data/spec/jasmine/filtered_success/success_other_file.js +7 -0
  131. data/spec/jasmine/filtered_success/success_two_spec.js +6 -0
  132. data/spec/jasmine/filtered_success_with_console/filtered_success.yml +10 -0
  133. data/spec/jasmine/filtered_success_with_console/src.js +0 -0
  134. data/spec/jasmine/filtered_success_with_console/success_one_spec.js +7 -0
  135. data/spec/jasmine/filtered_success_with_console/success_two_spec.js +6 -0
  136. data/spec/jasmine/leave_page/leave_page.js +4 -0
  137. data/spec/jasmine/leave_page/leave_page.yml +9 -0
  138. data/spec/jasmine/leave_page/leave_page_spec.js +11 -0
  139. data/spec/jasmine/noisy/file.js.erb +0 -0
  140. data/spec/jasmine/noisy/noisy.yml +8 -0
  141. data/spec/jasmine/noisy/other_file.js +2 -0
  142. data/spec/jasmine/runner_out_in_jasmine_yml/jasmine.yml +11 -0
  143. data/spec/jasmine/runner_out_in_jasmine_yml/test.js +2 -0
  144. data/spec/jasmine/runner_out_in_jasmine_yml/test_spec.coffee +4 -0
  145. data/spec/jasmine/success/success.js +1 -0
  146. data/spec/jasmine/success/success.yml +9 -0
  147. data/spec/jasmine/success/success_spec.js +6 -0
  148. data/spec/jasmine/success_with_error/success_with_error.js +3 -0
  149. data/spec/jasmine/success_with_error/success_with_error.yml +9 -0
  150. data/spec/jasmine/success_with_error/success_with_error_spec.js +6 -0
  151. data/spec/jasmine/two_files_from_src_files/app/app-file.js +0 -0
  152. data/spec/jasmine/two_files_from_src_files/app/app.js +2 -0
  153. data/spec/jasmine/two_files_from_src_files/jasmine.yml +7 -0
  154. data/spec/jasmine/two_files_from_src_files/vendor/vendor-file.js +0 -0
  155. data/spec/jasmine/two_files_from_src_files/vendor/vendor.js +2 -0
  156. data/spec/jasmine/two_spec_files_same_basename/jasmine.yml +6 -0
  157. data/spec/jasmine/two_spec_files_same_basename/spec.coffee +4 -0
  158. data/spec/jasmine/two_spec_files_same_basename/spec.js +6 -0
  159. data/spec/jasmine/window_prompt/source.js +2 -0
  160. data/spec/jasmine/window_prompt/window_prompt.yml +4 -0
  161. data/spec/jasmine/with_sprockets_includes/assets/application.js.erb +2 -0
  162. data/spec/jasmine/with_sprockets_includes/assets/things/code.js +6 -0
  163. data/spec/jasmine/with_sprockets_includes/assets/things/jquery.string.js +0 -0
  164. data/spec/jasmine/with_sprockets_includes/assets/things/required.js +3 -0
  165. data/spec/jasmine/with_sprockets_includes/assets/things/subcode/more_code.js +2 -0
  166. data/spec/jasmine/with_sprockets_includes/assets/things/templates/that.jst.ejs +1 -0
  167. data/spec/jasmine/with_sprockets_includes/assets/things/templates/this.jst +2 -0
  168. data/spec/jasmine/with_sprockets_includes/spec/spec_helper.js +1 -0
  169. data/spec/jasmine/with_sprockets_includes/spec/things/code_spec.js +9 -0
  170. data/spec/jasmine/with_sprockets_includes/with_sprockets_includes.yml +12 -0
  171. data/spec/javascripts/console.log_spec.coffee +15 -0
  172. data/spec/javascripts/headless_reporter_result_spec.coffee +30 -0
  173. data/spec/javascripts/helpers/spec_helper.coffee +2 -0
  174. data/spec/javascripts/jasmine-extensions_spec.coffee +80 -0
  175. data/spec/javascripts/jasmine.HeadlessReporter.ConsoleBase_spec.coffee +35 -0
  176. data/spec/javascripts/jasmine.HeadlessReporter.Console_spec.coffee +3 -0
  177. data/spec/javascripts/jasmine.HeadlessReporter.Tap_spec.coffee +19 -0
  178. data/spec/javascripts/jasmine.HeadlessReporter_spec.coffee +27 -0
  179. data/spec/javascripts/support/jasmine.yml +9 -0
  180. data/spec/lib/jasmine/headless/cacheable_action_spec.rb +122 -0
  181. data/spec/lib/jasmine/headless/coffee_script_cache_spec.rb +21 -0
  182. data/spec/lib/jasmine/headless/coffee_template_spec.rb +55 -0
  183. data/spec/lib/jasmine/headless/css_template_spec.rb +25 -0
  184. data/spec/lib/jasmine/headless/file_checker_spec.rb +41 -0
  185. data/spec/lib/jasmine/headless/files_list_spec.rb +194 -0
  186. data/spec/lib/jasmine/headless/js_template_spec.rb +31 -0
  187. data/spec/lib/jasmine/headless/jst_template_spec.rb +21 -0
  188. data/spec/lib/jasmine/headless/nil_template_spec.rb +31 -0
  189. data/spec/lib/jasmine/headless/options_spec.rb +194 -0
  190. data/spec/lib/jasmine/headless/report_message/seed_spec.rb +18 -0
  191. data/spec/lib/jasmine/headless/report_message/spec_spec.rb +20 -0
  192. data/spec/lib/jasmine/headless/report_spec.rb +95 -0
  193. data/spec/lib/jasmine/headless/runner_spec.rb +247 -0
  194. data/spec/lib/jasmine/headless/spec_file_analyzer_spec.rb +68 -0
  195. data/spec/lib/jasmine/headless/task_spec.rb +92 -0
  196. data/spec/lib/jasmine/headless/template_writer_spec.rb +92 -0
  197. data/spec/lib/jasmine/headless/unique_asset_list_spec.rb +22 -0
  198. data/spec/lib/jasmine/headless_spec.rb +38 -0
  199. data/spec/lib/qt/qmake_spec.rb +142 -0
  200. data/spec/skel/template.html.erb_spec.rb +8 -0
  201. data/spec/spec_helper.rb +113 -0
  202. data/vendor/assets/coffeescripts/headless_reporter_result.coffee +49 -0
  203. data/vendor/assets/coffeescripts/prolog.coffee +100 -0
  204. data/vendor/assets/javascripts/beautify-html.js +463 -0
  205. data/vendor/assets/javascripts/headless_reporter_result.js +79 -0
  206. data/vendor/assets/javascripts/intense.coffee +28 -0
  207. data/vendor/assets/javascripts/jasmine-extensions.coffee +97 -0
  208. data/vendor/assets/javascripts/jasmine.HeadlessReporter.Console.coffee +8 -0
  209. data/vendor/assets/javascripts/jasmine.HeadlessReporter.ConsoleBase.coffee +92 -0
  210. data/vendor/assets/javascripts/jasmine.HeadlessReporter.File.coffee +24 -0
  211. data/vendor/assets/javascripts/jasmine.HeadlessReporter.Tap.coffee +28 -0
  212. data/vendor/assets/javascripts/jasmine.HeadlessReporter.Verbose.coffee +64 -0
  213. data/vendor/assets/javascripts/jasmine.HeadlessReporter.coffee +58 -0
  214. data/vendor/assets/javascripts/jsDump.js +209 -0
  215. data/vendor/assets/javascripts/prolog.js +108 -0
  216. metadata +347 -0
@@ -0,0 +1,73 @@
1
+ #ifndef JHW_RUNNER
2
+ #define JHW_RUNNER
3
+
4
+ #include <QtGui>
5
+ #include <QtWebKit>
6
+ #include <QFile>
7
+ #include <QTextStream>
8
+ #include <iostream>
9
+ #include <fstream>
10
+ #include <sstream>
11
+ #include <QQueue>
12
+ #include <QApplication>
13
+
14
+ #include "Page.h"
15
+
16
+ using namespace std;
17
+
18
+ class Runner: public QObject {
19
+ Q_OBJECT
20
+ public:
21
+ enum { TIMER_TICK = 200, MAX_LOOPS = 50 };
22
+
23
+ Runner();
24
+ void setColors(bool colors);
25
+ void setReportFiles(QStack<QString> &files);
26
+ void setSeed(QString s);
27
+ void setQuiet(bool q);
28
+
29
+ void addFile(const QString &spec);
30
+ void go();
31
+
32
+ public slots:
33
+ void timerPause();
34
+ void timerDone();
35
+ void hasUsedConsole();
36
+ void hasError();
37
+ void hasSpecFailure();
38
+
39
+ bool isQuiet();
40
+ QString getSeed();
41
+
42
+ void print(const QString &fh, const QString &content);
43
+ void finishSuite();
44
+ void ping();
45
+
46
+ private slots:
47
+ void watch(bool ok);
48
+ void addJHW();
49
+ void timerEvent();
50
+ void handleError(const QString & message, int lineNumber, const QString & sourceID);
51
+
52
+ private:
53
+ Page page;
54
+ QTimer ticker;
55
+ int runs;
56
+ bool hasErrors;
57
+ bool _hasSpecFailure;
58
+ bool usedConsole;
59
+ bool isFinished;
60
+ bool useColors;
61
+ bool quiet;
62
+
63
+ QString seed;
64
+
65
+ QQueue<QString> runnerFiles;
66
+ QStack<QString> reportFiles;
67
+
68
+ void loadSpec();
69
+
70
+ QQueue<QFile *> outputFiles;
71
+ };
72
+
73
+ #endif
@@ -0,0 +1,8 @@
1
+ TEMPLATE = app
2
+ CONFIG -= app_bundle
3
+ QMAKE_INFO_PLIST = Info.plist
4
+ QT += network webkit
5
+
6
+ SOURCES = Page.cpp Runner.cpp
7
+ HEADERS = Page.h Runner.h
8
+
@@ -0,0 +1,10 @@
1
+ require 'fileutils'
2
+
3
+ $: << File.expand_path("../../../lib", __FILE__)
4
+
5
+ require 'qt/qmake'
6
+
7
+ system %{make clean}
8
+ Qt::Qmake.make!('jasmine-headless-webkit', 'specrunner.pro')
9
+
10
+ FileUtils.cp File.expand_path('../Makefile.dummy', __FILE__), File.expand_path('../Makefile', __FILE__)
@@ -0,0 +1,79 @@
1
+ /*
2
+ Copyright (c) 2010 Sencha Inc.
3
+ Copyright (c) 2011 John Bintz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
22
+ */
23
+
24
+ #include "Runner.h"
25
+
26
+ #if QT_VERSION < QT_VERSION_CHECK(4, 7, 0)
27
+ #error Use Qt 4.7 or later version
28
+ #endif
29
+
30
+ int main(int argc, char** argv)
31
+ {
32
+ bool showColors = false;
33
+ bool isQuiet = false;
34
+ QString seed;
35
+ QStack<QString> reporterFiles;
36
+
37
+ int c, index;
38
+
39
+ while ((c = getopt(argc, argv, "cr:s:q")) != -1) {
40
+ switch(c) {
41
+ case 'c':
42
+ showColors = true;
43
+ break;
44
+ case 'q':
45
+ isQuiet = true;
46
+ break;
47
+ case 'r':
48
+ reporterFiles.push(QString(optarg));
49
+ break;
50
+ case 's':
51
+ seed = QString(optarg);
52
+ break;
53
+ }
54
+ }
55
+
56
+ if (optind == argc) {
57
+ std::cerr << "Run Jasmine's SpecRunner headlessly" << std::endl << std::endl;
58
+ std::cerr << " specrunner [-c] [-s seed] [-r report file ...] specrunner.html ..." << std::endl;
59
+ return 1;
60
+ }
61
+
62
+ QApplication app(argc, argv);
63
+ app.setApplicationName("jasmine-headless-webkit");
64
+ Runner runner;
65
+
66
+ runner.setColors(showColors);
67
+ runner.setQuiet(isQuiet);
68
+ runner.setReportFiles(reporterFiles);
69
+ runner.setSeed(seed);
70
+
71
+ for (index = optind; index < argc; index++) {
72
+ runner.addFile(QString::fromLocal8Bit(argv[index]));
73
+ }
74
+
75
+ runner.go();
76
+
77
+ return app.exec();
78
+ }
79
+
@@ -0,0 +1,5 @@
1
+ include(common.pri)
2
+
3
+ SOURCES += specrunner.cpp
4
+ TARGET = jasmine-webkit-specrunner
5
+
@@ -0,0 +1,7 @@
1
+ Feature: Bin - Failure
2
+ Scenario: Run a failing test
3
+ Given there is no existing "spec/report.txt" file
4
+ When I run `bin/jasmine-headless-webkit -j spec/jasmine/failure/failure.yml -f File:spec/report.txt`
5
+ Then the exit status should be 1
6
+ And the report file "spec/report.txt" should have 1 total, 1 failure, no console usage
7
+
@@ -0,0 +1,7 @@
1
+ Feature: Bin - Files
2
+ Scenario: List the files a test suite will use
3
+ Given I have a test suite
4
+ When I run `bin/jasmine-headless-webkit -j spec/jasmine/success/success.yml -l`
5
+ Then the exit status should be 0
6
+ And the output should include "spec/jasmine/success/success.js"
7
+ And the output should include "spec/jasmine/success/success_spec.js"
@@ -0,0 +1,18 @@
1
+ Feature: Bin - Filtered Run - Both Runs
2
+ Background:
3
+ Given there is no existing "spec/report.txt" file
4
+
5
+ Scenario: Run one and fail
6
+ When I run `bin/jasmine-headless-webkit -j spec/jasmine/filtered_failure/filtered_failure.yml -f File:spec/report.txt ./spec/jasmine/filtered_failure/failure_spec.js`
7
+ Then the exit status should be 1
8
+ And the report file "spec/report.txt" should have 1 total, 1 failure, no console usage
9
+
10
+ Scenario: Run both and succeed
11
+ When I run `bin/jasmine-headless-webkit -j spec/jasmine/filtered_success/filtered_success.yml -f File:spec/report.txt ./spec/jasmine/filtered_success/success_one_spec.js`
12
+ Then the exit status should be 0
13
+ And the report file "spec/report.txt" should have 2 total, 0 failures, no console usage
14
+
15
+ Scenario: Run both with console.log
16
+ When I run `bin/jasmine-headless-webkit -j spec/jasmine/filtered_success_with_console/filtered_success.yml -f File:spec/report.txt ./spec/jasmine/filtered_success_with_console/success_one_spec.js`
17
+ Then the exit status should be 2
18
+ And the report file "spec/report.txt" should have 2 total, 0 failures, yes console usage
@@ -0,0 +1,14 @@
1
+ Feature: Bin - No Full Run
2
+ Background:
3
+ Given there is no existing "spec/report.txt" file
4
+
5
+ Scenario: Only run the filtered run
6
+ When I run `bin/jasmine-headless-webkit -j spec/jasmine/filtered_success/filtered_success.yml -f File:spec/report.txt --no-full-run ./spec/jasmine/filtered_success/success_one_spec.js`
7
+ Then the exit status should be 0
8
+ And the report file "spec/report.txt" should have 1 total, 0 failure, no console usage
9
+
10
+ Scenario: Use a file outside of the normal test run
11
+ When I run `bin/jasmine-headless-webkit -j spec/jasmine/filtered_success/filtered_success.yml -f File:spec/report.txt ./spec/jasmine/filtered_success/success_other_file.js`
12
+ Then the exit status should be 0
13
+ And the report file "spec/report.txt" should have 1 total, 0 failure, no console usage
14
+
@@ -0,0 +1,7 @@
1
+ Feature: Bin - Help
2
+ Scenario: Display the Help
3
+ Given I have a test suite
4
+ When I run `bin/jasmine-headless-webkit -h`
5
+ Then I should get help output
6
+ And the exit status should be 0
7
+
@@ -0,0 +1,8 @@
1
+ Feature: Bin - Quiet Messages
2
+ Scenario: Run a test that would cause a lot of messages to be displayed and silence them all
3
+ Given I have a test suite
4
+ When I run `bin/jasmine-headless-webkit -q -j spec/jasmine/noisy/noisy.yml`
5
+ Then the exit status should be 0
6
+ And the output should not include "[Skipping File]"
7
+ And the output should not include "You should mock"
8
+
@@ -0,0 +1,8 @@
1
+ Feature: Bin - Runner Out
2
+ Scenario: Write out the runner to a specified file
3
+ Given I have a test suite
4
+ When I run `bin/jasmine-headless-webkit -j spec/jasmine/success/success.yml --runner-out spec/runner.html`
5
+ Then the exit status should be 0
6
+ And the file "spec/runner.html" should contain a JHW runner
7
+ When I delete the file "spec/runner.html"
8
+
@@ -0,0 +1,7 @@
1
+ Feature: Bin - Two spec files with same basename
2
+ Scenario: Run both files
3
+ Given there is no existing "spec/report.txt" file
4
+ When I run `bin/jasmine-headless-webkit -j spec/jasmine/two_spec_files_same_basename/jasmine.yml -f File:spec/report.txt`
5
+ Then the exit status should be 0
6
+ And the report file "spec/report.txt" should have 2 total, 0 failures, no console usage
7
+
@@ -0,0 +1,20 @@
1
+ Feature: Bin - Success
2
+ Scenario: Run a successful test with long format definition
3
+ Given there is no existing "spec/report.txt" file
4
+ When I run `bin/jasmine-headless-webkit --seed 1234 -j spec/jasmine/success/success.yml --format File --out spec/report.txt`
5
+ Then the exit status should be 0
6
+ And the report file "spec/report.txt" should have 1 total, 0 failures, no console usage
7
+ And the report file "spec/report.txt" should have seed 1234
8
+
9
+ Scenario: Run a successful test with legacy file reporting
10
+ Given there is no existing "spec/report.txt" file
11
+ When I run `bin/jasmine-headless-webkit -j spec/jasmine/success/success.yml --report spec/report.txt`
12
+ Then the exit status should be 0
13
+ And the report file "spec/report.txt" should have 1 total, 0 failures, no console usage
14
+
15
+ Scenario: Run a successful test with shortened format definition
16
+ Given there is no existing "spec/report.txt" file
17
+ When I run `bin/jasmine-headless-webkit -j spec/jasmine/success/success.yml -f File:spec/report.txt`
18
+ Then the exit status should be 0
19
+ And the report file "spec/report.txt" should have 1 total, 0 failures, no console usage
20
+
@@ -0,0 +1,5 @@
1
+ Feature: Bin - Success with JS Error
2
+ Scenario: Succeed
3
+ Given there is no existing "spec/report.txt" file
4
+ When I run `bin/jasmine-headless-webkit -j spec/jasmine/success_with_error/success_with_error.yml -f File:spec/report.txt`
5
+ Then the exit status should be 1
@@ -0,0 +1,7 @@
1
+ Feature: Bin - Try to Leave Page
2
+ Scenario: Fail on trying to leave the page
3
+ Given there is no existing "spec/report.txt" file
4
+ When I run `bin/jasmine-headless-webkit -j spec/jasmine/leave_page/leave_page.yml -f File:spec/report.txt`
5
+ Then the exit status should be 1
6
+ And the report file "spec/report.txt" should exist
7
+
@@ -0,0 +1,7 @@
1
+ Feature: Bin - Try to Click A Button
2
+ Scenario: Don't leave page when clicking a button
3
+ Given there is no existing "spec/report.txt" file
4
+ When I run `bin/jasmine-headless-webkit -j spec/jasmine/click_button/click_button.yml -f File:spec/report.txt`
5
+ Then the exit status should be 0
6
+ And the report file "spec/report.txt" should have 0 total, 0 failures, no console usage
7
+
@@ -0,0 +1,11 @@
1
+ Feature: Two files from source files
2
+ Scenario: Files are ordered directly
3
+ Given I have a test suite
4
+ When I run `bin/jasmine-headless-webkit -j spec/jasmine/two_files_from_src_files/jasmine.yml -l`
5
+ Then the exit status should be 0
6
+ And the following files should be loaded in order:
7
+ | vendor/vendor-file.js |
8
+ | vendor/vendor.js |
9
+ | app/app-file.js |
10
+ | app/app.js |
11
+
@@ -0,0 +1,7 @@
1
+ Feature: Bin - With CoffeeScript error
2
+ Scenario: Fail on CoffeeScript error
3
+ Given there is no existing "spec/report.txt" file
4
+ When I run `bin/jasmine-headless-webkit -j spec/jasmine/coffeescript_error/coffeescript_error.yml -f File:spec/report.txt`
5
+ Then the exit status should be 1
6
+ And the report file "spec/report.txt" should not exist
7
+
@@ -0,0 +1,7 @@
1
+ Feature: Use console.log
2
+ Scenario: Run a successful test that uses console.log
3
+ Given there is no existing "spec/report.txt" file
4
+ When I run `bin/jasmine-headless-webkit -j spec/jasmine/console_log/console_log.yml -f File:spec/report.txt`
5
+ Then the exit status should be 2
6
+ And the report file "spec/report.txt" should have 1 total, 0 failures, yes console usage
7
+
@@ -0,0 +1,7 @@
1
+ Feature: Bin - With Server
2
+ Scenario: Run using an HTTP server
3
+ Given there is no existing "spec/report.txt" file
4
+ When I run `bin/jasmine-headless-webkit --use-server -j spec/jasmine/success/success.yml -f File:spec/report.txt`
5
+ Then the exit status should be 0
6
+ And the report file "spec/report.txt" should have 1 total, 0 failures, no console usage
7
+
@@ -0,0 +1,7 @@
1
+ Feature: Bin - With window.prompt()
2
+ Scenario: Alert the user that window.prompt() needs to be stubbed
3
+ Given I have a test suite
4
+ When I run `bin/jasmine-headless-webkit -j spec/jasmine/window_prompt/window_prompt.yml`
5
+ Then the exit status should be 0
6
+ And the output should include "You should mock window.prompt"
7
+
@@ -0,0 +1,24 @@
1
+ Feature: Reporters
2
+ In order to allow for multiple types of output
3
+ I should be able to
4
+ Manage reporters and decide which ones to use
5
+
6
+ Scenario: Use default reporters
7
+ Given I have the default runner options
8
+ When I get a runner
9
+ And I get a template writer
10
+ Then the template should use the "Console" reporter to "stdout"
11
+ And the command to run the runner should not include a report file
12
+
13
+ Scenario: Use a file reporter
14
+ Given I have the default runner options
15
+ And I have the following reporters:
16
+ | Name | File |
17
+ | Console | |
18
+ | File | file |
19
+ When I get a runner
20
+ And I get a template writer
21
+ Then the template should use the "Console" reporter to "stdout"
22
+ And the template should use the "File" reporter to "report:0"
23
+ And the command to run the runner should include the report file "file"
24
+
@@ -0,0 +1,34 @@
1
+ Feature: Using the Runner directly
2
+ Scenario: Succeed
3
+ Given I have the following runner options:
4
+ """
5
+ :jasmine_config: spec/jasmine/success/success.yml
6
+ :reporters:
7
+ - [ 'File', 'spec/report.txt' ]
8
+ """
9
+ When I get a runner
10
+ And I run the runner
11
+ Then the runner should have an exit status of 0
12
+ And the report file "spec/report.txt" should have 1 total, 0 failures, no console usage
13
+
14
+ Scenario: JavaScript Error
15
+ Given I have the following runner options:
16
+ """
17
+ :jasmine_config: spec/jasmine/success_with_error/success_with_error.yml
18
+ """
19
+ When I get a runner
20
+ And I run the runner
21
+ Then the runner should have an exit status of 1
22
+
23
+ Scenario: Failure
24
+ Given I have the following runner options:
25
+ """
26
+ :jasmine_config: spec/jasmine/failure/failure.yml
27
+ :reporters:
28
+ - [ 'File', 'spec/report.txt' ]
29
+ """
30
+ When I get a runner
31
+ And I run the runner
32
+ Then the runner should have an exit status of 1
33
+ And the report file "spec/report.txt" should have 1 total, 1 failure, no console usage
34
+
@@ -0,0 +1,2 @@
1
+ Given /^I have a test suite$/ do
2
+ end
@@ -0,0 +1,4 @@
1
+ Given /^there is no existing "([^"]*)" file$/ do |file|
2
+ FileUtils.rm_rf file
3
+ end
4
+
@@ -0,0 +1,4 @@
1
+ Given /^I have the default runner options$/ do
2
+ @options = Jasmine::Headless::Options.new
3
+ end
4
+
@@ -0,0 +1,10 @@
1
+ Given /^I have the following reporters:$/ do |table|
2
+ @options[:reporters] = []
3
+
4
+ table.hashes.each do |hash|
5
+ reporter = [ hash['Name'] ]
6
+ reporter << hash['File'] if !hash['File'].empty?
7
+
8
+ @options[:reporters] << reporter
9
+ end
10
+ end