capybara-screenshot 1.0.24 → 1.0.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -1
- data/README.md +6 -5
- data/capybara-screenshot.gemspec +6 -2
- data/lib/capybara-screenshot.rb +5 -1
- data/lib/capybara-screenshot/cucumber.rb +7 -1
- data/lib/capybara-screenshot/rspec.rb +8 -0
- data/lib/capybara-screenshot/version.rb +1 -1
- data/spec/unit/saver_spec.rb +13 -0
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8539dcf08bbfb122dfb190cd76f82361373b4016888d02e65daedf42998e7cd2
|
4
|
+
data.tar.gz: bb64e6eb25278f8564a694784b21f9f38d3c550cf6cd2949fe5b5dd2adf5b916
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1b62365f1e18a17bc4e0d0443bce7194dd7fe9fdbe846df3ea68b45583d452e6fe0047611f8639eb43bc015307de9f993a1485164ddf502879801fd213f9031
|
7
|
+
data.tar.gz: 5a599e20a7684bf4045c2cb318099af8a9385705e83afe342fe756bd592dfc762816dcd54a3946a370b84805dc3d65c8ce2e5fb927c3673256e4c362131611aa
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
4 Oct 2020 - 1.0.24 -> 1.0.25
|
2
|
+
|
3
|
+
* [Fix Cucumber 5 deprecation warnings](https://github.com/mattheworiordan/capybara-screenshot/pull/274)
|
4
|
+
* [Add support for Cuprite driver](https://github.com/mattheworiordan/capybara-screenshot/pull/270)
|
5
|
+
* [Rails system spec compatibility](https://github.com/mattheworiordan/capybara-screenshot/pull/264)
|
6
|
+
|
1
7
|
24 Nov 2019 - 1.0.23 -> 1.0.24
|
2
8
|
|
3
9
|
* [Support Apparition driver](https://github.com/mattheworiordan/capybara-screenshot/commit/273317b241d1d1d8600b32fad998742894424f3b)
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -8,7 +8,7 @@ capybara-screenshot gem
|
|
8
8
|
#### Capture a screenshot for every test failure automatically!
|
9
9
|
|
10
10
|
`capybara-screenshot` used with [Capybara](https://github.com/jnicklas/capybara) alongside [Cucumber](http://cukes.info/), [Rspec](https://www.relishapp.com/rspec) or [Minitest](https://github.com/seattlerb/minitest), will capture a screenshot for each failure in your test suite. Associated screenshot and HTML file
|
11
|
-
of the failed page (when using [capybara-webkit](https://github.com/thoughtbot/capybara-webkit), [Selenium](http://seleniumhq.org/)
|
11
|
+
of the failed page (when using [capybara-webkit](https://github.com/thoughtbot/capybara-webkit), [Selenium](http://seleniumhq.org/), [poltergeist](https://github.com/jonleighton/poltergeist) or [cuprite](https://github.com/machinio/cuprite)) is saved into `$APPLICATION_ROOT/tmp/capybara`.
|
12
12
|
|
13
13
|
Available screenshots for each test failure is incredibly helpful for diagnosing problems quickly in your failing steps. You have the ability to view screenshots (when applicable) and source code at the time of each failure.
|
14
14
|
|
@@ -130,7 +130,7 @@ This will cause Capybara to add `<base>http://localhost:3000</base>` to the HTML
|
|
130
130
|
rails s -p 3000
|
131
131
|
```
|
132
132
|
|
133
|
-
Now when you open the page, you should have something that looks much better. You can leave this setup in place and use the default HTML pages when you don't care about the presentation, or start the rails server when you need something better looking.
|
133
|
+
Now when you open the page, you should have something that looks much better. You can leave this setup in place and use the default HTML pages when you don't care about the presentation, or start the rails server when you need something better looking.
|
134
134
|
|
135
135
|
Driver configuration
|
136
136
|
--------------------
|
@@ -330,11 +330,12 @@ About
|
|
330
330
|
|
331
331
|
This gem was written by **Matthew O'Riordan**, with contributions from [many kind people](https://github.com/mattheworiordan/capybara-screenshot/network/members).
|
332
332
|
|
333
|
-
- [http://mattheworiordan.com](http://mattheworiordan.com)
|
333
|
+
- [http://mattheworiordan.com](http://mattheworiordan.com), [Technical co-founder & CEO of Ably Realtime](https://ably.com/)
|
334
334
|
- [@mattheworiordan](http://twitter.com/#!/mattheworiordan)
|
335
|
-
- [Linked In](http://www.linkedin.com/in/
|
335
|
+
- [Linked In](http://www.linkedin.com/in/mattoriordan)
|
336
|
+
|
336
337
|
|
337
338
|
License
|
338
339
|
-------
|
339
340
|
|
340
|
-
Copyright ©
|
341
|
+
Copyright © 2020 Matthew O'Riordan, inc. It is free software, and may be redistributed under the terms specified in the LICENSE file.
|
data/capybara-screenshot.gemspec
CHANGED
@@ -12,8 +12,12 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.summary = %q{Automatically create snapshots when Cucumber steps fail with Capybara and Rails}
|
13
13
|
s.description = %q{When a Cucumber step fails, it is useful to create a screenshot image and HTML file of the current page}
|
14
14
|
s.license = 'MIT'
|
15
|
-
|
16
|
-
|
15
|
+
s.metadata = {
|
16
|
+
"bug_tracker_uri" => "https://github.com/mattheworiordan/capybara-screenshot/issues",
|
17
|
+
"changelog_uri" => "https://github.com/mattheworiordan/capybara-screenshot/blob/master/CHANGELOG.md",
|
18
|
+
"documentation_uri" => "https://www.rubydoc.info/gems/capybara-screenshot/#{s.version}",
|
19
|
+
"source_code_uri" => "https://github.com/mattheworiordan/capybara-screenshot/tree/v#{s.version}",
|
20
|
+
}
|
17
21
|
|
18
22
|
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("1.9")
|
19
23
|
s.add_dependency 'capybara', ['>= 1.0', '< 2']
|
data/lib/capybara-screenshot.rb
CHANGED
@@ -190,10 +190,14 @@ Capybara::Screenshot.class_eval do
|
|
190
190
|
:not_supported
|
191
191
|
end
|
192
192
|
end
|
193
|
-
|
193
|
+
|
194
194
|
register_driver(:apparition) do |driver, path|
|
195
195
|
driver.save_screenshot(path)
|
196
196
|
end
|
197
|
+
|
198
|
+
register_driver(:cuprite) do |driver, path|
|
199
|
+
driver.render(path, :full => true)
|
200
|
+
end
|
197
201
|
end
|
198
202
|
|
199
203
|
# Register filename prefix formatters
|
@@ -21,7 +21,13 @@ After do |scenario|
|
|
21
21
|
saver.display_image
|
22
22
|
#this will embed the image in the HTML report, embed() is defined in cucumber
|
23
23
|
encoded_img = Base64.encode64(image)
|
24
|
-
|
24
|
+
|
25
|
+
# cucumber5 deprecates embed in favor of attach
|
26
|
+
if respond_to? :attach
|
27
|
+
attach(encoded_img, 'image/png')
|
28
|
+
else
|
29
|
+
embed(encoded_img, 'image/png;base64', "Screenshot of the error")
|
30
|
+
end
|
25
31
|
end
|
26
32
|
end
|
27
33
|
end
|
@@ -90,6 +90,14 @@ RSpec.configure do |config|
|
|
90
90
|
Capybara::Screenshot.final_session_name = nil
|
91
91
|
end
|
92
92
|
|
93
|
+
# TODO: DRY refactor into a method?
|
94
|
+
# Add support for Rails system specs (previously only worked with feature specs)
|
95
|
+
config.after(type: :system) do |example_from_block_arg|
|
96
|
+
# RSpec 3 no longer defines `example`, but passes the example as block argument instead
|
97
|
+
example = config.respond_to?(:expose_current_running_example_as) ? example_from_block_arg : self.example
|
98
|
+
|
99
|
+
Capybara::Screenshot::RSpec.after_failed_example(example)
|
100
|
+
end
|
93
101
|
config.after(type: :feature) do |example_from_block_arg|
|
94
102
|
# RSpec 3 no longer defines `example`, but passes the example as block argument instead
|
95
103
|
example = config.respond_to?(:expose_current_running_example_as) ? example_from_block_arg : self.example
|
data/spec/unit/saver_spec.rb
CHANGED
@@ -298,6 +298,19 @@ describe Capybara::Screenshot::Saver do
|
|
298
298
|
end
|
299
299
|
end
|
300
300
|
|
301
|
+
describe "with cuprite driver" do
|
302
|
+
before do
|
303
|
+
allow(capybara_mock).to receive(:current_driver).and_return(:cuprite)
|
304
|
+
end
|
305
|
+
|
306
|
+
it 'saves driver render with :full => true' do
|
307
|
+
expect(driver_mock).to receive(:render).with(screenshot_path, {:full => true})
|
308
|
+
|
309
|
+
saver.save
|
310
|
+
expect(saver).to be_screenshot_saved
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
301
314
|
describe "with webkit driver" do
|
302
315
|
before do
|
303
316
|
allow(capybara_mock).to receive(:current_driver).and_return(:webkit)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara-screenshot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew O'Riordan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -240,7 +240,11 @@ files:
|
|
240
240
|
homepage: http://github.com/mattheworiordan/capybara-screenshot
|
241
241
|
licenses:
|
242
242
|
- MIT
|
243
|
-
metadata:
|
243
|
+
metadata:
|
244
|
+
bug_tracker_uri: https://github.com/mattheworiordan/capybara-screenshot/issues
|
245
|
+
changelog_uri: https://github.com/mattheworiordan/capybara-screenshot/blob/master/CHANGELOG.md
|
246
|
+
documentation_uri: https://www.rubydoc.info/gems/capybara-screenshot/1.0.25
|
247
|
+
source_code_uri: https://github.com/mattheworiordan/capybara-screenshot/tree/v1.0.25
|
244
248
|
post_install_message:
|
245
249
|
rdoc_options: []
|
246
250
|
require_paths:
|