watirsplash 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/History.rdoc CHANGED
@@ -1,3 +1,9 @@
1
+ === Version 0.2.5 / 2010-08-19
2
+
3
+ * #click_no_wait performance improved by 2-3x - see more from http://jira.openqa.org/browse/WTR-449
4
+ * spec's relative filename with line number and date is shown in example_group name in the report
5
+ * only time is shown in example name in the report
6
+
1
7
  === Version 0.2.4 / 2010-07-30
2
8
 
3
9
  * timestamp is now inserted into example names
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.4
1
+ 0.2.5
@@ -30,12 +30,13 @@ module WatirSplash
30
30
 
31
31
  def example_group_started(example_group) # :nodoc:
32
32
  @files_saved_during_example.clear
33
+ append_extra_information_to_desc(example_group)
33
34
  super
34
35
  end
35
36
 
36
37
  def example_started(example) # :nodoc:
37
38
  @files_saved_during_example.clear
38
- example.description << " (#{Time.now.strftime("%H:%M %d.%m")})"
39
+ example.description += "#{example.location.scan(/:\d+$/)} (#{Time.now.strftime("%H:%M:%S")})"
39
40
  super
40
41
  end
41
42
 
@@ -128,5 +129,15 @@ module WatirSplash
128
129
  end
129
130
  end
130
131
 
132
+ def append_extra_information_to_desc(example_group)
133
+ date = Time.now.strftime("%d.%m.%Y")
134
+ spec_dir = Pathname.new(example_group.location)
135
+ relative_spec_path = spec_dir.relative_path_from(Pathname.new(Dir.pwd + "/spec")).to_s
136
+ appended_description = " @ #{relative_spec_path}#{example_group.location.scan(/:\d+$/)} (#{date})"
137
+ example_group.description += appended_description
138
+ # needed for NestedTextFormatter
139
+ example_group.nested_descriptions.map! {|nested_description| nested_description + appended_description}
140
+ end
141
+
131
142
  end
132
143
  end
@@ -16,6 +16,10 @@ module Spec #:nodoc:all
16
16
  end
17
17
 
18
18
  module Example
19
+ class ExampleGroupProxy
20
+ attr_accessor :description
21
+ end
22
+
19
23
  class ExampleProxy
20
24
  attr_accessor :description
21
25
  end
@@ -93,19 +93,37 @@ module Watir
93
93
  def style
94
94
  currentstyle
95
95
  end
96
+
97
+ def click_no_wait
98
+ assert_enabled
99
+
100
+ highlight(:set)
101
+ element = "#{self.class}.new(#{@page_container.attach_command}, :unique_number, #{self.unique_number})"
102
+ @page_container.click_no_wait(element)
103
+ highlight(:clear)
104
+ end
96
105
  end
97
106
 
98
107
  module PageContainer #:nodoc:all
99
- # patch for .click_no_wait
100
- def eval_in_spawned_process(command)
101
- command.strip!
102
- ruby_code = "require 'rubygems';"
103
- ruby_code << "require 'watir/ie';"
104
- ruby_code << "pc = #{attach_command};"
105
- ruby_code << "pc.instance_eval(#{command.inspect});"
106
- exec_string = "start rubyw -e #{ruby_code.inspect}".gsub("\\\"", "'")
107
- system(exec_string)
108
+ def click_no_wait(element)
109
+ ruby_code = "require 'rubygems';" <<
110
+ "require '#{File.expand_path(File.dirname(__FILE__))}/watir_core';" <<
111
+ "#{element}.click!"
112
+ system(spawned_click_no_wait_command(ruby_code))
113
+ end
114
+
115
+ def spawned_click_no_wait_command(command)
116
+ unless $VERBOSE
117
+ "start rubyw -e #{command.inspect}"
118
+ else
119
+ puts "#click_no_wait command:"
120
+ command = "ruby -e #{command.inspect}"
121
+ puts command
122
+ command
123
+ end
108
124
  end
125
+
126
+ private :spawned_click_no_wait_command
109
127
  end
110
128
 
111
129
  class Table < Element
@@ -0,0 +1,79 @@
1
+ # these require statements are needed for Watir
2
+ # to work with minimum functionality
3
+ #
4
+ # this is needed for #click_no_wait to perform faster
5
+ module Watir
6
+ # dummy modules for patching
7
+ module Win32
8
+ end
9
+
10
+ module Utils
11
+ end
12
+ end
13
+
14
+
15
+ require 'watir/win32ole'
16
+ require 'logger'
17
+ require 'watir/exceptions'
18
+ require 'watir/matches'
19
+
20
+ require 'watir/core_ext'
21
+ require 'watir/logger'
22
+ require 'watir/container'
23
+ require 'watir/locator'
24
+ require 'watir/page-container'
25
+ require 'watir/ie-class'
26
+ require 'watir/element'
27
+ require 'watir/element_collections'
28
+ require 'watir/form'
29
+ require 'watir/non_control_elements'
30
+ require 'watir/input_elements'
31
+ require 'watir/table'
32
+ require 'watir/image'
33
+ require 'watir/link'
34
+ begin
35
+ require 'watir/html_element'
36
+ rescue LoadError
37
+ # this exists currently only on github
38
+ end
39
+
40
+ require 'watir/waiter'
41
+
42
+ # watir/module
43
+ module Watir
44
+ include Watir::Exception
45
+
46
+ # Directory containing the watir.rb file
47
+ @@dir = File.expand_path(File.dirname(__FILE__))
48
+
49
+ ATTACHER = Waiter.new
50
+ # Like regular Ruby "until", except that a TimeOutException is raised
51
+ # if the timeout is exceeded. Timeout is IE.attach_timeout.
52
+ def self.until_with_timeout # block
53
+ ATTACHER.timeout = IE.attach_timeout
54
+ ATTACHER.wait_until { yield }
55
+ end
56
+
57
+ @@autoit = nil
58
+
59
+ def self.autoit
60
+ unless @@autoit
61
+ begin
62
+ @@autoit = WIN32OLE.new('AutoItX3.Control')
63
+ rescue WIN32OLERuntimeError
64
+ _register('AutoItX3.dll')
65
+ @@autoit = WIN32OLE.new('AutoItX3.Control')
66
+ end
67
+ end
68
+ @@autoit
69
+ end
70
+
71
+ def self._register(dll)
72
+ system("regsvr32.exe /s " + "#{@@dir}/#{dll}".gsub('/', '\\'))
73
+ end
74
+
75
+ def self._unregister(dll)
76
+ system("regsvr32.exe /s /u " + "#{@@dir}/#{dll}".gsub('/', '\\'))
77
+ end
78
+
79
+ end
@@ -30,7 +30,7 @@ describe WatirSplash::SpecHelper do
30
30
  result.should be_false
31
31
  end
32
32
 
33
- it "has file_path methods formatter" do
33
+ it "has file_path methods" do
34
34
  file_name = "blah.temp"
35
35
  ext = File.extname(file_name)
36
36
  base = File.basename(file_name, ext)
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watirsplash
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 29
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 2
8
- - 4
9
- version: 0.2.4
9
+ - 5
10
+ version: 0.2.5
10
11
  platform: ruby
11
12
  authors:
12
13
  - Jarmo Pertman
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-07-30 00:00:00 +03:00
18
+ date: 2010-08-19 00:00:00 +03:00
18
19
  default_executable: watirsplash
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: watir
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 5
27
30
  segments:
28
31
  - 1
29
32
  - 6
@@ -35,9 +38,11 @@ dependencies:
35
38
  name: rspec
36
39
  prerelease: false
37
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
38
42
  requirements:
39
43
  - - ">="
40
44
  - !ruby/object:Gem::Version
45
+ hash: 27
41
46
  segments:
42
47
  - 1
43
48
  - 3
@@ -49,9 +54,11 @@ dependencies:
49
54
  name: diff-lcs
50
55
  prerelease: false
51
56
  requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
52
58
  requirements:
53
59
  - - ">="
54
60
  - !ruby/object:Gem::Version
61
+ hash: 3
55
62
  segments:
56
63
  - 0
57
64
  version: "0"
@@ -61,9 +68,11 @@ dependencies:
61
68
  name: require_all
62
69
  prerelease: false
63
70
  requirement: &id004 !ruby/object:Gem::Requirement
71
+ none: false
64
72
  requirements:
65
73
  - - ">="
66
74
  - !ruby/object:Gem::Version
75
+ hash: 3
67
76
  segments:
68
77
  - 0
69
78
  version: "0"
@@ -73,9 +82,11 @@ dependencies:
73
82
  name: rmagick
74
83
  prerelease: false
75
84
  requirement: &id005 !ruby/object:Gem::Requirement
85
+ none: false
76
86
  requirements:
77
87
  - - ">="
78
88
  - !ruby/object:Gem::Version
89
+ hash: 3
79
90
  segments:
80
91
  - 0
81
92
  version: "0"
@@ -85,9 +96,11 @@ dependencies:
85
96
  name: syntax
86
97
  prerelease: false
87
98
  requirement: &id006 !ruby/object:Gem::Requirement
99
+ none: false
88
100
  requirements:
89
101
  - - ">="
90
102
  - !ruby/object:Gem::Version
103
+ hash: 3
91
104
  segments:
92
105
  - 0
93
106
  version: "0"
@@ -97,9 +110,11 @@ dependencies:
97
110
  name: win32console
98
111
  prerelease: false
99
112
  requirement: &id007 !ruby/object:Gem::Requirement
113
+ none: false
100
114
  requirements:
101
115
  - - ">="
102
116
  - !ruby/object:Gem::Version
117
+ hash: 3
103
118
  segments:
104
119
  - 0
105
120
  version: "0"
@@ -109,9 +124,11 @@ dependencies:
109
124
  name: win32screenshot
110
125
  prerelease: false
111
126
  requirement: &id008 !ruby/object:Gem::Requirement
127
+ none: false
112
128
  requirements:
113
129
  - - ">="
114
130
  - !ruby/object:Gem::Version
131
+ hash: 23
115
132
  segments:
116
133
  - 0
117
134
  - 0
@@ -136,7 +153,6 @@ files:
136
153
  - Rakefile
137
154
  - VERSION
138
155
  - bin/watirsplash
139
- - click_no_wait.txt
140
156
  - lib/watirsplash.rb
141
157
  - lib/watirsplash/autoit_helper.rb
142
158
  - lib/watirsplash/generator.rb
@@ -146,6 +162,7 @@ files:
146
162
  - lib/watirsplash/util.rb
147
163
  - lib/watirsplash/waiter.rb
148
164
  - lib/watirsplash/watir.rb
165
+ - lib/watirsplash/watir_core.rb
149
166
  - spec/spec.opts
150
167
  - spec/spec_helper_spec.rb
151
168
  - spec/spec_match_array_spec.rb
@@ -168,7 +185,7 @@ licenses: []
168
185
  post_install_message: |-
169
186
  *************************
170
187
 
171
- Thank you for installing WatirSplash 0.2.4! Don't forget to take a look at README and History files!
188
+ Thank you for installing WatirSplash 0.2.5! Don't forget to take a look at README and History files!
172
189
 
173
190
  Execute "watirsplash generate" under your project's directory to generate default project structure.
174
191
 
@@ -184,26 +201,30 @@ rdoc_options:
184
201
  require_paths:
185
202
  - lib
186
203
  required_ruby_version: !ruby/object:Gem::Requirement
204
+ none: false
187
205
  requirements:
188
206
  - - ">="
189
207
  - !ruby/object:Gem::Version
208
+ hash: 3
190
209
  segments:
191
210
  - 0
192
211
  version: "0"
193
212
  required_rubygems_version: !ruby/object:Gem::Requirement
213
+ none: false
194
214
  requirements:
195
215
  - - ">="
196
216
  - !ruby/object:Gem::Version
217
+ hash: 3
197
218
  segments:
198
219
  - 0
199
220
  version: "0"
200
221
  requirements: []
201
222
 
202
223
  rubyforge_project:
203
- rubygems_version: 1.3.6
224
+ rubygems_version: 1.3.7
204
225
  signing_key:
205
226
  specification_version: 3
206
- summary: watirsplash 0.2.4
227
+ summary: watirsplash 0.2.5
207
228
  test_files:
208
229
  - spec/spec_helper_spec.rb
209
230
  - spec/spec_match_array_spec.rb
data/click_no_wait.txt DELETED
@@ -1 +0,0 @@
1
- ruby -e "temp = Array.new(['c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/win32ole', 'c:/ruby/lib/ruby/gems/1.8/gems/json_pure-1.2.2/bin', 'c:/ruby/lib/ruby/gems/1.8/gems/json_pure-1.2.2/lib', 'c:/ruby/lib/ruby/gems/1.8/gems/gemcutter-0.5.0/bin', 'c:/ruby/lib/ruby/gems/1.8/gems/gemcutter-0.5.0/lib', 'c:/ruby/lib/ruby/gems/1.8/gems/xml-simple-1.0.12/bin', 'c:/ruby/lib/ruby/gems/1.8/gems/xml-simple-1.0.12/lib', 'c:/ruby/lib/ruby/gems/1.8/gems/rubyforge-2.0.4/bin', 'c:/ruby/lib/ruby/gems/1.8/gems/rubyforge-2.0.4/lib', 'c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/bin', 'c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib', 'c:/ruby/lib/ruby/gems/1.8/gems/hoe-2.5.0/bin', 'c:/ruby/lib/ruby/gems/1.8/gems/hoe-2.5.0/lib', 'c:/ruby/lib/ruby/gems/1.8/gems/s4t-utils-1.0.4/bin', 'c:/ruby/lib/ruby/gems/1.8/gems/s4t-utils-1.0.4/lib', 'c:/ruby/lib/ruby/gems/1.8/gems/builder-2.1.2/bin', 'c:/ruby/lib/ruby/gems/1.8/gems/builder-2.1.2/lib', 'c:/ruby/lib/ruby/gems/1.8/gems/user-choices-1.1.6.1/bin', 'c:/ruby/lib/ruby/gems/1.8/gems/user-choices-1.1.6.1/lib', 'c:/ruby/lib/ruby/gems/1.8/gems/commonwatir-1.6.5/bin', 'c:/ruby/lib/ruby/gems/1.8/gems/commonwatir-1.6.5/lib', 'c:/ruby/lib/ruby/gems/1.8/gems/win32-api-1.4.6-x86-mingw32/bin', 'c:/ruby/lib/ruby/gems/1.8/gems/win32-api-1.4.6-x86-mingw32/lib', 'c:/ruby/lib/ruby/gems/1.8/gems/windows-api-0.4.0/bin', 'c:/ruby/lib/ruby/gems/1.8/gems/windows-api-0.4.0/lib', 'c:/ruby/lib/ruby/gems/1.8/gems/windows-pr-1.0.9/bin', 'c:/ruby/lib/ruby/gems/1.8/gems/windows-pr-1.0.9/lib', 'c:/ruby/lib/ruby/gems/1.8/gems/win32-process-0.6.2/bin', 'c:/ruby/lib/ruby/gems/1.8/gems/win32-process-0.6.2/lib', 'c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/bin', 'c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib', 'c:/ruby/lib/ruby/gems/1.8/gems/firewatir-1.6.5/bin', 'c:/ruby/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib', 'c:/ruby/lib/ruby/gems/1.8/gems/nokogiri-1.4.1-x86-mingw32/bin', 'c:/ruby/lib/ruby/gems/1.8/gems/nokogiri-1.4.1-x86-mingw32/lib', 'c:/ruby/lib/ruby/gems/1.8/gems/nokogiri-1.4.1-x86-mingw32/ext', 'c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/bin', 'c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib', 'c:/ruby/lib/ruby/site_ruby/1.8', 'c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt', 'c:/ruby/lib/ruby/site_ruby', 'c:/ruby/lib/ruby/1.8', 'c:/ruby/lib/ruby/1.8/i386-mingw32', '.']); $LOAD_PATH.clear; temp.each {|element| $LOAD_PATH << element}; require 'watir/ie'; pc = Watir::IE.attach(:hwnd, 1247126); pc.instance_eval('Watir::Button.new(self, :unique_number, 1).click!')"