capybara-screenshot-nocolor 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +7 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +17 -0
  5. data/Appraisals +31 -0
  6. data/CHANGELOG.md +198 -0
  7. data/Gemfile +7 -0
  8. data/LICENSE +19 -0
  9. data/README.md +240 -0
  10. data/Rakefile +40 -0
  11. data/capybara-screenshot.gemspec +38 -0
  12. data/gemfiles/cucumber.1.2.gemfile +9 -0
  13. data/gemfiles/cucumber.1.3.0.gemfile +9 -0
  14. data/gemfiles/latest.gemfile +8 -0
  15. data/gemfiles/rspec.2.14.gemfile +9 -0
  16. data/gemfiles/rspec.2.99.gemfile +9 -0
  17. data/gemfiles/rspec.3.0.gemfile +9 -0
  18. data/gemfiles/spinach.0.7.gemfile +9 -0
  19. data/gemfiles/spinach.0.8.0.gemfile +9 -0
  20. data/lib/capybara-screenshot.rb +157 -0
  21. data/lib/capybara-screenshot/capybara.rb +28 -0
  22. data/lib/capybara-screenshot/cucumber.rb +27 -0
  23. data/lib/capybara-screenshot/minitest.rb +27 -0
  24. data/lib/capybara-screenshot/pruner.rb +47 -0
  25. data/lib/capybara-screenshot/rspec.rb +92 -0
  26. data/lib/capybara-screenshot/rspec/base_reporter.rb +21 -0
  27. data/lib/capybara-screenshot/rspec/html_embed_reporter.rb +25 -0
  28. data/lib/capybara-screenshot/rspec/html_link_reporter.rb +37 -0
  29. data/lib/capybara-screenshot/rspec/text_reporter.rb +38 -0
  30. data/lib/capybara-screenshot/rspec/textmate_link_reporter.rb +19 -0
  31. data/lib/capybara-screenshot/saver.rb +87 -0
  32. data/lib/capybara-screenshot/spinach.rb +26 -0
  33. data/lib/capybara-screenshot/testunit.rb +39 -0
  34. data/lib/capybara-screenshot/version.rb +5 -0
  35. data/spec/cucumber/cucumber_spec.rb +93 -0
  36. data/spec/cucumber/step_definitions/step_definitions.rb +18 -0
  37. data/spec/cucumber/support/env.rb +17 -0
  38. data/spec/feature/minitest_spec.rb +110 -0
  39. data/spec/feature/testunit_spec.rb +81 -0
  40. data/spec/rspec/rspec_spec.rb +159 -0
  41. data/spec/spec_helper.rb +29 -0
  42. data/spec/spinach/spinach_spec.rb +64 -0
  43. data/spec/spinach/support/spinach_failure.rb +41 -0
  44. data/spec/support/common_setup.rb +59 -0
  45. data/spec/support/html_reporter_context.rb +28 -0
  46. data/spec/support/test_app.rb +13 -0
  47. data/spec/unit/base_reporter_spec.rb +25 -0
  48. data/spec/unit/capybara-screenshot_rspec_spec.rb +48 -0
  49. data/spec/unit/capybara-screenshot_spec.rb +88 -0
  50. data/spec/unit/capybara_spec.rb +50 -0
  51. data/spec/unit/pruner_spec.rb +108 -0
  52. data/spec/unit/rspec_reporters/html_embed_reporter_spec.rb +18 -0
  53. data/spec/unit/rspec_reporters/html_link_reporter_spec.rb +27 -0
  54. data/spec/unit/rspec_reporters/text_reporter_spec.rb +97 -0
  55. data/spec/unit/rspec_reporters/textmate_link_reporter_spec.rb +39 -0
  56. data/spec/unit/saver_spec.rb +282 -0
  57. metadata +247 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: debcd0f6b147d7d43971537748912f05f4ec56f9
4
+ data.tar.gz: e59b5fd4cc7d9cb383f449f0df6d676553000d6e
5
+ SHA512:
6
+ metadata.gz: dbe69f576c94d13a97d0ec0dea4fc7fb0a9280689b1c6c9509ef4ada996b7d95a18d8dbb3c3897f5c40e9ac3a654f7474953a7971130944d1db049fc61b3e082
7
+ data.tar.gz: 83f83cc3d6683d389906c5e3e4a90a4e058e672a5a38dd95d2dece211089fab1632c66b91ec2fe6d274decf94a2642a64d9638775647bb273a179a2635eec61c
@@ -0,0 +1,7 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ gemfiles/*.lock
5
+ pkg/*
6
+ .rvmrc
7
+ bin
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
@@ -0,0 +1,17 @@
1
+ language: ruby
2
+ script: "rake travis:ci"
3
+ rvm:
4
+ - 1.9.3
5
+ - 2.0.0
6
+ - 2.1.2
7
+ - jruby-19mode
8
+ - jruby-1.7.13
9
+ gemfile:
10
+ - gemfiles/cucumber.1.2.gemfile
11
+ - gemfiles/cucumber.1.3.0.gemfile
12
+ - gemfiles/latest.gemfile
13
+ - gemfiles/rspec.2.14.gemfile
14
+ - gemfiles/rspec.2.99.gemfile
15
+ - gemfiles/rspec.3.0.gemfile
16
+ - gemfiles/spinach.0.7.gemfile
17
+ - gemfiles/spinach.0.8.0.gemfile
@@ -0,0 +1,31 @@
1
+ appraise "rspec.2.14" do
2
+ gem "rspec", "2.14"
3
+ end
4
+
5
+ appraise "rspec.2.99" do
6
+ gem "rspec", "2.99"
7
+ end
8
+
9
+ appraise "rspec.3.0" do
10
+ gem "rspec", "3.0"
11
+ end
12
+
13
+ appraise "cucumber.1.2" do
14
+ gem "cucumber", "1.2"
15
+ end
16
+
17
+ appraise "cucumber.1.3.0" do
18
+ gem "cucumber", "1.3.0"
19
+ end
20
+
21
+ appraise "spinach.0.7" do
22
+ gem "spinach", "0.7"
23
+ end
24
+
25
+ appraise "spinach.0.8.0" do
26
+ gem "spinach", "0.8.0"
27
+ end
28
+
29
+ appraise "latest" do
30
+ # will get latest versions of all gems
31
+ end
@@ -0,0 +1,198 @@
1
+ 10 Feburary 2015 - 1.04 -> 1.0.5
2
+ -----------
3
+
4
+ * Added support for appending a random string to the filename
5
+
6
+ Thanks to [Brad Wedell](https://github.com/streetlogics)
7
+
8
+ 5 January 2015 - 1.0.3 -> 1.0.4
9
+ -----------
10
+
11
+ * Added support for Poltergeist Billy
12
+ * Don't initialize a new Capybara::Session in after hook
13
+
14
+ Thanks to [Neodude](https://github.com/neodude) and [Dominik Masur](https://github.com/dmasur)
15
+
16
+ 1 October 2014 - 1.0.2 -> 1.0.3
17
+ -----------
18
+
19
+ * Added ability to prune screenshots automatically, see https://github.com/mattheworiordan/capybara-screenshot/pull/100
20
+
21
+ Thanks to [Anton Kolomiychuk](https://github.com/akolomiychuk) for his contribution.
22
+
23
+ 27 September 2014 - 1.0.1 -> 1.0.2
24
+ -----------
25
+
26
+ * Improved documentation to cover RSpec 3's new approach to using `rails_helper` in place of `spec_helper` for Rails tests
27
+ * Updated documentation to use Ruby formatting in language blocks
28
+ * Removed need to manually `require 'capybara-screenshot'` for RSpec
29
+
30
+ 18 September 2014 - 1.0.0 -> 1.0.1
31
+ -----------
32
+
33
+ * Hot fix for RSpec version issue that assumed RSpec base library was always available, now uses `RSpec::Core::VERSION`
34
+ * Improve Travis CI performance and stability
35
+
36
+ 18 September 2014 - 0.3.22 -> 1.0.0
37
+ -----------
38
+
39
+ Because of the broad test coverage now across RSpec, Cucumber, Spinach, Minitest and TestUnit using [Aruba](https://github.com/cucumber/aruba), I feel that this gem is ready for its first major release. New features and refactoring can now reliably be done without the fear of regressions.
40
+
41
+ The major changes in this 1.0 release are:
42
+
43
+ * Acceptance test coverage for RSpec, Cucumber, Spinach, Minitest and TestUnit
44
+ * Travis CI test coverage across a matrix of old and new versions of the aforementioned testing frameworks, see https://github.com/mattheworiordan/capybara-screenshot/blob/master/.travis.yml
45
+ * Support for RSpec 3 using the custom formatters
46
+ * Support for sessions using `using_session`, see https://github.com/mattheworiordan/capybara-screenshot/pull/91 for more info
47
+ * Support for RSpec DocumentationFormatter
48
+ * Considerable refactoring of the test suite
49
+
50
+ Special thanks goes to [Andrew Brown](https://github.com/dontfidget) who has contributed a huge amount of the code that has helped enable this Gem to have its stable major version release.
51
+
52
+ 22 July 2014 - 0.3.21 -> 0.3.22
53
+ -----------
54
+
55
+ Replaced [colorize](https://rubygems.org/gems/colorize) gem with [colored](https://rubygems.org/gems/colored) due to license issue, see https://github.com/mattheworiordan/capybara-screenshot/issues/93.
56
+
57
+ 22 July 2014 - 0.3.20 -> 0.3.21
58
+ -----------
59
+
60
+ As a result of recent merges and insufficient test coverage, it seems that for test suites other than RSpec the HTML or Image screenshot path was no longer being outputted in the test results. This has now been fixed, and screenshot output format for RSpec and all other test suites has been standardised.
61
+
62
+ 11 July 2014 - 0.3.19 -> 0.3.20
63
+ -----------
64
+
65
+ * Added reporters to improve screenshot info in RSpec output
66
+ * Added support for Webkit options such as width and height
67
+
68
+ Thanks to https://github.com/multiplegeorges and https://github.com/noniq
69
+
70
+ 2 April 2014 - 0.3.18 -> 0.3.19
71
+ -----------
72
+
73
+ * Added support Spinach, thanks to https://github.com/suchitpuri
74
+
75
+ 2 March 2014 - 0.3.16 -> 0.3.17
76
+ -----------
77
+
78
+ * Added support for RSpec 3 and cleaned up the logging so there is less noise within the test results when a driver does not support a particular format.
79
+ * Updated Travis to test against Ruby 2.0 and Ruby 2.1
80
+
81
+ Thanks to https://github.com/noniq
82
+
83
+ 7 January 2014
84
+ -----------
85
+
86
+ Bug fix for Minitest 5, thanks to https://github.com/cschramm
87
+
88
+
89
+ 12 September 2013
90
+ -----------
91
+
92
+ Added support for Test Unit, fixed RSpec deprecation warnings and fixed a dependency issue.
93
+
94
+ Thanks to:
95
+
96
+ * https://github.com/budnik
97
+ * https://github.com/jkraemer
98
+ * https://github.com/mariovisic
99
+
100
+
101
+ 23 July 2013
102
+ -----------
103
+
104
+ https://github.com/stevenwilkin contributed code to display a warning for [Mechanize](http://mechanize.rubyforge.org/) users.
105
+
106
+ 3 June 2013
107
+ -----------
108
+
109
+ Dropped Ruby 1.8 support for this Gem because of conflicts with Nokogiri requiring a later version of Ruby. Instead, there is a new branch https://github.com/mattheworiordan/capybara-screenshot/tree/ruby-1.8-support which can be used if requiring backwards compatabiltiy.
110
+
111
+ 18 Apr 2013
112
+ -----------
113
+
114
+ Improved documentation, Ruby 1.8.7 support by not allowing Capybara 2.1 to be used, improved Sinatra support.
115
+ RSpec screenshot fix to only screenshot when applicable: https://github.com/mattheworiordan/capybara-screenshot/issues/44
116
+
117
+ 07 Jan 2013
118
+ -----------
119
+
120
+ Support for Terminus, thanks to https://github.com/jamesotron
121
+
122
+ 27 Dec 2012
123
+ -----------
124
+
125
+ Previos version bump broke Ruby 1.8.7 support, so Travis CI build added to this Gem and Ruby 1.8.7 support along with JRuby support added.
126
+
127
+ 30 Oct 2012 - Significant version bump 0.3
128
+ -----------
129
+
130
+ After some consideration, and continued problems with load order of capybara-screenshot in relation to other required gems, the commits from @adzap in the pull request https://github.com/mattheworiordan/capybara-screenshot/pull/29 have been incorporated. Moving forwards, for every testing framework you use, you will be required to add an explicit require.
131
+
132
+
133
+ 15 Feb 2012
134
+ -----------
135
+
136
+ Merged pull request https://github.com/mattheworiordan/capybara-screenshot/pull/14 to limit when capybara-screenshot is fired for RSpec
137
+
138
+ 30 Jan 2012
139
+ -----------
140
+
141
+ Merged pull request from https://github.com/hlascelles to support Padrino
142
+
143
+ 15 Jan 2012
144
+ -----------
145
+
146
+ Removed unnecessary and annoying warning that a screen shot cannot be taken. This message was being shown when RSpec tests were run that did not even invoke Capybara
147
+
148
+ 13 Jan 2012
149
+ -----------
150
+
151
+ Updated documentation to reflect support for more frameworks, https://github.com/mattheworiordan/capybara-screenshot/issues/9
152
+
153
+ 3 Jan 2012
154
+ ----------
155
+
156
+ Removed Cucumber dependency https://github.com/mattheworiordan/capybara-screenshot/issues/7
157
+ Allowed PNG save path to be configured using capybara.save_and_open_page_path
158
+
159
+ 3 December 2011
160
+ ---------------
161
+
162
+ More robust handling of Minitest for users who have it installed as a dependency
163
+ https://github.com/mattheworiordan/capybara-screenshot/issues/5
164
+
165
+
166
+ 2 December 2011
167
+ ---------------
168
+
169
+ Fixed bug related to teardown hook not being available in Minitest for some reason (possibly version issues).
170
+ https://github.com/mattheworiordan/capybara-screenshot/issues/5
171
+
172
+ 24 November 2011
173
+ ----------------
174
+
175
+ Added support for:
176
+
177
+ * More platforms (Poltergeist)
178
+ * Removed Rails dependencies (bug)
179
+ * Added screenshot capability for Selenium
180
+ * Added support for embed for HTML reports
181
+
182
+ Thanks to [https://github.com/rb2k](https://github.com/rb2k) for 2 [great commits](https://github.com/mattheworiordan/capybara-screenshot/pull/4)
183
+
184
+ 16 November 2011
185
+ ----------------
186
+
187
+ Added support for Minitest using teardown hooks
188
+
189
+
190
+ 16 November 2011
191
+ ----------------
192
+
193
+ Added support for RSpec by adding a RSpec configuration after hook and checking if Capybara is being used.
194
+
195
+ 15 November 2011
196
+ ----------------
197
+
198
+ Ensured that tests run other than Cucumber won't fail. Prior to this Cucumber was required.
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in capybara-screenshot.gemspec
4
+ gemspec
5
+
6
+ gem 'rake'
7
+ gem 'appraisal'
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2011 Matthew O'Riordan, inc.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -0,0 +1,240 @@
1
+ capybara-screenshot gem
2
+ =======================
3
+
4
+ [![Build Status](https://travis-ci.org/mattheworiordan/capybara-screenshot.png)](https://travis-ci.org/mattheworiordan/capybara-screenshot)
5
+ [![Code Climate](https://d3s6mut3hikguw.cloudfront.net/github/mattheworiordan/capybara-screenshot.png)](https://codeclimate.com/github/mattheworiordan/capybara-screenshot)
6
+ [![Gem Version](https://badge.fury.io/rb/capybara-screenshot.svg)](http://badge.fury.io/rb/capybara-screenshot)
7
+
8
+ #### Capture a screen shot for every test failure automatically!
9
+
10
+ `capybara-screenshot` used with [Capybara](https://github.com/jnicklas/capybara) and [Cucumber](http://cukes.info/), [Rspec](https://www.relishapp.com/rspec) or [Minitest](https://github.com/seattlerb/minitest), will capture a screen shot for each failure in your test suite. The HTML for the failed page, and a screenshot image (when using [capybara-webkit](https://github.com/thoughtbot/capybara-webkit), [Selenium](http://seleniumhq.org/) or [poltergeist](https://github.com/jonleighton/poltergeist)) is saved into `$APPLICATION_ROOT/tmp/capybara`.
11
+
12
+ Having screenshots readily available for each test failure is incredibly helpful when trying to quickly diagnose a problem in your failing steps. You can view the source code, and have a screen shot of the page (when applicable), at the time of each failure.
13
+
14
+ _Please note that Ruby 1.9+ is required to use this Gem. For Ruby 1.8 support, please see the [capybara-screenshot Ruby 1.8 branch](https://github.com/mattheworiordan/capybara-screenshot/tree/ruby-1.8-support)_
15
+
16
+ Installation
17
+ -----
18
+
19
+ ### Step 1: install the gem
20
+
21
+ Using Bundler, add the following to your Gemfile
22
+
23
+ ```ruby
24
+ gem 'capybara-screenshot', :group => :test
25
+ ```
26
+
27
+ or install manually using Ruby Gems:
28
+
29
+ ```
30
+ gem install capybara-screenshot
31
+ ```
32
+
33
+ ### Step 2: load capybara-screenshot into your tests
34
+
35
+ #### Cucumber
36
+
37
+ In env.rb or a support file, please add:
38
+
39
+ ```ruby
40
+ require 'capybara-screenshot/cucumber'
41
+ ```
42
+
43
+ #### RSpec
44
+
45
+ In rails_helper.rb, spec_helper.rb, or a support file, after the require for 'capybara/rspec', please add:
46
+
47
+ ```ruby
48
+ # remember: you must require 'capybara/rspec' first
49
+ require 'capybara-screenshot/rspec'
50
+ ```
51
+
52
+ *Note: As of RSpec Rails 3.0, it is recommended that all your Rails environment code is loaded into `rails_helper.rb` instead of `spec_helper.rb`, and as such, the capybara-screenshot require should be located in `rails_helper.rb`. See the [RSpec Rails 3.0 upgrade notes](https://www.relishapp.com/rspec/rspec-rails/v/3-0/docs/upgrade) for more info.*
53
+
54
+ #### Minitest
55
+
56
+ Typically in 'test/test_helper.rb', please add:
57
+
58
+ ```ruby
59
+ require 'capybara-screenshot/minitest'
60
+ ```
61
+
62
+ #### Test::Unit
63
+
64
+ Typically in 'test/test_helper.rb', please add:
65
+
66
+ ```ruby
67
+ require 'capybara-screenshot/testunit'
68
+ ```
69
+
70
+ By default, screenshots will be captured for `Test::Unit` tests in the path 'test/integration'. You can add additional paths as:
71
+
72
+ ```ruby
73
+ Capybara::Screenshot.testunit_paths << 'test/feature'
74
+ ```
75
+
76
+
77
+ Manual screenshots
78
+ ----
79
+
80
+ If you require more control, you can generate the screenshot on demand rather than on failure. This is useful
81
+ if the failure occurs at a point where the screen shot is not as useful for debugging a rendering problem. This
82
+ can be more useful if you disable the auto-generate on failure feature with the following config
83
+
84
+ ```ruby
85
+ Capybara::Screenshot.autosave_on_failure = false
86
+ ```
87
+
88
+ Anywhere the Capybara DSL methods (visit, click etc.) are available so too are the screenshot methods.
89
+
90
+ ```ruby
91
+ screenshot_and_save_page
92
+ ```
93
+
94
+ Or for screenshot only, which will automatically open the image.
95
+
96
+ ```ruby
97
+ screenshot_and_open_image
98
+ ```
99
+
100
+ These are just calls on the main library methods.
101
+
102
+ ```ruby
103
+ Capybara::Screenshot.screenshot_and_save_page
104
+ Capybara::Screenshot.screenshot_and_open_image
105
+ ```
106
+
107
+
108
+ Driver configuration
109
+ --------------------
110
+
111
+ The gem supports the default rendering method for Capybara to generate the screenshot, which is:
112
+
113
+ ```ruby
114
+ page.driver.render(path)
115
+ ```
116
+
117
+ There are also some specific driver configurations for Selenium, Webkit, and Poltergeist. See [the definitions here](https://github.com/mattheworiordan/capybara-screenshot/blob/master/lib/capybara-screenshot.rb). The Rack::Test driver, Rails' default, does not allow
118
+ rendering, so it has a driver definition as a noop.
119
+
120
+ Capybara-webkit defaults to a screenshot size of 1000px by 10px. To specify a custom size, use the following option:
121
+
122
+ ```ruby
123
+ Capybara::Screenshot.webkit_options = { width: 1024, height: 768 }
124
+ ```
125
+
126
+ If a driver is not found the default rendering will be used. If this doesn't work with your driver, then you can
127
+ add another driver configuration like so
128
+
129
+ ```ruby
130
+ # The driver name should match the Capybara driver config name.
131
+ Capybara::Screenshot.register_driver(:exotic_browser_driver) do |driver, path|
132
+ driver.super_dooper_render(path)
133
+ end
134
+ ```
135
+
136
+ If your driver is based on existing browser driver, like Firefox, instead of `.super_dooper_render` do `driver.browser.save_screenshot path`.
137
+
138
+
139
+ Custom screenshot filename
140
+ --------------------------
141
+
142
+ If you want to control the screenshot filename for a specific test library, to inject the test name into it for example,
143
+ you can override how the basename is generated for the file like so
144
+
145
+ ```ruby
146
+ Capybara::Screenshot.register_filename_prefix_formatter(:rspec) do |example|
147
+ "screenshot_#{example.description.gsub(' ', '-').gsub(/^.*\/spec\//,'')}"
148
+ end
149
+ ```
150
+
151
+ By default capybara-screenshot will append a timestamp to the basename. If you want to disable this behavior set the following option:
152
+
153
+ ```ruby
154
+ Capybara::Screenshot.append_timestamp = false
155
+ ```
156
+
157
+
158
+ Custom screenshot directory
159
+ --------------------------
160
+ By default screenshots are saved into `$APPLICATION_ROOT/tmp/capybara`. If you want to customize the location, override the file path as:
161
+
162
+ ```ruby
163
+ Capybara.save_and_open_page_path = "/file/path"
164
+ ```
165
+
166
+
167
+ Pruning old screenshots automatically
168
+ --------------------------
169
+ By default screenshots are saved indefinitely, if you want them to be automatically pruned on a new failure, then you can specify one of the following prune strategies as follows:
170
+
171
+ ```ruby
172
+ # Keep only the screenshots generated from the last failing test suite
173
+ Capybara::Screenshot.prune_strategy = :keep_last_run
174
+
175
+ # Keep up to the number of screenshots specified in the hash
176
+ Capybara::Screenshot.prune_strategy = { keep: 20 }
177
+ ```
178
+
179
+
180
+ Information about screenshots in RSpec output
181
+ ---------------------------------------------
182
+
183
+ By default, capybara-screenshot extend RSpec’s formatters to include a link to the screenshot and/or saved html page for each failed spec. If you want to disable this feature completely (eg. to avoid problems with CI tools), use:
184
+
185
+ ```ruby
186
+ Capybara::Screenshot::RSpec.add_link_to_screenshot_for_failed_examples = false
187
+ ```
188
+
189
+ It’s also possible to directly embed the screenshot image in the output if you’re using RSpec’s HtmlFormatter:
190
+
191
+ ```ruby
192
+ Capybara::Screenshot::RSpec::REPORTERS["RSpec::Core::Formatters::HtmlFormatter"] = Capybara::Screenshot::RSpec::HtmlEmbedReporter
193
+ ```
194
+
195
+ If you want to further customize the information added to RSpec’s output, just implement your own reporter class and customize `Capybara::Screenshot::RSpec::REPORTERS` accordingly. See [rspec.rb](lib/capybara-screenshot/rspec.rb) for more info.
196
+
197
+
198
+ Common problems
199
+ ---------------
200
+
201
+ If you have recently upgraded from v0.2, or you find that screen shots are not automatically being generated, then it's most likely you have not included the necessary `require` statement for your testing framework described above. As of version 0.3, without the explicit require, Capybara-Screenshot will not automatically take screen shots. Please re-read the installation instructions above.
202
+
203
+ Also make sure that you're not calling `Capybara.reset_sessions!` before the screenshot hook runs. For RSpec you want to make sure that you're using `append_after` instead of `after`, for instance:
204
+
205
+ ```ruby
206
+ config.append_after(:each) do
207
+ Capybara.reset_sessions!
208
+ end
209
+ ```
210
+
211
+ [Raise an issue on the Capybara-Screenshot issue tracker](https://github.com/mattheworiordan/capybara-screenshot/issues) if you are still having problems.
212
+
213
+ Repository & Contributing to this Gem
214
+ -------------------------------------
215
+
216
+ #### Bugs
217
+
218
+ Please raise an issue at [https://github.com/mattheworiordan/capybara-screenshot/issues](https://github.com/mattheworiordan/capybara-screenshot/issues) and ensure you provide sufficient detail to replicate the problem.
219
+
220
+ #### Contributions
221
+
222
+ Contributions are welcome. Please fork this gem, and submit a pull request. New features must include test coverage and must pass on all versions of the testing frameworks supported. Run `appraisal "bundle exec rspec && bundle exec cucumber"` locally to test your changes against all versions of testing framework gems supported.
223
+
224
+ #### Rubygems
225
+
226
+ The gem details on RubyGems.org can be found at [https://rubygems.org/gems/capybara-screenshot](https://rubygems.org/gems/capybara-screenshot)
227
+
228
+ About
229
+ -----
230
+
231
+ This gem was written by **Matthew O'Riordan**, with contributions from [many kind people](https://github.com/mattheworiordan/capybara-screenshot/network/members).
232
+
233
+ - [http://mattheworiordan.com](http://mattheworiordan.com)
234
+ - [@mattheworiordan](http://twitter.com/#!/mattheworiordan)
235
+ - [Linked In](http://www.linkedin.com/in/lemon)
236
+
237
+ License
238
+ -------
239
+
240
+ Copyright © 2014 Matthew O'Riordan, inc. It is free software, and may be redistributed under the terms specified in the LICENSE file.