firewatir 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MozillaBaseElement.rb +1778 -0
- data/container.rb +889 -0
- data/firewatir/exceptions.rb +44 -0
- data/firewatir/testUnitAddons.rb +8 -0
- data/firewatir.rb +1130 -0
- data/htmlelements.rb +2277 -0
- data/unittests/attach_to_new_window_test.rb +34 -0
- data/unittests/bug_fixes_test.rb +188 -0
- data/unittests/buttons_test.rb +215 -0
- data/unittests/buttons_xpath_test.rb +87 -0
- data/unittests/checkbox_test.rb +154 -0
- data/unittests/checkbox_xpath_test.rb +107 -0
- data/unittests/div_test.rb +274 -0
- data/unittests/filefield_test.rb +45 -0
- data/unittests/filefield_xpath_test.rb +35 -0
- data/unittests/form_test.rb +307 -0
- data/unittests/frame_test.rb +151 -0
- data/unittests/hidden_test.rb +85 -0
- data/unittests/hidden_xpath_test.rb +72 -0
- data/unittests/html/JavascriptClick.html +42 -0
- data/unittests/html/blankpage.html +12 -0
- data/unittests/html/buttons1.html +61 -0
- data/unittests/html/checkboxes1.html +71 -0
- data/unittests/html/complex_table.html +36 -0
- data/unittests/html/cssTest.html +42 -0
- data/unittests/html/div.html +72 -0
- data/unittests/html/div_xml.html +21 -0
- data/unittests/html/fileupload.html +45 -0
- data/unittests/html/formTest1.html +39 -0
- data/unittests/html/forms2.html +45 -0
- data/unittests/html/forms3.html +132 -0
- data/unittests/html/forms4.html +27 -0
- data/unittests/html/frame_buttons.html +4 -0
- data/unittests/html/frame_links.html +4 -0
- data/unittests/html/frame_multi.html +5 -0
- data/unittests/html/iframeTest.html +15 -0
- data/unittests/html/iframeTest1.html +14 -0
- data/unittests/html/iframeTest2.html +6 -0
- data/unittests/html/images/1.gif +0 -0
- data/unittests/html/images/2.GIF +0 -0
- data/unittests/html/images/3.GIF +0 -0
- data/unittests/html/images/button.jpg +0 -0
- data/unittests/html/images/circle.jpg +0 -0
- data/unittests/html/images/minus.GIF +0 -0
- data/unittests/html/images/originaltriangle.jpg +0 -0
- data/unittests/html/images/plus.gif +0 -0
- data/unittests/html/images/square.jpg +0 -0
- data/unittests/html/images/triangle.jpg +0 -0
- data/unittests/html/images1.html +67 -0
- data/unittests/html/javascriptevents.html +35 -0
- data/unittests/html/link_pass.html +11 -0
- data/unittests/html/links1.html +42 -0
- data/unittests/html/links2.html +11 -0
- data/unittests/html/modal_dialog.html +8 -0
- data/unittests/html/modal_dialog_launcher.html +12 -0
- data/unittests/html/nestedFrames.html +6 -0
- data/unittests/html/new_browser.html +17 -0
- data/unittests/html/pass.html +10 -0
- data/unittests/html/popups1.html +60 -0
- data/unittests/html/pre.html +28 -0
- data/unittests/html/radioButtons1.html +71 -0
- data/unittests/html/redirect.html +10 -0
- data/unittests/html/redirect1.html +9 -0
- data/unittests/html/redirect2.html +9 -0
- data/unittests/html/redirect3.html +9 -0
- data/unittests/html/select_tealeaf.html +54 -0
- data/unittests/html/selectboxes1.html +55 -0
- data/unittests/html/simple_table.html +26 -0
- data/unittests/html/simple_table_buttons.html +104 -0
- data/unittests/html/simple_table_columns.html +74 -0
- data/unittests/html/table1.html +165 -0
- data/unittests/html/tableCell_using_xpath.html +19 -0
- data/unittests/html/textarea.html +30 -0
- data/unittests/html/textfields1.html +62 -0
- data/unittests/html/textsearch.html +44 -0
- data/unittests/images_test.rb +204 -0
- data/unittests/images_xpath_test.rb +118 -0
- data/unittests/iostring.rb +30 -0
- data/unittests/iostring_test.rb +48 -0
- data/unittests/javascript_test.rb +71 -0
- data/unittests/links_test.rb +230 -0
- data/unittests/links_xpath_test.rb +79 -0
- data/unittests/mozilla_all_tests.rb +18 -0
- data/unittests/pre_test.rb +74 -0
- data/unittests/radios_test.rb +166 -0
- data/unittests/radios_xpath_test.rb +101 -0
- data/unittests/redirect_test.rb +40 -0
- data/unittests/selectbox_test.rb +141 -0
- data/unittests/selectbox_xpath_test.rb +127 -0
- data/unittests/setup.rb +35 -0
- data/unittests/table_test.rb +372 -0
- data/unittests/table_xpath_test.rb +184 -0
- data/unittests/textfields_test.rb +230 -0
- data/unittests/textfields_xpath_test.rb +112 -0
- metadata +144 -0
@@ -0,0 +1,230 @@
|
|
1
|
+
# feature tests for Text Fields & Labels
|
2
|
+
# revision: $Revision: 1.0 $
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
5
|
+
require 'unittests/setup'
|
6
|
+
|
7
|
+
class TC_Fields < Test::Unit::TestCase
|
8
|
+
include FireWatir
|
9
|
+
|
10
|
+
def setup
|
11
|
+
$ff.goto($htmlRoot + "textfields1.html")
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_text_field_exists
|
15
|
+
assert($ff.text_field(:name, "text1").exists?)
|
16
|
+
assert_false($ff.text_field(:name, "missing").exists?)
|
17
|
+
|
18
|
+
assert($ff.text_field(:id, "text2").exists?)
|
19
|
+
assert_false($ff.text_field(:id, "alsomissing").exists?)
|
20
|
+
|
21
|
+
# TODO: Need to find an alternative to this in Mozilla
|
22
|
+
#assert($ff.text_field(:beforeText, "This Text After").exists? )
|
23
|
+
#assert($ff.text_field(:afterText, "This Text Before").exists? )
|
24
|
+
|
25
|
+
#assert($ff.text_field(:beforeText, /after/i).exists? )
|
26
|
+
#assert($ff.text_field(:afterText, /before/i).exists? )
|
27
|
+
end
|
28
|
+
|
29
|
+
# Drag Contents to in not supported by Mozilla because onDragStart, onDragEnd etc are not
|
30
|
+
# supported in Mozilla
|
31
|
+
#def test_text_field_dragContentsTo
|
32
|
+
|
33
|
+
#$ff.text_field(:name, "text1").dragContentsTo(:id, "text2")
|
34
|
+
#assert_equal($ff.text_field(:name, "text1").value, "")
|
35
|
+
#assert_equal($ff.text_field(:id, "text2").value, "goodbye allHello World")
|
36
|
+
#end
|
37
|
+
|
38
|
+
def test_text_field_verify_contains
|
39
|
+
assert($ff.text_field(:name, "text1").verify_contains("Hello World"))
|
40
|
+
assert($ff.text_field(:name, "text1").verify_contains(/Hello\sW/))
|
41
|
+
assert_false($ff.text_field(:name, "text1").verify_contains("Ruby"))
|
42
|
+
assert_false($ff.text_field(:name, "text1").verify_contains(/R/))
|
43
|
+
assert_raises(UnknownObjectException) { $ff.text_field(:name, "NoName").verify_contains("No field to get a value of") }
|
44
|
+
|
45
|
+
assert($ff.text_field(:id, "text2").verify_contains("goodbye all") )
|
46
|
+
assert_raises(UnknownObjectException) { $ff.text_field(:id, "noID").verify_contains("No field to get a value of") }
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_text_field_enabled
|
50
|
+
assert_false($ff.text_field(:name, "disabled").enabled? )
|
51
|
+
assert($ff.text_field(:name, "text1").enabled? )
|
52
|
+
assert($ff.text_field(:id, "text2").enabled? )
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_text_field_readonly
|
56
|
+
assert_false($ff.text_field(:name, "disabled").readonly? )
|
57
|
+
assert($ff.text_field(:name, "readOnly").readonly? )
|
58
|
+
assert($ff.text_field(:id, "readOnly2").readonly? )
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_text_field_get_contents
|
62
|
+
assert_raises(UnknownObjectException) { $ff.text_field(:name, "missing_field").append("Some Text") }
|
63
|
+
assert_equal("Hello World", $ff.text_field(:name, "text1").value)
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_text_field_to_s
|
67
|
+
expected = [
|
68
|
+
"name: text1",
|
69
|
+
"type: text",
|
70
|
+
"id: ",
|
71
|
+
"value: Hello World",
|
72
|
+
"disabled: false",
|
73
|
+
#"style: ",
|
74
|
+
#" for: ",
|
75
|
+
"read only: false",
|
76
|
+
"max length: 500",
|
77
|
+
"length: 0"
|
78
|
+
]
|
79
|
+
assert_equal(expected, $ff.text_field(:index, 1).to_s)
|
80
|
+
expected[0] = "name: "
|
81
|
+
expected[2] = "id: text2"
|
82
|
+
expected[3] = "value: goodbye all"
|
83
|
+
assert_equal(expected, $ff.text_field(:index, 2).to_s)
|
84
|
+
assert_raises(UnknownObjectException) { $ff.text_field(:index, 999).to_s }
|
85
|
+
#puts $ff.text_field(:name, "text1").to_s
|
86
|
+
#puts $ff.text_field(:name, "readOnly").to_s
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_text_field_append
|
90
|
+
assert_raises(ObjectReadOnlyException) { $ff.text_field(:id, "readOnly2").append("Some Text") }
|
91
|
+
assert_raises(ObjectDisabledException) { $ff.text_field(:name, "disabled").append("Some Text") }
|
92
|
+
assert_raises(UnknownObjectException) { $ff.text_field(:name, "missing_field").append("Some Text") }
|
93
|
+
|
94
|
+
$ff.text_field(:name, "text1").append(" Some Text")
|
95
|
+
assert_equal("Hello World Some Text", $ff.text_field(:name, "text1").value)
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_text_field_clear
|
99
|
+
$ff.text_field(:name, "text1").clear
|
100
|
+
assert_equal("", $ff.text_field(:name, "text1").value)
|
101
|
+
end
|
102
|
+
|
103
|
+
def test_text_field_set
|
104
|
+
$ff.text_field(:name, "text1").set("FireWatir Firefox Controller")
|
105
|
+
assert_equal("FireWatir Firefox Controller" , $ff.text_field(:name, "text1").value)
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_text_field_properties
|
109
|
+
assert_raises(UnknownObjectException) { $ff.text_field(:index, 199).value }
|
110
|
+
assert_raises(UnknownObjectException) { $ff.text_field(:index, 199).name }
|
111
|
+
assert_raises(UnknownObjectException) { $ff.text_field(:index, 199).id }
|
112
|
+
assert_raises(UnknownObjectException) { $ff.text_field(:index, 199).disabled }
|
113
|
+
assert_raises(UnknownObjectException) { $ff.text_field(:index, 199).type }
|
114
|
+
|
115
|
+
assert_equal("Hello World" , $ff.text_field(:index, 1).value)
|
116
|
+
assert_equal("text" , $ff.text_field(:index, 1).type)
|
117
|
+
assert_equal("text1" , $ff.text_field(:index, 1).name)
|
118
|
+
assert_equal("" , $ff.text_field(:index, 1).id)
|
119
|
+
assert_equal(false , $ff.text_field(:index, 1).disabled)
|
120
|
+
|
121
|
+
assert_equal("" , $ff.text_field(:index, 2).name)
|
122
|
+
assert_equal("text2" , $ff.text_field(:index, 2).id)
|
123
|
+
|
124
|
+
assert($ff.text_field(:index, 3).disabled)
|
125
|
+
|
126
|
+
assert_equal("This used to test :afterText", $ff.text_field(:name, "aftertest").title)
|
127
|
+
assert_equal("", $ff.text_field(:index, 1).title)
|
128
|
+
end
|
129
|
+
|
130
|
+
def test_text_field_iterators
|
131
|
+
assert_equal(12, $ff.text_fields.length)
|
132
|
+
|
133
|
+
# watir is 1 based, so this is the first text field
|
134
|
+
assert_equal("Hello World" , $ff.text_fields[1].value)
|
135
|
+
assert_equal("text1" , $ff.text_fields[1].name)
|
136
|
+
assert_equal("password" , $ff.text_fields[$ff.text_fields.length].type)
|
137
|
+
|
138
|
+
index = 1
|
139
|
+
$ff.text_fields.each do |t|
|
140
|
+
assert_equal($ff.text_field(:index, index).value, t.value)
|
141
|
+
assert_equal($ff.text_field(:index, index).id, t.id)
|
142
|
+
assert_equal($ff.text_field(:index, index).name, t.name)
|
143
|
+
index += 1
|
144
|
+
end
|
145
|
+
assert_equal(index - 1, $ff.text_fields.length)
|
146
|
+
end
|
147
|
+
|
148
|
+
def test_JS_Events
|
149
|
+
$ff.text_field(:name, 'events_tester').set('p')
|
150
|
+
|
151
|
+
# the following line has an extra keypress at the begining, as we mimic the delete key being pressed
|
152
|
+
assert_equal( "keypresskeydownkeypresskeyup" , $ff.text_field(:name , 'events_text').value.gsub("\n" , "") )
|
153
|
+
$ff.button(:value , "Clear Events Box").click
|
154
|
+
$ff.text_field(:name , 'events_tester').set('ab')
|
155
|
+
|
156
|
+
# the following line has an extra keypress at the begining, as we mimic the delete key being pressed
|
157
|
+
assert_equal( "keypresskeydownkeypresskeyupkeydownkeypresskeyup" , $ff.text_field(:name , 'events_text').value.gsub("\n" , "") )
|
158
|
+
|
159
|
+
$ff.text_field(:name, "events_text").set("angrez\nsingh")
|
160
|
+
$ff.text_field(:name, "events_text").append("\n")
|
161
|
+
$ff.text_field(:name, "events_text").append("singh") #\\nsupel")
|
162
|
+
end
|
163
|
+
|
164
|
+
def test_password
|
165
|
+
$ff.text_field(:name , "password1").set("secret")
|
166
|
+
assert( 'secret' , $ff.text_field(:name , "password1").value )
|
167
|
+
|
168
|
+
$ff.text_field(:id , "password1").set("top_secret")
|
169
|
+
assert( 'top_secret' , $ff.text_field(:id, "password1").value )
|
170
|
+
end
|
171
|
+
|
172
|
+
def test_labels_iterator
|
173
|
+
assert_equal(3, $ff.labels.length)
|
174
|
+
assert_equal('Label For this Field' , $ff.labels[1].innerText.strip )
|
175
|
+
assert_equal('Password With ID ( the text here is a label for it )' , $ff.labels[3].innerText )
|
176
|
+
|
177
|
+
count=0
|
178
|
+
$ff.labels.each do |l|
|
179
|
+
count +=1
|
180
|
+
end
|
181
|
+
assert_equal(count, $ff.labels.length)
|
182
|
+
end
|
183
|
+
|
184
|
+
def test_label_properties
|
185
|
+
assert_raises(UnknownObjectException) { $ff.label(:index,20).innerText }
|
186
|
+
assert_raises(UnknownObjectException) { $ff.label(:index,20).for }
|
187
|
+
assert_raises(UnknownObjectException) { $ff.label(:index,20).name }
|
188
|
+
assert_raises(UnknownObjectException) { $ff.label(:index,20).type }
|
189
|
+
assert_raises(UnknownObjectException) { $ff.label(:index,20).id }
|
190
|
+
|
191
|
+
assert_false($ff.label(:index,10).exists?)
|
192
|
+
assert_false($ff.label(:id,'missing').exists?)
|
193
|
+
assert($ff.label(:index,1).exists?)
|
194
|
+
|
195
|
+
assert_equal("", $ff.label(:index,1).id)
|
196
|
+
#assert_false( $ff.label(:index,1).disabled?)
|
197
|
+
assert( $ff.label(:index,1).enabled?)
|
198
|
+
|
199
|
+
assert_equal("label2", $ff.label(:index,2).id )
|
200
|
+
|
201
|
+
assert_equal("Password With ID ( the text here is a label for it )" , $ff.label(:index,3).innerText)
|
202
|
+
assert_equal("password1", $ff.label(:index,3).for)
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
class TC_Labels_Display < Test::Unit::TestCase
|
207
|
+
include FireWatir
|
208
|
+
include MockStdoutTestCase
|
209
|
+
|
210
|
+
def test_showLabels
|
211
|
+
$ff.goto($htmlRoot + "textfields1.html")
|
212
|
+
$stdout = @mockout
|
213
|
+
$ff.showLabels
|
214
|
+
assert_equal(<<END_OF_MESSAGE, @mockout)
|
215
|
+
There are 3 labels
|
216
|
+
label: name:
|
217
|
+
id:
|
218
|
+
for: text2
|
219
|
+
index: 1
|
220
|
+
label: name:
|
221
|
+
id: label2
|
222
|
+
for: readOnly2
|
223
|
+
index: 2
|
224
|
+
label: name:
|
225
|
+
id:
|
226
|
+
for: password1
|
227
|
+
index: 3
|
228
|
+
END_OF_MESSAGE
|
229
|
+
end
|
230
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
# feature tests for Text Fields
|
2
|
+
# revision: $Revision: 1.0 $
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
5
|
+
require 'unittests/setup'
|
6
|
+
|
7
|
+
class TC_Fields_XPath < Test::Unit::TestCase
|
8
|
+
include FireWatir
|
9
|
+
|
10
|
+
def setup()
|
11
|
+
$ff.goto($htmlRoot + "textfields1.html")
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_text_field_exists
|
15
|
+
assert($ff.text_field(:xpath , "//input[@name='text1']").exists?)
|
16
|
+
assert_false($ff.text_field(:xpath , "//input[@name='missing']").exists?)
|
17
|
+
|
18
|
+
assert($ff.text_field(:xpath , "//input[@id='text2']").exists?)
|
19
|
+
assert_false($ff.text_field(:xpath , "//input[@id='alsomissing']").exists?)
|
20
|
+
|
21
|
+
#assert($ff.text_field(:xpath , "//input[@beforeText='This Text After']").exists? )
|
22
|
+
#assert($ff.text_field(:xpath , "//input[@afterText='This Text Before']").exists? )
|
23
|
+
end
|
24
|
+
|
25
|
+
# Not supported by Mozilla
|
26
|
+
#def test_text_field_dragContentsTo
|
27
|
+
# $ff.text_field(:xpath , "//input[@name='text1']").dragContentsTo(:xpath , "//input[@id='text2']/")
|
28
|
+
# assert_equal($ff.text_field(:xpath , "//input[@name='text1']").value, "" )
|
29
|
+
# assert_equal($ff.text_field(:xpath , "//input[@id='text2']").value, "goodbye allHello World" )
|
30
|
+
#end
|
31
|
+
|
32
|
+
def test_text_field_VerifyContents
|
33
|
+
assert($ff.text_field(:xpath , "//input[@name='text1']").verify_contains("Hello World") )
|
34
|
+
assert($ff.text_field(:xpath , "//input[@name='text1']").verify_contains(/Hello\sW/ ) )
|
35
|
+
assert_false($ff.text_field(:xpath , "//input[@name='text1']").verify_contains("Ruby") )
|
36
|
+
assert_false($ff.text_field(:xpath , "//input[@name='text1']").verify_contains(/R/) )
|
37
|
+
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ff.text_field(:xpath , "//input[@name='NoName']").verify_contains("No field to get a value of") }
|
38
|
+
|
39
|
+
assert($ff.text_field(:xpath , "//input[@id='text2']").verify_contains("goodbye all") )
|
40
|
+
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ff.text_field(:xpath , "//input[@id='noID']").verify_contains("No field to get a value of") }
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_text_field_enabled
|
44
|
+
assert_false($ff.text_field(:xpath , "//input[@name='disabled']").enabled? )
|
45
|
+
assert($ff.text_field(:xpath , "//input[@name='text1']").enabled? )
|
46
|
+
assert($ff.text_field(:xpath , "//input[@id='text2']").enabled? )
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_text_field_readOnly
|
50
|
+
assert_false($ff.text_field(:xpath , "//input[@name='disabled']").readonly? )
|
51
|
+
assert($ff.text_field(:xpath , "//input[@name='readOnly']").readonly? )
|
52
|
+
assert($ff.text_field(:xpath , "//input[@id='readOnly2']").readonly? )
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_text_field_value()
|
56
|
+
assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) { $ff.text_field(:xpath , "//input[@name='missing_field']").append("Some Text") }
|
57
|
+
assert_equal( "Hello World" , $ff.text_field(:xpath , "//input[@name='text1']").value )
|
58
|
+
end
|
59
|
+
|
60
|
+
def build_to_s_regex(lhs, rhs)
|
61
|
+
Regexp.new("^#{lhs}: +#{rhs}$")
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_text_field_Append
|
65
|
+
assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) { $ff.text_field(:xpath , "//input[@id='readOnly2']").append("Some Text") }
|
66
|
+
assert_raises(ObjectDisabledException , "ObjectDisabledException was supposed to be thrown" ) { $ff.text_field(:xpath , "//input[@name='disabled']").append("Some Text") }
|
67
|
+
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ff.text_field(:xpath , "//input[@name='missing_field']").append("Some Text") }
|
68
|
+
|
69
|
+
$ff.text_field(:xpath , "//input[@name='text1']").append(" Some Text")
|
70
|
+
assert_equal( "Hello World Some Text" , $ff.text_field(:xpath , "//input[@name='text1']").value )
|
71
|
+
end
|
72
|
+
|
73
|
+
|
74
|
+
def test_text_field_Clear
|
75
|
+
assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) { $ff.text_field(:xpath , "//input[@id='readOnly2']").append("Some Text") }
|
76
|
+
assert_raises(ObjectDisabledException , "ObjectReadOnlyException was supposed to be thrown" ) { $ff.text_field(:xpath , "//input[@name='disabled']").append("Some Text") }
|
77
|
+
assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) { $ff.text_field(:xpath , "//input[@name='missing_field']").append("Some Text") }
|
78
|
+
|
79
|
+
$ff.text_field(:xpath , "//input[@name='text1']").clear()
|
80
|
+
assert_equal( "" , $ff.text_field(:xpath , "//input[@name='text1']").value )
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_text_field_Set
|
84
|
+
assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) { $ff.text_field(:xpath , "//input[@id='readOnly2']").append("Some Text") }
|
85
|
+
assert_raises(ObjectDisabledException , "ObjectReadOnlyException was supposed to be thrown" ) { $ff.text_field(:xpath , "//input[@name='disabled']").append("Some Text") }
|
86
|
+
assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) { $ff.text_field(:xpath , "//input[@name='missing_field']").append("Some Text") }
|
87
|
+
|
88
|
+
$ff.text_field(:xpath , "//input[@name='text1']").set("FireWatir Firefox Controller")
|
89
|
+
assert_equal( "FireWatir Firefox Controller" , $ff.text_field(:xpath , "//input[@name='text1']").value )
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_JS_Events
|
93
|
+
$ff.text_field(:xpath , "//input[@name='events_tester']").set('p')
|
94
|
+
|
95
|
+
# the following line has an extra keypress at the begining, as we mimic the delete key being pressed
|
96
|
+
assert_equal( "keypresskeydownkeypresskeyup" , $ff.text_field(:xpath , "//textarea[@name='events_text']").value.gsub("\n" , "") )
|
97
|
+
$ff.button(:xpath , "//input[@value = 'Clear Events Box']").click
|
98
|
+
$ff.text_field(:xpath , "//input[@name='events_tester']").set('ab')
|
99
|
+
|
100
|
+
# the following line has an extra keypress at the begining, as we mimic the delete key being pressed
|
101
|
+
assert_equal( "keypresskeydownkeypresskeyupkeydownkeypresskeyup" , $ff.text_field(:xpath , "//textarea[@name='events_text']").value.gsub("\n" , "") )
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_password
|
105
|
+
$ff.text_field(:xpath , "//input[@name='password1']").set("secret")
|
106
|
+
assert( 'secret' , $ff.text_field(:xpath , "//input[@name='password1']").value )
|
107
|
+
|
108
|
+
$ff.text_field(:xpath , "//input[@id='password1']").set("top_secret")
|
109
|
+
assert( 'top_secret' , $ff.text_field(:xpath , "//input[@id='password1']").value )
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
metadata
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.9.0
|
3
|
+
specification_version: 1
|
4
|
+
name: firewatir
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 1.1.1
|
7
|
+
date: 2008-04-08 00:00:00 +05:30
|
8
|
+
summary: Automated testing tool for web applications using Firefox browser.
|
9
|
+
require_paths:
|
10
|
+
- .
|
11
|
+
email:
|
12
|
+
homepage: http://code.google.com/p/firewatir
|
13
|
+
rubyforge_project:
|
14
|
+
description: FireWatir stands for "Web Application Testing in Ruby for Firefox". FireWatir (pronounced firewater) is a free, open-source functional testing tool for automating browser-based tests of web applications. It works with applications written in any language. FireWatir drives the Firefox browser the same way an end user would. It clicks links, fills in forms, presses buttons. FireWatir also checks results, such as whether expected text appears on the page, or whether a control is enabled. FireWatir is a Ruby library that works with Firefox on Windows. It also works on Linux, Mac but without support for JavaScript popups (currently support will be there shortly).
|
15
|
+
autorequire: firewatir
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: true
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
24
|
+
version:
|
25
|
+
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
post_install_message:
|
29
|
+
authors:
|
30
|
+
- Angrez Singh
|
31
|
+
files:
|
32
|
+
- container.rb
|
33
|
+
- firewatir.rb
|
34
|
+
- htmlelements.rb
|
35
|
+
- MozillaBaseElement.rb
|
36
|
+
- firewatir/exceptions.rb
|
37
|
+
- firewatir/testUnitAddons.rb
|
38
|
+
- unittests/attach_to_new_window_test.rb
|
39
|
+
- unittests/bug_fixes_test.rb
|
40
|
+
- unittests/buttons_test.rb
|
41
|
+
- unittests/buttons_xpath_test.rb
|
42
|
+
- unittests/checkbox_test.rb
|
43
|
+
- unittests/checkbox_xpath_test.rb
|
44
|
+
- unittests/div_test.rb
|
45
|
+
- unittests/filefield_test.rb
|
46
|
+
- unittests/filefield_xpath_test.rb
|
47
|
+
- unittests/form_test.rb
|
48
|
+
- unittests/frame_test.rb
|
49
|
+
- unittests/hidden_test.rb
|
50
|
+
- unittests/hidden_xpath_test.rb
|
51
|
+
- unittests/images_test.rb
|
52
|
+
- unittests/images_xpath_test.rb
|
53
|
+
- unittests/iostring.rb
|
54
|
+
- unittests/iostring_test.rb
|
55
|
+
- unittests/javascript_test.rb
|
56
|
+
- unittests/links_test.rb
|
57
|
+
- unittests/links_xpath_test.rb
|
58
|
+
- unittests/mozilla_all_tests.rb
|
59
|
+
- unittests/pre_test.rb
|
60
|
+
- unittests/radios_test.rb
|
61
|
+
- unittests/radios_xpath_test.rb
|
62
|
+
- unittests/redirect_test.rb
|
63
|
+
- unittests/selectbox_test.rb
|
64
|
+
- unittests/selectbox_xpath_test.rb
|
65
|
+
- unittests/setup.rb
|
66
|
+
- unittests/table_test.rb
|
67
|
+
- unittests/table_xpath_test.rb
|
68
|
+
- unittests/textfields_test.rb
|
69
|
+
- unittests/textfields_xpath_test.rb
|
70
|
+
- unittests/html/blankpage.html
|
71
|
+
- unittests/html/buttons1.html
|
72
|
+
- unittests/html/checkboxes1.html
|
73
|
+
- unittests/html/complex_table.html
|
74
|
+
- unittests/html/cssTest.html
|
75
|
+
- unittests/html/div.html
|
76
|
+
- unittests/html/div_xml.html
|
77
|
+
- unittests/html/fileupload.html
|
78
|
+
- unittests/html/forms2.html
|
79
|
+
- unittests/html/forms3.html
|
80
|
+
- unittests/html/forms4.html
|
81
|
+
- unittests/html/formTest1.html
|
82
|
+
- unittests/html/frame_buttons.html
|
83
|
+
- unittests/html/frame_links.html
|
84
|
+
- unittests/html/frame_multi.html
|
85
|
+
- unittests/html/iframeTest.html
|
86
|
+
- unittests/html/iframeTest1.html
|
87
|
+
- unittests/html/iframeTest2.html
|
88
|
+
- unittests/html/images1.html
|
89
|
+
- unittests/html/JavascriptClick.html
|
90
|
+
- unittests/html/javascriptevents.html
|
91
|
+
- unittests/html/links1.html
|
92
|
+
- unittests/html/links2.html
|
93
|
+
- unittests/html/link_pass.html
|
94
|
+
- unittests/html/modal_dialog.html
|
95
|
+
- unittests/html/modal_dialog_launcher.html
|
96
|
+
- unittests/html/nestedFrames.html
|
97
|
+
- unittests/html/new_browser.html
|
98
|
+
- unittests/html/pass.html
|
99
|
+
- unittests/html/popups1.html
|
100
|
+
- unittests/html/pre.html
|
101
|
+
- unittests/html/radioButtons1.html
|
102
|
+
- unittests/html/redirect.html
|
103
|
+
- unittests/html/redirect1.html
|
104
|
+
- unittests/html/redirect2.html
|
105
|
+
- unittests/html/redirect3.html
|
106
|
+
- unittests/html/selectboxes1.html
|
107
|
+
- unittests/html/select_tealeaf.html
|
108
|
+
- unittests/html/simple_table.html
|
109
|
+
- unittests/html/simple_table_buttons.html
|
110
|
+
- unittests/html/simple_table_columns.html
|
111
|
+
- unittests/html/table1.html
|
112
|
+
- unittests/html/tableCell_using_xpath.html
|
113
|
+
- unittests/html/textarea.html
|
114
|
+
- unittests/html/textfields1.html
|
115
|
+
- unittests/html/textsearch.html
|
116
|
+
- unittests/html/images/1.gif
|
117
|
+
- unittests/html/images/2.GIF
|
118
|
+
- unittests/html/images/3.GIF
|
119
|
+
- unittests/html/images/button.jpg
|
120
|
+
- unittests/html/images/circle.jpg
|
121
|
+
- unittests/html/images/minus.GIF
|
122
|
+
- unittests/html/images/originaltriangle.jpg
|
123
|
+
- unittests/html/images/plus.gif
|
124
|
+
- unittests/html/images/square.jpg
|
125
|
+
- unittests/html/images/triangle.jpg
|
126
|
+
test_files:
|
127
|
+
- unittests/mozilla_all_tests.rb
|
128
|
+
rdoc_options:
|
129
|
+
- --title
|
130
|
+
- FireWatir API Reference
|
131
|
+
- --accessor
|
132
|
+
- def_wrap=R,def_wrap_guard=R,def_creator=R,def_creator_with_default=R
|
133
|
+
- --exclude
|
134
|
+
- unittests|camel_case.rb|testUnitAddons.rb
|
135
|
+
extra_rdoc_files: []
|
136
|
+
|
137
|
+
executables: []
|
138
|
+
|
139
|
+
extensions: []
|
140
|
+
|
141
|
+
requirements:
|
142
|
+
- Mozilla Firefox browser 1.5 or later.
|
143
|
+
dependencies: []
|
144
|
+
|