capybara-screenshot 0.3.20 → 0.3.21

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZWU2OWY4YzU2ZjQyYjIwNWM0MGEzOTA3Mjg4YjFiMTY5NTA1NTdhYQ==
5
- data.tar.gz: !binary |-
6
- NmU0ZjcwMTYyMzlmOGYwYzYyODI1YmZlNjg1OGExMmI3ZTM0NDgyYw==
2
+ SHA1:
3
+ metadata.gz: 91a97a9e0bf879f017c84d44a8f8924bb85c4fd9
4
+ data.tar.gz: 42f70ae43c2d25cea336b84eb26bb4473130791a
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NTRiMDIxYmQ1NzkwNTIzM2RkOGMzNzE0MDJiMGE1OGM3MTk3ZDc1YmNiZDYx
10
- ZTVhNDI0MjM0OGQ0YWQ0YTIyOWQ4M2Y5MWJmMGVjYmRmODZkMTYxOWIxNjQ5
11
- MzRlZDI5NDIwMmI3NzE0ZDU5ZTE5NGI0ZmEyNTZlNmFlZjE4NzU=
12
- data.tar.gz: !binary |-
13
- YzhhMjc5MTQ1MGNlNjU4YWE2ZmZjNzNiNDAwM2I3M2I2ZDM3MTk5ODk3ZjVh
14
- YTM3NjE5Yjk1MDBlMDM3Yjk3ODYyY2E5NTk0NDAxMTQ1N2RkNmIzMDZiMmU3
15
- NGY5ZjI2ZmVlYzA1MzczN2E4ZDkyMjAzYjZhYzk1MzYzNmVjOGY=
6
+ metadata.gz: a1c6eef0cdd4e3d0f8145cd5b2604890dda72ec6b59cf18b94a3efc961824c2620935fa3a8104c2edb8bcb7c0ae6814238c25714847e50b88d7dc92141787d3b
7
+ data.tar.gz: 7256a232ad55ac1ea9573e53672011d11693a3745cf1f30352863313d298eca9849a016ad89a14b62d140fa87da1542a1e3641b4b57ccf74eac5cb48c4a603f5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ 22 July 2014 - 0.3.20 -> 0.3.21
2
+ -----------
3
+
4
+ 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.
5
+
1
6
  11 July 2014 - 0.3.19 -> 0.3.20
2
7
  -----------
3
8
 
@@ -21,8 +21,9 @@ Gem::Specification.new do |s|
21
21
  s.add_dependency 'capybara', ['>= 1.0', '< 3']
22
22
  end
23
23
  s.add_dependency 'launchy'
24
-
25
- s.add_development_dependency 'rspec', '~> 2.7'
24
+ s.add_dependency 'colorize'
25
+
26
+ s.add_development_dependency 'rspec', '~> 2.9'
26
27
  s.add_development_dependency 'timecop'
27
28
 
28
29
  s.files = `git ls-files`.split("\n")
@@ -4,6 +4,7 @@ After do |scenario|
4
4
 
5
5
  saver = Capybara::Screenshot::Saver.new(Capybara, Capybara.page, true, filename_prefix)
6
6
  saver.save
7
+ saver.output_screenshot_path
7
8
 
8
9
  # Trying to embed the screenshot into our output."
9
10
  if File.exist?(saver.screenshot_path)
@@ -15,4 +16,4 @@ After do |scenario|
15
16
  embed("data:image/png;base64,#{encoded_img}", 'image/png', "Screenshot of the error")
16
17
  end
17
18
  end
18
- end
19
+ end
@@ -16,9 +16,10 @@ unless method.nil?
16
16
 
17
17
  saver = Capybara::Screenshot::Saver.new(Capybara, Capybara.page, true, filename_prefix)
18
18
  saver.save
19
+ saver.output_screenshot_path
19
20
  end
20
21
  end
21
22
  rescue NoMethodError
22
23
  # do nothing, teardown for minitest not available
23
24
  end
24
- end
25
+ end
@@ -11,9 +11,8 @@ module Capybara
11
11
  dump_failure_info_without_screenshot(example)
12
12
  return unless (screenshot = example.metadata[:screenshot])
13
13
 
14
- colorize = lambda { |str| respond_to?(:failure_color, true) ? failure_color(str) : red(str) }
15
- output.puts(long_padding + colorize["HTML page: #{screenshot[:html]}"]) if screenshot[:html]
16
- output.puts(long_padding + colorize["Screenshot: #{screenshot[:image]}"]) if screenshot[:image]
14
+ output.puts(long_padding + "HTML screenshot: #{screenshot[:html]}".colorize(:yellow)) if screenshot[:html]
15
+ output.puts(long_padding + "Image screenshot: #{screenshot[:image]}".colorize(:yellow)) if screenshot[:image]
17
16
  end
18
17
  end
19
18
  end
@@ -1,3 +1,5 @@
1
+ require 'colorize'
2
+
1
3
  module Capybara
2
4
  module Screenshot
3
5
  class Saver
@@ -67,6 +69,16 @@ module Capybara
67
69
  yield
68
70
  Capybara.save_and_open_page_path = old_path
69
71
  end
72
+
73
+ def output_screenshot_path
74
+ output "HTML screenshot: #{html_path}" if html_saved?
75
+ output "Image screenshot: #{screenshot_path}" if screenshot_saved?
76
+ end
77
+
78
+ private
79
+ def output(message)
80
+ puts " #{message.colorize(:yellow)}"
81
+ end
70
82
  end
71
83
  end
72
84
  end
@@ -3,5 +3,6 @@ Spinach.hooks.on_failed_step do |step_data, exception, location, step_definition
3
3
  filename_prefix = Capybara::Screenshot.filename_prefix_for(:spinach, step_data)
4
4
  saver = Capybara::Screenshot::Saver.new(Capybara, Capybara.page, true, filename_prefix)
5
5
  saver.save
6
+ saver.output_screenshot_path
6
7
  end
7
- end
8
+ end
@@ -11,6 +11,7 @@ Test::Unit::TestResult.class_eval do
11
11
 
12
12
  saver = Capybara::Screenshot::Saver.new(Capybara, Capybara.page, true, filename_prefix)
13
13
  saver.save
14
+ saver.output_screenshot_path
14
15
  end
15
16
  end
16
17
  end
@@ -1,5 +1,5 @@
1
1
  module Capybara
2
2
  module Screenshot
3
- VERSION = "0.3.20"
3
+ VERSION = "0.3.21"
4
4
  end
5
5
  end
@@ -106,7 +106,7 @@ describe Capybara::Screenshot::Saver do
106
106
  capybara_mock.should_not_receive(:save_page)
107
107
 
108
108
  saver.save
109
- saver.html_saved?.should be_false
109
+ expect(saver.html_saved?).to be_falsey
110
110
  end
111
111
 
112
112
  it 'should not save if current_path is empty' do
@@ -115,8 +115,29 @@ describe Capybara::Screenshot::Saver do
115
115
  driver_mock.should_not_receive(:render)
116
116
 
117
117
  saver.save
118
- saver.screenshot_saved?.should be_false
119
- saver.html_saved?.should be_false
118
+ expect(saver.screenshot_saved?).to be_falsey
119
+ expect(saver.html_saved?).to be_falsey
120
+ end
121
+
122
+ describe '#output_screenshot_path' do
123
+ let(:saver) { Capybara::Screenshot::Saver.new(capybara_mock, page_mock) }
124
+
125
+ before do
126
+ allow(saver).to receive(:html_path) { 'page.html' }
127
+ allow(saver).to receive(:screenshot_path) { 'screenshot.png' }
128
+ end
129
+
130
+ it 'should output the path for the HTML screenshot' do
131
+ saver.stub(:html_saved?).and_return(true)
132
+ expect(saver).to receive(:output).with("HTML screenshot: page.html")
133
+ saver.output_screenshot_path
134
+ end
135
+
136
+ it 'should output the path for the Image screenshot' do
137
+ saver.stub(:screenshot_saved?).and_return(true)
138
+ expect(saver).to receive(:output).with("Image screenshot: screenshot.png")
139
+ saver.output_screenshot_path
140
+ end
120
141
  end
121
142
 
122
143
  describe "with selenium driver" do
@@ -130,7 +151,7 @@ describe Capybara::Screenshot::Saver do
130
151
  browser_mock.should_receive(:save_screenshot).with(screenshot_path)
131
152
 
132
153
  saver.save
133
- saver.screenshot_saved?.should be_true
154
+ expect(saver.screenshot_saved?).to be_truthy
134
155
  end
135
156
  end
136
157
 
@@ -143,7 +164,7 @@ describe Capybara::Screenshot::Saver do
143
164
  driver_mock.should_receive(:render).with(screenshot_path, {:full => true})
144
165
 
145
166
  saver.save
146
- saver.screenshot_saved?.should be_true
167
+ expect(saver.screenshot_saved?).to be_truthy
147
168
  end
148
169
  end
149
170
 
@@ -161,7 +182,7 @@ describe Capybara::Screenshot::Saver do
161
182
  driver_mock.should_receive(:render).with(screenshot_path)
162
183
 
163
184
  saver.save
164
- saver.screenshot_saved?.should be_true
185
+ expect(saver.screenshot_saved?).to be_truthy
165
186
  end
166
187
  end
167
188
 
@@ -176,7 +197,7 @@ describe Capybara::Screenshot::Saver do
176
197
  driver_mock.should_receive(:save_screenshot).with(screenshot_path, {})
177
198
 
178
199
  saver.save
179
- saver.screenshot_saved?.should be_true
200
+ expect(saver.screenshot_saved?).to be_truthy
180
201
  end
181
202
 
182
203
  it 'should pass webkit_options to driver' do
@@ -184,7 +205,7 @@ describe Capybara::Screenshot::Saver do
184
205
  driver_mock.should_receive(:save_screenshot).with(screenshot_path, webkit_options)
185
206
 
186
207
  saver.save
187
- saver.screenshot_saved?.should be_true
208
+ expect(saver.screenshot_saved?).to be_truthy
188
209
  end
189
210
  end
190
211
  end
@@ -198,7 +219,7 @@ describe Capybara::Screenshot::Saver do
198
219
  driver_mock.should_receive(:render).with(screenshot_path)
199
220
 
200
221
  saver.save
201
- saver.screenshot_saved?.should be_true
222
+ expect(saver.screenshot_saved?).to be_truthy
202
223
  end
203
224
  end
204
225
 
@@ -212,7 +233,7 @@ describe Capybara::Screenshot::Saver do
212
233
  driver_mock.should_receive(:render).with(screenshot_path)
213
234
 
214
235
  saver.save
215
- saver.screenshot_saved?.should be_true
236
+ expect(saver.screenshot_saved?).to be_truthy
216
237
  end
217
238
 
218
239
  it 'should output warning about unknown results' do
@@ -220,7 +241,7 @@ describe Capybara::Screenshot::Saver do
220
241
  saver.should_receive(:warn).with(/screenshot driver for 'unknown'.*unknown results/).and_return(nil)
221
242
 
222
243
  saver.save
223
- saver.screenshot_saved?.should be_true
244
+ expect(saver.screenshot_saved?).to be_truthy
224
245
  end
225
246
 
226
247
  describe "with rack_test driver" do
@@ -230,7 +251,7 @@ describe Capybara::Screenshot::Saver do
230
251
 
231
252
  it 'should indicate that a screenshot could not be saved' do
232
253
  saver.save
233
- saver.screenshot_saved?.should be_false
254
+ expect(saver.screenshot_saved?).to be_falsey
234
255
  end
235
256
  end
236
257
 
@@ -241,7 +262,7 @@ describe Capybara::Screenshot::Saver do
241
262
 
242
263
  it 'should indicate that a screenshot could not be saved' do
243
264
  saver.save
244
- saver.screenshot_saved?.should be_false
265
+ expect(saver.screenshot_saved?).to be_falsey
245
266
  end
246
267
  end
247
268
  end
@@ -42,20 +42,20 @@ describe Capybara::Screenshot::RSpec::TextReporter do
42
42
  end
43
43
 
44
44
  context 'when a html file was saved' do
45
- let(:example) { double("example", metadata: {screenshot: {html: "path/to/html"}}) }
45
+ let(:example) { double("example", metadata: { screenshot: { html: "path/to/html" } }) }
46
46
 
47
47
  it 'appends the html file path to the original output' do
48
48
  @reporter.dump_failure_info(example)
49
- @reporter.output.string.should == "original failure info\n colorized(HTML page: path/to/html)\n"
49
+ @reporter.output.string.should == "original failure info\n #{"HTML screenshot: path/to/html".colorize(:yellow)}\n"
50
50
  end
51
51
  end
52
52
 
53
53
  context 'when a html file and an image were saved' do
54
- let(:example) { double("example", metadata: {screenshot: {html: "path/to/html", image: "path/to/image"}}) }
54
+ let(:example) { double("example", metadata: { screenshot: { html: "path/to/html", image: "path/to/image" } }) }
55
55
 
56
56
  it 'appends the image path to the original output' do
57
57
  @reporter.dump_failure_info(example)
58
- @reporter.output.string.should == "original failure info\n colorized(HTML page: path/to/html)\n colorized(Screenshot: path/to/image)\n"
58
+ @reporter.output.string.should == "original failure info\n #{"HTML screenshot: path/to/html".colorize(:yellow)}\n #{"Image screenshot: path/to/image".colorize(:yellow)}\n"
59
59
  end
60
60
  end
61
61
 
@@ -69,8 +69,8 @@ describe Capybara::Screenshot::RSpec::TextReporter do
69
69
  end
70
70
  old_reporter = old_reporter_class.new
71
71
  old_reporter.singleton_class.send :include, described_class
72
- example = double("example", metadata: {screenshot: {html: "path/to/html"}})
72
+ example = double("example", metadata: { screenshot: { html: "path/to/html" } })
73
73
  old_reporter.dump_failure_info(example)
74
- old_reporter.output.string.should == "original failure info\n red(HTML page: path/to/html)\n"
74
+ old_reporter.output.string.should == "original failure info\n #{"HTML screenshot: path/to/html".colorize(:yellow)}\n"
75
75
  end
76
76
  end
metadata CHANGED
@@ -1,20 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-screenshot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.20
4
+ version: 0.3.21
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: 2014-07-11 00:00:00.000000000 Z
11
+ date: 2014-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.0'
20
20
  - - <
@@ -24,7 +24,7 @@ dependencies:
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - ! '>='
27
+ - - '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: '1.0'
30
30
  - - <
@@ -34,14 +34,28 @@ dependencies:
34
34
  name: launchy
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ! '>='
37
+ - - '>='
38
38
  - !ruby/object:Gem::Version
39
39
  version: '0'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - ! '>='
44
+ - - '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: colorize
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - '>='
45
59
  - !ruby/object:Gem::Version
46
60
  version: '0'
47
61
  - !ruby/object:Gem::Dependency
@@ -50,26 +64,26 @@ dependencies:
50
64
  requirements:
51
65
  - - ~>
52
66
  - !ruby/object:Gem::Version
53
- version: '2.7'
67
+ version: '2.9'
54
68
  type: :development
55
69
  prerelease: false
56
70
  version_requirements: !ruby/object:Gem::Requirement
57
71
  requirements:
58
72
  - - ~>
59
73
  - !ruby/object:Gem::Version
60
- version: '2.7'
74
+ version: '2.9'
61
75
  - !ruby/object:Gem::Dependency
62
76
  name: timecop
63
77
  requirement: !ruby/object:Gem::Requirement
64
78
  requirements:
65
- - - ! '>='
79
+ - - '>='
66
80
  - !ruby/object:Gem::Version
67
81
  version: '0'
68
82
  type: :development
69
83
  prerelease: false
70
84
  version_requirements: !ruby/object:Gem::Requirement
71
85
  requirements:
72
- - - ! '>='
86
+ - - '>='
73
87
  - !ruby/object:Gem::Version
74
88
  version: '0'
75
89
  description: When a Cucumber step fails, it is useful to create a screenshot image
@@ -124,17 +138,17 @@ require_paths:
124
138
  - lib
125
139
  required_ruby_version: !ruby/object:Gem::Requirement
126
140
  requirements:
127
- - - ! '>='
141
+ - - '>='
128
142
  - !ruby/object:Gem::Version
129
143
  version: '0'
130
144
  required_rubygems_version: !ruby/object:Gem::Requirement
131
145
  requirements:
132
- - - ! '>='
146
+ - - '>='
133
147
  - !ruby/object:Gem::Version
134
148
  version: '0'
135
149
  requirements: []
136
150
  rubyforge_project: capybara-screenshot
137
- rubygems_version: 2.1.11
151
+ rubygems_version: 2.0.14
138
152
  signing_key:
139
153
  specification_version: 4
140
154
  summary: Automatically create snapshots when Cucumber steps fail with Capybara and