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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 22e4947e2a2732dab014286a51a11ea34bb4f526
4
- data.tar.gz: 325a896f4d89de7f3c8f4e6d331036bd54993b03
3
+ metadata.gz: f0b16f9c48ab4c0fe15c28b5356a2756f1c28d77
4
+ data.tar.gz: 65f31ac0e558fa1b0a11f816d4addfa34a5616b8
5
5
  SHA512:
6
- metadata.gz: c76004de73430501663874c5f5f49b1c679065723cc8b7c1b080dae20926178045ae8e2c3758f997afa8fb5dbb01d0675c10e5d387864a728d487e7c4271e3c0
7
- data.tar.gz: 179741c94b593fb861e06cfdb0a4d54568aae76b8c5247eab084ad7843257bd4e8ee8cf994f8dd86c3c7e84c478b8de8a6d10dab43a54bd934841c80c9f78ea1
6
+ metadata.gz: 0ffc9e90117ecd9e673b3cf0c66ae7a71dc65942a9100dd25e0ff00f6260e86e02dbf088a4bc76acd91e09d8afea218f07234b4d3164e294f33292959289c252
7
+ data.tar.gz: cd0e5887786b251791b6602b7d5aedd8874308ce0ca7192c8589e1c605ae11ee5c869e799f942c9605a791753bcb262ff880ce7981c93904e50765fb8f0cc893
@@ -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
- @@driver_map = {
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 (@@driver_map[Capybara.current_driver])
22
- msgs = @@driver_map[Capybara.current_driver].get_console_messages(capybara_page).ai(html: true)
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
+ }
@@ -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 :poltergeist do |app|
6
- Capybara::Poltergeist::Driver.new(app, options.merge(logger: @log))
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autopsy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Will Pleasant-Ryan