watirsplash 0.2.8 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +6 -0
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/lib/watirsplash.rb +1 -1
- data/lib/watirsplash/html_formatter.rb +0 -19
- data/lib/watirsplash/wait_helper.rb +0 -15
- data/lib/watirsplash/watir.rb +15 -8
- data/spec/watir_ie_spec.rb +0 -8
- metadata +26 -13
- data/lib/watirsplash/auto_it_helper.rb +0 -121
data/History.rdoc
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
=== Version 0.2.9 / 2010-10-14
|
2
|
+
|
3
|
+
* AutoItHelper is no more! Using RAutomation gem instead
|
4
|
+
* JavaScript error messages are not screenshotted anymore due to it's complexity and vagueness of the messages themselves
|
5
|
+
* deleted #wait_until? and #wait_while? methods
|
6
|
+
|
1
7
|
=== Version 0.2.8 / 2010-10-06
|
2
8
|
|
3
9
|
* use Watir 1.6.6 and RSpec 1.3.0 from now on
|
data/Rakefile
CHANGED
@@ -30,6 +30,7 @@ Execute "watirsplash generate" under your project's directory to generate defaul
|
|
30
30
|
gem.add_dependency("watir", "=1.6.5")
|
31
31
|
gem.add_dependency("rspec", "=1.3.0")
|
32
32
|
gem.add_dependency("diff-lcs")
|
33
|
+
gem.add_dependency("rautomation")
|
33
34
|
gem.add_dependency("require_all")
|
34
35
|
gem.add_dependency("rmagick")
|
35
36
|
gem.add_dependency("syntax")
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.9
|
data/lib/watirsplash.rb
CHANGED
@@ -5,13 +5,13 @@ require "spec"
|
|
5
5
|
gem "watir", "=1.6.6"
|
6
6
|
require "watir"
|
7
7
|
require "pathname"
|
8
|
+
require "rautomation"
|
8
9
|
require_rel "watirsplash/wait_helper"
|
9
10
|
require_rel "watirsplash/element_extensions"
|
10
11
|
require_rel "watirsplash/file_helper"
|
11
12
|
require_rel "watirsplash/spec_helper"
|
12
13
|
require_rel "watirsplash/spec"
|
13
14
|
require_rel "watirsplash/watir"
|
14
|
-
require_rel "watirsplash/auto_it_helper"
|
15
15
|
require_rel "watirsplash/util"
|
16
16
|
WatirSplash::Util.load_environment
|
17
17
|
|
@@ -42,7 +42,6 @@ module WatirSplash
|
|
42
42
|
|
43
43
|
def extra_failure_content(failure) # :nodoc:
|
44
44
|
if @browser.exists?
|
45
|
-
save_javascript_error
|
46
45
|
save_html
|
47
46
|
save_screenshot
|
48
47
|
end
|
@@ -89,24 +88,6 @@ module WatirSplash
|
|
89
88
|
file_name
|
90
89
|
end
|
91
90
|
|
92
|
-
def save_javascript_error # :nodoc:
|
93
|
-
file_name = nil
|
94
|
-
begin
|
95
|
-
if @browser.is_a?(Watir::IE) && @browser.status =~ /Error on page/
|
96
|
-
autoit = Watir::autoit
|
97
|
-
autoit.AutoItSetOption("MouseCoordMode", 0)
|
98
|
-
autoit.ControlClick("[TITLE:#{@browser.title}]", "", "[CLASS:msctls_statusbar32]", "left", 2)
|
99
|
-
popup_title = "[REGEXPTITLE:^(Windows )?Internet Explorer$]"
|
100
|
-
autoit.WinWait(popup_title, "", 10)
|
101
|
-
file_name = save_screenshot("JS_Error", autoit.WinGetHandle(popup_title).hex)
|
102
|
-
autoit.WinClose(popup_title)
|
103
|
-
end
|
104
|
-
rescue => e
|
105
|
-
$stderr.puts "saving of javascript error failed: #{e.message}"
|
106
|
-
end
|
107
|
-
file_name
|
108
|
-
end
|
109
|
-
|
110
91
|
# Generates unique file name and path for each example.
|
111
92
|
#
|
112
93
|
# All file names generated with this method will be shown
|
@@ -26,13 +26,6 @@ module Watir
|
|
26
26
|
raise TimeoutError, "timed out after #{timeout} seconds"
|
27
27
|
end
|
28
28
|
|
29
|
-
def wait_until?(timeout = 60, &block)
|
30
|
-
wait_until(timeout, &block)
|
31
|
-
true
|
32
|
-
rescue TimeoutError
|
33
|
-
false
|
34
|
-
end
|
35
|
-
|
36
29
|
#
|
37
30
|
# Wait while the block evaluates to true or times out.
|
38
31
|
#
|
@@ -47,13 +40,5 @@ module Watir
|
|
47
40
|
|
48
41
|
raise TimeoutError, "timed out after #{timeout} seconds"
|
49
42
|
end
|
50
|
-
|
51
|
-
def wait_while?(timeout = 60, &block)
|
52
|
-
wait_until(timeout, &block)
|
53
|
-
true
|
54
|
-
rescue TimeoutError
|
55
|
-
false
|
56
|
-
end
|
57
|
-
|
58
43
|
end # WaitHelper
|
59
44
|
end # Watir
|
data/lib/watirsplash/watir.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Watir
|
2
2
|
module PageCheckers
|
3
3
|
# raises an error if javascript error was found
|
4
|
-
JAVASCRIPT_ERRORS_CHECKER = lambda {|ie| raise "
|
4
|
+
JAVASCRIPT_ERRORS_CHECKER = lambda {|ie| raise "Expected no JavaScript errors to appear on page, but having some!" if ie.status =~ /Error on page/}
|
5
5
|
end
|
6
6
|
end
|
7
7
|
|
@@ -25,10 +25,16 @@ module Watir
|
|
25
25
|
path = Pathname.new(file_path)
|
26
26
|
raise "path to #{file_path} has to be absolute!" unless path.absolute?
|
27
27
|
self.click_no_wait
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
download_window = RAutomation::Window.new(:title => "File Download",
|
29
|
+
:text => "Do you want to open or save this file?")
|
30
|
+
WaitHelper.wait_until {download_window.present?}
|
31
|
+
download_window.button(:value => "&Save").click
|
32
|
+
|
33
|
+
save_as_window = RAutomation::Window.new(:title => "Save As")
|
34
|
+
WaitHelper.wait_until {save_as_window.present?}
|
35
|
+
save_as_window.text_field(:class_name => "Edit1").set(File.native_path(file_path))
|
36
|
+
save_as_window.button(:value => "&Save").click
|
37
|
+
|
32
38
|
WaitHelper.wait_until {File.exists?(file_path)}
|
33
39
|
file_path
|
34
40
|
end
|
@@ -39,9 +45,10 @@ module Watir
|
|
39
45
|
raise "#{file_path} has to exist to set!" unless File.exists?(file_path)
|
40
46
|
assert_exists
|
41
47
|
self.click_no_wait
|
42
|
-
window =
|
43
|
-
window.
|
44
|
-
window.
|
48
|
+
window = RAutomation::Window.new(:title => /choose file( to upload)?/i)
|
49
|
+
WaitHelper.wait_until {window.present?}
|
50
|
+
window.text_field(:class_name => "Edit1").set(File.native_path(file_path))
|
51
|
+
window.button(:value => "&Open").click
|
45
52
|
end
|
46
53
|
end
|
47
54
|
|
data/spec/watir_ie_spec.rb
CHANGED
@@ -47,14 +47,6 @@ describe Watir::IE do
|
|
47
47
|
lambda {wait_until(0.5) {sleep 0.1; false}}.should raise_exception(Watir::WaitHelper::TimeoutError)
|
48
48
|
end
|
49
49
|
|
50
|
-
it "has wait_until?" do
|
51
|
-
result = wait_until? {sleep 0.1; true}
|
52
|
-
result.should be_true
|
53
|
-
|
54
|
-
result = wait_until?(0.5) {sleep 0.1; false}
|
55
|
-
result.should be_false
|
56
|
-
end
|
57
|
-
|
58
50
|
it "closes the browser even when Watir::IE#run_error_checks throws an exception" do
|
59
51
|
@browser.add_checker lambda {raise "let's fail IE#wait in IE#close"}
|
60
52
|
@browser.should exist
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: watirsplash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 9
|
10
|
+
version: 0.2.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jarmo Pertman
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-14 00:00:00 +03:00
|
19
19
|
default_executable: watirsplash
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
type: :runtime
|
66
66
|
version_requirements: *id003
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
|
-
name:
|
68
|
+
name: rautomation
|
69
69
|
prerelease: false
|
70
70
|
requirement: &id004 !ruby/object:Gem::Requirement
|
71
71
|
none: false
|
@@ -79,7 +79,7 @@ dependencies:
|
|
79
79
|
type: :runtime
|
80
80
|
version_requirements: *id004
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
|
-
name:
|
82
|
+
name: require_all
|
83
83
|
prerelease: false
|
84
84
|
requirement: &id005 !ruby/object:Gem::Requirement
|
85
85
|
none: false
|
@@ -93,7 +93,7 @@ dependencies:
|
|
93
93
|
type: :runtime
|
94
94
|
version_requirements: *id005
|
95
95
|
- !ruby/object:Gem::Dependency
|
96
|
-
name:
|
96
|
+
name: rmagick
|
97
97
|
prerelease: false
|
98
98
|
requirement: &id006 !ruby/object:Gem::Requirement
|
99
99
|
none: false
|
@@ -107,7 +107,7 @@ dependencies:
|
|
107
107
|
type: :runtime
|
108
108
|
version_requirements: *id006
|
109
109
|
- !ruby/object:Gem::Dependency
|
110
|
-
name:
|
110
|
+
name: syntax
|
111
111
|
prerelease: false
|
112
112
|
requirement: &id007 !ruby/object:Gem::Requirement
|
113
113
|
none: false
|
@@ -121,9 +121,23 @@ dependencies:
|
|
121
121
|
type: :runtime
|
122
122
|
version_requirements: *id007
|
123
123
|
- !ruby/object:Gem::Dependency
|
124
|
-
name:
|
124
|
+
name: win32console
|
125
125
|
prerelease: false
|
126
126
|
requirement: &id008 !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
hash: 3
|
132
|
+
segments:
|
133
|
+
- 0
|
134
|
+
version: "0"
|
135
|
+
type: :runtime
|
136
|
+
version_requirements: *id008
|
137
|
+
- !ruby/object:Gem::Dependency
|
138
|
+
name: win32screenshot
|
139
|
+
prerelease: false
|
140
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
127
141
|
none: false
|
128
142
|
requirements:
|
129
143
|
- - ">="
|
@@ -135,7 +149,7 @@ dependencies:
|
|
135
149
|
- 4
|
136
150
|
version: 0.0.4
|
137
151
|
type: :runtime
|
138
|
-
version_requirements: *
|
152
|
+
version_requirements: *id009
|
139
153
|
description: WatirSplash makes testing of web applications splashin' easy by combining best features of Watir, RSpec and Ruby!
|
140
154
|
email: jarmo.p@gmail.com
|
141
155
|
executables:
|
@@ -154,7 +168,6 @@ files:
|
|
154
168
|
- VERSION
|
155
169
|
- bin/watirsplash
|
156
170
|
- lib/watirsplash.rb
|
157
|
-
- lib/watirsplash/auto_it_helper.rb
|
158
171
|
- lib/watirsplash/element_extensions.rb
|
159
172
|
- lib/watirsplash/file_helper.rb
|
160
173
|
- lib/watirsplash/generator.rb
|
@@ -187,7 +200,7 @@ licenses: []
|
|
187
200
|
post_install_message: |-
|
188
201
|
*************************
|
189
202
|
|
190
|
-
Thank you for installing WatirSplash 0.2.
|
203
|
+
Thank you for installing WatirSplash 0.2.9! Don't forget to take a look at README and History files!
|
191
204
|
|
192
205
|
Execute "watirsplash generate" under your project's directory to generate default project structure.
|
193
206
|
|
@@ -226,7 +239,7 @@ rubyforge_project:
|
|
226
239
|
rubygems_version: 1.3.7
|
227
240
|
signing_key:
|
228
241
|
specification_version: 3
|
229
|
-
summary: watirsplash 0.2.
|
242
|
+
summary: watirsplash 0.2.9
|
230
243
|
test_files:
|
231
244
|
- spec/spec_helper_spec.rb
|
232
245
|
- spec/spec_match_array_spec.rb
|
@@ -1,121 +0,0 @@
|
|
1
|
-
module AutoIt
|
2
|
-
class Window
|
3
|
-
include Watir::WaitHelper
|
4
|
-
|
5
|
-
class << self
|
6
|
-
def autoit
|
7
|
-
@@autoit
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
@@autoit = Watir.autoit
|
12
|
-
attr_reader :locator
|
13
|
-
|
14
|
-
def initialize(window_locator)
|
15
|
-
@locator =
|
16
|
-
case window_locator
|
17
|
-
when Regexp
|
18
|
-
"[REGEXPTITLE:#{window_locator}]"
|
19
|
-
when Fixnum
|
20
|
-
"[HANDLE:#{window_locator.to_s(16).rjust(8, "0")}]"
|
21
|
-
else
|
22
|
-
window_locator
|
23
|
-
end
|
24
|
-
@title = window_locator
|
25
|
-
end
|
26
|
-
|
27
|
-
# makes window active
|
28
|
-
# * returns true if activation was successful and false otherwise
|
29
|
-
def activate
|
30
|
-
@@autoit.WinWait(@locator, "", 1) == 1 &&
|
31
|
-
@@autoit.WinActivate(@locator) != 0 &&
|
32
|
-
@@autoit.WinActive(@locator) != 0
|
33
|
-
end
|
34
|
-
|
35
|
-
def text
|
36
|
-
@@autoit.WinGetText(@locator)
|
37
|
-
end
|
38
|
-
|
39
|
-
def exists?
|
40
|
-
@@autoit.WinExists(@locator) == 1
|
41
|
-
end
|
42
|
-
|
43
|
-
def close
|
44
|
-
@@autoit.WinClose(@locator)
|
45
|
-
@@autoit.WinKill(@locator)
|
46
|
-
end
|
47
|
-
|
48
|
-
def button(name)
|
49
|
-
Button.new(self, name)
|
50
|
-
end
|
51
|
-
|
52
|
-
def text_field(name)
|
53
|
-
TextField.new(self, name)
|
54
|
-
end
|
55
|
-
|
56
|
-
def method_missing name, *args #:nodoc:
|
57
|
-
@@autoit.respond_to?(name) ? @@autoit.send(name, *args) : super
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
class Button
|
62
|
-
include Watir::WaitHelper
|
63
|
-
|
64
|
-
def initialize(window, button_name)
|
65
|
-
@window = window
|
66
|
-
@name = button_name
|
67
|
-
end
|
68
|
-
|
69
|
-
# clicks specified button on window with specified title,
|
70
|
-
# activates window automatically and makes sure that the click
|
71
|
-
# was successful
|
72
|
-
def click
|
73
|
-
clicked = false
|
74
|
-
wait_until do
|
75
|
-
@window.activate &&
|
76
|
-
Window.autoit.ControlFocus(@window.locator, "", @name) == 1 &&
|
77
|
-
Window.autoit.ControlClick(@window.locator, "", @name) == 1 &&
|
78
|
-
clicked = true # is clicked at least once
|
79
|
-
|
80
|
-
clicked && !exists?
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
def exists?
|
85
|
-
not Window.autoit.ControlGetHandle(@window.locator, "", @name).empty?
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
class TextField
|
90
|
-
include Watir::WaitHelper
|
91
|
-
|
92
|
-
def initialize(window, field_name)
|
93
|
-
@window = window
|
94
|
-
@name = field_name
|
95
|
-
end
|
96
|
-
|
97
|
-
# sets specified field's value on window with specified title,
|
98
|
-
# activates window automatically and makes sure that the field's
|
99
|
-
# value got changed
|
100
|
-
def set(text)
|
101
|
-
wait_until do
|
102
|
-
@window.activate &&
|
103
|
-
Window.autoit.ControlFocus(@window.locator, "", @name) == 1 &&
|
104
|
-
Window.autoit.ControlSetText(@window.locator, "", @name, text) == 1 &&
|
105
|
-
value == text
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
def clear
|
110
|
-
set ""
|
111
|
-
end
|
112
|
-
|
113
|
-
def value
|
114
|
-
Window.autoit.ControlGetText(@window.locator, "", @name)
|
115
|
-
end
|
116
|
-
|
117
|
-
def exists?
|
118
|
-
not Window.autoit.ControlGetHandle(@window.locator, "", @name).empty?
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|