capybara-chromedriver-logger 0.1.1 → 0.1.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6bf949569140cd895d2e29fb9c168b933a362c71
|
4
|
+
data.tar.gz: 932cc9b2c08c52af54a05728428ac100621024d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77de57767e12fcac2eade8c81795e1e413bbdcb6ab169696f6a1b18d3c786e83542f66ceae06c1b92cb44f7d4064e15383e8ecc5dc38ae3727ab29f07f42c968
|
7
|
+
data.tar.gz: 8edc993525de574405a2cb840956281040f8f9689de0d84d7439a072d1edc86bb781abe3313ebb9f50ed854222bcba9c35ae74fad79e8f1262f5779d801cabcf
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -5,18 +5,14 @@ module Capybara
|
|
5
5
|
def self.for_rspec!
|
6
6
|
::RSpec.configure do |config|
|
7
7
|
filters = { type: :feature }
|
8
|
-
watcher = Capybara::Chromedriver::Logger::Watcher.instance
|
9
|
-
|
10
|
-
config.before :suite do
|
11
|
-
watcher.before_suite!
|
12
|
-
end
|
13
8
|
|
14
9
|
config.before :each, filters do
|
15
|
-
|
10
|
+
@_log_watcher = Capybara::Chromedriver::Logger::Watcher.new
|
11
|
+
@_log_watcher.before_example!
|
16
12
|
end
|
17
13
|
|
18
14
|
config.after :each, filters do
|
19
|
-
|
15
|
+
@_log_watcher.after_example!
|
20
16
|
end
|
21
17
|
end
|
22
18
|
end
|
@@ -4,10 +4,6 @@ module Capybara
|
|
4
4
|
module Chromedriver
|
5
5
|
module Logger
|
6
6
|
class Watcher
|
7
|
-
def self.instance
|
8
|
-
@instance ||= new
|
9
|
-
end
|
10
|
-
|
11
7
|
def initialize(log_destination: $stdout, filters: nil)
|
12
8
|
@log_destination = log_destination
|
13
9
|
@last_timestamp = 0
|
@@ -18,17 +14,9 @@ module Capybara
|
|
18
14
|
@errors = []
|
19
15
|
end
|
20
16
|
|
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
17
|
def before_example!
|
31
18
|
unpause!
|
19
|
+
start_listener!
|
32
20
|
end
|
33
21
|
|
34
22
|
def after_example!
|
@@ -43,6 +31,15 @@ module Capybara
|
|
43
31
|
|
44
32
|
private
|
45
33
|
|
34
|
+
def start_listener!
|
35
|
+
@thread = Thread.new do
|
36
|
+
loop do
|
37
|
+
flush_logs! unless paused?
|
38
|
+
sleep 0.1
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
46
43
|
def raise_errors_if_needed!
|
47
44
|
return unless Capybara::Chromedriver::Logger.raise_js_errors?
|
48
45
|
return if errors.empty?
|