capybara-screenshot 1.0.17 → 1.0.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0ab9945e12e4f0aecbd988f805e0823c97506dda
4
- data.tar.gz: 3114b7782691089bf0226c05473be33b14f148c6
3
+ metadata.gz: 0b22d05c34f635af9cc03ca84aa57d11addd461e
4
+ data.tar.gz: bab574490ec585c958590977030bec8101b91e06
5
5
  SHA512:
6
- metadata.gz: 7fa7efb0ec06499bd65217077de23ecd8f63a89c7562f08187d2525ae3b9e5b873d8c769b181232aa433bf2749dd109a1421b045bed8cfd5fda6b44204ead894
7
- data.tar.gz: 2fdd28b3be83176029cdb4461c2891412571469bbde6634a0ab1f6b3cff8bee767e2053a7b595b7769a2cff3df36a618f12f4100ca5adfc35ac7ce3b3311cb3d
6
+ metadata.gz: 84e95bc1a09fd91f0d59de2cdce2494a967d44d970b5bde24d02eb205e59ceefb46905faa55f544568229c02e94313e6a7524d0ae269ec8af3ba9cbfcffa6ff2
7
+ data.tar.gz: a49fa5149d17b6aa390af17a76c74afe8bfdb96f4f33fcd2b3b77fc0dca163ec84774fa5414e6f24450665b2715156d8e1f04e8278ccfdba2497d78b88ea4d4a
@@ -11,4 +11,5 @@ gemfile:
11
11
  - gemfiles/cucumber.2.4.gemfile
12
12
  - gemfiles/latest.gemfile
13
13
  - gemfiles/rspec.3.0.gemfile
14
+ - gemfiles/rspec.3.3.gemfile
14
15
  - gemfiles/spinach.0.8.gemfile
data/Appraisals CHANGED
@@ -1,19 +1,29 @@
1
1
  appraise "rspec.3.0" do
2
2
  gem "rspec", "3.0"
3
+ gem 'nokogiri', '< 1.7.0', platform: :ruby_20
4
+ end
5
+
6
+ appraise "rspec.3.3" do
7
+ gem "rspec", "~> 3.3.0"
8
+ gem 'nokogiri', '< 1.7.0', platform: :ruby_20
3
9
  end
4
10
 
5
11
  appraise "cucumber.1.3" do
6
12
  gem "cucumber", "~>1.3.0"
13
+ gem 'nokogiri', '< 1.7.0', platform: :ruby_20
7
14
  end
8
15
 
9
16
  appraise "cucumber.2.4" do
10
17
  gem "cucumber", "~>2.4.0"
18
+ gem 'nokogiri', '< 1.7.0', platform: :ruby_20
11
19
  end
12
20
 
13
21
  appraise "spinach.0.8" do
14
22
  gem "spinach", "~>0.8.0"
23
+ gem 'nokogiri', '< 1.7.0', platform: :ruby_20
15
24
  end
16
25
 
17
26
  appraise "latest" do
18
27
  # will get latest versions of all gems
28
+ gem 'nokogiri', '< 1.7.0', platform: :ruby_20
19
29
  end
@@ -1,3 +1,11 @@
1
+ 2 November 2017 - 1.0.17 -> 1.0.18
2
+
3
+ * [RSpec 3.3 support](https://github.com/mattheworiordan/capybara-screenshot/pull/213)
4
+ * [Add support for selenium_chrome and selenium_chrome_headless](https://github.com/mattheworiordan/capybara-screenshot/pull/219)
5
+ * [Less dependencies for S3 uploads](https://github.com/mattheworiordan/capybara-screenshot/pull/218)
6
+
7
+ Special thanks to the fine contribution from [Matt Bricston](https://github.com/mattbrictson)
8
+
1
9
  17 July 2017 - 1.0.16 -> 1.0.17
2
10
 
3
11
  * [Better handling of `page.current_path` exceptions for Spinach](https://github.com/mattheworiordan/capybara-screenshot/pull/208)
data/README.md CHANGED
@@ -194,11 +194,11 @@ Uploading screenshots to S3
194
194
  --------------------------
195
195
  You can configure capybara-screenshot to automatically save your screenshots to an AWS S3 bucket.
196
196
 
197
- First, install the `aws-sdk` gem or add it to your Gemfile
197
+ First, install the `aws-sdk-s3` gem or add it to your Gemfile
198
198
 
199
199
  ```ruby
200
- gem 'capybara-screenshot', :group => :test
201
- gem 'aws-sdk', :group => :test
200
+ gem 'aws-sdk-s3', group: :test
201
+ gem 'capybara-screenshot', group: :test
202
202
  ```
203
203
 
204
204
  Next, configure capybara-screenshot with your S3 credentials, the bucket to save to, and an optional region (default: `us-east-1`).
@@ -30,7 +30,7 @@ Gem::Specification.new do |s|
30
30
  s.add_development_dependency 'test-unit'
31
31
  s.add_development_dependency 'spinach'
32
32
  s.add_development_dependency 'minitest'
33
- s.add_development_dependency 'aws-sdk'
33
+ s.add_development_dependency 'aws-sdk-s3'
34
34
 
35
35
  s.files = `git ls-files`.split("\n")
36
36
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -7,5 +7,6 @@ gem "rake", "~> 10.0"
7
7
  gem "appraisal", "~> 2.0"
8
8
  gem "aruba", "~> 0.14.0"
9
9
  gem "cucumber", "~>1.3.0"
10
+ gem "nokogiri", "< 1.7.0", platform: :ruby_20
10
11
 
11
12
  gemspec :path => "../"
@@ -7,5 +7,6 @@ gem "rake", "~> 10.0"
7
7
  gem "appraisal", "~> 2.0"
8
8
  gem "aruba", "~> 0.14.0"
9
9
  gem "cucumber", "~>2.4.0"
10
+ gem "nokogiri", "< 1.7.0", platform: :ruby_20
10
11
 
11
12
  gemspec :path => "../"
@@ -6,5 +6,6 @@ gem "rack", "~> 1.0"
6
6
  gem "rake", "~> 10.0"
7
7
  gem "appraisal", "~> 2.0"
8
8
  gem "aruba", "~> 0.14.0"
9
+ gem "nokogiri", "< 1.7.0", platform: :ruby_20
9
10
 
10
11
  gemspec :path => "../"
@@ -7,5 +7,6 @@ gem "rake", "~> 10.0"
7
7
  gem "appraisal", "~> 2.0"
8
8
  gem "aruba", "~> 0.14.0"
9
9
  gem "rspec", "3.0"
10
+ gem "nokogiri", "< 1.7.0", platform: :ruby_20
10
11
 
11
12
  gemspec :path => "../"
@@ -0,0 +1,12 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "rack", "~> 1.0"
6
+ gem "rake", "~> 10.0"
7
+ gem "appraisal", "~> 2.0"
8
+ gem "aruba", "~> 0.14.0"
9
+ gem "rspec", "~> 3.3.0"
10
+ gem "nokogiri", "< 1.7.0", platform: :ruby_20
11
+
12
+ gemspec :path => "../"
@@ -7,5 +7,6 @@ gem "rake", "~> 10.0"
7
7
  gem "appraisal", "~> 2.0"
8
8
  gem "aruba", "~> 0.14.0"
9
9
  gem "spinach", "~>0.8.0"
10
+ gem "nokogiri", "< 1.7.0", platform: :ruby_20
10
11
 
11
12
  gemspec :path => "../"
@@ -156,10 +156,14 @@ Capybara::Screenshot.class_eval do
156
156
  :not_supported
157
157
  end
158
158
 
159
- register_driver(:selenium) do |driver, path|
159
+ selenium_block = proc do |driver, path|
160
160
  driver.browser.save_screenshot(path)
161
161
  end
162
162
 
163
+ register_driver :selenium, &selenium_block
164
+ register_driver :selenium_chrome, &selenium_block
165
+ register_driver :selenium_chrome_headless, &selenium_block
166
+
163
167
  register_driver(:poltergeist) do |driver, path|
164
168
  driver.render(path, :full => true)
165
169
  end
@@ -43,7 +43,8 @@ module Capybara
43
43
  "RSpec::Core::Formatters::JsonFormatter" => Capybara::Screenshot::RSpec::JsonReporter,
44
44
  "RSpec::Core::Formatters::TextMateFormatter" => Capybara::Screenshot::RSpec::TextMateLinkReporter, # RSpec 2
45
45
  "RSpec::Mate::Formatters::TextMateFormatter" => Capybara::Screenshot::RSpec::TextMateLinkReporter, # RSpec 3
46
- "Fuubar" => Capybara::Screenshot::RSpec::TextReporter
46
+ "Fuubar" => Capybara::Screenshot::RSpec::TextReporter,
47
+ "Spec::Runner::Formatter::TeamcityFormatter" => Capybara::Screenshot::RSpec::TextReporter
47
48
  }
48
49
 
49
50
  class << self
@@ -52,7 +53,7 @@ module Capybara
52
53
  def after_failed_example(example)
53
54
  if example.example_group.include?(Capybara::DSL) # Capybara DSL method has been included for a feature we can snapshot
54
55
  Capybara.using_session(Capybara::Screenshot.final_session_name) do
55
- if Capybara.page.current_url != '' && Capybara::Screenshot.autosave_on_failure && example.exception
56
+ if Capybara::Screenshot.autosave_on_failure && failed?(example) && Capybara.page.current_url != ''
56
57
  filename_prefix = Capybara::Screenshot.filename_prefix_for(:rspec, example)
57
58
 
58
59
  saver = Capybara::Screenshot.new_saver(Capybara, Capybara.page, true, filename_prefix)
@@ -65,6 +66,18 @@ module Capybara
65
66
  end
66
67
  end
67
68
  end
69
+
70
+ private
71
+
72
+ def failed?(example)
73
+ return true if example.exception
74
+ return false unless defined?(::RSpec::Expectations::FailureAggregator)
75
+
76
+ failure_notifier = ::RSpec::Support.failure_notifier
77
+ return false unless failure_notifier.is_a?(::RSpec::Expectations::FailureAggregator)
78
+
79
+ failure_notifier.failures.any? || failure_notifier.other_errors.any?
80
+ end
68
81
  end
69
82
 
70
83
  self.add_link_to_screenshot_for_failed_examples = true
@@ -1,4 +1,4 @@
1
- require 'aws-sdk'
1
+ require 'aws-sdk-s3'
2
2
 
3
3
  module Capybara
4
4
  module Screenshot
@@ -1,5 +1,5 @@
1
1
  module Capybara
2
2
  module Screenshot
3
- VERSION = '1.0.17'
3
+ VERSION = '1.0.18'
4
4
  end
5
5
  end
@@ -40,7 +40,7 @@ describe Capybara::Screenshot::RSpec, :type => :aruba do
40
40
  "rspec #{"--format #{format} " if format}#{expand_path('spec/test_failure.rb')}"
41
41
  end
42
42
 
43
- it 'saves a screenshot on failure' do
43
+ it 'saves a screenshot when browser action fails' do
44
44
  run_failing_case <<-RUBY, %q{Unable to find link or button "you'll never find me"}
45
45
  feature 'screenshot with failure' do
46
46
  scenario 'click on a missing link' do
@@ -50,7 +50,19 @@ describe Capybara::Screenshot::RSpec, :type => :aruba do
50
50
  end
51
51
  end
52
52
  RUBY
53
- expect(expand_path('tmp/screenshot.html')).to_not have_file_content('This is the root page')
53
+ expect('tmp/screenshot.html').to have_file_content('This is the root page')
54
+ end
55
+
56
+ it 'saves a screenshot when expectation fails when using :aggregate_failures' do
57
+ run_failing_case <<-RUBY, %q{expected "This is the root page" to include "you'll never find me"}
58
+ feature 'screenshot with failure', :aggregate_failures do
59
+ scenario 'expect a missing link' do
60
+ visit '/'
61
+ expect(page.body).to include("you'll never find me")
62
+ end
63
+ end
64
+ RUBY
65
+ expect('tmp/screenshot.html').to have_file_content('This is the root page')
54
66
  end
55
67
 
56
68
  formatters = {
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.17
4
+ version: 1.0.18
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: 2017-07-17 00:00:00.000000000 Z
11
+ date: 2017-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -157,7 +157,7 @@ dependencies:
157
157
  - !ruby/object:Gem::Version
158
158
  version: '0'
159
159
  - !ruby/object:Gem::Dependency
160
- name: aws-sdk
160
+ name: aws-sdk-s3
161
161
  requirement: !ruby/object:Gem::Requirement
162
162
  requirements:
163
163
  - - ">="
@@ -192,6 +192,7 @@ files:
192
192
  - gemfiles/cucumber.2.4.gemfile
193
193
  - gemfiles/latest.gemfile
194
194
  - gemfiles/rspec.3.0.gemfile
195
+ - gemfiles/rspec.3.3.gemfile
195
196
  - gemfiles/spinach.0.8.gemfile
196
197
  - lib/capybara-screenshot.rb
197
198
  - lib/capybara-screenshot/callbacks.rb