teaspoon 1.1.5 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +5 -0
- data/MIT.LICENSE +2 -2
- data/README.md +37 -28
- data/app/assets/javascripts/teaspoon/hook.coffee +1 -1
- data/app/assets/javascripts/teaspoon/teaspoon.coffee +13 -1
- data/app/controllers/teaspoon/suite_controller.rb +18 -13
- data/app/views/teaspoon/suite/index.html.erb +1 -1
- data/lib/generators/teaspoon/install/install_generator.rb +34 -34
- data/lib/generators/teaspoon/install/templates/MISSING_FRAMEWORK +1 -1
- data/lib/generators/teaspoon/install/templates/POST_INSTALL +1 -1
- data/lib/generators/teaspoon/install/templates/_boot.html.erb +1 -1
- data/lib/generators/teaspoon/install/templates/env_comments.rb.tt +8 -8
- data/lib/tasks/teaspoon/info.rake +1 -1
- data/lib/teaspoon/command_line.rb +76 -76
- data/lib/teaspoon/configuration.rb +4 -4
- data/lib/teaspoon/console.rb +40 -40
- data/lib/teaspoon/coverage.rb +29 -25
- data/lib/teaspoon/deprecated.rb +1 -1
- data/lib/teaspoon/driver.rb +0 -1
- data/lib/teaspoon/driver/browserstack.rb +48 -51
- data/lib/teaspoon/driver/phantomjs.rb +25 -25
- data/lib/teaspoon/driver/phantomjs/runner.js +31 -3
- data/lib/teaspoon/driver/selenium.rb +13 -9
- data/lib/teaspoon/engine.rb +26 -15
- data/lib/teaspoon/environment.rb +28 -28
- data/lib/teaspoon/exceptions.rb +7 -7
- data/lib/teaspoon/exporter.rb +23 -23
- data/lib/teaspoon/formatter/base.rb +64 -46
- data/lib/teaspoon/formatter/clean.rb +2 -2
- data/lib/teaspoon/formatter/documentation.rb +40 -40
- data/lib/teaspoon/formatter/dot.rb +12 -12
- data/lib/teaspoon/formatter/json.rb +21 -21
- data/lib/teaspoon/formatter/junit.rb +52 -52
- data/lib/teaspoon/formatter/modules/report_module.rb +34 -32
- data/lib/teaspoon/formatter/pride.rb +21 -21
- data/lib/teaspoon/formatter/rspec_html.rb +31 -31
- data/lib/teaspoon/formatter/snowday.rb +6 -5
- data/lib/teaspoon/formatter/swayze_or_oprah.rb +91 -91
- data/lib/teaspoon/formatter/tap.rb +29 -29
- data/lib/teaspoon/formatter/tap_y.rb +57 -57
- data/lib/teaspoon/formatter/teamcity.rb +63 -63
- data/lib/teaspoon/framework/base.rb +1 -1
- data/lib/teaspoon/instrumentation.rb +18 -18
- data/lib/teaspoon/registry.rb +8 -8
- data/lib/teaspoon/registry/has_default.rb +2 -2
- data/lib/teaspoon/runner.rb +37 -37
- data/lib/teaspoon/server.rb +30 -29
- data/lib/teaspoon/suite.rb +68 -57
- data/lib/teaspoon/utility.rb +6 -0
- data/lib/teaspoon/version.rb +1 -1
- metadata +10 -18
- data/lib/teaspoon/driver/capybara_webkit.rb +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c44d8efd0539ab016e391776bdb0482e7095f2c0167d653ad44f1be1405b3090
|
4
|
+
data.tar.gz: '097dd6321d53376a96bff9ca0f969d29912b66670b181dc4fe58db1feac2c91a'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a0dc950fd951087ed669aed77fdfc1b2b09c2961889f4d994b93836aff7c2f6c2f120d7fee168aeb43b97142d9b92048550631cf30420ea0c989f68c8680bc8
|
7
|
+
data.tar.gz: 62968c676eee69aa9f41f99a3e5066c2dc7ce78c212c4cef8c38bbd6f2c02ffddd1a61192d0b034c16fb08515850a3acb3e7d6b89ccbd841b70b97a5c6bc9402
|
data/CHANGELOG.md
CHANGED
data/MIT.LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
Copyright
|
1
|
+
Copyright 2019 Jeremy Jackson
|
2
2
|
|
3
|
-
https://github.com/
|
3
|
+
https://github.com/jejacks0n/teaspoon
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
6
6
|
a copy of this software and associated documentation files (the
|
data/README.md
CHANGED
@@ -2,38 +2,34 @@ Teaspoon
|
|
2
2
|
========
|
3
3
|
|
4
4
|
[![Gem Version](https://img.shields.io/gem/v/teaspoon.svg)](https://rubygems.org/gems/teaspoon)
|
5
|
-
[![
|
6
|
-
[![
|
7
|
-
[![
|
8
|
-
[![
|
9
|
-
[![
|
5
|
+
[![Build Status](https://travis-ci.org/jejacks0n/teaspoon.svg?branch=master)](https://travis-ci.org/jejacks0n/teaspoon)
|
6
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/70c116d18acd407d9201/maintainability)](https://codeclimate.com/github/jejacks0n/teaspoon/maintainability)
|
7
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/70c116d18acd407d9201/test_coverage)](https://codeclimate.com/github/jejacks0n/teaspoon/test_coverage)
|
8
|
+
[![License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)
|
9
|
+
[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)
|
10
10
|
|
11
|
-
<img src="https://raw.github.com/
|
12
|
-
<sup>Logo by [Morgan Keys](
|
11
|
+
<img src="https://raw.github.com/jejacks0n/teaspoon/master/screenshots/logo_big.png" alt="Logo by Morgan Keys" align="right" />
|
12
|
+
<sup>Logo by [Morgan Keys](https://twitter.com/morganrkeys)</sup>
|
13
13
|
|
14
|
-
Teaspoon is a Javascript test runner built for Rails. It can run tests in the browser and headless using PhantomJS, Selenium WebDriver
|
15
|
-
|
16
|
-
Feedback, ideas and pull requests are always welcome, or you can hit us up on Twitter @modeset_.
|
17
|
-
|
18
|
-
[![Join the chat at https://gitter.im/modeset/teaspoon](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/modeset/teaspoon?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
14
|
+
Teaspoon is a Javascript test runner built for Rails. It can run tests in the browser and headless using PhantomJS, or Selenium WebDriver. It can also run your tests on selenium-webgrid providers such as [BrowserStack](https://www.browserstack.com).
|
19
15
|
|
20
16
|
The goal of Teaspoon is to be simple to use while also providing the most complete Javascript testing solution for Rails.
|
21
17
|
|
22
18
|
Teaspoon takes advantage of the Rails asset pipeline, and ships with support for Jasmine, Mocha, and QUnit.
|
23
19
|
|
24
|
-
If you'd like to use Teaspoon with [Guard](https://github.com/guard/guard), check out the [guard-teaspoon](https://github.com/
|
20
|
+
If you'd like to use Teaspoon with [Guard](https://github.com/guard/guard), check out the [guard-teaspoon](https://github.com/jejacks0n/guard-teaspoon) project. Or, if you want to use the [Spring](https://github.com/rails/spring) preloader, try the unofficial [spring-commands-teaspoon](https://github.com/alejandrobabio/spring-commands-teaspoon).
|
25
21
|
|
26
22
|
|
27
23
|
## Screenshots
|
28
24
|
|
29
25
|
### Running in the console
|
30
|
-
![Console Reporter](https://raw.github.com/
|
26
|
+
![Console Reporter](https://raw.github.com/jejacks0n/teaspoon/master/screenshots/console-reporter.png)
|
31
27
|
|
32
28
|
### Running in the console using [Tapout](https://github.com/rubyworks/tapout)
|
33
|
-
![Console Reporter Tapout](https://raw.github.com/
|
29
|
+
![Console Reporter Tapout](https://raw.github.com/jejacks0n/teaspoon/master/screenshots/console-reporter-tapout.png)
|
34
30
|
|
35
31
|
### Running in the browser
|
36
|
-
![Browser Reporter](https://raw.github.com/
|
32
|
+
![Browser Reporter](https://raw.github.com/jejacks0n/teaspoon/master/screenshots/html-reporter.jpg)
|
37
33
|
|
38
34
|
|
39
35
|
## Table of Contents
|
@@ -66,14 +62,14 @@ Run the install generator to get the environment file and a basic spec helper. I
|
|
66
62
|
rails generate teaspoon:install --coffee
|
67
63
|
```
|
68
64
|
|
69
|
-
To run Teaspoon headless you'll need PhantomJS
|
65
|
+
To run Teaspoon headless you'll need PhantomJS or Selenium Webdriver.
|
70
66
|
|
71
67
|
|
72
68
|
## Usage
|
73
69
|
|
74
70
|
Teaspoon uses the Rails asset pipeline to serve files. This allows you to use `= require` in your test files, and allows you use things like HAML or RABL/JBuilder within your fixtures.
|
75
71
|
|
76
|
-
Here's a great [Quick Start Walkthrough](https://github.com/
|
72
|
+
Here's a great [Quick Start Walkthrough](https://github.com/jejacks0n/teaspoon/wiki/Quick-Start-Walkthrough) for writing and running your first tests.
|
77
73
|
|
78
74
|
You can run Teaspoon three ways -- in the browser, via the rake task, and using the command line interface (CLI).
|
79
75
|
|
@@ -140,7 +136,7 @@ describe("My great feature", function() {
|
|
140
136
|
});
|
141
137
|
```
|
142
138
|
|
143
|
-
You can also check out the examples of a [Mocha Spec](https://github.com/
|
139
|
+
You can also check out the examples of a [Mocha Spec](https://github.com/jejacks0n/teaspoon/wiki/Using-Mocha), and a [QUnit Test](https://github.com/jejacks0n/teaspoon/wiki/Using-QUnit).
|
144
140
|
|
145
141
|
### Pending Specs
|
146
142
|
|
@@ -175,7 +171,7 @@ setTimeout(Teaspoon.execute, 1000); // defers execution for 1 second
|
|
175
171
|
|
176
172
|
### Using Require.js
|
177
173
|
|
178
|
-
There's a wiki article that goes into more depth on using [RequireJS with Teaspoon](https://github.com/
|
174
|
+
There's a wiki article that goes into more depth on using [RequireJS with Teaspoon](https://github.com/jejacks0n/teaspoon/wiki/RequireJS-with-Teaspoon). But in simple terms you can configure your suite to boot with RequireJS by setting the suite `boot_partial` directive to `"boot_require_js"`.
|
179
175
|
|
180
176
|
Be sure to require `require.js` in your spec helper. Teaspoon doesn't include it as a support library, so you'll need to provide your own.
|
181
177
|
|
@@ -244,7 +240,7 @@ describe("Using fixtures", function() {
|
|
244
240
|
});
|
245
241
|
```
|
246
242
|
|
247
|
-
Check out some example of using fixtures with [Mocha](https://github.com/
|
243
|
+
Check out some example of using fixtures with [Mocha](https://github.com/jejacks0n/teaspoon/wiki/Using-Mocha), [QUnit](https://github.com/jejacks0n/teaspoon/wiki/Using-QUnit).
|
248
244
|
|
249
245
|
**Note:** The element that Teaspoon creates is "#teaspoon-fixtures", in case you need to access it directly and put your own fixtures in manually.
|
250
246
|
|
@@ -271,6 +267,20 @@ config.suite :my_suite do |suite|
|
|
271
267
|
end
|
272
268
|
```
|
273
269
|
|
270
|
+
When defining multiple suites and running the tests on a CI (like Jenkins), you might need the output of `bundle exec teaspoon` in your XML-reports.
|
271
|
+
To get one XML-file per suite you are running, you might want to add e.g a `junit` formatter which creates one result file per suite.
|
272
|
+
|
273
|
+
```ruby
|
274
|
+
config.formatters = ["junit>#{Rails.root.join(["spec", "reports", "teaspoon_%{suite_name}.xml"])}"]
|
275
|
+
```
|
276
|
+
|
277
|
+
Will create a single file for each defined test-suite under `spec/reports/teasoon_%{suite_name}.xml`.
|
278
|
+
Allowed placeholders are:
|
279
|
+
|
280
|
+
- `suite_name`: the name defined by your config (`config.suite :my_suite ...`)
|
281
|
+
- `date`: the execution timestamp of your test (`Date.now.to_i`)
|
282
|
+
|
283
|
+
|
274
284
|
### Hooks
|
275
285
|
|
276
286
|
Hooks are designed to facilitate loading fixtures or other things that might be required on the back end before, after, or during running a suite or test.
|
@@ -373,18 +383,18 @@ end
|
|
373
383
|
|
374
384
|
## Configuration
|
375
385
|
|
376
|
-
When you install Teaspoon a `teaspoon_env.rb` file is generated that contains good documentation for each configuration directive. Otherwise you can get a refresher by checking the [Teaspoon Configuration](https://github.com/
|
386
|
+
When you install Teaspoon a `teaspoon_env.rb` file is generated that contains good documentation for each configuration directive. Otherwise you can get a refresher by checking the [Teaspoon Configuration](https://github.com/jejacks0n/teaspoon/wiki/Teaspoon-Configuration) article.
|
377
387
|
|
378
388
|
**Note** If you want `teaspoon_env.rb` to live in a location other than the default install path, you can specify an alternate path in a `TEASPOON_ENV` environment variable (eg `$ TEASPOON_ENV=config/teaspoon.rb teaspoon`).
|
379
389
|
|
380
390
|
|
381
391
|
## Test Frameworks
|
382
392
|
|
383
|
-
[Jasmine](
|
393
|
+
[Jasmine](https://jasmine.github.io/) is one of the first BDD-style frameworks. We've been using Jasmine for a long time, and have been pretty happy with it. It lacks a few important things that could be in a test framework, so we've done a little bit of work to make that nicer. Like adding pending spec support.
|
384
394
|
|
385
|
-
[Mocha](http://
|
395
|
+
[Mocha](http://mochajs.org/) came up while we were working on Teaspoon -- we read up about it and thought it was a pretty awesome library with some really great approaches to some of the things that some of us browser types should consider more often, so we included it and added support for it. We encourage you to give it a try. Read more about [Using Mocha](https://github.com/jejacks0n/teaspoon/wiki/Using-Mocha) with Teaspoon.
|
386
396
|
|
387
|
-
[QUnit](http://qunitjs.com) We're not sure about how many people use QUnit, but we like jQuery, so we added it. Read more about [Using QUnit](https://github.com/
|
397
|
+
[QUnit](http://qunitjs.com) We're not sure about how many people use QUnit, but we like jQuery, so we added it. Read more about [Using QUnit](https://github.com/jejacks0n/teaspoon/wiki/Using-QUnit) with Teaspoon.
|
388
398
|
|
389
399
|
If you'd like to see what frameworks and versions Teaspoon supports, you can run `rake teaspoon:info`. The results of this will be restricted by what framework gems you have included in your Gemfile.
|
390
400
|
|
@@ -440,7 +450,7 @@ We encourage you to experiment and let us know. Feel free to create a wiki artic
|
|
440
450
|
|
441
451
|
Running your javascript tests on the BrowserStack infrastructure is easy with the included `browserstack` driver.
|
442
452
|
|
443
|
-
In `teaspoon_env.rb` configure your driver to `config.driver = :browserstack`. You must add the browsers you'd like to test on as an array of hashes with key `capabilities` in `config.driver_options`. More details about the driver configurations are available on the [Using BrowserStack WebDriver](https://github.com/
|
453
|
+
In `teaspoon_env.rb` configure your driver to `config.driver = :browserstack`. You must add the browsers you'd like to test on as an array of hashes with key `capabilities` in `config.driver_options`. More details about the driver configurations are available on the [Using BrowserStack WebDriver](https://github.com/jejacks0n/teaspoon/wiki/Using-BrowserStack-WebDriver) wiki article.
|
444
454
|
|
445
455
|
By default you can run 10 tests in parallel by default, and the number of tests running in parallel can be specified using the `max_parallel` driver option.
|
446
456
|
|
@@ -460,10 +470,9 @@ Now you can run Teaspoon locally and can see your tests running on the [BrowserS
|
|
460
470
|
|
461
471
|
Licensed under the [MIT License](http://creativecommons.org/licenses/MIT/)
|
462
472
|
|
463
|
-
Copyright
|
473
|
+
Copyright 2016 [jejacks0n](https://github.com/jejacks0n)
|
464
474
|
|
465
475
|
All licenses for the bundled Javascript libraries are included (MIT/BSD).
|
466
476
|
|
467
477
|
|
468
478
|
## Make Code Not War
|
469
|
-
![crest](https://secure.gravatar.com/avatar/aa8ea677b07f626479fd280049b0e19f?s=75)
|
@@ -32,6 +32,16 @@ class @Teaspoon
|
|
32
32
|
new (Teaspoon.resolveClass("Runner"))()
|
33
33
|
|
34
34
|
|
35
|
+
@setupErrorHandler: ->
|
36
|
+
originalOnError = window.onerror
|
37
|
+
window.onerror = (message) ->
|
38
|
+
originalOnError(arguments...) if originalOnError && originalOnError.call
|
39
|
+
return if Teaspoon.started
|
40
|
+
Teaspoon.messages.push JSON.stringify
|
41
|
+
_teaspoon: true
|
42
|
+
type: "exception"
|
43
|
+
message: message
|
44
|
+
|
35
45
|
@reload: ->
|
36
46
|
window.location.reload()
|
37
47
|
|
@@ -85,10 +95,12 @@ class @Teaspoon
|
|
85
95
|
|
86
96
|
|
87
97
|
@checkNamespace: (root, klass) ->
|
88
|
-
namespaces = klass.split(
|
98
|
+
namespaces = klass.split(".")
|
89
99
|
scope = root
|
90
100
|
|
91
101
|
for namespace, i in namespaces
|
92
102
|
return false if !(scope = scope[namespace])
|
93
103
|
|
94
104
|
return scope
|
105
|
+
|
106
|
+
Teaspoon.setupErrorHandler()
|
@@ -18,8 +18,13 @@ class Teaspoon::SuiteController < ActionController::Base
|
|
18
18
|
|
19
19
|
def hook
|
20
20
|
hooks = Teaspoon::Suite.new(params).hooks[params[:hook].to_s]
|
21
|
-
|
22
|
-
|
21
|
+
|
22
|
+
if hooks.present?
|
23
|
+
hooks.each { |hook| hook.call(hook_params(params[:args])) }
|
24
|
+
head(:ok)
|
25
|
+
else
|
26
|
+
render status: :not_found, json: { err: "The `#{params[:hook]}` hook is not defined in the `#{params[:suite]}` suite " }
|
27
|
+
end
|
23
28
|
end
|
24
29
|
|
25
30
|
def fixtures
|
@@ -28,18 +33,18 @@ class Teaspoon::SuiteController < ActionController::Base
|
|
28
33
|
|
29
34
|
private
|
30
35
|
|
31
|
-
|
32
|
-
|
33
|
-
|
36
|
+
def check_env
|
37
|
+
Teaspoon::Environment.check_env!
|
38
|
+
end
|
34
39
|
|
35
|
-
|
36
|
-
|
37
|
-
|
40
|
+
def prepend_fixture_paths
|
41
|
+
Teaspoon.configuration.fixture_paths.each do |path|
|
42
|
+
prepend_view_path Teaspoon.configuration.root.join(path)
|
43
|
+
end
|
38
44
|
end
|
39
|
-
end
|
40
45
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
46
|
+
def hook_params(params)
|
47
|
+
return params.permit!.to_h if params.respond_to?(:permit!)
|
48
|
+
params
|
49
|
+
end
|
45
50
|
end
|
@@ -13,7 +13,7 @@
|
|
13
13
|
<h1>Teaspoon</h1>
|
14
14
|
<ul>
|
15
15
|
<li>version: <b><%= Teaspoon::VERSION %></b></li>
|
16
|
-
<li><a href="http://github.com/
|
16
|
+
<li><a href="http://github.com/jejacks0n/teaspoon" target="blank">http://github.com/jejacks0n/teaspoon</a></li>
|
17
17
|
</ul>
|
18
18
|
</div>
|
19
19
|
<div id="teaspoon-progress"><div class="teaspoon-indicator teaspoon-logo"></div></div>
|
@@ -71,49 +71,49 @@ module Teaspoon
|
|
71
71
|
|
72
72
|
private
|
73
73
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
74
|
+
def described_frameworks
|
75
|
+
Teaspoon::Framework.available.map do |framework, options|
|
76
|
+
klass = Teaspoon::Framework.fetch(framework)
|
77
|
+
"#{framework}: versions[#{klass.versions.join(', ')}]"
|
78
|
+
end
|
78
79
|
end
|
79
|
-
end
|
80
80
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
81
|
+
def framework
|
82
|
+
@framework ||= begin
|
83
|
+
framework = Teaspoon::Framework.fetch(options[:framework])
|
84
|
+
source_paths
|
85
|
+
@source_paths = framework.template_paths + @source_paths
|
86
|
+
framework
|
87
|
+
end
|
87
88
|
end
|
88
|
-
end
|
89
89
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
90
|
+
def suite
|
91
|
+
@suite ||= begin
|
92
|
+
config = Teaspoon::Configuration::Suite.new
|
93
|
+
framework.modify_config(config)
|
94
|
+
config
|
95
|
+
end
|
95
96
|
end
|
96
|
-
end
|
97
97
|
|
98
|
-
|
99
|
-
|
100
|
-
|
98
|
+
def version
|
99
|
+
@version ||= options[:version] ? determine_requested_version : framework.versions.last
|
100
|
+
end
|
101
101
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
102
|
+
def determine_requested_version
|
103
|
+
return options[:version] if framework.versions.include?(options[:version])
|
104
|
+
raise Teaspoon::UnknownFrameworkVersion.new(name: framework.name, version: options[:version])
|
105
|
+
end
|
106
106
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
107
|
+
def abort_with_message
|
108
|
+
if Teaspoon::Framework.available.empty?
|
109
|
+
readme "MISSING_FRAMEWORK"
|
110
|
+
else
|
111
|
+
message = "Unknown framework: #{options[:framework]}#{options[:version] ? "[#{options[:version]}]" : ''}"
|
112
|
+
message << "\n Available: #{described_frameworks.join("\n ")}"
|
113
|
+
say_status message, nil, :red
|
114
|
+
end
|
115
|
+
exit(1)
|
114
116
|
end
|
115
|
-
exit(1)
|
116
|
-
end
|
117
117
|
end
|
118
118
|
end
|
119
119
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= javascript_include_tag *@suite.spec_assets, debug: @suite.config.expand_assets %>
|
1
|
+
<%= javascript_include_tag *@suite.spec_assets, debug: @suite.config.expand_assets, allow_non_precompiled: true %>
|
2
2
|
<script type="text/javascript">
|
3
3
|
Teaspoon.onWindowLoad(Teaspoon.execute);
|
4
4
|
</script>
|
@@ -94,18 +94,18 @@ Teaspoon.configure do |config|
|
|
94
94
|
# Specify which headless driver to use. Supports PhantomJS, Selenium Webdriver and BrowserStack Webdriver.
|
95
95
|
#
|
96
96
|
# Available: <%= Teaspoon::Driver.available.keys.map{|f| ":#{f}"}.join(", ") %>
|
97
|
-
# PhantomJS: https://github.com/
|
98
|
-
# Selenium Webdriver: https://github.com/
|
99
|
-
# BrowserStack Webdriver: https://github.com/
|
100
|
-
# Capybara Webkit: https://github.com/
|
97
|
+
# PhantomJS: https://github.com/jejacks0n/teaspoon/wiki/Using-PhantomJS
|
98
|
+
# Selenium Webdriver: https://github.com/jejacks0n/teaspoon/wiki/Using-Selenium-WebDriver
|
99
|
+
# BrowserStack Webdriver: https://github.com/jejacks0n/teaspoon/wiki/Using-BrowserStack-WebDriver
|
100
|
+
# Capybara Webkit: https://github.com/jejacks0n/teaspoon/wiki/Using-Capybara-Webkit
|
101
101
|
#config.driver = :<%= Teaspoon::Driver.default %>
|
102
102
|
|
103
103
|
# Specify additional options for the driver.
|
104
104
|
#
|
105
|
-
# PhantomJS: https://github.com/
|
106
|
-
# Selenium Webdriver: https://github.com/
|
107
|
-
# BrowserStack Webdriver: https://github.com/
|
108
|
-
# Capybara Webkit: https://github.com/
|
105
|
+
# PhantomJS: https://github.com/jejacks0n/teaspoon/wiki/Using-PhantomJS
|
106
|
+
# Selenium Webdriver: https://github.com/jejacks0n/teaspoon/wiki/Using-Selenium-WebDriver
|
107
|
+
# BrowserStack Webdriver: https://github.com/jejacks0n/teaspoon/wiki/Using-BrowserStack-WebDriver
|
108
|
+
# Capybara Webkit: https://github.com/jejacks0n/teaspoon/wiki/Using-Capybara-Webkit
|
109
109
|
#config.driver_options = nil
|
110
110
|
|
111
111
|
# Specify the timeout for the driver. Specs are expected to complete within this time frame or the run will be
|
@@ -32,113 +32,113 @@ module Teaspoon
|
|
32
32
|
|
33
33
|
protected
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
def opts_for_general
|
36
|
+
opt :environment, "-r", "--require FILE",
|
37
|
+
"Require Teaspoon environment file."
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
# opt :custom_options_file,
|
40
|
+
# "-O", "--options PATH",
|
41
|
+
# "Specify the path to a custom options file."
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
opt :driver, "-d", "--driver DRIVER",
|
44
|
+
"Specify driver:",
|
45
|
+
*driver_details
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
47
|
+
opt :driver_options, "--driver-options OPTIONS",
|
48
|
+
"Specify driver-specific options to pass into the driver.",
|
49
|
+
" e.g. \"--ssl-protocol=any --ssl-certificates-path=/path/to/certs\".",
|
50
|
+
" Driver options are only supported with phantomjs."
|
51
51
|
|
52
|
-
|
53
|
-
|
52
|
+
opt :driver_timeout, "--driver-timeout SECONDS",
|
53
|
+
"Sets the timeout for the driver to wait before exiting."
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
opt :server, "--server SERVER",
|
56
|
+
"Sets server to use with Rack.",
|
57
|
+
" e.g. webrick, thin"
|
58
58
|
|
59
|
-
|
60
|
-
|
59
|
+
opt :server_host, "--server-host HOST",
|
60
|
+
"Sets the server to use a specific host."
|
61
61
|
|
62
|
-
|
63
|
-
|
62
|
+
opt :server_port, "--server-port PORT",
|
63
|
+
"Sets the server to use a specific port."
|
64
64
|
|
65
|
-
|
66
|
-
|
65
|
+
opt :server_timeout, "--server-timeout SECONDS",
|
66
|
+
"Sets the timeout that the server must start within."
|
67
67
|
|
68
|
-
|
69
|
-
|
70
|
-
|
68
|
+
opt :fail_fast, "-F", "--[no-]fail-fast",
|
69
|
+
"Abort after the first failing suite."
|
70
|
+
end
|
71
71
|
|
72
|
-
|
73
|
-
|
72
|
+
def opts_for_filtering
|
73
|
+
separator("Filtering")
|
74
74
|
|
75
|
-
|
76
|
-
|
75
|
+
opt :suite, "-s", "--suite SUITE",
|
76
|
+
"Focus to a specific suite."
|
77
77
|
|
78
|
-
|
79
|
-
|
80
|
-
|
78
|
+
opt :filter, "-g", "--filter FILTER",
|
79
|
+
"Filter tests matching a specific filter."
|
80
|
+
end
|
81
81
|
|
82
|
-
|
83
|
-
|
82
|
+
def opts_for_output
|
83
|
+
separator("Output")
|
84
84
|
|
85
|
-
|
86
|
-
|
85
|
+
opt :suppress_log, "-q", "--[no-]suppress-log",
|
86
|
+
"Suppress logs coming from console[log/debug/error]."
|
87
87
|
|
88
|
-
|
89
|
-
|
88
|
+
opt :color, "-c", "--[no-]color",
|
89
|
+
"Enable/Disable color output."
|
90
90
|
|
91
|
-
|
92
|
-
|
91
|
+
opt :export, "-e", "--export [OUTPUT_PATH]",
|
92
|
+
"Exports the test suite as the full HTML (requires wget)."
|
93
93
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
94
|
+
opt :formatters, "-f", "--format FORMATTERS",
|
95
|
+
"Specify formatters (comma separated)",
|
96
|
+
*formatter_details
|
97
|
+
end
|
98
98
|
|
99
|
-
|
100
|
-
|
99
|
+
def opts_for_coverage
|
100
|
+
separator("Coverage")
|
101
101
|
|
102
|
-
|
103
|
-
|
104
|
-
|
102
|
+
opt :use_coverage, "-C", "--coverage CONFIG_NAME",
|
103
|
+
"Generate coverage reports using a pre-defined coverage configuration."
|
104
|
+
end
|
105
105
|
|
106
|
-
|
107
|
-
|
106
|
+
def opts_for_utility
|
107
|
+
separator("Utility")
|
108
108
|
|
109
|
-
|
110
|
-
|
111
|
-
|
109
|
+
@parser.on "-v", "--version", "Display the version." do
|
110
|
+
Teaspoon.abort(Teaspoon::VERSION, 0)
|
111
|
+
end
|
112
112
|
|
113
|
-
|
114
|
-
|
113
|
+
@parser.on "-h", "--help", "You're looking at it." do
|
114
|
+
Teaspoon.abort(@parser, 0)
|
115
|
+
end
|
115
116
|
end
|
116
|
-
end
|
117
117
|
|
118
118
|
private
|
119
119
|
|
120
|
-
|
121
|
-
|
122
|
-
|
120
|
+
def separator(message)
|
121
|
+
@parser.separator("\n **** #{message} ****\n\n")
|
122
|
+
end
|
123
123
|
|
124
|
-
|
125
|
-
|
126
|
-
|
124
|
+
def opt(config, *args)
|
125
|
+
@parser.on(*args, proc { |value| @options[config] = value })
|
126
|
+
end
|
127
127
|
|
128
|
-
|
129
|
-
|
130
|
-
|
128
|
+
def require_console
|
129
|
+
require "teaspoon/console"
|
130
|
+
end
|
131
131
|
|
132
|
-
|
133
|
-
|
134
|
-
|
132
|
+
def formatter_details
|
133
|
+
Teaspoon::Formatter.available.map do |name, options|
|
134
|
+
" #{name}#{' (default)' if options[:default]} - #{options[:description]}"
|
135
|
+
end
|
135
136
|
end
|
136
|
-
end
|
137
137
|
|
138
|
-
|
139
|
-
|
140
|
-
|
138
|
+
def driver_details
|
139
|
+
Teaspoon::Driver.available.map do |name, options|
|
140
|
+
" #{name}#{' (default)' if options[:default]}"
|
141
|
+
end
|
141
142
|
end
|
142
|
-
end
|
143
143
|
end
|
144
144
|
end
|