capybara-chromedriver-logger 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +141 -0
- data/.travis.yml +6 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +5 -3
- data/README.md +12 -0
- data/capybara-chromedriver-logger.gemspec +3 -2
- data/lib/capybara/chromedriver/logger.rb +13 -5
- data/lib/capybara/chromedriver/logger/collector.rb +15 -13
- data/lib/capybara/chromedriver/logger/message.rb +1 -0
- data/lib/capybara/chromedriver/logger/test_hooks.rb +4 -2
- data/lib/capybara/chromedriver/logger/version.rb +1 -1
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a0188c7bb3434429a524f07cfe950f0a02b4bd2e4c949a5dc3e8ecd65a553644
|
4
|
+
data.tar.gz: 22342de9e1295f5377375ea0a248d3b5e4ff2c41da8a696ab53d772da69470ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b5818892be7d9ad66d4c00c741c7d4ae50f70bb863b32d20a77943d272970f53c73ce052d508e2cc03dffedfd2526a67bdf7f0907cc7ff9e8b77048f3e4e207
|
7
|
+
data.tar.gz: abf13f36355acf43333c0716aafae32a91fbbf7777c4870130f4785e9be9796367f2922654295507a0d300e9f8822bd639a3f2a08de3cff80357f9923ed06c24
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
AllCops:
|
2
|
+
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
|
3
|
+
# to ignore them, so only the ones explicitly set in this file are enabled.
|
4
|
+
DisabledByDefault: true
|
5
|
+
TargetRubyVersion: 2.3
|
6
|
+
|
7
|
+
# Prefer &&/|| over and/or.
|
8
|
+
Style/AndOr:
|
9
|
+
Enabled: true
|
10
|
+
|
11
|
+
# Do not use braces for hash literals when they are the last argument of a
|
12
|
+
# method call.
|
13
|
+
Style/BracesAroundHashParameters:
|
14
|
+
Enabled: true
|
15
|
+
|
16
|
+
# Align `when` with `case`.
|
17
|
+
Layout/CaseIndentation:
|
18
|
+
Enabled: true
|
19
|
+
|
20
|
+
# Align comments with method definitions.
|
21
|
+
Layout/CommentIndentation:
|
22
|
+
Enabled: true
|
23
|
+
|
24
|
+
Layout/EmptyLineAfterMagicComment:
|
25
|
+
Enabled: true
|
26
|
+
|
27
|
+
# No extra empty lines.
|
28
|
+
Layout/EmptyLines:
|
29
|
+
Enabled: true
|
30
|
+
|
31
|
+
# In a regular class definition, no empty lines around the body.
|
32
|
+
Layout/EmptyLinesAroundClassBody:
|
33
|
+
Enabled: true
|
34
|
+
|
35
|
+
# In a regular method definition, no empty lines around the body.
|
36
|
+
Layout/EmptyLinesAroundMethodBody:
|
37
|
+
Enabled: true
|
38
|
+
|
39
|
+
# In a regular module definition, no empty lines around the body.
|
40
|
+
Layout/EmptyLinesAroundModuleBody:
|
41
|
+
Enabled: true
|
42
|
+
|
43
|
+
# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
|
44
|
+
Style/HashSyntax:
|
45
|
+
Enabled: true
|
46
|
+
|
47
|
+
# Method definitions after `private` or `protected` isolated calls need one
|
48
|
+
# extra level of indentation.
|
49
|
+
Layout/IndentationConsistency:
|
50
|
+
Enabled: true
|
51
|
+
EnforcedStyle: normal
|
52
|
+
|
53
|
+
# Two spaces, no tabs (for indentation).
|
54
|
+
Layout/IndentationWidth:
|
55
|
+
Enabled: true
|
56
|
+
|
57
|
+
Layout/SpaceAfterColon:
|
58
|
+
Enabled: true
|
59
|
+
|
60
|
+
Layout/SpaceAfterComma:
|
61
|
+
Enabled: true
|
62
|
+
|
63
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
64
|
+
Enabled: true
|
65
|
+
|
66
|
+
Layout/SpaceAroundKeyword:
|
67
|
+
Enabled: true
|
68
|
+
|
69
|
+
Layout/SpaceAroundOperators:
|
70
|
+
Enabled: true
|
71
|
+
|
72
|
+
Layout/SpaceBeforeFirstArg:
|
73
|
+
Enabled: true
|
74
|
+
|
75
|
+
# Defining a method with parameters needs parentheses.
|
76
|
+
Style/MethodDefParentheses:
|
77
|
+
Enabled: true
|
78
|
+
|
79
|
+
# Use `foo {}` not `foo{}`.
|
80
|
+
Layout/SpaceBeforeBlockBraces:
|
81
|
+
Enabled: true
|
82
|
+
|
83
|
+
# Use `foo { bar }` not `foo {bar}`.
|
84
|
+
Layout/SpaceInsideBlockBraces:
|
85
|
+
Enabled: true
|
86
|
+
|
87
|
+
# Use `{ a: 1 }` not `{a:1}`.
|
88
|
+
Layout/SpaceInsideHashLiteralBraces:
|
89
|
+
Enabled: true
|
90
|
+
|
91
|
+
Layout/SpaceInsideParens:
|
92
|
+
Enabled: true
|
93
|
+
|
94
|
+
# Don't care about single vs double quotes
|
95
|
+
Style/StringLiterals:
|
96
|
+
Enabled: false
|
97
|
+
SupportedStyles:
|
98
|
+
- single_quotes
|
99
|
+
- double_quotes
|
100
|
+
|
101
|
+
# Detect hard tabs, no hard tabs.
|
102
|
+
Layout/Tab:
|
103
|
+
Enabled: true
|
104
|
+
|
105
|
+
# Blank lines should not have any spaces.
|
106
|
+
Layout/TrailingBlankLines:
|
107
|
+
Enabled: true
|
108
|
+
|
109
|
+
Metrics/LineLength:
|
110
|
+
Enabled: true
|
111
|
+
Max: 80
|
112
|
+
IgnoredPatterns: ['\A\s*class ']
|
113
|
+
|
114
|
+
Layout/MultilineMethodCallIndentation:
|
115
|
+
Enabled: true
|
116
|
+
EnforcedStyle: indented
|
117
|
+
IndentationWidth: 2
|
118
|
+
|
119
|
+
# No trailing whitespace.
|
120
|
+
Layout/TrailingWhitespace:
|
121
|
+
Enabled: true
|
122
|
+
|
123
|
+
# Use quotes for string literals when they are enough.
|
124
|
+
Style/UnneededPercentQ:
|
125
|
+
Enabled: true
|
126
|
+
|
127
|
+
# Align `end` with the matching keyword or starting expression except for
|
128
|
+
# assignments, where it should be aligned with the LHS.
|
129
|
+
Lint/EndAlignment:
|
130
|
+
Enabled: true
|
131
|
+
EnforcedStyleAlignWith: variable
|
132
|
+
|
133
|
+
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
134
|
+
Lint/RequireParentheses:
|
135
|
+
Enabled: true
|
136
|
+
|
137
|
+
Style/BlockDelimiters:
|
138
|
+
Enabled: true
|
139
|
+
|
140
|
+
Style/SymbolArray:
|
141
|
+
Enabled: true
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
capybara-chromedriver-logger (0.2.
|
4
|
+
capybara-chromedriver-logger (0.2.1)
|
5
5
|
capybara
|
6
6
|
colorize
|
7
7
|
|
@@ -28,6 +28,7 @@ GEM
|
|
28
28
|
colorize (0.8.1)
|
29
29
|
diff-lcs (1.3)
|
30
30
|
ffi (1.9.21)
|
31
|
+
gem-release (2.0.1)
|
31
32
|
io-like (0.3.0)
|
32
33
|
method_source (0.9.0)
|
33
34
|
mini_mime (1.0.0)
|
@@ -39,7 +40,7 @@ GEM
|
|
39
40
|
method_source (~> 0.9.0)
|
40
41
|
public_suffix (3.0.2)
|
41
42
|
rack (2.0.4)
|
42
|
-
rack-test (0.
|
43
|
+
rack-test (1.0.0)
|
43
44
|
rack (>= 1.0, < 3)
|
44
45
|
rake (10.5.0)
|
45
46
|
rspec (3.7.0)
|
@@ -71,6 +72,7 @@ DEPENDENCIES
|
|
71
72
|
bundler (~> 1.16)
|
72
73
|
capybara-chromedriver-logger!
|
73
74
|
chromedriver-helper
|
75
|
+
gem-release
|
74
76
|
pry
|
75
77
|
rake (~> 10.0)
|
76
78
|
rspec (~> 3.0)
|
@@ -78,4 +80,4 @@ DEPENDENCIES
|
|
78
80
|
stub_server
|
79
81
|
|
80
82
|
BUNDLED WITH
|
81
|
-
1.16.
|
83
|
+
1.16.2
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/dbalatero/capybara-chromedriver-logger.svg?branch=master)](https://travis-ci.org/dbalatero/capybara-chromedriver-logger)
|
2
|
+
|
1
3
|
# capybara-chromedriver-logger
|
2
4
|
|
3
5
|
This gem provides `console.log` debug output for Ruby feature specs running under Chromedriver.
|
@@ -86,6 +88,16 @@ Capybara::Chromedriver::Logger.filters = [
|
|
86
88
|
/Download the React DevTools/i,
|
87
89
|
/The SSL certificate used to load resources from/i
|
88
90
|
]
|
91
|
+
|
92
|
+
# If you want to filter out specific severity levels, you can do so here:
|
93
|
+
#
|
94
|
+
# default: nil
|
95
|
+
Capybara::Chromedriver::Logger.filter_levels = %i[
|
96
|
+
severe
|
97
|
+
info
|
98
|
+
warning
|
99
|
+
debug
|
100
|
+
]
|
89
101
|
```
|
90
102
|
|
91
103
|
## Development
|
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["David Balatero"]
|
10
10
|
spec.email = ["dbalatero@gmail.com"]
|
11
11
|
|
12
|
-
spec.summary =
|
12
|
+
spec.summary = 'Adds realtime console.log output to Capybara + Selenium + Chromedriver'
|
13
13
|
spec.homepage = "https://github.com/dbalatero/capybara-chromedriver-logger"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
"public gem pushes."
|
23
23
|
end
|
24
24
|
|
25
|
-
spec.files
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
26
26
|
f.match(%r{^(test|spec|features)/})
|
27
27
|
end
|
28
28
|
spec.bindir = "exe"
|
@@ -34,6 +34,7 @@ Gem::Specification.new do |spec|
|
|
34
34
|
|
35
35
|
spec.add_development_dependency "bundler", "~> 1.16"
|
36
36
|
spec.add_development_dependency "chromedriver-helper"
|
37
|
+
spec.add_development_dependency "gem-release"
|
37
38
|
spec.add_development_dependency "pry"
|
38
39
|
spec.add_development_dependency "rake", "~> 10.0"
|
39
40
|
spec.add_development_dependency "rspec", "~> 3.0"
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'capybara'
|
2
2
|
require 'selenium-webdriver'
|
3
3
|
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
4
|
+
require 'capybara/chromedriver/logger/test_hooks'
|
5
|
+
require 'capybara/chromedriver/logger/version'
|
6
|
+
require 'capybara/chromedriver/logger/js_error'
|
7
|
+
require 'capybara/chromedriver/logger/message'
|
8
|
+
require 'capybara/chromedriver/logger/collector'
|
9
9
|
|
10
10
|
module Capybara
|
11
11
|
module Chromedriver
|
@@ -20,6 +20,14 @@ module Capybara
|
|
20
20
|
@filters = filters
|
21
21
|
end
|
22
22
|
|
23
|
+
def filter_levels
|
24
|
+
@filter_levels || []
|
25
|
+
end
|
26
|
+
|
27
|
+
def filter_levels=(filters)
|
28
|
+
@filter_levels = filters && filters.map(&:upcase).map(&:to_s)
|
29
|
+
end
|
30
|
+
|
23
31
|
def raise_js_errors?
|
24
32
|
!!@raise_js_errors
|
25
33
|
end
|
@@ -2,10 +2,12 @@ module Capybara
|
|
2
2
|
module Chromedriver
|
3
3
|
module Logger
|
4
4
|
class Collector
|
5
|
-
def initialize(
|
6
|
-
@log_destination = log_destination
|
7
|
-
@filters = filters || Capybara::Chromedriver::Logger.filters
|
5
|
+
def initialize(options = {})
|
8
6
|
@errors = []
|
7
|
+
@log_destination = options[:log_destination] || $stdout
|
8
|
+
@filters = options[:filters] || Capybara::Chromedriver::Logger.filters
|
9
|
+
@filter_levels = options[:filter_levels] ||
|
10
|
+
Capybara::Chromedriver::Logger.filter_levels
|
9
11
|
end
|
10
12
|
|
11
13
|
def flush_and_check_errors!
|
@@ -24,8 +26,7 @@ module Capybara
|
|
24
26
|
formatted_errors = errors.map(&:to_s)
|
25
27
|
error_list = formatted_errors.join("\n")
|
26
28
|
|
27
|
-
raise JsError,
|
28
|
-
"Got some JS errors during testing:\n\n#{error_list}"
|
29
|
+
raise JsError, "Got some JS errors during testing:\n\n#{error_list}"
|
29
30
|
end
|
30
31
|
|
31
32
|
def flush_logs!
|
@@ -55,20 +56,21 @@ module Capybara
|
|
55
56
|
end
|
56
57
|
|
57
58
|
def should_filter?(message)
|
58
|
-
|
59
|
+
should_filter_by_level?(message) || should_filter_content?(message)
|
59
60
|
end
|
60
61
|
|
61
|
-
def
|
62
|
-
|
62
|
+
def should_filter_by_level?(message)
|
63
|
+
filter_levels.include?(message.level)
|
63
64
|
end
|
64
65
|
|
65
|
-
def
|
66
|
-
|
66
|
+
def should_filter_content?(message)
|
67
|
+
filters.any? { |filter| filter =~ message.message }
|
67
68
|
end
|
68
69
|
|
69
|
-
|
70
|
-
|
71
|
-
|
70
|
+
attr_reader :errors
|
71
|
+
attr_reader :filters
|
72
|
+
attr_reader :filter_levels
|
73
|
+
attr_reader :log_destination
|
72
74
|
end
|
73
75
|
end
|
74
76
|
end
|
@@ -9,8 +9,10 @@ module Capybara
|
|
9
9
|
|
10
10
|
def self.for_rspec!
|
11
11
|
::RSpec.configure do |config|
|
12
|
-
|
13
|
-
|
12
|
+
%i[feature system].each do |type|
|
13
|
+
config.after :each, type: type do
|
14
|
+
Capybara::Chromedriver::Logger::TestHooks.after_example!
|
15
|
+
end
|
14
16
|
end
|
15
17
|
end
|
16
18
|
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.
|
4
|
+
version: 0.2.1
|
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-
|
11
|
+
date: 2018-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: gem-release
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: pry
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -145,6 +159,7 @@ extra_rdoc_files: []
|
|
145
159
|
files:
|
146
160
|
- ".gitignore"
|
147
161
|
- ".rspec"
|
162
|
+
- ".rubocop.yml"
|
148
163
|
- ".travis.yml"
|
149
164
|
- CHANGELOG.md
|
150
165
|
- Gemfile
|
@@ -183,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
183
198
|
version: '0'
|
184
199
|
requirements: []
|
185
200
|
rubyforge_project:
|
186
|
-
rubygems_version: 2.
|
201
|
+
rubygems_version: 2.7.7
|
187
202
|
signing_key:
|
188
203
|
specification_version: 4
|
189
204
|
summary: Adds realtime console.log output to Capybara + Selenium + Chromedriver
|