autopsy 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/autopsy.rb +8 -7
- data/lib/autopsy/poltergeist.rb +7 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0b16f9c48ab4c0fe15c28b5356a2756f1c28d77
|
4
|
+
data.tar.gz: 65f31ac0e558fa1b0a11f816d4addfa34a5616b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ffc9e90117ecd9e673b3cf0c66ae7a71dc65942a9100dd25e0ff00f6260e86e02dbf088a4bc76acd91e09d8afea218f07234b4d3164e294f33292959289c252
|
7
|
+
data.tar.gz: cd0e5887786b251791b6602b7d5aedd8874308ce0ca7192c8589e1c605ae11ee5c869e799f942c9605a791753bcb262ff880ce7981c93904e50765fb8f0cc893
|
data/lib/autopsy.rb
CHANGED
@@ -6,20 +6,18 @@ require_relative 'autopsy/poltergeist'
|
|
6
6
|
class Autopsy
|
7
7
|
class << self
|
8
8
|
attr_accessor :artifacts_path
|
9
|
+
attr_accessor :driver_console_messages_map
|
9
10
|
end
|
10
11
|
|
11
|
-
|
12
|
-
webkit: AutopsyWebkit,
|
13
|
-
poltergeist: AutopsyPoltergeist
|
14
|
-
}
|
12
|
+
|
15
13
|
|
16
14
|
def self.perform(capybara_page, test_base, exception)
|
17
15
|
file_base = "#{File.expand_path(Autopsy.artifacts_path)}/#{test_base}"
|
18
16
|
if exception != nil
|
19
17
|
capybara_page.save_screenshot "#{file_base}.png"
|
20
18
|
capybara_page.save_page "#{file_base}.html"
|
21
|
-
if (
|
22
|
-
msgs =
|
19
|
+
if (Autopsy.driver_console_messages_map[Capybara.current_driver])
|
20
|
+
msgs = Autopsy.driver_console_messages_map[Capybara.current_driver].get_console_messages(capybara_page).ai(html: true)
|
23
21
|
File.open("#{file_base}_msgs.html", 'w') {|f| f.write(msgs) }
|
24
22
|
end
|
25
23
|
File.open("#{file_base}_error.log", 'w') do |f|
|
@@ -35,4 +33,7 @@ class Autopsy
|
|
35
33
|
end
|
36
34
|
|
37
35
|
Autopsy.artifacts_path = "." # default
|
38
|
-
|
36
|
+
Autopsy.driver_console_messages_map = {
|
37
|
+
webkit: AutopsyWebkit,
|
38
|
+
poltergeist: AutopsyPoltergeist
|
39
|
+
}
|
data/lib/autopsy/poltergeist.rb
CHANGED
@@ -1,18 +1,17 @@
|
|
1
|
+
require 'autopsy'
|
2
|
+
|
1
3
|
class AutopsyPoltergeist
|
2
4
|
class << self
|
3
|
-
def init(options = {})
|
5
|
+
def init(name=:poltergeist, options = {})
|
6
|
+
Autopsy.driver_console_messages_map[name] = AutopsyPoltergeist
|
4
7
|
@log = StringIO.new
|
5
|
-
Capybara.register_driver
|
6
|
-
Capybara::Poltergeist::Driver.new(app, options.merge(
|
8
|
+
Capybara.register_driver name do |app|
|
9
|
+
Capybara::Poltergeist::Driver.new(app, options.merge(phantomjs_logger: @log))
|
7
10
|
end
|
8
11
|
end
|
9
12
|
|
10
13
|
def get_console_messages(capybara_page)
|
11
|
-
lines
|
12
|
-
@log.each_line do |line|
|
13
|
-
lines << line
|
14
|
-
end
|
15
|
-
lines
|
14
|
+
@log.string.lines
|
16
15
|
end
|
17
16
|
end
|
18
17
|
end
|