capybara-chromedriver-logger 0.2.1 → 0.3.0

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
  SHA256:
3
- metadata.gz: a0188c7bb3434429a524f07cfe950f0a02b4bd2e4c949a5dc3e8ecd65a553644
4
- data.tar.gz: 22342de9e1295f5377375ea0a248d3b5e4ff2c41da8a696ab53d772da69470ce
3
+ metadata.gz: 68085b1dbc94aa5b82471943475394993948fe989166e16ab924a2530503c184
4
+ data.tar.gz: 95c921822830bc941a17c0c186ae9ff16e5a7591f8e4a56a125f91dca48a8b30
5
5
  SHA512:
6
- metadata.gz: 2b5818892be7d9ad66d4c00c741c7d4ae50f70bb863b32d20a77943d272970f53c73ce052d508e2cc03dffedfd2526a67bdf7f0907cc7ff9e8b77048f3e4e207
7
- data.tar.gz: abf13f36355acf43333c0716aafae32a91fbbf7777c4870130f4785e9be9796367f2922654295507a0d300e9f8822bd639a3f2a08de3cff80357f9923ed06c24
6
+ metadata.gz: 0d1f78c3de46714021eeda7bd243b09c7b6f529379ffe901389561adee6b99c4607fe60338e7236be96e8884a83e59d787fb41e90c41570b7089623a9a5194e3
7
+ data.tar.gz: 94cd2d17f4a360595874e15f85293b132bb5cc61f3c09357a52e4403c46d0c00f791f42ddf9d4f60f4dd23ae0ab817189c8004c9d1beb32920eba1c590956d30
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+ .ruby-gemset
@@ -0,0 +1 @@
1
+ 2.6.5
@@ -1,11 +1,7 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  addons:
4
- apt:
5
- sources:
6
- - google-chrome
7
- packages:
8
- - google-chrome-stable
4
+ chrome: stable
9
5
  rvm:
10
- - 2.4.1
6
+ - 2.6.5
11
7
  before_install: gem install bundler -v 1.16.0
@@ -1,3 +1,9 @@
1
+ # 0.3.0 [March 21, 2020]
2
+
3
+ * Prevent errors from being raised if they match a filter
4
+ * Added instructions to the README about dealing with new versions of Chrome
5
+ * Added a new `#build_capabilities` method to wrap the Capabilities configuration
6
+
1
7
  # 0.2.1 [June 23, 2018]
2
8
 
3
9
  * Added `filter_levels` option for filtering by log level (closes #4)
@@ -1,48 +1,44 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capybara-chromedriver-logger (0.2.1)
4
+ capybara-chromedriver-logger (0.3.0)
5
5
  capybara
6
6
  colorize
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- addressable (2.5.2)
12
- public_suffix (>= 2.0.2, < 4.0)
13
- archive-zip (0.11.0)
14
- io-like (~> 0.3.0)
15
- capybara (2.18.0)
11
+ addressable (2.7.0)
12
+ public_suffix (>= 2.0.2, < 5.0)
13
+ capybara (3.31.0)
16
14
  addressable
17
15
  mini_mime (>= 0.1.3)
18
- nokogiri (>= 1.3.3)
19
- rack (>= 1.0.0)
20
- rack-test (>= 0.5.4)
21
- xpath (>= 2.0, < 4.0)
16
+ nokogiri (~> 1.8)
17
+ rack (>= 1.6.0)
18
+ rack-test (>= 0.6.3)
19
+ regexp_parser (~> 1.5)
20
+ xpath (~> 3.2)
22
21
  childprocess (0.8.0)
23
22
  ffi (~> 1.0, >= 1.0.11)
24
- chromedriver-helper (1.2.0)
25
- archive-zip (~> 0.10)
26
- nokogiri (~> 1.8)
27
23
  coderay (1.1.2)
28
24
  colorize (0.8.1)
29
25
  diff-lcs (1.3)
30
- ffi (1.9.21)
26
+ ffi (1.12.2)
31
27
  gem-release (2.0.1)
32
- io-like (0.3.0)
33
28
  method_source (0.9.0)
34
- mini_mime (1.0.0)
35
- mini_portile2 (2.3.0)
36
- nokogiri (1.8.2)
37
- mini_portile2 (~> 2.3.0)
29
+ mini_mime (1.0.2)
30
+ mini_portile2 (2.4.0)
31
+ nokogiri (1.10.8)
32
+ mini_portile2 (~> 2.4.0)
38
33
  pry (0.11.3)
39
34
  coderay (~> 1.1.0)
40
35
  method_source (~> 0.9.0)
41
- public_suffix (3.0.2)
42
- rack (2.0.4)
43
- rack-test (1.0.0)
36
+ public_suffix (4.0.3)
37
+ rack (2.0.8)
38
+ rack-test (1.1.0)
44
39
  rack (>= 1.0, < 3)
45
- rake (10.5.0)
40
+ rake (13.0.1)
41
+ regexp_parser (1.7.0)
46
42
  rspec (3.7.0)
47
43
  rspec-core (~> 3.7.0)
48
44
  rspec-expectations (~> 3.7.0)
@@ -62,7 +58,11 @@ GEM
62
58
  rubyzip (~> 1.2)
63
59
  stub_server (0.2.1)
64
60
  rack
65
- xpath (3.0.0)
61
+ webdrivers (4.1.2)
62
+ nokogiri (~> 1.6)
63
+ rubyzip (~> 1.0)
64
+ selenium-webdriver (>= 3.0, < 4.0)
65
+ xpath (3.2.0)
66
66
  nokogiri (~> 1.8)
67
67
 
68
68
  PLATFORMS
@@ -71,13 +71,13 @@ PLATFORMS
71
71
  DEPENDENCIES
72
72
  bundler (~> 1.16)
73
73
  capybara-chromedriver-logger!
74
- chromedriver-helper
75
74
  gem-release
76
75
  pry
77
- rake (~> 10.0)
76
+ rake (~> 13.0)
78
77
  rspec (~> 3.0)
79
78
  selenium-webdriver
80
79
  stub_server
80
+ webdrivers (~> 4.0)
81
81
 
82
82
  BUNDLED WITH
83
- 1.16.2
83
+ 1.17.3
data/README.md CHANGED
@@ -36,10 +36,12 @@ You'll want to modify your `spec_helper.rb` file to configure Capybara correctly
36
36
 
37
37
  ```ruby
38
38
  Capybara.register_driver(:chrome) do |app|
39
- # Turn on browser logs
40
- capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
41
- loggingPrefs: {
42
- browser: 'ALL'
39
+ # option 1:
40
+ # This wraps Selenium::WebDriver::Remote::Capabilities.chrome() with the
41
+ # correct settings for logging.
42
+ capabilities = Capybara::Chromedriver::Logger.build_capabilities(
43
+ chromeOptions: {
44
+ args: %w[headless]
43
45
  }
44
46
  )
45
47
 
@@ -65,6 +67,29 @@ RSpec.configure do |config|
65
67
  end
66
68
  ```
67
69
 
70
+ If you don't want to use the capability wrapper above for any reason, you can
71
+ still manually configure things:
72
+
73
+ ```ruby
74
+ # option 2: manual setup
75
+ # Turn on browser logs
76
+ capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
77
+ chromeOptions: {
78
+ args: %w[headless],
79
+ # required for Chrome 75+
80
+ w3c: false
81
+ },
82
+ # For up to Chrome 74
83
+ loggingPrefs: {
84
+ browser: 'ALL'
85
+ }
86
+ # for Chrome 75+
87
+ "goog:loggingPrefs" => {
88
+ browser: 'ALL'
89
+ }
90
+ )
91
+ ```
92
+
68
93
  ## Configuration
69
94
 
70
95
  Here are examples of the supported configuration options:
@@ -33,11 +33,11 @@ Gem::Specification.new do |spec|
33
33
  spec.add_dependency "colorize"
34
34
 
35
35
  spec.add_development_dependency "bundler", "~> 1.16"
36
- spec.add_development_dependency "chromedriver-helper"
37
36
  spec.add_development_dependency "gem-release"
38
37
  spec.add_development_dependency "pry"
39
- spec.add_development_dependency "rake", "~> 10.0"
38
+ spec.add_development_dependency "rake", "~> 13.0"
40
39
  spec.add_development_dependency "rspec", "~> 3.0"
41
40
  spec.add_development_dependency "selenium-webdriver"
42
41
  spec.add_development_dependency "stub_server"
42
+ spec.add_development_dependency 'webdrivers', '~> 4.0'
43
43
  end
@@ -12,6 +12,31 @@ module Capybara
12
12
  module Logger
13
13
  extend self
14
14
 
15
+ def build_capabilities(loggingPrefs: { browser: 'ALL' }, **options)
16
+ options[:chromeOptions] ||= {}
17
+
18
+ if options[:chromeOptions][:w3c]
19
+ warn "warning: Setting chromeOptions.w3c to true makes it not "\
20
+ "possible to get console.log messages from Chrome.\n\n"\
21
+ "Please see: https://github.com/SeleniumHQ/selenium/issues/7270"
22
+ else
23
+ options[:chromeOptions][:w3c] = false
24
+ end
25
+
26
+ if loggingPrefs[:browser] != 'ALL'
27
+ warn "warning: loggingPrefs needs to contain { browser: 'ALL' } "\
28
+ "when using Logger#build_capabilities"
29
+ end
30
+
31
+ options[:loggingPrefs] = loggingPrefs
32
+
33
+ # Support Chrome 75+
34
+ # see: https://github.com/SeleniumHQ/selenium/issues/7342
35
+ options["goog:loggingPrefs"] = loggingPrefs
36
+
37
+ ::Selenium::WebDriver::Remote::Capabilities.chrome(options)
38
+ end
39
+
15
40
  def filters
16
41
  @filters || []
17
42
  end
@@ -32,9 +32,12 @@ module Capybara
32
32
  def flush_logs!
33
33
  browser_logs.each do |log|
34
34
  message = Message.new(log)
35
- errors << message if message.error?
35
+
36
+ next if should_filter?(message)
36
37
 
37
- log_destination.puts message.to_s unless should_filter?(message)
38
+ errors << message if message.error?
39
+
40
+ log_destination.puts message.to_s
38
41
  end
39
42
  end
40
43
 
@@ -1,7 +1,7 @@
1
1
  module Capybara
2
2
  module Chromedriver
3
3
  module Logger
4
- VERSION = "0.2.1"
4
+ VERSION = "0.3.0"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-chromedriver-logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Balatero
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-23 00:00:00.000000000 Z
11
+ date: 2020-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.16'
55
- - !ruby/object:Gem::Dependency
56
- name: chromedriver-helper
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: gem-release
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +86,14 @@ dependencies:
100
86
  requirements:
101
87
  - - "~>"
102
88
  - !ruby/object:Gem::Version
103
- version: '10.0'
89
+ version: '13.0'
104
90
  type: :development
105
91
  prerelease: false
106
92
  version_requirements: !ruby/object:Gem::Requirement
107
93
  requirements:
108
94
  - - "~>"
109
95
  - !ruby/object:Gem::Version
110
- version: '10.0'
96
+ version: '13.0'
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: rspec
113
99
  requirement: !ruby/object:Gem::Requirement
@@ -150,6 +136,20 @@ dependencies:
150
136
  - - ">="
151
137
  - !ruby/object:Gem::Version
152
138
  version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: webdrivers
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '4.0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '4.0'
153
153
  description:
154
154
  email:
155
155
  - dbalatero@gmail.com
@@ -160,6 +160,7 @@ files:
160
160
  - ".gitignore"
161
161
  - ".rspec"
162
162
  - ".rubocop.yml"
163
+ - ".ruby-version"
163
164
  - ".travis.yml"
164
165
  - CHANGELOG.md
165
166
  - Gemfile
@@ -197,8 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
198
  - !ruby/object:Gem::Version
198
199
  version: '0'
199
200
  requirements: []
200
- rubyforge_project:
201
- rubygems_version: 2.7.7
201
+ rubygems_version: 3.0.6
202
202
  signing_key:
203
203
  specification_version: 4
204
204
  summary: Adds realtime console.log output to Capybara + Selenium + Chromedriver