firewatir 1.6.2 → 1.6.5
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +32 -0
- data/lib/firewatir.rb +40 -50
- data/lib/firewatir/container.rb +491 -534
- data/lib/firewatir/document.rb +239 -0
- data/lib/firewatir/element.rb +1365 -0
- data/lib/firewatir/element_collections.rb +314 -0
- data/lib/firewatir/elements/button.rb +15 -0
- data/lib/firewatir/elements/file_field.rb +29 -0
- data/lib/firewatir/elements/form.rb +40 -0
- data/lib/firewatir/elements/frame.rb +55 -0
- data/lib/firewatir/elements/hidden.rb +56 -0
- data/lib/firewatir/elements/image.rb +139 -0
- data/lib/firewatir/elements/input_element.rb +44 -0
- data/lib/firewatir/elements/link.rb +76 -0
- data/lib/firewatir/elements/non_control_element.rb +53 -0
- data/lib/firewatir/elements/non_control_elements.rb +108 -0
- data/lib/firewatir/elements/not_used.rb +278 -0
- data/lib/firewatir/elements/option.rb +131 -0
- data/lib/firewatir/elements/radio_check_common.rb +163 -0
- data/lib/firewatir/elements/select_list.rb +188 -0
- data/lib/firewatir/elements/table.rb +218 -0
- data/lib/firewatir/elements/table_cell.rb +54 -0
- data/lib/firewatir/elements/table_row.rb +100 -0
- data/lib/firewatir/elements/text_field.rb +218 -0
- data/lib/firewatir/exceptions.rb +10 -10
- data/lib/firewatir/firefox.rb +1040 -1127
- data/lib/firewatir/jssh_socket.rb +101 -0
- data/lib/firewatir/version.rb +5 -5
- data/unittests/attach_to_new_window_test.rb +49 -42
- data/unittests/bug_fixes_test.rb +195 -198
- data/unittests/buttons_xpath_test.rb +88 -88
- data/unittests/checkbox_test.rb +158 -155
- data/unittests/checkbox_xpath_test.rb +107 -107
- data/unittests/div_test.rb +275 -276
- data/unittests/filefield_test.rb +49 -45
- data/unittests/filefield_xpath_test.rb +35 -35
- data/unittests/form_test.rb +296 -308
- data/unittests/frame_test.rb +159 -152
- data/unittests/hidden_test.rb +85 -85
- data/unittests/hidden_xpath_test.rb +72 -72
- data/unittests/html/blankpage.html +11 -11
- data/unittests/html/buttons1.html +61 -61
- data/unittests/html/cssTest.html +42 -42
- data/unittests/html/div.html +72 -72
- data/unittests/html/fileupload.html +45 -45
- data/unittests/html/formTest1.html +38 -38
- data/unittests/html/forms2.html +45 -45
- data/unittests/html/frame_buttons.html +3 -3
- data/unittests/html/iframeTest.html +14 -14
- data/unittests/html/iframeTest1.html +13 -13
- data/unittests/html/iframeTest2.html +5 -5
- data/unittests/html/links1.html +42 -42
- data/unittests/html/nestedFrames.html +6 -6
- data/unittests/html/new_browser.html +1 -0
- data/unittests/html/new_browser_popup.html +8 -0
- data/unittests/html/pass.html +9 -9
- data/unittests/html/pre.html +27 -27
- data/unittests/html/redirect.html +10 -10
- data/unittests/html/redirect1.html +8 -8
- data/unittests/html/redirect2.html +8 -8
- data/unittests/html/redirect3.html +8 -8
- data/unittests/html/simple_table_columns.html +74 -74
- data/unittests/html/table1.html +165 -165
- data/unittests/html/textfields1.html +62 -62
- data/unittests/images_test.rb +198 -205
- data/unittests/images_xpath_test.rb +118 -119
- data/unittests/javascript_test.rb +75 -75
- data/unittests/links_test.rb +231 -232
- data/unittests/links_xpath_test.rb +79 -79
- data/unittests/mozilla_all_tests.rb +7 -7
- data/unittests/pre_test.rb +75 -76
- data/unittests/radios_xpath_test.rb +101 -101
- data/unittests/redirect_test.rb +41 -41
- data/unittests/selectbox_test.rb +142 -142
- data/unittests/selectbox_xpath_test.rb +129 -129
- data/unittests/setup.rb +29 -30
- data/unittests/table_test.rb +385 -373
- data/unittests/table_xpath_test.rb +185 -185
- data/unittests/textfields_test.rb +234 -233
- data/unittests/textfields_xpath_test.rb +113 -113
- metadata +33 -11
- data/lib/firewatir/MozillaBaseElement.rb +0 -1863
- data/lib/firewatir/htmlelements.rb +0 -1911
- data/unittests/iostring.rb +0 -30
- data/unittests/iostring_test.rb +0 -48
@@ -1,62 +1,62 @@
|
|
1
|
-
<html>
|
2
|
-
<head>
|
3
|
-
<title>Test page for Text Fields </title>
|
4
|
-
</head>
|
5
|
-
<body>
|
6
|
-
CVS Revision: "$Revision: 1.0 $"
|
7
|
-
<script>
|
8
|
-
function addEvent(e) {
|
9
|
-
document.all.events_text.value = document.all.events_text.value + "\n" + e
|
10
|
-
}
|
11
|
-
</script>
|
12
|
-
<br>
|
13
|
-
<br>
|
14
|
-
<table>
|
15
|
-
<tr>
|
16
|
-
<td>
|
17
|
-
<input type="text" name="text1" value='Hello World' maxlength="500">number 1
|
18
|
-
<br>
|
19
|
-
<label for="text2">Label For this Field </label><input type="text" id="text2" value='goodbye all' maxlength="500">
|
20
|
-
<td>
|
21
|
-
These text fields are not in a form
|
22
|
-
<tr>
|
23
|
-
<td>
|
24
|
-
<input type="text" name="disabled" value="Cant enter text in me" disabled>
|
25
|
-
<td>
|
26
|
-
Disabled text box
|
27
|
-
<tr>
|
28
|
-
<td>
|
29
|
-
<input type="text" maxlength="400" name="readOnly" value="Cant enter text in me" readonly>
|
30
|
-
<br>
|
31
|
-
<label for="readOnly2" id="label2">Another Label (pointless- its a readonly box!) </label><input type="text" id="readOnly2" value="Cant enter text in me" readonly>
|
32
|
-
<td>
|
33
|
-
readonly text boxes
|
34
|
-
<form name="test1" method="get" action="pass.html">
|
35
|
-
<tr>
|
36
|
-
<td>
|
37
|
-
<input type="text" name="text1" value='Ruby'>
|
38
|
-
<td>
|
39
|
-
This is used in text1 in form test1
|
40
|
-
</form>
|
41
|
-
</tr>
|
42
|
-
</table>
|
43
|
-
These text fields are used to test :beforeText and :afterText
|
44
|
-
<br>
|
45
|
-
<input type="text" name="beforetest" value='Before Text Test'>This Text After
|
46
|
-
<br>
|
47
|
-
This Text Before<input type="text" name="aftertest" value='AfterText Test' title="This used to test :afterText">
|
48
|
-
<br>
|
49
|
-
<br>
|
50
|
-
This Field has javascript events in it <input type="text" name="events_tester" onKeyUp='javascript:addEvent("keyup")' onKeyDown='javascript:addEvent("keydown")'
|
51
|
-
onKeyPress='javascript:addEvent("keypress")'>
|
52
|
-
<br>
|
53
|
-
<textarea id="events_text" name="events_text" cols="20" rows="10"></textarea> <input type="button" onClick='document.all.events_text.value=""' value="Clear Events Box">
|
54
|
-
<br>
|
55
|
-
Password Fields
|
56
|
-
<br>
|
57
|
-
Password With Name<input type="password" name="password1">
|
58
|
-
<br>
|
59
|
-
<label for="password1">Password With ID ( the text here is a label for it )</label><input type="password" id="password1">
|
60
|
-
<div name="divvy">Div Text</div>
|
61
|
-
</body>
|
62
|
-
</html>
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>Test page for Text Fields </title>
|
4
|
+
</head>
|
5
|
+
<body>
|
6
|
+
CVS Revision: "$Revision: 1.0 $"
|
7
|
+
<script>
|
8
|
+
function addEvent(e) {
|
9
|
+
document.all.events_text.value = document.all.events_text.value + "\n" + e
|
10
|
+
}
|
11
|
+
</script>
|
12
|
+
<br>
|
13
|
+
<br>
|
14
|
+
<table>
|
15
|
+
<tr>
|
16
|
+
<td>
|
17
|
+
<input type="text" name="text1" value='Hello World' maxlength="500">number 1
|
18
|
+
<br>
|
19
|
+
<label for="text2">Label For this Field </label><input type="text" id="text2" value='goodbye all' maxlength="500">
|
20
|
+
<td>
|
21
|
+
These text fields are not in a form
|
22
|
+
<tr>
|
23
|
+
<td>
|
24
|
+
<input type="text" name="disabled" value="Cant enter text in me" disabled>
|
25
|
+
<td>
|
26
|
+
Disabled text box
|
27
|
+
<tr>
|
28
|
+
<td>
|
29
|
+
<input type="text" maxlength="400" name="readOnly" value="Cant enter text in me" readonly>
|
30
|
+
<br>
|
31
|
+
<label for="readOnly2" id="label2">Another Label (pointless- its a readonly box!) </label><input type="text" id="readOnly2" value="Cant enter text in me" readonly>
|
32
|
+
<td>
|
33
|
+
readonly text boxes
|
34
|
+
<form name="test1" method="get" action="pass.html">
|
35
|
+
<tr>
|
36
|
+
<td>
|
37
|
+
<input type="text" name="text1" value='Ruby'>
|
38
|
+
<td>
|
39
|
+
This is used in text1 in form test1
|
40
|
+
</form>
|
41
|
+
</tr>
|
42
|
+
</table>
|
43
|
+
These text fields are used to test :beforeText and :afterText
|
44
|
+
<br>
|
45
|
+
<input type="text" name="beforetest" value='Before Text Test'>This Text After
|
46
|
+
<br>
|
47
|
+
This Text Before<input type="text" name="aftertest" value='AfterText Test' title="This used to test :afterText">
|
48
|
+
<br>
|
49
|
+
<br>
|
50
|
+
This Field has javascript events in it <input type="text" name="events_tester" onKeyUp='javascript:addEvent("keyup")' onKeyDown='javascript:addEvent("keydown")'
|
51
|
+
onKeyPress='javascript:addEvent("keypress")'>
|
52
|
+
<br>
|
53
|
+
<textarea id="events_text" name="events_text" cols="20" rows="10"></textarea> <input type="button" onClick='document.all.events_text.value=""' value="Clear Events Box">
|
54
|
+
<br>
|
55
|
+
Password Fields
|
56
|
+
<br>
|
57
|
+
Password With Name<input type="password" name="password1">
|
58
|
+
<br>
|
59
|
+
<label for="password1">Password With ID ( the text here is a label for it )</label><input type="password" id="password1">
|
60
|
+
<div name="divvy">Div Text</div>
|
61
|
+
</body>
|
62
|
+
</html>
|
data/unittests/images_test.rb
CHANGED
@@ -1,205 +1,198 @@
|
|
1
|
-
# feature tests for Images
|
2
|
-
# revision: $Revision: 1.0 $
|
3
|
-
|
4
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
5
|
-
require 'unittests/setup'
|
6
|
-
require '
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
#
|
22
|
-
#
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
assert(
|
27
|
-
assert( browser.image(:name ,
|
28
|
-
|
29
|
-
|
30
|
-
assert(
|
31
|
-
assert( browser.image(:id ,
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
assert( browser.image(:src, /
|
37
|
-
|
38
|
-
|
39
|
-
assert( browser.image(:alt ,
|
40
|
-
|
41
|
-
|
42
|
-
assert( ! browser.image(:alt ,
|
43
|
-
|
44
|
-
|
45
|
-
assert(
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
assert_raises(UnknownObjectException ) { browser.image(:
|
51
|
-
assert_raises(UnknownObjectException ) { browser.image(:
|
52
|
-
assert_raises(UnknownObjectException ) { browser.image(:
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
browser.
|
57
|
-
browser.
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
browser.
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
browser.
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
browser.
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
#
|
75
|
-
#
|
76
|
-
# assert_raises(UnknownObjectException ) { browser.image(:
|
77
|
-
# assert_raises(UnknownObjectException ) { browser.image(:
|
78
|
-
# assert_raises(UnknownObjectException ) { browser.image(:
|
79
|
-
#
|
80
|
-
#
|
81
|
-
# assert(
|
82
|
-
#
|
83
|
-
#
|
84
|
-
# assert( browser.image(:alt,
|
85
|
-
#
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
#
|
90
|
-
#assert_raises(UnknownObjectException ) { browser.image(:
|
91
|
-
#assert_raises(UnknownObjectException ) { browser.image(:
|
92
|
-
#assert_raises(UnknownObjectException ) { browser.image(:
|
93
|
-
|
94
|
-
|
95
|
-
assert_raises(UnknownObjectException ) { browser.image(:index, 82).
|
96
|
-
assert_raises(UnknownObjectException ) { browser.image(:index, 82).
|
97
|
-
assert_raises(UnknownObjectException ) { browser.image(:index, 82).
|
98
|
-
assert_raises(UnknownObjectException ) { browser.image(:index, 82).
|
99
|
-
assert_raises(UnknownObjectException ) { browser.image(:index, 82).
|
100
|
-
|
101
|
-
|
102
|
-
#
|
103
|
-
#assert_raises(UnknownObjectException ) { browser.image(:index, 82).
|
104
|
-
|
105
|
-
|
106
|
-
assert_raises(UnknownObjectException ) { browser.image(:index, 82).
|
107
|
-
|
108
|
-
|
109
|
-
assert_equal( ""
|
110
|
-
|
111
|
-
|
112
|
-
assert_equal( "" , browser.image(:index, 2).
|
113
|
-
assert_equal( "88" , browser.image(:index, 2).
|
114
|
-
|
115
|
-
|
116
|
-
#
|
117
|
-
#assert_equal( "
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
assert_equal(
|
122
|
-
assert_equal(
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
puts
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
assert_equal(
|
132
|
-
assert_equal(""
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
assert_equal( browser.image(:index, index).
|
139
|
-
assert_equal( browser.image(:index, index).
|
140
|
-
assert_equal( browser.image(:index, index).
|
141
|
-
assert_equal( browser.image(:index, index).
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
id:
|
200
|
-
src: images/circle.jpg
|
201
|
-
index: 6
|
202
|
-
END_OF_MESSAGE
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
1
|
+
# feature tests for Images
|
2
|
+
# revision: $Revision: 1.0 $
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
5
|
+
require 'unittests/setup'
|
6
|
+
require 'webrick'
|
7
|
+
|
8
|
+
class TC_Images < Test::Unit::TestCase
|
9
|
+
|
10
|
+
|
11
|
+
def setup
|
12
|
+
goto_page("images1.html")
|
13
|
+
@saved_img_path = build_path("sample.img.dat");
|
14
|
+
clean_saved_image
|
15
|
+
end
|
16
|
+
|
17
|
+
def teardown
|
18
|
+
clean_saved_image
|
19
|
+
end
|
20
|
+
# def test_show_all_objects
|
21
|
+
# browser.show_all_objects
|
22
|
+
# end
|
23
|
+
|
24
|
+
def test_imageExists
|
25
|
+
assert( ! browser.image(:name , "missing_name").exists? )
|
26
|
+
assert( browser.image(:name , "circle").exists? )
|
27
|
+
assert( browser.image(:name , /circ/ ).exists? )
|
28
|
+
|
29
|
+
assert( ! browser.image(:id , "missing_id").exists? )
|
30
|
+
assert( browser.image(:id , "square").exists? )
|
31
|
+
assert( browser.image(:id , /squ/ ).exists? )
|
32
|
+
|
33
|
+
assert( ! browser.image(:src, "missingsrc.gif").exists? )
|
34
|
+
|
35
|
+
assert( browser.image(:src, /images\/triangle.jpg/).exists? )
|
36
|
+
assert( browser.image(:src , /triangle/ ).exists? )
|
37
|
+
|
38
|
+
assert( browser.image(:alt , "circle" ).exists? )
|
39
|
+
assert( browser.image(:alt , /cir/ ).exists? )
|
40
|
+
|
41
|
+
assert( ! browser.image(:alt , "triangle" ).exists? )
|
42
|
+
assert( ! browser.image(:alt , /tri/ ).exists? )
|
43
|
+
|
44
|
+
assert( browser.image(:title, 'square_image').exists? )
|
45
|
+
assert( ! browser.image(:title, 'pentagram').exists? )
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_image_click
|
49
|
+
assert_raises(UnknownObjectException ) { browser.image(:name, "no_image_with_this").click }
|
50
|
+
assert_raises(UnknownObjectException ) { browser.image(:id, "no_image_with_this").click }
|
51
|
+
assert_raises(UnknownObjectException ) { browser.image(:src, "no_image_with_this").click}
|
52
|
+
assert_raises(UnknownObjectException ) { browser.image(:alt, "no_image_with_this").click}
|
53
|
+
|
54
|
+
# test for bug 1882
|
55
|
+
browser.text_field(:name , "text1").clear
|
56
|
+
browser.button(:value , /Pos/ ).click
|
57
|
+
assert_equal('clicked' , browser.text_field(:name , "text1" ).value )
|
58
|
+
|
59
|
+
# test for disabled button. Click the button to make it disabled
|
60
|
+
browser.button(:name , 'disable_img').click
|
61
|
+
assert( browser.image(:name , 'disabler_test').disabled )
|
62
|
+
|
63
|
+
# Click button again to make it enabled.
|
64
|
+
browser.button(:name , 'disable_img').click
|
65
|
+
assert( ! browser.image(:name , 'disabler_test').disabled )
|
66
|
+
|
67
|
+
|
68
|
+
browser.image(:src, /button/).click
|
69
|
+
#assert(browser.text.include?("PASS") )
|
70
|
+
assert(browser.contains_text("PASS") )
|
71
|
+
end
|
72
|
+
|
73
|
+
# TODO: Need to see alternative for this in Mozilla
|
74
|
+
#def test_imageHasLoaded
|
75
|
+
# assert_raises(UnknownObjectException ) { browser.image(:name, "no_image_with_this").hasLoaded? }
|
76
|
+
# assert_raises(UnknownObjectException ) { browser.image(:id, "no_image_with_this").hasLoaded? }
|
77
|
+
# assert_raises(UnknownObjectException ) { browser.image(:src, "no_image_with_this").hasLoaded? }
|
78
|
+
# assert_raises(UnknownObjectException ) { browser.image(:alt, "no_image_with_this").hasLoaded? }
|
79
|
+
#
|
80
|
+
# assert( ! browser.image(:name, "themissingimage").hasLoaded? )
|
81
|
+
# assert( browser.image(:name, "circle").hasLoaded? )
|
82
|
+
#
|
83
|
+
# assert( browser.image(:alt, "circle").hasLoaded? )
|
84
|
+
# assert( browser.image(:alt, /cir/ ).hasLoaded? )
|
85
|
+
#end
|
86
|
+
|
87
|
+
def test_image_properties
|
88
|
+
# TODO: Need to see alternative for this in Mozilla
|
89
|
+
#assert_raises(UnknownObjectException ) { browser.image(:name, "no_image_with_this").hasLoaded? }
|
90
|
+
#assert_raises(UnknownObjectException ) { browser.image(:id, "no_image_with_this").hasLoaded? }
|
91
|
+
#assert_raises(UnknownObjectException ) { browser.image(:src, "no_image_with_this").hasLoaded? }
|
92
|
+
#assert_raises(UnknownObjectException ) { browser.image(:index, 82).hasLoaded? }
|
93
|
+
|
94
|
+
assert_raises(UnknownObjectException ) { browser.image(:index, 82).name }
|
95
|
+
assert_raises(UnknownObjectException ) { browser.image(:index, 82).id }
|
96
|
+
assert_raises(UnknownObjectException ) { browser.image(:index, 82).src }
|
97
|
+
assert_raises(UnknownObjectException ) { browser.image(:index, 82).value }
|
98
|
+
assert_raises(UnknownObjectException ) { browser.image(:index, 82).height }
|
99
|
+
assert_raises(UnknownObjectException ) { browser.image(:index, 82).width }
|
100
|
+
|
101
|
+
# TODO: Need to see alternative for this in Mozilla
|
102
|
+
#assert_raises(UnknownObjectException ) { browser.image(:index, 82).fileCreatedDate }
|
103
|
+
#assert_raises(UnknownObjectException ) { browser.image(:index, 82).fileSize }
|
104
|
+
|
105
|
+
assert_raises(UnknownObjectException ) { browser.image(:index, 82).alt}
|
106
|
+
assert_raises(UnknownObjectException ) { browser.image(:index, 82).title}
|
107
|
+
|
108
|
+
assert_equal( "" , browser.image(:index, 2).name )
|
109
|
+
assert_equal( "square" , browser.image(:index, 2).id )
|
110
|
+
assert_match( /square\.jpg/i ,browser.image(:index, 2).src )
|
111
|
+
assert_equal( "" , browser.image(:index, 2).value )
|
112
|
+
assert_equal( "88" , browser.image(:index, 2).height )
|
113
|
+
assert_equal( "88" , browser.image(:index, 2).width )
|
114
|
+
|
115
|
+
# this line fails, as the date is when it is installed on the local oc, not the date the file was really created
|
116
|
+
#assert_equal( "03/10/2005" , browser.image(:index, 2).fileCreatedDate )
|
117
|
+
#assert_equal( "788", browser.image(:index, 2).fileSize )
|
118
|
+
|
119
|
+
# tool tips: alt text + title
|
120
|
+
assert_equal('circle' , browser.image(:index, 6).alt)
|
121
|
+
assert_equal( "" , browser.image(:index, 2).alt)
|
122
|
+
assert_equal('square_image', browser.image(:id, 'square').title)
|
123
|
+
|
124
|
+
# to string tests -- output should be verified!
|
125
|
+
puts browser.image(:name , "circle").to_s
|
126
|
+
puts browser.image(:index , 2).to_s
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_image_iterator
|
130
|
+
assert_equal(6 , browser.images.length)
|
131
|
+
assert_equal("" , browser.images[2].name )
|
132
|
+
assert_equal("square", browser.images[2].id )
|
133
|
+
assert_match(/square/, browser.images[2].src )
|
134
|
+
|
135
|
+
index = 1
|
136
|
+
browser.images.each do |i|
|
137
|
+
assert_equal( browser.image(:index, index).id , i.id )
|
138
|
+
assert_equal( browser.image(:index, index).name , i.name )
|
139
|
+
assert_equal( browser.image(:index, index).src , i.src )
|
140
|
+
assert_equal( browser.image(:index, index).height , i.height.to_s )
|
141
|
+
assert_equal( browser.image(:index, index).width , i.width.to_s )
|
142
|
+
|
143
|
+
index+=1
|
144
|
+
end
|
145
|
+
assert_equal( index-1 , browser.images.length )
|
146
|
+
end
|
147
|
+
|
148
|
+
def clean_saved_image
|
149
|
+
File.delete(@saved_img_path) if (File.exists?(@saved_img_path))
|
150
|
+
end
|
151
|
+
|
152
|
+
def build_windows_path(part)
|
153
|
+
build_path(part).gsub(/\//, "\\")
|
154
|
+
end
|
155
|
+
|
156
|
+
def build_path(part)
|
157
|
+
"#{$myDir}/#{part}"
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
class TC_Images_Display < Test::Unit::TestCase
|
162
|
+
|
163
|
+
include CaptureIOHelper
|
164
|
+
|
165
|
+
tag_method :test_showImages, :fails_on_ie
|
166
|
+
def test_showImages
|
167
|
+
goto_page("images1.html")
|
168
|
+
actual = capture_stdout { browser.showImages }
|
169
|
+
assert_equal(<<END_OF_MESSAGE, actual)
|
170
|
+
There are 6 images
|
171
|
+
image: name:
|
172
|
+
id:
|
173
|
+
src: images/triangle.jpg
|
174
|
+
index: 1
|
175
|
+
image: name:
|
176
|
+
id: square
|
177
|
+
src: images/square.jpg
|
178
|
+
index: 2
|
179
|
+
image: name: circle
|
180
|
+
id:
|
181
|
+
src: images/circle.jpg
|
182
|
+
index: 3
|
183
|
+
image: name: themissingimage
|
184
|
+
id:
|
185
|
+
src: images/missing.jpg
|
186
|
+
index: 4
|
187
|
+
image: name: disabler_test
|
188
|
+
id:
|
189
|
+
src: images/button.jpg
|
190
|
+
index: 5
|
191
|
+
image: name:
|
192
|
+
id:
|
193
|
+
src: images/circle.jpg
|
194
|
+
index: 6
|
195
|
+
END_OF_MESSAGE
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|