tddium_reporting 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,9 @@
1
1
  # Copyright (c) 2011 Solano Labs All Rights Reserved
2
2
  require File.expand_path(File.dirname(__FILE__) + "/tddium_reporting/system_capture")
3
3
  require File.expand_path(File.dirname(__FILE__) + "/tddium_reporting/spec_runner")
4
+ require File.expand_path(File.dirname(__FILE__) + "/tddium_reporting/exec_path")
4
5
 
6
+ # Configure RSpec selenium 1 capture
5
7
  spec_runner = TddiumReporting::SpecRunner.runner
6
8
  if spec_runner && ENV["TDDIUM"] && spec_runner.respond_to?(:configure)
7
9
  spec_runner.configure do |config|
@@ -18,3 +20,4 @@ if spec_runner && ENV["TDDIUM"] && spec_runner.respond_to?(:configure)
18
20
  end
19
21
  end
20
22
  end
23
+
@@ -0,0 +1,30 @@
1
+ # Copyright (c) 2011 Solano Labs Inc. All Rights Reserved.
2
+
3
+ require "tddium_reporting/exec_path"
4
+ require "tddium_reporting/respond_to_chain"
5
+
6
+ #
7
+ # Configure Cucumber capture of Capybara HTML, Selenium / Webkit Screenshots
8
+ #
9
+
10
+ if ENV['TDDIUM']
11
+ include TddiumReporting::PathHelper
12
+ include TddiumReporting::RespondToChain
13
+ begin
14
+ Capybara.save_and_open_page_path = test_exec_path
15
+ After do |scenario|
16
+ if scenario.failed?
17
+ html_path = save_page
18
+ save_base = html_path.gsub(/.html$/,".png")
19
+ if respond_to_chain?(page, :driver, :browser, :save_screenshot)
20
+ page.driver.browser.save_screenshot(save_base + "-selenium.png")
21
+ end
22
+ if respond_to_chain?(page, :driver, :render)
23
+ page.driver.render(save_base + "-webkit.png")
24
+ end
25
+ end
26
+ end
27
+ rescue => e
28
+ STDERR.puts "Error installing tddium reporting hooks: #{e}"
29
+ end
30
+ end
@@ -0,0 +1,9 @@
1
+ # Copyright (c) 2011 Solano Labs All Rights Reserved
2
+
3
+ module TddiumReporting
4
+ module PathHelper
5
+ def test_exec_path
6
+ File.expand_path("~/results/#{ENV['TDDIUM_SESSION_ID']}/#{ENV['TDDIUM_TEST_EXEC_ID']}/")
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,14 @@
1
+ # Copyright (c) 2011 Solano Labs All Rights Reserved
2
+
3
+ module TddiumReporting
4
+ module RespondToChain
5
+ def respond_to_chain?(subject, *chain)
6
+ chain.each do |k|
7
+ return false unless subject.respond_to?(k)
8
+ subject = subject.send(k)
9
+ end
10
+ true
11
+ end
12
+ end
13
+ end
14
+
@@ -1,9 +1,11 @@
1
1
  # Copyright (c) 2011 Solano Labs All Rights Reserved
2
2
  #
3
3
  require 'base64'
4
+ require File.expand_path(File.dirname(__FILE__) + "/exec_path")
4
5
 
5
6
  module TddiumReporting
6
7
  class SystemCapture
8
+ include TddiumReporting::PathHelper
7
9
  attr_reader :example_id
8
10
 
9
11
  def initialize(selenium_driver, example)
@@ -17,7 +19,7 @@ module TddiumReporting
17
19
  end
18
20
 
19
21
  def path_for(thing)
20
- File.expand_path("~/results/#{ENV['TDDIUM_SESSION_ID']}/#{ENV['TDDIUM_TEST_EXEC_ID']}/#{@example_id}-#{thing}.#{@things[thing]}")
22
+ test_exec_path + "#{@example_id}-#{thing}.#{@things[thing]}"
21
23
  end
22
24
 
23
25
  def capture_system_state
@@ -1,4 +1,4 @@
1
1
  # Copyright (c) 2011 Solano Labs All Rights Reserved
2
2
  module TddiumReporting
3
- VERSION = '0.0.5'
3
+ VERSION = '0.0.6'
4
4
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: tddium_reporting
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.5
5
+ version: 0.0.6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Solano Labs
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-09-23 00:00:00 Z
13
+ date: 2011-10-01 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
@@ -45,6 +45,9 @@ extra_rdoc_files: []
45
45
 
46
46
  files:
47
47
  - lib/tddium_reporting.rb
48
+ - lib/tddium_reporting/cucumber.rb
49
+ - lib/tddium_reporting/exec_path.rb
50
+ - lib/tddium_reporting/respond_to_chain.rb
48
51
  - lib/tddium_reporting/spec_runner.rb
49
52
  - lib/tddium_reporting/system_capture.rb
50
53
  - lib/tddium_reporting/version.rb