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,107 @@
|
|
1
|
+
# feature tests for Check Boxes
|
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_CheckBox_XPath < Test::Unit::TestCase
|
8
|
+
include FireWatir
|
9
|
+
|
10
|
+
def setup
|
11
|
+
$ff.goto($htmlRoot + "checkboxes1.html")
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_checkbox_properties
|
15
|
+
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ff.checkbox(:xpath , "//input[@name='noName']").id }
|
16
|
+
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ff.checkbox(:xpath , "//input[@name='noName']").name }
|
17
|
+
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ff.checkbox(:xpath , "//input[@name='noName']").disabled }
|
18
|
+
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ff.checkbox(:xpath , "//input[@name='noName']").type }
|
19
|
+
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ff.checkbox(:xpath , "//input[@name='noName']").value }
|
20
|
+
|
21
|
+
assert_equal("1" , $ff.checkbox(:xpath , "//input[@name='box4']").value )
|
22
|
+
assert_equal("3" , $ff.checkbox(:xpath , "//input[@name='box4' and @value='3']").value )
|
23
|
+
assert_equal("checkbox" , $ff.checkbox(:xpath , "//input[@name='box4' and @value='3']").type )
|
24
|
+
assert_equal(false , $ff.checkbox(:xpath , "//input[@name='box4' and @value='3']").disabled )
|
25
|
+
assert_equal("" , $ff.checkbox(:xpath , "//input[@name='box4' and @value='3']").id )
|
26
|
+
|
27
|
+
assert_equal("box4-value5" , $ff.checkbox(:xpath , "//input[@name='box4' and @value='5']").title)
|
28
|
+
assert_equal("" , $ff.checkbox(:xpath , "//input[@name='box4' and @value='4']").title)
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_CheckBox_Exists
|
32
|
+
assert($ff.checkbox(:xpath , "//input[@name='box4' and @value='1']").exists?)
|
33
|
+
assert_false($ff.checkbox(:xpath , "//input[@name='box4' and @value='22']").exists?)
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_checkbox_Enabled
|
37
|
+
assert_raises(UnknownObjectException) { $ff.checkbox(:xpath , "//input[@name='noName']").enabled? }
|
38
|
+
assert_raises(UnknownObjectException) { $ff.checkbox(:xpath , "//input[@id='noName']").enabled? }
|
39
|
+
assert_raises(UnknownObjectException) { $ff.checkbox(:xpath , "//input[@name='box4' and @value='6']").enabled? }
|
40
|
+
|
41
|
+
assert($ff.checkbox(:xpath , "//input[@name='box1']").enabled?)
|
42
|
+
assert_false($ff.checkbox(:xpath , "//input[@name='box2']").enabled?)
|
43
|
+
|
44
|
+
assert($ff.checkbox(:xpath , "//input[@name='box4' and @value='4']").enabled?)
|
45
|
+
assert_false($ff.checkbox(:xpath , "//input[@name='box4' and @value='5']").enabled?)
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_checkbox_isSet
|
49
|
+
assert_raises(UnknownObjectException ) { $ff.checkbox(:xpath , "//input[@name='noName']").isSet? }
|
50
|
+
|
51
|
+
assert_false($ff.checkbox(:xpath , "//input[@name='box1']").isSet?)
|
52
|
+
assert_false($ff.checkbox(:xpath , "//input[@name='box2']").isSet?)
|
53
|
+
assert($ff.checkbox(:xpath , "//input[@name='box3']").isSet?)
|
54
|
+
|
55
|
+
assert_false($ff.checkbox(:xpath , "//input[@name='box4' and @value='2']").isSet?)
|
56
|
+
assert($ff.checkbox(:xpath , "//input[@name='box4' and @value='1']").isSet?)
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_checkbox_clear
|
60
|
+
assert_raises(UnknownObjectException) { $ff.checkbox(:xpath , "//input[@name='noName']").clear }
|
61
|
+
$ff.checkbox(:xpath , "//input[@name='box1']").clear
|
62
|
+
assert_false($ff.checkbox(:xpath , "//input[@name='box1']").isSet?)
|
63
|
+
|
64
|
+
assert_raises(ObjectDisabledException) { $ff.checkbox(:xpath , "//input[@name='box2']").clear }
|
65
|
+
assert_false($ff.checkbox(:xpath , "//input[@name='box2']").isSet?)
|
66
|
+
|
67
|
+
$ff.checkbox(:xpath , "//input[@name='box3']").clear
|
68
|
+
assert_false($ff.checkbox(:xpath , "//input[@name='box3']").isSet?)
|
69
|
+
|
70
|
+
$ff.checkbox(:xpath , "//input[@name='box4' and @value='1']").clear
|
71
|
+
assert_false($ff.checkbox(:xpath , "//input[@name='box4' and @value='1']").isSet?)
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_checkbox_getState
|
75
|
+
assert_raises(UnknownObjectException) { $ff.checkbox(:xpath , "//input[@name='noName']").getState }
|
76
|
+
assert_equal( false , $ff.checkbox(:xpath , "//input[@name='box1']").getState )
|
77
|
+
assert_equal( true , $ff.checkbox(:xpath , "//input[@name='box3']").getState)
|
78
|
+
|
79
|
+
# checkboxes that have the same name but different values
|
80
|
+
assert_equal( false , $ff.checkbox(:xpath , "//input[@name='box4' and @value='2']").getState )
|
81
|
+
assert_equal( true , $ff.checkbox(:xpath , "//input[@name='box4' and @value='1']").getState)
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_checkbox_set
|
85
|
+
assert_raises(UnknownObjectException) { $ff.checkbox(:xpath , "//input[@name='noName']").set }
|
86
|
+
$ff.checkbox(:xpath , "//input[@name='box1']").set
|
87
|
+
assert($ff.checkbox(:xpath , "//input[@name='box1']").isSet?)
|
88
|
+
|
89
|
+
assert_raises(ObjectDisabledException) { $ff.checkbox(:xpath , "//input[@name='box2']").set }
|
90
|
+
|
91
|
+
$ff.checkbox(:xpath , "//input[@name='box3']").set
|
92
|
+
assert($ff.checkbox(:xpath , "//input[@name='box3']").isSet?)
|
93
|
+
|
94
|
+
# checkboxes that have the same name but different values
|
95
|
+
$ff.checkbox(:xpath , "//input[@name='box4' and @value='3']").set
|
96
|
+
assert($ff.checkbox(:xpath , "//input[@name='box4' and @value='3']").isSet?)
|
97
|
+
|
98
|
+
# test set using the optinal true/false
|
99
|
+
# assumes the checkbox is already checked
|
100
|
+
$ff.checkbox(:xpath , "//input[@name='box1']").set( false )
|
101
|
+
assert_false($ff.checkbox(:xpath , "//input[@name='box1']").isSet?)
|
102
|
+
|
103
|
+
$ff.checkbox(:xpath , "//input[@name='box1']").set( true )
|
104
|
+
assert($ff.checkbox(:xpath , "//input[@name='box1']").isSet?)
|
105
|
+
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,274 @@
|
|
1
|
+
# feature tests for Divs, Spans and P's
|
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_Divs < Test::Unit::TestCase
|
8
|
+
include FireWatir
|
9
|
+
|
10
|
+
def setup
|
11
|
+
$ff.goto($htmlRoot + "div.html")
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_divs
|
15
|
+
assert_raises(UnknownObjectException) {$ff.div(:id , "div77").click }
|
16
|
+
assert_raises(UnknownObjectException) {$ff.div(:title , "div77").click }
|
17
|
+
|
18
|
+
assert($ff.text_field(:name, "text1").verify_contains("0") )
|
19
|
+
$ff.div(:id , "div3").click
|
20
|
+
assert($ff.text_field(:name, "text1").verify_contains("1") )
|
21
|
+
$ff.div(:id , "div4").click
|
22
|
+
assert($ff.text_field(:name, "text1").verify_contains("0") )
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_show_all_objects
|
26
|
+
assert_equal(36, $ff.show_all_objects.length)
|
27
|
+
assert_equal(3,$ff.div(:id,"text_fields1").show_all_objects.length)
|
28
|
+
|
29
|
+
assert_equal(8,$ff.text_fields.length)
|
30
|
+
assert_equal(3,$ff.div(:id,"text_fields1").text_fields.length)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_div_properties
|
34
|
+
assert_raises(UnknownObjectException) {$ff.div(:id , "div77").text }
|
35
|
+
assert_raises(UnknownObjectException) {$ff.div(:title , "div77").text }
|
36
|
+
|
37
|
+
assert_equal("This div has an onClick that increments text1", $ff.div(:id , "div3").text.strip )
|
38
|
+
assert_equal("This text is in a div with an id of div1 and title of test1",$ff.div(:title , "Test1").text.strip )
|
39
|
+
|
40
|
+
assert_raises(UnknownObjectException) {$ff.div(:id , "div77").class_name }
|
41
|
+
assert_equal("blueText" , $ff.div(:id , "div2").class_name )
|
42
|
+
assert_equal("" , $ff.div(:id , "div1").class_name )
|
43
|
+
|
44
|
+
assert_raises(UnknownObjectException) {$ff.div(:index , 44).class_name }
|
45
|
+
assert_equal("div1" , $ff.div(:index , 1).id )
|
46
|
+
assert_equal("" , $ff.div(:index , 1).class_name )
|
47
|
+
assert_equal("blueText" , $ff.div(:index , 2).class_name )
|
48
|
+
assert_equal("" , $ff.div(:index , 2).value)
|
49
|
+
#assert_equal(false , $ff.div(:index , 2).disabled)
|
50
|
+
assert_equal("" , $ff.div(:index , 2).name)
|
51
|
+
assert_equal("div2", $ff.div(:index , 2).id)
|
52
|
+
#puts $ff.div(:id,"text_fields1").to_s
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_div_iterator
|
56
|
+
assert_equal( 7 , $ff.divs.length)
|
57
|
+
assert_equal( "div1" , $ff.divs[1].id )
|
58
|
+
|
59
|
+
index =1
|
60
|
+
$ff.divs.each do |s|
|
61
|
+
# puts "each - div= " + s.to_s
|
62
|
+
assert_equal($ff.div(:index, index ).name , s.name )
|
63
|
+
assert_equal($ff.div(:index, index ).id , s.id )
|
64
|
+
assert_equal($ff.div(:index, index ).class_name , s.class_name )
|
65
|
+
index +=1
|
66
|
+
end
|
67
|
+
assert_equal(index-1, $ff.divs.length) # -1 as we add 1 at the end of the loop
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_objects_in_div
|
71
|
+
assert($ff.div(:id, 'buttons1').button(:index,1).exists? )
|
72
|
+
assert(!$ff.div(:id, 'buttons1').button(:index,3).exists? )
|
73
|
+
assert($ff.div(:id, 'buttons1').button(:name,'b1').exists? )
|
74
|
+
$ff.div(:id, 'buttons1').button(:name,'b1').click
|
75
|
+
|
76
|
+
assert($ff.div(:id, 'buttons2').button(:index,1).exists? )
|
77
|
+
assert($ff.div(:id, 'buttons2').button(:index,2).exists? )
|
78
|
+
assert(!$ff.div(:id, 'buttons1').button(:index,3).exists? )
|
79
|
+
|
80
|
+
$ff.div(:id, 'buttons1').button(:index,1).click
|
81
|
+
|
82
|
+
assert_equal( 'button1' , $ff.div(:id , 'text_fields1').text_field(:index,1).value)
|
83
|
+
|
84
|
+
#assert_equal( 3 , $ff.div(:id , 'text_fields1').text_fields.length )
|
85
|
+
$ff.div(:id, 'text_fields1').text_field(:name, 'div_text1').set("drink me")
|
86
|
+
assert_equal("drink me", $ff.div(:id, 'text_fields1').text_field(:name, 'div_text1').getContents)
|
87
|
+
end
|
88
|
+
|
89
|
+
#---- Span Tests ---
|
90
|
+
def test_spans
|
91
|
+
assert_raises(UnknownObjectException) {$ff.span(:id , "span77").click }
|
92
|
+
assert_raises(UnknownObjectException) {$ff.span(:title , "span77").click }
|
93
|
+
|
94
|
+
assert($ff.text_field(:name, "text2").verify_contains("0") )
|
95
|
+
$ff.span(:id , "span3").click
|
96
|
+
assert($ff.text_field(:name, "text2").verify_contains("1") )
|
97
|
+
|
98
|
+
$ff.span(:id , "span4").click
|
99
|
+
assert($ff.text_field(:name, "text2").verify_contains("0") )
|
100
|
+
|
101
|
+
#puts $ff.span(:id,"text_fields1").to_s
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_span_properties
|
105
|
+
assert_raises(UnknownObjectException) {$ff.span(:id , "span77").text }
|
106
|
+
assert_raises(UnknownObjectException) {$ff.span(:title , "span77").text }
|
107
|
+
|
108
|
+
assert_equal("This span has an onClick that increments text2" , $ff.span(:id , "span3").text.strip )
|
109
|
+
assert_equal("This text is in a span with an id of span1 and title of test2" , $ff.span(:title , "Test2").text.strip )
|
110
|
+
|
111
|
+
assert_raises(UnknownObjectException) {$ff.span(:id , "span77").class_name }
|
112
|
+
assert_equal("blueText" , $ff.span(:id , "span2").class_name )
|
113
|
+
assert_equal("" , $ff.span(:id , "span1").class_name )
|
114
|
+
|
115
|
+
assert_raises(UnknownObjectException) {$ff.span(:index , 44).class_name }
|
116
|
+
assert_equal("span1" , $ff.span(:index , 1).id )
|
117
|
+
assert_equal("" , $ff.span(:index , 1).class_name )
|
118
|
+
assert_equal("blueText" , $ff.span(:index , 2).class_name )
|
119
|
+
assert_equal("" , $ff.span(:index , 2).value)
|
120
|
+
#assert_equal(false , $ff.span(:index , 2).disabled)
|
121
|
+
assert_equal("" , $ff.span(:index , 2).name)
|
122
|
+
assert_equal("span2", $ff.span(:index , 2).id)
|
123
|
+
end
|
124
|
+
|
125
|
+
def test_span_iterator
|
126
|
+
assert_equal(7, $ff.spans.length)
|
127
|
+
assert_equal("span1", $ff.spans[1].id)
|
128
|
+
|
129
|
+
index = 1
|
130
|
+
$ff.spans.each do |s|
|
131
|
+
# puts "each - span = " + s.to_s
|
132
|
+
assert_equal($ff.span(:index, index ).name , s.name )
|
133
|
+
assert_equal($ff.span(:index, index ).id , s.id )
|
134
|
+
assert_equal($ff.span(:index, index ).class_name , s.class_name )
|
135
|
+
index += 1
|
136
|
+
end
|
137
|
+
assert_equal(index - 1, $ff.spans.length) # -1 as we add 1 at the end of the loop
|
138
|
+
end
|
139
|
+
|
140
|
+
def test_objects_in_span
|
141
|
+
assert($ff.span(:id, 'buttons1').button(:index,1).exists? )
|
142
|
+
assert(!$ff.span(:id, 'buttons1').button(:index,3).exists? )
|
143
|
+
assert($ff.span(:id, 'buttons1').button(:name,'b1').exists? )
|
144
|
+
|
145
|
+
assert($ff.span(:id, 'buttons2').button(:index,1).exists? )
|
146
|
+
assert($ff.span(:id, 'buttons2').button(:index,2).exists? )
|
147
|
+
assert(!$ff.span(:id, 'buttons1').button(:index,3).exists? )
|
148
|
+
|
149
|
+
$ff.span(:id, 'buttons1').button(:index,1).click
|
150
|
+
|
151
|
+
assert_equal( 'button1' , $ff.span(:id , 'text_fields1').text_field(:index,1).value)
|
152
|
+
$ff.span(:id , 'text_fields1').text_field(:index,1).set('text box inside span')
|
153
|
+
assert_equal( 'text box inside span' , $ff.span(:id , 'text_fields1').text_field(:index,1).value)
|
154
|
+
|
155
|
+
#assert_equal( 3 , $ff.span(:id , 'text_fields1').text_fields.length )
|
156
|
+
end
|
157
|
+
|
158
|
+
def test_p
|
159
|
+
assert($ff.p(:id, 'number1').exists?)
|
160
|
+
assert($ff.p(:index, 3).exists?)
|
161
|
+
assert($ff.p(:title, 'test_3').exists?)
|
162
|
+
|
163
|
+
assert(!$ff.p(:id, 'missing').exists?)
|
164
|
+
assert(!$ff.p(:index, 8).exists?)
|
165
|
+
assert(!$ff.p(:title, 'test_55').exists?)
|
166
|
+
|
167
|
+
assert_raises( UnknownObjectException) {$ff.p(:id , 'missing').class_name }
|
168
|
+
assert_raises( UnknownObjectException) {$ff.p(:id , 'missing').text }
|
169
|
+
assert_raises( UnknownObjectException) {$ff.p(:id , 'missing').title }
|
170
|
+
assert_raises( UnknownObjectException) {$ff.p(:id , 'missing').to_s }
|
171
|
+
assert_raises( UnknownObjectException) {$ff.p(:id , 'missing').disabled }
|
172
|
+
|
173
|
+
assert_equal( 'redText' , $ff.p(:index,1).class_name)
|
174
|
+
assert_equal( 'P_tag_1' , $ff.p(:index,1).title)
|
175
|
+
assert_equal( 'This text is in a p with an id of number2' , $ff.p(:index,2).text)
|
176
|
+
end
|
177
|
+
|
178
|
+
def test_p_iterator
|
179
|
+
assert_equal( 3, $ff.ps.length)
|
180
|
+
assert_equal( 'italicText', $ff.ps[2].class_name)
|
181
|
+
assert_equal( 'number3', $ff.ps[3].id)
|
182
|
+
|
183
|
+
count=1
|
184
|
+
$ff.ps.each do |p|
|
185
|
+
assert_equal('number'+count.to_s , p.id)
|
186
|
+
count+=1
|
187
|
+
end
|
188
|
+
assert_equal( count-1 , $ff.ps.length)
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
class TC_Divs_Display < Test::Unit::TestCase
|
193
|
+
include FireWatir
|
194
|
+
include MockStdoutTestCase
|
195
|
+
|
196
|
+
def test_showDivs
|
197
|
+
$ff.goto($htmlRoot + "div.html")
|
198
|
+
$stdout = @mockout
|
199
|
+
$ff.showDivs
|
200
|
+
assert_equal(<<END_OF_MESSAGE, @mockout)
|
201
|
+
There are 7 divs
|
202
|
+
div: name:
|
203
|
+
id: div1
|
204
|
+
class:
|
205
|
+
index: 1
|
206
|
+
div: name:
|
207
|
+
id: div2
|
208
|
+
class: blueText
|
209
|
+
index: 2
|
210
|
+
div: name:
|
211
|
+
id: div3
|
212
|
+
class:
|
213
|
+
index: 3
|
214
|
+
div: name:
|
215
|
+
id: div4
|
216
|
+
class:
|
217
|
+
index: 4
|
218
|
+
div: name:
|
219
|
+
id: buttons1
|
220
|
+
class:
|
221
|
+
index: 5
|
222
|
+
div: name:
|
223
|
+
id: buttons2
|
224
|
+
class:
|
225
|
+
index: 6
|
226
|
+
div: name: divName
|
227
|
+
id: text_fields1
|
228
|
+
class: divClass
|
229
|
+
index: 7
|
230
|
+
END_OF_MESSAGE
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
class TC_Spans_Display < Test::Unit::TestCase
|
235
|
+
include FireWatir
|
236
|
+
include MockStdoutTestCase
|
237
|
+
|
238
|
+
def test_showSpans
|
239
|
+
$ff.goto($htmlRoot + "div.html")
|
240
|
+
$stdout = @mockout
|
241
|
+
$ff.showSpans
|
242
|
+
assert_equal(<<END_OF_MESSAGE, @mockout)
|
243
|
+
There are 7 spans
|
244
|
+
span: name:
|
245
|
+
id: span1
|
246
|
+
class:
|
247
|
+
index: 1
|
248
|
+
span: name:
|
249
|
+
id: span2
|
250
|
+
class: blueText
|
251
|
+
index: 2
|
252
|
+
span: name:
|
253
|
+
id: span3
|
254
|
+
class:
|
255
|
+
index: 3
|
256
|
+
span: name:
|
257
|
+
id: span4
|
258
|
+
class:
|
259
|
+
index: 4
|
260
|
+
span: name:
|
261
|
+
id: buttons1
|
262
|
+
class:
|
263
|
+
index: 5
|
264
|
+
span: name:
|
265
|
+
id: buttons2
|
266
|
+
class:
|
267
|
+
index: 6
|
268
|
+
span: name: spanName
|
269
|
+
id: text_fields1
|
270
|
+
class: spanClass
|
271
|
+
index: 7
|
272
|
+
END_OF_MESSAGE
|
273
|
+
end
|
274
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# feature tests for file 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_FileField < Test::Unit::TestCase
|
8
|
+
include FireWatir
|
9
|
+
|
10
|
+
def gotoPage()
|
11
|
+
$ff.goto($htmlRoot + "fileupload.html")
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_fileField_Exists
|
15
|
+
gotoPage()
|
16
|
+
#test for existance of 4 file area
|
17
|
+
assert($ff.file_field(:name,"file1").exists?)
|
18
|
+
assert($ff.file_field(:id,"file2").exists?)
|
19
|
+
#test for missing
|
20
|
+
assert_false($ff.file_field(:name, "missing").exists?)
|
21
|
+
assert_false($ff.file_field(:name,"totallybogus").exists?)
|
22
|
+
#pop one open and put something in it.
|
23
|
+
$ff.file_field(:name,"file3").set($htmlRoot + "fileupload.html")
|
24
|
+
#click the upload button
|
25
|
+
$ff.button(:name,"upload").click
|
26
|
+
|
27
|
+
assert($ff.text.include?("PASS"))
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_iterator
|
31
|
+
gotoPage()
|
32
|
+
assert_equal(6, $ff.file_fields.length)
|
33
|
+
arrFileFields = $ff.file_fields
|
34
|
+
assert_equal("file1", arrFileFields[1].name)
|
35
|
+
assert_equal("file2", arrFileFields[2].id)
|
36
|
+
assert_equal("disabled", arrFileFields[3].name)
|
37
|
+
assert_equal("file3", arrFileFields[4].name)
|
38
|
+
assert_equal("beforetest", arrFileFields[5].name)
|
39
|
+
assert_equal("aftertest", arrFileFields[6].name)
|
40
|
+
arrFileFields.each do |fileField|
|
41
|
+
assert_equal("file", fileField.type)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# feature tests for TextArea 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_FileField_XPath < Test::Unit::TestCase
|
8
|
+
include FireWatir
|
9
|
+
|
10
|
+
def gotoPage
|
11
|
+
$ff.goto($htmlRoot + "fileupload.html")
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_file_field_Exists
|
15
|
+
gotoPage()
|
16
|
+
#test for existance of 4 file area
|
17
|
+
assert($ff.file_field(:xpath, "//input[@name='file1']").exists?)
|
18
|
+
assert($ff.file_field(:xpath, "//input[@id='file2']").exists?)
|
19
|
+
#test for missing
|
20
|
+
assert_false($ff.file_field(:xpath, "//input[@name='missing']").exists?)
|
21
|
+
assert_false($ff.file_field(:xpath, "//input[@name='totallybogus']").exists?)
|
22
|
+
#pop one open and put something in it.
|
23
|
+
$ff.file_field(:xpath, "//input[@name='file3']").set($htmlRoot + "fileupload.html")
|
24
|
+
#click the upload button
|
25
|
+
$ff.button(:xpath, "//input[@name='upload']").click
|
26
|
+
|
27
|
+
assert($ff.text.include?("PASS"))
|
28
|
+
end
|
29
|
+
|
30
|
+
#def test_iterator
|
31
|
+
# gotoPage()
|
32
|
+
# assert_equal(6, $ff.file_fields.length)
|
33
|
+
#end
|
34
|
+
|
35
|
+
end
|