autopsy 0.0.6 → 0.1.0
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 +22 -14
- data/lib/autopsy/cucumber.rb +12 -2
- data/lib/autopsy/poltergeist.rb +18 -0
- data/lib/autopsy/rspec.rb +1 -1
- data/lib/autopsy/webkit.rb +7 -0
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22e4947e2a2732dab014286a51a11ea34bb4f526
|
4
|
+
data.tar.gz: 325a896f4d89de7f3c8f4e6d331036bd54993b03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c76004de73430501663874c5f5f49b1c679065723cc8b7c1b080dae20926178045ae8e2c3758f997afa8fb5dbb01d0675c10e5d387864a728d487e7c4271e3c0
|
7
|
+
data.tar.gz: 179741c94b593fb861e06cfdb0a4d54568aae76b8c5247eab084ad7843257bd4e8ee8cf994f8dd86c3c7e84c478b8de8a6d10dab43a54bd934841c80c9f78ea1
|
data/lib/autopsy.rb
CHANGED
@@ -1,25 +1,33 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require 'capybara/rspec'
|
3
1
|
require 'awesome_print'
|
2
|
+
require 'capybara'
|
3
|
+
require_relative 'autopsy/webkit'
|
4
|
+
require_relative 'autopsy/poltergeist'
|
4
5
|
|
5
6
|
class Autopsy
|
6
7
|
class << self
|
7
8
|
attr_accessor :artifacts_path
|
9
|
+
end
|
10
|
+
|
11
|
+
@@driver_map = {
|
12
|
+
webkit: AutopsyWebkit,
|
13
|
+
poltergeist: AutopsyPoltergeist
|
14
|
+
}
|
8
15
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
16
|
+
def self.perform(capybara_page, test_base, exception)
|
17
|
+
file_base = "#{File.expand_path(Autopsy.artifacts_path)}/#{test_base}"
|
18
|
+
if exception != nil
|
19
|
+
capybara_page.save_screenshot "#{file_base}.png"
|
20
|
+
capybara_page.save_page "#{file_base}.html"
|
21
|
+
if (@@driver_map[Capybara.current_driver])
|
22
|
+
msgs = @@driver_map[Capybara.current_driver].get_console_messages(capybara_page).ai(html: true)
|
15
23
|
File.open("#{file_base}_msgs.html", 'w') {|f| f.write(msgs) }
|
16
|
-
|
17
|
-
|
24
|
+
end
|
25
|
+
File.open("#{file_base}_error.log", 'w') do |f|
|
26
|
+
f.write exception.message
|
27
|
+
f.write "\n"
|
28
|
+
(exception.backtrace || []).each do |l|
|
29
|
+
f.write l
|
18
30
|
f.write "\n"
|
19
|
-
(exception.backtrace || []).each do |l|
|
20
|
-
f.write l
|
21
|
-
f.write "\n"
|
22
|
-
end
|
23
31
|
end
|
24
32
|
end
|
25
33
|
end
|
data/lib/autopsy/cucumber.rb
CHANGED
@@ -5,8 +5,18 @@ Autopsy.artifacts_path = "./features/artifacts"
|
|
5
5
|
|
6
6
|
After do |scenario|
|
7
7
|
if scenario.failed?
|
8
|
-
|
9
|
-
|
8
|
+
location = if (scenario.respond_to? :location)
|
9
|
+
scenario.location
|
10
|
+
else
|
11
|
+
scenario
|
12
|
+
end
|
13
|
+
file_base = "#{location.file.split("/").last.split(".").first}-#{location.line}"
|
14
|
+
exception = if (scenario.respond_to? :exception)
|
15
|
+
scenario.exception
|
16
|
+
else
|
17
|
+
scenario.instance_variable_get("@result").exception ## boo cucumber bug
|
18
|
+
end
|
19
|
+
Autopsy.perform(page, file_base, exception)
|
10
20
|
end
|
11
21
|
end
|
12
22
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class AutopsyPoltergeist
|
2
|
+
class << self
|
3
|
+
def init(options = {})
|
4
|
+
@log = StringIO.new
|
5
|
+
Capybara.register_driver :poltergeist do |app|
|
6
|
+
Capybara::Poltergeist::Driver.new(app, options.merge(logger: @log))
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def get_console_messages(capybara_page)
|
11
|
+
lines = []
|
12
|
+
@log.each_line do |line|
|
13
|
+
lines << line
|
14
|
+
end
|
15
|
+
lines
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/autopsy/rspec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autopsy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Will Pleasant-Ryan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|
@@ -26,15 +26,17 @@ dependencies:
|
|
26
26
|
version: '0'
|
27
27
|
description: See error messages, screenshots, current HTML, and current Javascript
|
28
28
|
console messages on feature test failures.
|
29
|
-
email:
|
29
|
+
email: will.ryan@atomicobject.com
|
30
30
|
executables: []
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
34
|
- lib/autopsy.rb
|
35
35
|
- lib/autopsy/cucumber.rb
|
36
|
+
- lib/autopsy/poltergeist.rb
|
36
37
|
- lib/autopsy/rspec.rb
|
37
|
-
|
38
|
+
- lib/autopsy/webkit.rb
|
39
|
+
homepage: https://github.com/atomicobject/autopsy
|
38
40
|
licenses:
|
39
41
|
- MIT
|
40
42
|
metadata: {}
|
@@ -54,8 +56,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
56
|
version: '0'
|
55
57
|
requirements: []
|
56
58
|
rubyforge_project:
|
57
|
-
rubygems_version: 2.
|
59
|
+
rubygems_version: 2.4.5
|
58
60
|
signing_key:
|
59
61
|
specification_version: 4
|
60
|
-
summary: Emit helpful artifacts for failed Capybara
|
62
|
+
summary: Emit helpful artifacts for failed Capybara feature tests
|
61
63
|
test_files: []
|