watirsplash 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +7 -0
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/click_no_wait.txt +1 -0
- data/lib/watirsplash.rb +1 -1
- data/lib/watirsplash/autoit_helper.rb +56 -0
- data/lib/watirsplash/html_formatter.rb +11 -6
- data/lib/watirsplash/spec.rb +6 -0
- data/templates/project/environment.rb +4 -5
- data/templates/project/{application_helper.rb → spec/application_helper.rb} +0 -0
- metadata +8 -7
- data/lib/watirsplash/autoit.rb +0 -54
data/History.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -132,11 +132,11 @@ After that the directory structure will be something like this:
|
|
132
132
|
└───spec
|
133
133
|
|
134
134
|
The contents of that ui-test directory will be:
|
135
|
-
ui-test\application_helper.rb
|
136
135
|
ui-test\config.rb
|
137
136
|
ui-test\environment.rb
|
138
137
|
|
139
138
|
ui-test\spec
|
139
|
+
ui-test\spec\application_helper.rb
|
140
140
|
ui-test\spec\dummy_spec.rb
|
141
141
|
ui-test\spec\spec.opts
|
142
142
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.4
|
data/click_no_wait.txt
ADDED
@@ -0,0 +1 @@
|
|
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!')"
|
data/lib/watirsplash.rb
CHANGED
@@ -7,7 +7,7 @@ require_rel "watirsplash/waiter"
|
|
7
7
|
require_rel "watirsplash/spec_helper"
|
8
8
|
require_rel "watirsplash/spec"
|
9
9
|
require_rel "watirsplash/watir"
|
10
|
-
require_rel "watirsplash/
|
10
|
+
require_rel "watirsplash/autoit_helper"
|
11
11
|
require_rel "watirsplash/util"
|
12
12
|
WatirSplash::Util.load_environment
|
13
13
|
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module WatirSplash
|
2
|
+
# Helper class for AutoIt
|
3
|
+
class AutoItHelper
|
4
|
+
extend WatirSplash::Waiter
|
5
|
+
|
6
|
+
@@autoit = Watir.autoit
|
7
|
+
|
8
|
+
class << self
|
9
|
+
# clicks save button on window with specified title,
|
10
|
+
# activates window automatically and makes sure that the click
|
11
|
+
# was successful
|
12
|
+
def click_save(window_title="File Download")
|
13
|
+
click_button(window_title, "&Save")
|
14
|
+
end
|
15
|
+
|
16
|
+
# sets edit field value to field_value on window with specified title,
|
17
|
+
# activates window automatically and makes sure that the field's
|
18
|
+
# value got changed
|
19
|
+
def set_edit(field_value, window_title="Save As")
|
20
|
+
set_field(window_title, "Edit1", field_value)
|
21
|
+
end
|
22
|
+
|
23
|
+
# sets specified field's value on window with specified title,
|
24
|
+
# activates window automatically and makes sure that the field's
|
25
|
+
# value got changed
|
26
|
+
def set_field(window_title, field_name, field_value)
|
27
|
+
wait_until do
|
28
|
+
activate_window(window_title) &&
|
29
|
+
@@autoit.ControlFocus(window_title, "", field_name) == 1 &&
|
30
|
+
@@autoit.ControlSetText(window_title, "", field_name, field_value) == 1 &&
|
31
|
+
@@autoit.ControlGetText(window_title, "", field_name) == field_value
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# clicks specified button on window with specified title,
|
36
|
+
# activates window automatically and makes sure that the click
|
37
|
+
# was successful
|
38
|
+
def click_button(window_title, button_name)
|
39
|
+
wait_until do
|
40
|
+
activate_window(window_title) &&
|
41
|
+
@@autoit.ControlFocus(window_title, "", button_name) == 1 &&
|
42
|
+
@@autoit.ControlClick(window_title, "", button_name) == 1 &&
|
43
|
+
wait_until?(3) {@@autoit.WinExists(window_title) == 0}
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# makes window active with specified title
|
48
|
+
# * returns true if activation was successful and false otherwise
|
49
|
+
def activate_window(window_title)
|
50
|
+
@@autoit.WinWait(window_title, "", 1) == 1 &&
|
51
|
+
@@autoit.WinActivate(window_title) != 0 &&
|
52
|
+
@@autoit.WinActive(window_title) != 0
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -28,15 +28,23 @@ module WatirSplash
|
|
28
28
|
super
|
29
29
|
end
|
30
30
|
|
31
|
+
def example_group_started(example_group) # :nodoc:
|
32
|
+
@files_saved_during_example.clear
|
33
|
+
super
|
34
|
+
end
|
35
|
+
|
31
36
|
def example_started(example) # :nodoc:
|
32
37
|
@files_saved_during_example.clear
|
38
|
+
example.description << " (#{Time.now.strftime("%H:%M %d.%m")})"
|
33
39
|
super
|
34
40
|
end
|
35
41
|
|
36
42
|
def extra_failure_content(failure) # :nodoc:
|
37
|
-
|
38
|
-
|
39
|
-
|
43
|
+
if @browser.exists?
|
44
|
+
save_javascript_error
|
45
|
+
save_html
|
46
|
+
save_screenshot
|
47
|
+
end
|
40
48
|
|
41
49
|
content = []
|
42
50
|
content << "<span>"
|
@@ -60,7 +68,6 @@ module WatirSplash
|
|
60
68
|
File.open(file_name, 'w') {|f| f.puts html}
|
61
69
|
rescue => e
|
62
70
|
$stderr.puts "saving of html failed: #{e.message}"
|
63
|
-
$stderr.puts e.backtrace
|
64
71
|
end
|
65
72
|
file_name
|
66
73
|
end
|
@@ -77,7 +84,6 @@ module WatirSplash
|
|
77
84
|
end
|
78
85
|
rescue => e
|
79
86
|
$stderr.puts "saving of screenshot failed: #{e.message}"
|
80
|
-
$stderr.puts e.backtrace
|
81
87
|
end
|
82
88
|
file_name
|
83
89
|
end
|
@@ -96,7 +102,6 @@ module WatirSplash
|
|
96
102
|
end
|
97
103
|
rescue => e
|
98
104
|
$stderr.puts "saving of javascript error failed: #{e.message}"
|
99
|
-
$stderr.puts e.backtrace
|
100
105
|
end
|
101
106
|
file_name
|
102
107
|
end
|
data/lib/watirsplash/spec.rb
CHANGED
@@ -14,6 +14,12 @@ module Spec #:nodoc:all
|
|
14
14
|
class ExampleGroup
|
15
15
|
subject {self}
|
16
16
|
end
|
17
|
+
|
18
|
+
module Example
|
19
|
+
class ExampleProxy
|
20
|
+
attr_accessor :description
|
21
|
+
end
|
22
|
+
end
|
17
23
|
end
|
18
24
|
|
19
25
|
# match_array is useful for matching arrays where some elements are regular expressions.
|
@@ -7,9 +7,8 @@
|
|
7
7
|
# By default everything, which is not a spec file, will be loaded from spec directory
|
8
8
|
# and it's subdirectories
|
9
9
|
spec_dir = File.join(File.dirname(__FILE__), "spec/**/*.rb")
|
10
|
-
|
11
|
-
File.
|
10
|
+
filtered_ruby_files = Dir.glob(spec_dir).delete_if do |file|
|
11
|
+
File.basename(file) =~ /.*_spec\.rb$/
|
12
12
|
end
|
13
|
-
require_all
|
14
|
-
require_rel "config.rb"
|
15
|
-
require_rel "application_helper.rb"
|
13
|
+
require_all filtered_ruby_files unless filtered_ruby_files.empty?
|
14
|
+
require_rel "config.rb"
|
File without changes
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 4
|
9
|
+
version: 0.2.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jarmo Pertman
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-07-
|
17
|
+
date: 2010-07-30 00:00:00 +03:00
|
18
18
|
default_executable: watirsplash
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -136,8 +136,9 @@ files:
|
|
136
136
|
- Rakefile
|
137
137
|
- VERSION
|
138
138
|
- bin/watirsplash
|
139
|
+
- click_no_wait.txt
|
139
140
|
- lib/watirsplash.rb
|
140
|
-
- lib/watirsplash/
|
141
|
+
- lib/watirsplash/autoit_helper.rb
|
141
142
|
- lib/watirsplash/generator.rb
|
142
143
|
- lib/watirsplash/html_formatter.rb
|
143
144
|
- lib/watirsplash/spec.rb
|
@@ -155,9 +156,9 @@ files:
|
|
155
156
|
- templates/common/config.rb
|
156
157
|
- templates/common/environment.rb
|
157
158
|
- templates/common/lib/common_application_helper.rb
|
158
|
-
- templates/project/application_helper.rb
|
159
159
|
- templates/project/config.rb
|
160
160
|
- templates/project/environment.rb
|
161
|
+
- templates/project/spec/application_helper.rb
|
161
162
|
- templates/project/spec/dummy_spec.rb
|
162
163
|
- templates/project/spec/spec.opts
|
163
164
|
has_rdoc: true
|
@@ -167,7 +168,7 @@ licenses: []
|
|
167
168
|
post_install_message: |-
|
168
169
|
*************************
|
169
170
|
|
170
|
-
Thank you for installing WatirSplash 0.2.
|
171
|
+
Thank you for installing WatirSplash 0.2.4! Don't forget to take a look at README and History files!
|
171
172
|
|
172
173
|
Execute "watirsplash generate" under your project's directory to generate default project structure.
|
173
174
|
|
@@ -202,7 +203,7 @@ rubyforge_project:
|
|
202
203
|
rubygems_version: 1.3.6
|
203
204
|
signing_key:
|
204
205
|
specification_version: 3
|
205
|
-
summary: watirsplash 0.2.
|
206
|
+
summary: watirsplash 0.2.4
|
206
207
|
test_files:
|
207
208
|
- spec/spec_helper_spec.rb
|
208
209
|
- spec/spec_match_array_spec.rb
|
data/lib/watirsplash/autoit.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
# Helper class for AutoIt
|
2
|
-
class AutoItHelper
|
3
|
-
extend WatirSplash::Waiter
|
4
|
-
|
5
|
-
@@autoit = Watir.autoit
|
6
|
-
|
7
|
-
class << self
|
8
|
-
# clicks save button on window with specified title,
|
9
|
-
# activates window automatically and makes sure that the click
|
10
|
-
# was successful
|
11
|
-
def click_save(window_title="File Download")
|
12
|
-
click_button(window_title, "&Save")
|
13
|
-
end
|
14
|
-
|
15
|
-
# sets edit field value to field_value on window with specified title,
|
16
|
-
# activates window automatically and makes sure that the field's
|
17
|
-
# value got changed
|
18
|
-
def set_edit(field_value, window_title="Save As")
|
19
|
-
set_field(window_title, "Edit1", field_value)
|
20
|
-
end
|
21
|
-
|
22
|
-
# sets specified field's value on window with specified title,
|
23
|
-
# activates window automatically and makes sure that the field's
|
24
|
-
# value got changed
|
25
|
-
def set_field(window_title, field_name, field_value)
|
26
|
-
wait_until do
|
27
|
-
activate_window(window_title) &&
|
28
|
-
@@autoit.ControlFocus(window_title, "", field_name) == 1 &&
|
29
|
-
@@autoit.ControlSetText(window_title, "", field_name, field_value) == 1 &&
|
30
|
-
@@autoit.ControlGetText(window_title, "", field_name) == field_value
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
# clicks specified button on window with specified title,
|
35
|
-
# activates window automatically and makes sure that the click
|
36
|
-
# was successful
|
37
|
-
def click_button(window_title, button_name)
|
38
|
-
wait_until do
|
39
|
-
activate_window(window_title) &&
|
40
|
-
@@autoit.ControlFocus(window_title, "", button_name) == 1 &&
|
41
|
-
@@autoit.ControlClick(window_title, "", button_name) == 1 &&
|
42
|
-
wait_until?(3) {@@autoit.WinExists(window_title) == 0}
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
# makes window active with specified title
|
47
|
-
# * returns true if activation was successful and false otherwise
|
48
|
-
def activate_window(window_title)
|
49
|
-
@@autoit.WinWait(window_title, "", 1) == 1 &&
|
50
|
-
@@autoit.WinActivate(window_title) != 0 &&
|
51
|
-
@@autoit.WinActive(window_title) != 0
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|