capybara-chromedriver-logger 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +79 -0
- data/LICENSE.txt +21 -0
- data/README.md +101 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/capybara-chromedriver-logger.gemspec +42 -0
- data/images/example.png +0 -0
- data/lib/capybara/chromedriver/logger.rb +41 -0
- data/lib/capybara/chromedriver/logger/js_error.rb +8 -0
- data/lib/capybara/chromedriver/logger/message.rb +64 -0
- data/lib/capybara/chromedriver/logger/selenium_thread_safe_bridge.rb +16 -0
- data/lib/capybara/chromedriver/logger/test_hooks.rb +26 -0
- data/lib/capybara/chromedriver/logger/version.rb +7 -0
- data/lib/capybara/chromedriver/logger/watcher.rb +131 -0
- metadata +191 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 869016e895120f49aac09f57558b2284d02fd780
|
4
|
+
data.tar.gz: 0f0c6580fdf8a8e46f5c000328b4fbc0e10fcd2e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a7c7d9339f1271820782dd095876de97b0b45f35a762376a23a24b4a42d979733a1872038379e51f5cbc5fe27a6363d985a4382c5971b94ae12f051cfe8aec56
|
7
|
+
data.tar.gz: d578742ac8cd77ef15fd05a317a5475ea979d4c37ff02cc68a81b2dfb668c691ebdf6ad415ae3a451e7be1e51f4b81783ba2cb77aaad80b4c015083fd0b49e39
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
capybara-chromedriver-logger (0.1.0)
|
5
|
+
capybara
|
6
|
+
colorize
|
7
|
+
net-http-persistent
|
8
|
+
selenium-webdriver
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
addressable (2.5.2)
|
14
|
+
public_suffix (>= 2.0.2, < 4.0)
|
15
|
+
archive-zip (0.11.0)
|
16
|
+
io-like (~> 0.3.0)
|
17
|
+
capybara (2.18.0)
|
18
|
+
addressable
|
19
|
+
mini_mime (>= 0.1.3)
|
20
|
+
nokogiri (>= 1.3.3)
|
21
|
+
rack (>= 1.0.0)
|
22
|
+
rack-test (>= 0.5.4)
|
23
|
+
xpath (>= 2.0, < 4.0)
|
24
|
+
childprocess (0.8.0)
|
25
|
+
ffi (~> 1.0, >= 1.0.11)
|
26
|
+
chromedriver-helper (1.2.0)
|
27
|
+
archive-zip (~> 0.10)
|
28
|
+
nokogiri (~> 1.8)
|
29
|
+
colorize (0.8.1)
|
30
|
+
connection_pool (2.2.1)
|
31
|
+
diff-lcs (1.3)
|
32
|
+
ffi (1.9.21)
|
33
|
+
io-like (0.3.0)
|
34
|
+
mini_mime (1.0.0)
|
35
|
+
mini_portile2 (2.3.0)
|
36
|
+
net-http-persistent (3.0.0)
|
37
|
+
connection_pool (~> 2.2)
|
38
|
+
nokogiri (1.8.2)
|
39
|
+
mini_portile2 (~> 2.3.0)
|
40
|
+
public_suffix (3.0.2)
|
41
|
+
rack (2.0.4)
|
42
|
+
rack-test (0.8.2)
|
43
|
+
rack (>= 1.0, < 3)
|
44
|
+
rake (10.5.0)
|
45
|
+
rspec (3.7.0)
|
46
|
+
rspec-core (~> 3.7.0)
|
47
|
+
rspec-expectations (~> 3.7.0)
|
48
|
+
rspec-mocks (~> 3.7.0)
|
49
|
+
rspec-core (3.7.1)
|
50
|
+
rspec-support (~> 3.7.0)
|
51
|
+
rspec-expectations (3.7.0)
|
52
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
53
|
+
rspec-support (~> 3.7.0)
|
54
|
+
rspec-mocks (3.7.0)
|
55
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
56
|
+
rspec-support (~> 3.7.0)
|
57
|
+
rspec-support (3.7.1)
|
58
|
+
rubyzip (1.2.1)
|
59
|
+
selenium-webdriver (3.9.0)
|
60
|
+
childprocess (~> 0.5)
|
61
|
+
rubyzip (~> 1.2)
|
62
|
+
stub_server (0.2.1)
|
63
|
+
rack
|
64
|
+
xpath (3.0.0)
|
65
|
+
nokogiri (~> 1.8)
|
66
|
+
|
67
|
+
PLATFORMS
|
68
|
+
ruby
|
69
|
+
|
70
|
+
DEPENDENCIES
|
71
|
+
bundler (~> 1.16)
|
72
|
+
capybara-chromedriver-logger!
|
73
|
+
chromedriver-helper
|
74
|
+
rake (~> 10.0)
|
75
|
+
rspec (~> 3.0)
|
76
|
+
stub_server
|
77
|
+
|
78
|
+
BUNDLED WITH
|
79
|
+
1.16.0
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 David Balatero
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
# capybara-chromedriver-logger
|
2
|
+
|
3
|
+
This gem provides real-time `console.log` debug output for Ruby feature specs running under Chromedriver.
|
4
|
+
|
5
|
+
We currently assume you're running:
|
6
|
+
|
7
|
+
* capybara
|
8
|
+
* chromedriver
|
9
|
+
* rspec
|
10
|
+
* selenium-webdriver
|
11
|
+
|
12
|
+
to handle your JS feature specs. I'd love to expand support for other combinations of test environments!
|
13
|
+
|
14
|
+
<img src="https://raw.githubusercontent.com/dbalatero/capybara-chromedriver-logger/master/images/example.png" />
|
15
|
+
|
16
|
+
## Installation
|
17
|
+
|
18
|
+
Add this line to your application's Gemfile:
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
gem 'capybara-chromedriver-logger'
|
22
|
+
```
|
23
|
+
|
24
|
+
And then execute:
|
25
|
+
|
26
|
+
$ bundle
|
27
|
+
|
28
|
+
Or install it yourself as:
|
29
|
+
|
30
|
+
$ gem install capybara-chromedriver-logger
|
31
|
+
|
32
|
+
## Usage
|
33
|
+
|
34
|
+
You'll want to modify your `spec_helper.rb` file to configure Capybara correctly:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
Capybara.register_driver(:chrome) do |app|
|
38
|
+
# Turn on browser logs
|
39
|
+
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
|
40
|
+
loggingPrefs: {
|
41
|
+
browser: 'ALL'
|
42
|
+
}
|
43
|
+
)
|
44
|
+
|
45
|
+
# Selenium needs to use a thread-safe HTTP client
|
46
|
+
client = Capybara::Chromedriver::Logger::SeleniumHttpClient.new
|
47
|
+
|
48
|
+
Capybara::Selenium::Driver.new(
|
49
|
+
app,
|
50
|
+
browser: :chrome,
|
51
|
+
desired_capabilities: capabilities,
|
52
|
+
http_client: client
|
53
|
+
)
|
54
|
+
end
|
55
|
+
|
56
|
+
# Use the driver we've configured
|
57
|
+
Capybara.default_driver = :chrome
|
58
|
+
Capybara.javascript_driver = :chrome
|
59
|
+
|
60
|
+
# Setup before/after hooks for your feature specs
|
61
|
+
Capybara::Chromedriver::Logger::TestHooks.for_rspec!
|
62
|
+
```
|
63
|
+
|
64
|
+
## Configuration
|
65
|
+
|
66
|
+
Here are examples of the supported configuration options:
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
# If you set this to true, any specs that generate console errors
|
70
|
+
# will automatically raise. This is similar to poltergeist's
|
71
|
+
# `js_errors: true` config option
|
72
|
+
#
|
73
|
+
# If you filter out any errors with the `filters` option, they will
|
74
|
+
# not trigger an exception in your spec examples.
|
75
|
+
#
|
76
|
+
# default: false
|
77
|
+
Capybara::Chromedriver::Logger.raise_js_errors = true
|
78
|
+
|
79
|
+
# If third-party libraries are dumping obnoxious logs into your output,
|
80
|
+
# you can filter them out here.
|
81
|
+
#
|
82
|
+
# default: []
|
83
|
+
Capybara::Chromedriver::Logger.filters = [
|
84
|
+
/Download the React DevTools/i,
|
85
|
+
/The SSL certificate used to load resources from/i
|
86
|
+
]
|
87
|
+
```
|
88
|
+
|
89
|
+
## Development
|
90
|
+
|
91
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
92
|
+
|
93
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
94
|
+
|
95
|
+
## Contributing
|
96
|
+
|
97
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/dbalatero/capybara-chromedriver-logger.
|
98
|
+
|
99
|
+
## License
|
100
|
+
|
101
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "capybara/chromedriver/logger"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
|
4
|
+
require "capybara/chromedriver/logger/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "capybara-chromedriver-logger"
|
8
|
+
spec.version = Capybara::Chromedriver::Logger::VERSION
|
9
|
+
spec.authors = ["David Balatero"]
|
10
|
+
spec.email = ["dbalatero@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Adds realtime console.log output to Capybara + Selenium + Chromedriver}
|
13
|
+
spec.homepage = "https://github.com/dbalatero/capybara-chromedriver-logger"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
+
if spec.respond_to?(:metadata)
|
19
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
20
|
+
else
|
21
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
22
|
+
"public gem pushes."
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
26
|
+
f.match(%r{^(test|spec|features)/})
|
27
|
+
end
|
28
|
+
spec.bindir = "exe"
|
29
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
|
+
spec.require_paths = ["lib"]
|
31
|
+
|
32
|
+
spec.add_dependency "capybara"
|
33
|
+
spec.add_dependency "colorize"
|
34
|
+
spec.add_dependency "net-http-persistent"
|
35
|
+
spec.add_dependency "selenium-webdriver"
|
36
|
+
|
37
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
38
|
+
spec.add_development_dependency "chromedriver-helper"
|
39
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
40
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
41
|
+
spec.add_development_dependency "stub_server"
|
42
|
+
end
|
data/images/example.png
ADDED
Binary file
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'capybara'
|
2
|
+
require 'selenium-webdriver'
|
3
|
+
require 'selenium/webdriver/remote/http/persistent'
|
4
|
+
|
5
|
+
require "capybara/chromedriver/logger/test_hooks"
|
6
|
+
require "capybara/chromedriver/logger/version"
|
7
|
+
require "capybara/chromedriver/logger/js_error"
|
8
|
+
require "capybara/chromedriver/logger/message"
|
9
|
+
require "capybara/chromedriver/logger/watcher"
|
10
|
+
require "capybara/chromedriver/logger/selenium_thread_safe_bridge"
|
11
|
+
|
12
|
+
class Selenium::WebDriver::Remote::Bridge
|
13
|
+
prepend Capybara::Chromedriver::Logger::SeleniumThreadSafeBridge
|
14
|
+
end
|
15
|
+
|
16
|
+
module Capybara
|
17
|
+
module Chromedriver
|
18
|
+
module Logger
|
19
|
+
# This HTTP client is thread-safe, unlike the default client.
|
20
|
+
SeleniumHttpClient = ::Selenium::WebDriver::Remote::Http::Persistent
|
21
|
+
|
22
|
+
extend self
|
23
|
+
|
24
|
+
def filters
|
25
|
+
@filters || []
|
26
|
+
end
|
27
|
+
|
28
|
+
def filters=(filters)
|
29
|
+
@filters = filters
|
30
|
+
end
|
31
|
+
|
32
|
+
def raise_js_errors?
|
33
|
+
!!@raise_js_errors
|
34
|
+
end
|
35
|
+
|
36
|
+
def raise_js_errors=(value)
|
37
|
+
@raise_js_errors = value
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'colorize'
|
2
|
+
|
3
|
+
module Capybara
|
4
|
+
module Chromedriver
|
5
|
+
module Logger
|
6
|
+
class Message
|
7
|
+
attr_reader :level, :message, :file, :location, :timestamp
|
8
|
+
|
9
|
+
def initialize(log)
|
10
|
+
@message = log.message.strip.gsub(/%c/, '')
|
11
|
+
@level = log.level
|
12
|
+
@file = nil
|
13
|
+
@location = nil
|
14
|
+
|
15
|
+
extract_file_and_location!
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_s
|
19
|
+
[
|
20
|
+
"\u{1F4DC} ",
|
21
|
+
log_level,
|
22
|
+
file_and_location,
|
23
|
+
message
|
24
|
+
].compact.join(' ')
|
25
|
+
end
|
26
|
+
|
27
|
+
def error?
|
28
|
+
level == 'SEVERE'
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
COLORS = {
|
34
|
+
'SEVERE' => :light_red,
|
35
|
+
'INFO' => :light_green,
|
36
|
+
'DEBUG' => :light_blue
|
37
|
+
}.freeze
|
38
|
+
|
39
|
+
def level_color
|
40
|
+
COLORS[level] || :light_blue
|
41
|
+
end
|
42
|
+
|
43
|
+
def log_level
|
44
|
+
" #{level.downcase} ".colorize(color: :white, background: level_color).bold
|
45
|
+
end
|
46
|
+
|
47
|
+
def file_and_location
|
48
|
+
return unless file && location
|
49
|
+
|
50
|
+
"#{file} #{location}".colorize(color: :white, background: :light_magenta)
|
51
|
+
end
|
52
|
+
|
53
|
+
def extract_file_and_location!
|
54
|
+
match = message.match(/^(.+)\s+?(\d+:\d+)\s+?(.+)$/)
|
55
|
+
|
56
|
+
return unless match
|
57
|
+
|
58
|
+
_, @file, @location, message = match.to_a
|
59
|
+
@message = message.gsub(/^"(.+?)"$/, '\1')
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Capybara
|
2
|
+
module Chromedriver
|
3
|
+
module Logger
|
4
|
+
# Ensure our polling thread doesn't compete with the main spec example
|
5
|
+
module SeleniumThreadSafeBridge
|
6
|
+
def __execute_lock
|
7
|
+
@__execute_lock ||= Mutex.new
|
8
|
+
end
|
9
|
+
|
10
|
+
def execute(*args)
|
11
|
+
__execute_lock.synchronize { super }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Capybara
|
2
|
+
module Chromedriver
|
3
|
+
module Logger
|
4
|
+
class TestHooks
|
5
|
+
def self.for_rspec!
|
6
|
+
::RSpec.configure do |config|
|
7
|
+
filters = { type: :feature }
|
8
|
+
watcher = Capybara::Chromedriver::Logger::Watcher.instance
|
9
|
+
|
10
|
+
config.before :suite do
|
11
|
+
watcher.before_suite!
|
12
|
+
end
|
13
|
+
|
14
|
+
config.before :each, filters do
|
15
|
+
watcher.before_example!
|
16
|
+
end
|
17
|
+
|
18
|
+
config.after :each, filters do
|
19
|
+
watcher.after_example!
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,131 @@
|
|
1
|
+
require 'thread'
|
2
|
+
|
3
|
+
module Capybara
|
4
|
+
module Chromedriver
|
5
|
+
module Logger
|
6
|
+
class Watcher
|
7
|
+
def self.instance
|
8
|
+
@instance ||= new
|
9
|
+
end
|
10
|
+
|
11
|
+
def initialize(log_destination: $stdout, filters: nil)
|
12
|
+
@log_destination = log_destination
|
13
|
+
@last_timestamp = 0
|
14
|
+
@mutex = Mutex.new
|
15
|
+
@thread = nil
|
16
|
+
@paused = true
|
17
|
+
@filters = filters || Capybara::Chromedriver::Logger.filters
|
18
|
+
@errors = []
|
19
|
+
end
|
20
|
+
|
21
|
+
def before_suite!
|
22
|
+
@thread = Thread.new do
|
23
|
+
loop do
|
24
|
+
flush_logs! unless paused?
|
25
|
+
sleep 0.1
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def before_example!
|
31
|
+
unpause!
|
32
|
+
end
|
33
|
+
|
34
|
+
def after_example!
|
35
|
+
pause!
|
36
|
+
flush_logs!
|
37
|
+
|
38
|
+
raise_errors_if_needed!
|
39
|
+
clear_errors!
|
40
|
+
ensure
|
41
|
+
thread.kill if thread
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def raise_errors_if_needed!
|
47
|
+
return unless Capybara::Chromedriver::Logger.raise_js_errors?
|
48
|
+
return if errors.empty?
|
49
|
+
|
50
|
+
formatted_errors = errors.map(&:to_s)
|
51
|
+
error_list = formatted_errors.join("\n")
|
52
|
+
|
53
|
+
raise JsError,
|
54
|
+
"Got some JS errors during testing:\n\n#{error_list}"
|
55
|
+
end
|
56
|
+
|
57
|
+
def flush_logs!
|
58
|
+
browser_logs.each do |log|
|
59
|
+
next if log.timestamp < last_timestamp
|
60
|
+
|
61
|
+
@last_timestamp = log.timestamp
|
62
|
+
|
63
|
+
message = Message.new(log)
|
64
|
+
|
65
|
+
errors << message if message.error?
|
66
|
+
log_destination.puts message.to_s unless should_filter?(message)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def clear_errors!
|
71
|
+
@errors = []
|
72
|
+
end
|
73
|
+
|
74
|
+
def browser_logs
|
75
|
+
logs(:browser)
|
76
|
+
end
|
77
|
+
|
78
|
+
def logs(type)
|
79
|
+
mutex.synchronize do
|
80
|
+
Capybara
|
81
|
+
.current_session
|
82
|
+
.driver.browser
|
83
|
+
.manage
|
84
|
+
.logs
|
85
|
+
.get(type)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def should_filter?(message)
|
90
|
+
filters.any? { |filter| filter =~ message.message }
|
91
|
+
end
|
92
|
+
|
93
|
+
def errors
|
94
|
+
@errors
|
95
|
+
end
|
96
|
+
|
97
|
+
def unpause!
|
98
|
+
@paused = false
|
99
|
+
end
|
100
|
+
|
101
|
+
def pause!
|
102
|
+
@paused = true
|
103
|
+
end
|
104
|
+
|
105
|
+
def mutex
|
106
|
+
@mutex
|
107
|
+
end
|
108
|
+
|
109
|
+
def filters
|
110
|
+
@filters
|
111
|
+
end
|
112
|
+
|
113
|
+
def last_timestamp
|
114
|
+
@last_timestamp
|
115
|
+
end
|
116
|
+
|
117
|
+
def paused?
|
118
|
+
!!@paused
|
119
|
+
end
|
120
|
+
|
121
|
+
def log_destination
|
122
|
+
@log_destination
|
123
|
+
end
|
124
|
+
|
125
|
+
def thread
|
126
|
+
@thread
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
metadata
ADDED
@@ -0,0 +1,191 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capybara-chromedriver-logger
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- David Balatero
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-02-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: capybara
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: colorize
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: net-http-persistent
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: selenium-webdriver
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.16'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.16'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: chromedriver-helper
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '10.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '10.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '3.0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '3.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: stub_server
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description:
|
140
|
+
email:
|
141
|
+
- dbalatero@gmail.com
|
142
|
+
executables: []
|
143
|
+
extensions: []
|
144
|
+
extra_rdoc_files: []
|
145
|
+
files:
|
146
|
+
- ".gitignore"
|
147
|
+
- ".rspec"
|
148
|
+
- ".travis.yml"
|
149
|
+
- CHANGELOG.md
|
150
|
+
- Gemfile
|
151
|
+
- Gemfile.lock
|
152
|
+
- LICENSE.txt
|
153
|
+
- README.md
|
154
|
+
- Rakefile
|
155
|
+
- bin/console
|
156
|
+
- bin/setup
|
157
|
+
- capybara-chromedriver-logger.gemspec
|
158
|
+
- images/example.png
|
159
|
+
- lib/capybara/chromedriver/logger.rb
|
160
|
+
- lib/capybara/chromedriver/logger/js_error.rb
|
161
|
+
- lib/capybara/chromedriver/logger/message.rb
|
162
|
+
- lib/capybara/chromedriver/logger/selenium_thread_safe_bridge.rb
|
163
|
+
- lib/capybara/chromedriver/logger/test_hooks.rb
|
164
|
+
- lib/capybara/chromedriver/logger/version.rb
|
165
|
+
- lib/capybara/chromedriver/logger/watcher.rb
|
166
|
+
homepage: https://github.com/dbalatero/capybara-chromedriver-logger
|
167
|
+
licenses:
|
168
|
+
- MIT
|
169
|
+
metadata:
|
170
|
+
allowed_push_host: https://rubygems.org
|
171
|
+
post_install_message:
|
172
|
+
rdoc_options: []
|
173
|
+
require_paths:
|
174
|
+
- lib
|
175
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - ">="
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '0'
|
180
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
181
|
+
requirements:
|
182
|
+
- - ">="
|
183
|
+
- !ruby/object:Gem::Version
|
184
|
+
version: '0'
|
185
|
+
requirements: []
|
186
|
+
rubyforge_project:
|
187
|
+
rubygems_version: 2.6.11
|
188
|
+
signing_key:
|
189
|
+
specification_version: 4
|
190
|
+
summary: Adds realtime console.log output to Capybara + Selenium + Chromedriver
|
191
|
+
test_files: []
|