rwebspec 1.9.2 → 1.9.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,7 +1,10 @@
1
1
  CHANGELOG
2
2
  =========
3
+ 1.9.3
4
+ [Enhacement] take_screenshot with to_dir arguments
5
+
3
6
  1.9.2
4
- [] TestWise 2
7
+ [Update] TestWise 2 Constants
5
8
 
6
9
  1.9.1
7
10
  [Fix] test_utils sentences and paragraphs
data/Rakefile CHANGED
@@ -70,7 +70,7 @@ end
70
70
  spec = Gem::Specification.new do |s|
71
71
  s.platform= Gem::Platform::RUBY
72
72
  s.name = "rwebspec"
73
- s.version = "1.9.2"
73
+ s.version = "1.9.3"
74
74
  s.summary = "Executable functional specification for web applications in RSpec syntax and Watir"
75
75
  s.description = "Executable functional specification for web applications in RSpec syntax and Watir"
76
76
 
@@ -974,15 +974,20 @@ module RWebSpec
974
974
  end
975
975
  end
976
976
 
977
+
977
978
  # use win32screenshot library to save curernt active window, which shall be IE
978
979
  #
979
- def take_screenshot
980
- # puts "calling new take screenshot"
981
- if $testwise_screenshot_supported && is_windows?
982
- # puts "testwise supported: #{$testwise_screenshot_supported}"
980
+ # opts[:to_dir] => the direcotry to save image under
981
+ def take_screenshot(opts = {})
982
+ # puts "calling new take screenshot: #{$screenshot_supported}"
983
+ unless $screenshot_supported
984
+ puts " [WARN] Screenhost not supported, check whether win32screenshot gem is installed"
985
+ return
986
+ end
987
+
983
988
  begin
984
989
  screenshot_image_filename = "screenshot_" + Time.now.strftime("%m%d%H%M%S") + ".jpg"
985
- the_dump_dir = default_dump_dir
990
+ the_dump_dir = opts[:to_dir] || default_dump_dir
986
991
  FileUtils.mkdir_p(the_dump_dir) unless File.exists?(the_dump_dir)
987
992
  screenshot_image_filepath = File.join(the_dump_dir, screenshot_image_filename)
988
993
  screenshot_image_filepath.gsub!("/", "\\") if is_windows?
@@ -991,7 +996,7 @@ module RWebSpec
991
996
 
992
997
  if is_firefox? then
993
998
  Win32::Screenshot::Take.of(:window, :title => /mozilla\sfirefox/i).write(screenshot_image_filepath)
994
- elsif ie
999
+ elsif ie
995
1000
  Win32::Screenshot::Take.of(:window, :title => /internet\sexplorer/i).write(screenshot_image_filepath)
996
1001
  else
997
1002
  Win32::Screenshot::Take.of(:foreground).write(screenshot_image_filepath)
@@ -1000,10 +1005,9 @@ module RWebSpec
1000
1005
  rescue => e
1001
1006
  puts "error on taking screenshot: #{e}"
1002
1007
  end
1003
- end
1008
+
1004
1009
  end
1005
-
1006
- # end of methods
1010
+ # end of methods
1007
1011
 
1008
1012
  end
1009
1013
 
data/lib/rwebspec.rb CHANGED
@@ -24,14 +24,14 @@ require 'active_support/core_ext'
24
24
  require 'spec'
25
25
 
26
26
  unless defined? RWEBSPEC_VERSION
27
- RWEBSPEC_VERSION = RWEBUNIT_VERSION = "1.8.2"
27
+ RWEBSPEC_VERSION = RWEBUNIT_VERSION = "1.9.3"
28
28
  end
29
29
 
30
- if RUBY_PLATFORM =~ /mswin/ or RUBY_PLATFORM =~ /mingw/
31
- $testwise_screenshot_supported = false
30
+ if RUBY_PLATFORM =~ /mswin/ or RUBY_PLATFORM =~ /mingw/
31
+ $screenshot_supported = false
32
32
  begin
33
33
  require 'win32/screenshot'
34
- $testwise_screenshot_supported = true
34
+ $screenshot_supported = true
35
35
  rescue LoadError => no_screen_library_error
36
36
  end
37
37
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 9
8
- - 2
9
- version: 1.9.2
8
+ - 3
9
+ version: 1.9.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Zhimin Zhan
@@ -14,7 +14,7 @@ autorequire: rwebspec
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-08-18 00:00:00 +10:00
17
+ date: 2011-10-02 00:00:00 +10:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency