capybara-screenshot 1.0.14 → 1.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +51 -2
- data/lib/capybara-screenshot.rb +11 -1
- data/lib/capybara-screenshot/callbacks.rb +44 -0
- data/lib/capybara-screenshot/rspec.rb +1 -0
- data/lib/capybara-screenshot/s3_saver.rb +15 -7
- data/lib/capybara-screenshot/saver.rb +9 -0
- data/lib/capybara-screenshot/version.rb +1 -1
- data/spec/cucumber/cucumber_spec.rb +0 -4
- data/spec/feature/minitest_spec.rb +0 -4
- data/spec/feature/testunit_spec.rb +0 -4
- data/spec/rspec/rspec_spec.rb +0 -1
- data/spec/spinach/spinach_spec.rb +0 -4
- data/spec/support/aruba.rb +0 -1
- data/spec/unit/capybara-screenshot_spec.rb +2 -1
- data/spec/unit/s3_saver_spec.rb +66 -6
- data/spec/unit/saver_spec.rb +34 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17a6c4cc3fd164bb2b6f74448ef7b9ddf83b771c
|
4
|
+
data.tar.gz: fc743fe14f52cb0481a3aa545e9b5290420a4cd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 366222eb34fb0bdfa5bf53c5b27a7e00902c1e8300b6767a377ff6fa207eb1a5104d6cc868d7f69c1829f370ff90ebbde1940e8529b8ab694fb544b9ab5fc38d
|
7
|
+
data.tar.gz: 0c04abede37b6e6fc39a1f1d22a2d7429eada67a0d46bbb8ef59bf1ba53d35763d1d4b4c7361d8c21ffa52dc90e58e7de9421a2864effa8e71dae5c939e9b944
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
12 July 2017 - 1.0.14 -> 1.0.15
|
2
|
+
|
3
|
+
* [SVG badges added](https://github.com/mattheworiordan/capybara-screenshot/pull/207)
|
4
|
+
* [Ensure the reporter module is not loaded multiple times](https://github.com/mattheworiordan/capybara-screenshot/pull/205)
|
5
|
+
* [S3 object config option](https://github.com/mattheworiordan/capybara-screenshot/pull/204)
|
6
|
+
* [Saver can use injected page](https://github.com/mattheworiordan/capybara-screenshot/pull/181)
|
7
|
+
* [After* callbacks](https://github.com/mattheworiordan/capybara-screenshot/pull/171)
|
8
|
+
|
1
9
|
15 Sep 2016 - 1.0.13 -> 1.0.14
|
2
10
|
|
3
11
|
* CI stable again - dropped CI support for older versions of Ruby and JRuby. It is just too painful and there is no evidence that our users need this or that Capybara Screenshot is indeed broken. It is better to have a reliable build system so that PRs can get merged in reliably and easily.
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
capybara-screenshot gem
|
2
2
|
=======================
|
3
3
|
|
4
|
-
[![Build Status](https://travis-ci.org/mattheworiordan/capybara-screenshot.
|
5
|
-
[![Code Climate](https://d3s6mut3hikguw.cloudfront.net/github/mattheworiordan/capybara-screenshot.
|
4
|
+
[![Build Status](https://travis-ci.org/mattheworiordan/capybara-screenshot.svg)](https://travis-ci.org/mattheworiordan/capybara-screenshot)
|
5
|
+
[![Code Climate](https://d3s6mut3hikguw.cloudfront.net/github/mattheworiordan/capybara-screenshot.svg)](https://codeclimate.com/github/mattheworiordan/capybara-screenshot)
|
6
6
|
[![Gem Version](https://badge.fury.io/rb/capybara-screenshot.svg)](http://badge.fury.io/rb/capybara-screenshot)
|
7
7
|
|
8
8
|
#### Capture a screen shot for every test failure automatically!
|
@@ -113,6 +113,22 @@ Capybara::Screenshot.screenshot_and_save_page
|
|
113
113
|
Capybara::Screenshot.screenshot_and_open_image
|
114
114
|
```
|
115
115
|
|
116
|
+
Better looking HTML screenshots
|
117
|
+
-------------------------------
|
118
|
+
|
119
|
+
By the default, HTML screenshots will not look very good when opened in a browser. This happens because the browser can't correctly resolve relative paths like `<link href="/assets/...." />`, which stops CSS, images, etc... from beind loaded. To get a nicer looking page, configure Capybara with:
|
120
|
+
|
121
|
+
```ruby
|
122
|
+
Capybara.asset_host = 'http://localhost:3000'
|
123
|
+
```
|
124
|
+
|
125
|
+
This will cause Capybara to add `<base>http://localhost:3000</base>` to the HTML file, which gives the browser enough information to resolve relative paths. Next, start a rails server in development mode, on port 3000, to respond to requests for assets:
|
126
|
+
|
127
|
+
```bash
|
128
|
+
rails s -p 3000
|
129
|
+
```
|
130
|
+
|
131
|
+
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.
|
116
132
|
|
117
133
|
Driver configuration
|
118
134
|
--------------------
|
@@ -198,6 +214,15 @@ Capybara::Screenshot.s3_configuration = {
|
|
198
214
|
}
|
199
215
|
```
|
200
216
|
|
217
|
+
It is also possible to specify the object parameters such as acl.
|
218
|
+
Configure the capybara-screenshot with these options in this way:
|
219
|
+
|
220
|
+
```ruby
|
221
|
+
Capybara::Screenshot.s3_object_configuration = {
|
222
|
+
acl: 'public-read'
|
223
|
+
}
|
224
|
+
```
|
225
|
+
|
201
226
|
|
202
227
|
Pruning old screenshots automatically
|
203
228
|
--------------------------
|
@@ -211,6 +236,30 @@ Capybara::Screenshot.prune_strategy = :keep_last_run
|
|
211
236
|
Capybara::Screenshot.prune_strategy = { keep: 20 }
|
212
237
|
```
|
213
238
|
|
239
|
+
Callbacks
|
240
|
+
---------
|
241
|
+
|
242
|
+
You can hook your own logic into callbacks after the html/screenshot has been saved.
|
243
|
+
|
244
|
+
```ruby
|
245
|
+
# after Saver#save_html
|
246
|
+
Capybara::Screenshot.after_save_html do |path|
|
247
|
+
mail = Mail.new do
|
248
|
+
delivery_method :sendmail
|
249
|
+
from 'capybara-screenshot@example.com'
|
250
|
+
to 'dev@example.com'
|
251
|
+
subject 'Capybara Screenshot'
|
252
|
+
add_file File.read path
|
253
|
+
end
|
254
|
+
mail.delivery_method :sendmail
|
255
|
+
mail.deliver
|
256
|
+
end
|
257
|
+
|
258
|
+
# after Saver#save_screenshot
|
259
|
+
Capybara::Screenshot.after_save_screenshot do |path|
|
260
|
+
# ...
|
261
|
+
end
|
262
|
+
```
|
214
263
|
|
215
264
|
Information about screenshots in RSpec output
|
216
265
|
---------------------------------------------
|
data/lib/capybara-screenshot.rb
CHANGED
@@ -10,6 +10,7 @@ module Capybara
|
|
10
10
|
attr_writer :final_session_name
|
11
11
|
attr_accessor :prune_strategy
|
12
12
|
attr_accessor :s3_configuration
|
13
|
+
attr_accessor :s3_object_configuration
|
13
14
|
end
|
14
15
|
|
15
16
|
self.autosave_on_failure = true
|
@@ -20,6 +21,7 @@ module Capybara
|
|
20
21
|
self.webkit_options = {}
|
21
22
|
self.prune_strategy = :keep_all
|
22
23
|
self.s3_configuration = {}
|
24
|
+
self.s3_object_configuration = {}
|
23
25
|
|
24
26
|
def self.append_screenshot_path=(value)
|
25
27
|
$stderr.puts "WARNING: Capybara::Screenshot.append_screenshot_path is deprecated. " +
|
@@ -97,12 +99,20 @@ module Capybara
|
|
97
99
|
|
98
100
|
unless s3_configuration.empty?
|
99
101
|
require 'capybara-screenshot/s3_saver'
|
100
|
-
saver = S3Saver.new_with_configuration(saver, s3_configuration)
|
102
|
+
saver = S3Saver.new_with_configuration(saver, s3_configuration, s3_object_configuration)
|
101
103
|
end
|
102
104
|
|
103
105
|
return saver
|
104
106
|
end
|
105
107
|
|
108
|
+
def self.after_save_html &block
|
109
|
+
Saver.after_save_html &block
|
110
|
+
end
|
111
|
+
|
112
|
+
def self.after_save_screenshot &block
|
113
|
+
Saver.after_save_screenshot &block
|
114
|
+
end
|
115
|
+
|
106
116
|
private
|
107
117
|
|
108
118
|
# If the path isn't set, default to the current directory
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Capybara
|
2
|
+
module Screenshot
|
3
|
+
module Callbacks
|
4
|
+
class CallbackSet < Array
|
5
|
+
def call *args
|
6
|
+
each do |callback|
|
7
|
+
callback.call *args
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
module ClassMethods
|
13
|
+
def callbacks
|
14
|
+
@callbacks ||= {}
|
15
|
+
end
|
16
|
+
|
17
|
+
def define_callback name
|
18
|
+
callbacks[name] ||= CallbackSet.new
|
19
|
+
|
20
|
+
define_singleton_method name do |&block|
|
21
|
+
callbacks[name] << block
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def run_callbacks name, *args
|
26
|
+
if cb_set = callbacks[name]
|
27
|
+
cb_set.call *args
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
module InstanceMethods
|
33
|
+
def run_callbacks name, *args
|
34
|
+
self.class.run_callbacks name, *args
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.included receiver
|
39
|
+
receiver.extend ClassMethods
|
40
|
+
receiver.send :include, InstanceMethods
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -88,6 +88,7 @@ RSpec.configure do |config|
|
|
88
88
|
if Capybara::Screenshot::RSpec.add_link_to_screenshot_for_failed_examples
|
89
89
|
RSpec.configuration.formatters.each do |formatter|
|
90
90
|
next unless (reporter_module = Capybara::Screenshot::RSpec::REPORTERS[formatter.class.to_s])
|
91
|
+
next if formatter.singleton_class.included_modules.include?(reporter_module)
|
91
92
|
formatter.singleton_class.send :include, reporter_module
|
92
93
|
end
|
93
94
|
end
|
@@ -5,13 +5,14 @@ module Capybara
|
|
5
5
|
class S3Saver
|
6
6
|
DEFAULT_REGION = 'us-east-1'
|
7
7
|
|
8
|
-
def initialize(saver, s3_client, bucket_name)
|
8
|
+
def initialize(saver, s3_client, bucket_name, object_configuration)
|
9
9
|
@saver = saver
|
10
10
|
@s3_client = s3_client
|
11
11
|
@bucket_name = bucket_name
|
12
|
+
@object_configuration = object_configuration
|
12
13
|
end
|
13
14
|
|
14
|
-
def self.new_with_configuration(saver, configuration)
|
15
|
+
def self.new_with_configuration(saver, configuration, object_configuration)
|
15
16
|
default_s3_client_credentials = {
|
16
17
|
region: DEFAULT_REGION
|
17
18
|
}
|
@@ -23,7 +24,7 @@ module Capybara
|
|
23
24
|
s3_client = Aws::S3::Client.new(s3_client_credentials)
|
24
25
|
bucket_name = configuration.fetch(:bucket_name)
|
25
26
|
|
26
|
-
new(saver, s3_client, bucket_name)
|
27
|
+
new(saver, s3_client, bucket_name, object_configuration)
|
27
28
|
rescue KeyError
|
28
29
|
raise "Invalid S3 Configuration #{configuration}. Please refer to the documentation for the necessary configurations."
|
29
30
|
end
|
@@ -31,10 +32,16 @@ module Capybara
|
|
31
32
|
def save_and_upload_screenshot
|
32
33
|
save_and do |local_file_path|
|
33
34
|
File.open(local_file_path) do |file|
|
35
|
+
object_payload = {
|
36
|
+
bucket: bucket_name,
|
37
|
+
key: File.basename(local_file_path),
|
38
|
+
body: file
|
39
|
+
}
|
40
|
+
|
41
|
+
object_payload.merge!(object_configuration) unless object_configuration.empty?
|
42
|
+
|
34
43
|
s3_client.put_object(
|
35
|
-
|
36
|
-
key: File.basename(local_file_path),
|
37
|
-
body: file
|
44
|
+
object_payload
|
38
45
|
)
|
39
46
|
end
|
40
47
|
end
|
@@ -51,7 +58,8 @@ module Capybara
|
|
51
58
|
private
|
52
59
|
attr_reader :saver,
|
53
60
|
:s3_client,
|
54
|
-
:bucket_name
|
61
|
+
:bucket_name,
|
62
|
+
:object_configuration
|
55
63
|
|
56
64
|
def save_and
|
57
65
|
saver.save
|
@@ -1,9 +1,16 @@
|
|
1
1
|
require 'capybara-screenshot/helpers'
|
2
|
+
require 'capybara-screenshot/callbacks'
|
2
3
|
|
3
4
|
module Capybara
|
4
5
|
module Screenshot
|
5
6
|
class Saver
|
7
|
+
include Capybara::Screenshot::Callbacks
|
8
|
+
|
9
|
+
define_callback :after_save_html
|
10
|
+
define_callback :after_save_screenshot
|
11
|
+
|
6
12
|
attr_reader :capybara, :page, :file_base_name
|
13
|
+
|
7
14
|
def initialize(capybara, page, html_save=true, filename_prefix='screenshot')
|
8
15
|
@capybara, @page, @html_save = capybara, page, html_save
|
9
16
|
time_now = Time.now
|
@@ -36,6 +43,7 @@ module Capybara
|
|
36
43
|
end
|
37
44
|
end
|
38
45
|
@html_saved = true
|
46
|
+
run_callbacks :after_save_html, html_path if html_saved?
|
39
47
|
end
|
40
48
|
|
41
49
|
def save_screenshot
|
@@ -47,6 +55,7 @@ module Capybara
|
|
47
55
|
}.call(page.driver, path)
|
48
56
|
@screenshot_saved = result != :not_supported
|
49
57
|
end
|
58
|
+
run_callbacks :after_save_screenshot, screenshot_path if screenshot_saved?
|
50
59
|
end
|
51
60
|
|
52
61
|
def html_path
|
@@ -3,10 +3,6 @@ require "spec_helper"
|
|
3
3
|
describe "Using Capybara::Screenshot with Test::Unit" do
|
4
4
|
include CommonSetup
|
5
5
|
|
6
|
-
before do
|
7
|
-
setup_aruba
|
8
|
-
end
|
9
|
-
|
10
6
|
def run_failing_case(code, integration_path = '.')
|
11
7
|
write_file("#{integration_path}/test_failure.rb", <<-RUBY)
|
12
8
|
#{ensure_load_paths_valid}
|
data/spec/rspec/rspec_spec.rb
CHANGED
data/spec/support/aruba.rb
CHANGED
@@ -81,11 +81,12 @@ describe Capybara::Screenshot do
|
|
81
81
|
args = double('args')
|
82
82
|
s3_saver_double = double('s3_saver')
|
83
83
|
s3_configuration = { hello: 'world' }
|
84
|
+
s3_object_configuration = {}
|
84
85
|
|
85
86
|
Capybara::Screenshot.s3_configuration = s3_configuration
|
86
87
|
|
87
88
|
expect(Capybara::Screenshot::Saver).to receive(:new).with(args).and_return(saver_double)
|
88
|
-
expect(Capybara::Screenshot::S3Saver).to receive(:new_with_configuration).with(saver_double, s3_configuration).and_return(s3_saver_double)
|
89
|
+
expect(Capybara::Screenshot::S3Saver).to receive(:new_with_configuration).with(saver_double, s3_configuration, s3_object_configuration).and_return(s3_saver_double)
|
89
90
|
|
90
91
|
expect(Capybara::Screenshot.new_saver(args)).to eq(s3_saver_double)
|
91
92
|
end
|
data/spec/unit/s3_saver_spec.rb
CHANGED
@@ -4,9 +4,10 @@ require 'capybara-screenshot/s3_saver'
|
|
4
4
|
describe Capybara::Screenshot::S3Saver do
|
5
5
|
let(:saver) { double('saver') }
|
6
6
|
let(:bucket_name) { double('bucket_name') }
|
7
|
+
let(:s3_object_configuration) { {} }
|
7
8
|
let(:s3_client) { double('s3_client') }
|
8
9
|
|
9
|
-
let(:s3_saver) { Capybara::Screenshot::S3Saver.new(saver, s3_client, bucket_name) }
|
10
|
+
let(:s3_saver) { Capybara::Screenshot::S3Saver.new(saver, s3_client, bucket_name, s3_object_configuration) }
|
10
11
|
|
11
12
|
describe '.new_with_configuration' do
|
12
13
|
let(:access_key_id) { double('access_key_id') }
|
@@ -30,10 +31,10 @@ describe Capybara::Screenshot::S3Saver do
|
|
30
31
|
Capybara::Screenshot::S3Saver.new_with_configuration(saver, {
|
31
32
|
s3_client_credentials: s3_client_credentials,
|
32
33
|
bucket_name: bucket_name
|
33
|
-
})
|
34
|
+
}, s3_object_configuration)
|
34
35
|
|
35
36
|
expect(Aws::S3::Client).to have_received(:new).with(s3_client_credentials)
|
36
|
-
expect(Capybara::Screenshot::S3Saver).to have_received(:new).with(saver, s3_client, bucket_name)
|
37
|
+
expect(Capybara::Screenshot::S3Saver).to have_received(:new).with(saver, s3_client, bucket_name, s3_object_configuration)
|
37
38
|
end
|
38
39
|
|
39
40
|
it 'defaults the region to us-east-1' do
|
@@ -45,13 +46,29 @@ describe Capybara::Screenshot::S3Saver do
|
|
45
46
|
Capybara::Screenshot::S3Saver.new_with_configuration(saver, {
|
46
47
|
s3_client_credentials: s3_client_credentials_using_defaults,
|
47
48
|
bucket_name: bucket_name
|
48
|
-
})
|
49
|
+
}, s3_object_configuration)
|
49
50
|
|
50
51
|
expect(Aws::S3::Client).to have_received(:new).with(
|
51
52
|
s3_client_credentials.merge(region: default_region)
|
52
53
|
)
|
53
54
|
|
54
|
-
expect(Capybara::Screenshot::S3Saver).to have_received(:new).with(saver, s3_client, bucket_name)
|
55
|
+
expect(Capybara::Screenshot::S3Saver).to have_received(:new).with(saver, s3_client, bucket_name, s3_object_configuration)
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'stores the object configuration when passed' do
|
59
|
+
s3_object_configuration = { acl: 'public-read' }
|
60
|
+
Capybara::Screenshot.s3_object_configuration = { acl: 'public-read' }
|
61
|
+
|
62
|
+
allow(Aws::S3::Client).to receive(:new).and_return(s3_client)
|
63
|
+
allow(Capybara::Screenshot::S3Saver).to receive(:new)
|
64
|
+
|
65
|
+
Capybara::Screenshot::S3Saver.new_with_configuration(saver, {
|
66
|
+
s3_client_credentials: s3_client_credentials,
|
67
|
+
bucket_name: bucket_name
|
68
|
+
}, s3_object_configuration)
|
69
|
+
|
70
|
+
expect(Aws::S3::Client).to have_received(:new).with(s3_client_credentials)
|
71
|
+
expect(Capybara::Screenshot::S3Saver).to have_received(:new).with(saver, s3_client, bucket_name, s3_object_configuration)
|
55
72
|
end
|
56
73
|
end
|
57
74
|
|
@@ -103,6 +120,49 @@ describe Capybara::Screenshot::S3Saver do
|
|
103
120
|
|
104
121
|
s3_saver.save
|
105
122
|
end
|
123
|
+
|
124
|
+
describe 'save to s3 with object configuration' do
|
125
|
+
let(:s3_object_configuration) { { acl: 'public-read' } }
|
126
|
+
let(:s3_saver) { Capybara::Screenshot::S3Saver.new(saver, s3_client, bucket_name, s3_object_configuration) }
|
127
|
+
|
128
|
+
it 'uploads the html' do
|
129
|
+
html_path = '/foo/bar.html'
|
130
|
+
expect(saver).to receive(:html_path).and_return(html_path)
|
131
|
+
expect(saver).to receive(:html_saved?).and_return(true)
|
132
|
+
|
133
|
+
html_file = double('html_file')
|
134
|
+
|
135
|
+
expect(File).to receive(:open).with(html_path).and_yield(html_file)
|
136
|
+
|
137
|
+
expect(s3_client).to receive(:put_object).with(
|
138
|
+
bucket: bucket_name,
|
139
|
+
key: 'bar.html',
|
140
|
+
body: html_file,
|
141
|
+
acl: 'public-read'
|
142
|
+
)
|
143
|
+
|
144
|
+
s3_saver.save
|
145
|
+
end
|
146
|
+
|
147
|
+
it 'uploads the screenshot' do
|
148
|
+
screenshot_path = '/baz/bim.jpg'
|
149
|
+
expect(saver).to receive(:screenshot_path).and_return(screenshot_path)
|
150
|
+
expect(saver).to receive(:screenshot_saved?).and_return(true)
|
151
|
+
|
152
|
+
screenshot_file = double('screenshot_file')
|
153
|
+
|
154
|
+
expect(File).to receive(:open).with(screenshot_path).and_yield(screenshot_file)
|
155
|
+
|
156
|
+
expect(s3_client).to receive(:put_object).with(
|
157
|
+
bucket: bucket_name,
|
158
|
+
key: 'bim.jpg',
|
159
|
+
body: screenshot_file,
|
160
|
+
acl: 'public-read'
|
161
|
+
)
|
162
|
+
|
163
|
+
s3_saver.save
|
164
|
+
end
|
165
|
+
end
|
106
166
|
end
|
107
167
|
|
108
168
|
# Needed because we cannot depend on Verifying Doubles
|
@@ -129,4 +189,4 @@ describe Capybara::Screenshot::S3Saver do
|
|
129
189
|
expect(saver).to have_received(:foo_bar).with(*args)
|
130
190
|
end
|
131
191
|
end
|
132
|
-
end
|
192
|
+
end
|
data/spec/unit/saver_spec.rb
CHANGED
@@ -161,6 +161,40 @@ describe Capybara::Screenshot::Saver do
|
|
161
161
|
end
|
162
162
|
end
|
163
163
|
|
164
|
+
describe 'callbacks' do
|
165
|
+
let(:saver) { Capybara::Screenshot::Saver.new(capybara_mock, page_mock) }
|
166
|
+
|
167
|
+
before do
|
168
|
+
allow(saver).to receive(:html_path) { 'page.html' }
|
169
|
+
allow(saver).to receive(:screenshot_path) { 'screenshot.png' }
|
170
|
+
end
|
171
|
+
|
172
|
+
before :all do
|
173
|
+
Capybara::Screenshot.after_save_html do |path|
|
174
|
+
puts "after_save_html ran with #{path}"
|
175
|
+
end
|
176
|
+
Capybara::Screenshot.after_save_screenshot do |path|
|
177
|
+
puts "after_save_screenshot ran with #{path}"
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
after :all do
|
182
|
+
Capybara::Screenshot::Saver.instance_eval { @callbacks = nil }
|
183
|
+
end
|
184
|
+
|
185
|
+
it 'runs after_save_html callbacks' do
|
186
|
+
expect do
|
187
|
+
saver.save
|
188
|
+
end.to output(/after_save_html ran with page\.html/).to_stdout
|
189
|
+
end
|
190
|
+
|
191
|
+
it 'runs after_save_screenshot callbacks' do
|
192
|
+
expect do
|
193
|
+
saver.save
|
194
|
+
end.to output(/after_save_screenshot ran with screenshot\.png/).to_stdout
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
164
198
|
describe "with selenium driver" do
|
165
199
|
before do
|
166
200
|
allow(capybara_mock).to receive(:current_driver).and_return(:selenium)
|
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.15
|
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: 2017-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -194,6 +194,7 @@ files:
|
|
194
194
|
- gemfiles/rspec.3.0.gemfile
|
195
195
|
- gemfiles/spinach.0.8.gemfile
|
196
196
|
- lib/capybara-screenshot.rb
|
197
|
+
- lib/capybara-screenshot/callbacks.rb
|
197
198
|
- lib/capybara-screenshot/capybara.rb
|
198
199
|
- lib/capybara-screenshot/cucumber.rb
|
199
200
|
- lib/capybara-screenshot/helpers.rb
|