firewatir 1.6.2 → 1.6.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. data/LICENSE +32 -0
  2. data/lib/firewatir.rb +40 -50
  3. data/lib/firewatir/container.rb +491 -534
  4. data/lib/firewatir/document.rb +239 -0
  5. data/lib/firewatir/element.rb +1365 -0
  6. data/lib/firewatir/element_collections.rb +314 -0
  7. data/lib/firewatir/elements/button.rb +15 -0
  8. data/lib/firewatir/elements/file_field.rb +29 -0
  9. data/lib/firewatir/elements/form.rb +40 -0
  10. data/lib/firewatir/elements/frame.rb +55 -0
  11. data/lib/firewatir/elements/hidden.rb +56 -0
  12. data/lib/firewatir/elements/image.rb +139 -0
  13. data/lib/firewatir/elements/input_element.rb +44 -0
  14. data/lib/firewatir/elements/link.rb +76 -0
  15. data/lib/firewatir/elements/non_control_element.rb +53 -0
  16. data/lib/firewatir/elements/non_control_elements.rb +108 -0
  17. data/lib/firewatir/elements/not_used.rb +278 -0
  18. data/lib/firewatir/elements/option.rb +131 -0
  19. data/lib/firewatir/elements/radio_check_common.rb +163 -0
  20. data/lib/firewatir/elements/select_list.rb +188 -0
  21. data/lib/firewatir/elements/table.rb +218 -0
  22. data/lib/firewatir/elements/table_cell.rb +54 -0
  23. data/lib/firewatir/elements/table_row.rb +100 -0
  24. data/lib/firewatir/elements/text_field.rb +218 -0
  25. data/lib/firewatir/exceptions.rb +10 -10
  26. data/lib/firewatir/firefox.rb +1040 -1127
  27. data/lib/firewatir/jssh_socket.rb +101 -0
  28. data/lib/firewatir/version.rb +5 -5
  29. data/unittests/attach_to_new_window_test.rb +49 -42
  30. data/unittests/bug_fixes_test.rb +195 -198
  31. data/unittests/buttons_xpath_test.rb +88 -88
  32. data/unittests/checkbox_test.rb +158 -155
  33. data/unittests/checkbox_xpath_test.rb +107 -107
  34. data/unittests/div_test.rb +275 -276
  35. data/unittests/filefield_test.rb +49 -45
  36. data/unittests/filefield_xpath_test.rb +35 -35
  37. data/unittests/form_test.rb +296 -308
  38. data/unittests/frame_test.rb +159 -152
  39. data/unittests/hidden_test.rb +85 -85
  40. data/unittests/hidden_xpath_test.rb +72 -72
  41. data/unittests/html/blankpage.html +11 -11
  42. data/unittests/html/buttons1.html +61 -61
  43. data/unittests/html/cssTest.html +42 -42
  44. data/unittests/html/div.html +72 -72
  45. data/unittests/html/fileupload.html +45 -45
  46. data/unittests/html/formTest1.html +38 -38
  47. data/unittests/html/forms2.html +45 -45
  48. data/unittests/html/frame_buttons.html +3 -3
  49. data/unittests/html/iframeTest.html +14 -14
  50. data/unittests/html/iframeTest1.html +13 -13
  51. data/unittests/html/iframeTest2.html +5 -5
  52. data/unittests/html/links1.html +42 -42
  53. data/unittests/html/nestedFrames.html +6 -6
  54. data/unittests/html/new_browser.html +1 -0
  55. data/unittests/html/new_browser_popup.html +8 -0
  56. data/unittests/html/pass.html +9 -9
  57. data/unittests/html/pre.html +27 -27
  58. data/unittests/html/redirect.html +10 -10
  59. data/unittests/html/redirect1.html +8 -8
  60. data/unittests/html/redirect2.html +8 -8
  61. data/unittests/html/redirect3.html +8 -8
  62. data/unittests/html/simple_table_columns.html +74 -74
  63. data/unittests/html/table1.html +165 -165
  64. data/unittests/html/textfields1.html +62 -62
  65. data/unittests/images_test.rb +198 -205
  66. data/unittests/images_xpath_test.rb +118 -119
  67. data/unittests/javascript_test.rb +75 -75
  68. data/unittests/links_test.rb +231 -232
  69. data/unittests/links_xpath_test.rb +79 -79
  70. data/unittests/mozilla_all_tests.rb +7 -7
  71. data/unittests/pre_test.rb +75 -76
  72. data/unittests/radios_xpath_test.rb +101 -101
  73. data/unittests/redirect_test.rb +41 -41
  74. data/unittests/selectbox_test.rb +142 -142
  75. data/unittests/selectbox_xpath_test.rb +129 -129
  76. data/unittests/setup.rb +29 -30
  77. data/unittests/table_test.rb +385 -373
  78. data/unittests/table_xpath_test.rb +185 -185
  79. data/unittests/textfields_test.rb +234 -233
  80. data/unittests/textfields_xpath_test.rb +113 -113
  81. metadata +33 -11
  82. data/lib/firewatir/MozillaBaseElement.rb +0 -1863
  83. data/lib/firewatir/htmlelements.rb +0 -1911
  84. data/unittests/iostring.rb +0 -30
  85. 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>
@@ -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 'ftools'
7
- require 'webrick'
8
-
9
- class TC_Images < Test::Unit::TestCase
10
-
11
-
12
- def setup
13
- goto_page("images1.html")
14
- @saved_img_path = build_path("sample.img.dat");
15
- clean_saved_image
16
- end
17
-
18
- def teardown
19
- clean_saved_image
20
- end
21
- # def test_show_all_objects
22
- # browser.show_all_objects
23
- # end
24
-
25
- def test_imageExists
26
- assert( ! browser.image(:name , "missing_name").exists? )
27
- assert( browser.image(:name , "circle").exists? )
28
- assert( browser.image(:name , /circ/ ).exists? )
29
-
30
- assert( ! browser.image(:id , "missing_id").exists? )
31
- assert( browser.image(:id , "square").exists? )
32
- assert( browser.image(:id , /squ/ ).exists? )
33
-
34
- assert( ! browser.image(:src, "missingsrc.gif").exists? )
35
-
36
- assert( browser.image(:src, /images\/triangle.jpg/).exists? )
37
- assert( browser.image(:src , /triangle/ ).exists? )
38
-
39
- assert( browser.image(:alt , "circle" ).exists? )
40
- assert( browser.image(:alt , /cir/ ).exists? )
41
-
42
- assert( ! browser.image(:alt , "triangle" ).exists? )
43
- assert( ! browser.image(:alt , /tri/ ).exists? )
44
-
45
- assert( browser.image(:title, 'square_image').exists? )
46
- assert( ! browser.image(:title, 'pentagram').exists? )
47
- end
48
-
49
- def test_image_click
50
- assert_raises(UnknownObjectException ) { browser.image(:name, "no_image_with_this").click }
51
- assert_raises(UnknownObjectException ) { browser.image(:id, "no_image_with_this").click }
52
- assert_raises(UnknownObjectException ) { browser.image(:src, "no_image_with_this").click}
53
- assert_raises(UnknownObjectException ) { browser.image(:alt, "no_image_with_this").click}
54
-
55
- # test for bug 1882
56
- browser.text_field(:name , "text1").clear
57
- browser.button(:value , /Pos/ ).click
58
- assert_equal('clicked' , browser.text_field(:name , "text1" ).value )
59
-
60
- # test for disabled button. Click the button to make it disabled
61
- browser.button(:name , 'disable_img').click
62
- assert( browser.image(:name , 'disabler_test').disabled )
63
-
64
- # Click button again to make it enabled.
65
- browser.button(:name , 'disable_img').click
66
- assert( ! browser.image(:name , 'disabler_test').disabled )
67
-
68
-
69
- browser.image(:src, /button/).click
70
- #assert(browser.text.include?("PASS") )
71
- assert(browser.contains_text("PASS") )
72
- end
73
-
74
- # TODO: Need to see alternative for this in Mozilla
75
- #def test_imageHasLoaded
76
- # assert_raises(UnknownObjectException ) { browser.image(:name, "no_image_with_this").hasLoaded? }
77
- # assert_raises(UnknownObjectException ) { browser.image(:id, "no_image_with_this").hasLoaded? }
78
- # assert_raises(UnknownObjectException ) { browser.image(:src, "no_image_with_this").hasLoaded? }
79
- # assert_raises(UnknownObjectException ) { browser.image(:alt, "no_image_with_this").hasLoaded? }
80
- #
81
- # assert( ! browser.image(:name, "themissingimage").hasLoaded? )
82
- # assert( browser.image(:name, "circle").hasLoaded? )
83
- #
84
- # assert( browser.image(:alt, "circle").hasLoaded? )
85
- # assert( browser.image(:alt, /cir/ ).hasLoaded? )
86
- #end
87
-
88
- def test_image_properties
89
- # TODO: Need to see alternative for this in Mozilla
90
- #assert_raises(UnknownObjectException ) { browser.image(:name, "no_image_with_this").hasLoaded? }
91
- #assert_raises(UnknownObjectException ) { browser.image(:id, "no_image_with_this").hasLoaded? }
92
- #assert_raises(UnknownObjectException ) { browser.image(:src, "no_image_with_this").hasLoaded? }
93
- #assert_raises(UnknownObjectException ) { browser.image(:index, 82).hasLoaded? }
94
-
95
- assert_raises(UnknownObjectException ) { browser.image(:index, 82).name }
96
- assert_raises(UnknownObjectException ) { browser.image(:index, 82).id }
97
- assert_raises(UnknownObjectException ) { browser.image(:index, 82).src }
98
- assert_raises(UnknownObjectException ) { browser.image(:index, 82).value }
99
- assert_raises(UnknownObjectException ) { browser.image(:index, 82).height }
100
- assert_raises(UnknownObjectException ) { browser.image(:index, 82).width }
101
-
102
- # TODO: Need to see alternative for this in Mozilla
103
- #assert_raises(UnknownObjectException ) { browser.image(:index, 82).fileCreatedDate }
104
- #assert_raises(UnknownObjectException ) { browser.image(:index, 82).fileSize }
105
-
106
- assert_raises(UnknownObjectException ) { browser.image(:index, 82).alt}
107
- assert_raises(UnknownObjectException ) { browser.image(:index, 82).title}
108
-
109
- assert_equal( "" , browser.image(:index, 2).name )
110
- assert_equal( "square" , browser.image(:index, 2).id )
111
- assert_match( /square\.jpg/i ,browser.image(:index, 2).src )
112
- assert_equal( "" , browser.image(:index, 2).value )
113
- assert_equal( "88" , browser.image(:index, 2).height )
114
- assert_equal( "88" , browser.image(:index, 2).width )
115
-
116
- # this line fails, as the date is when it is installed on the local oc, not the date the file was really created
117
- #assert_equal( "03/10/2005" , browser.image(:index, 2).fileCreatedDate )
118
- #assert_equal( "788", browser.image(:index, 2).fileSize )
119
-
120
- # tool tips: alt text + title
121
- assert_equal('circle' , browser.image(:index, 6).alt)
122
- assert_equal( "" , browser.image(:index, 2).alt)
123
- assert_equal('square_image', browser.image(:id, 'square').title)
124
-
125
- # to string tests -- output should be verified!
126
- puts browser.image(:name , "circle").to_s
127
- puts browser.image(:index , 2).to_s
128
- end
129
-
130
- def test_image_iterator
131
- assert_equal(6 , browser.images.length)
132
- assert_equal("" , browser.images[2].name )
133
- assert_equal("square", browser.images[2].id )
134
- assert_match(/square/, browser.images[2].src )
135
-
136
- index = 1
137
- browser.images.each do |i|
138
- assert_equal( browser.image(:index, index).id , i.id )
139
- assert_equal( browser.image(:index, index).name , i.name )
140
- assert_equal( browser.image(:index, index).src , i.src )
141
- assert_equal( browser.image(:index, index).height , i.height.to_s )
142
- assert_equal( browser.image(:index, index).width , i.width.to_s )
143
-
144
- index+=1
145
- end
146
- assert_equal( index-1 , browser.images.length )
147
- end
148
-
149
- #def test_save_local_image
150
- # browser.images[1].save(build_windows_path("sample.img.dat"))
151
- # assert(File.compare(@saved_img_path, browser.images[1].src.gsub(/^file:\/\/\//, '')))
152
- #end
153
-
154
- def clean_saved_image
155
- File.delete(@saved_img_path) if (File.exists?(@saved_img_path))
156
- end
157
-
158
- def build_windows_path(part)
159
- build_path(part).gsub(/\//, "\\")
160
- end
161
-
162
- def build_path(part)
163
- "#{$myDir}/#{part}"
164
- end
165
- end
166
-
167
- class TC_Images_Display < Test::Unit::TestCase
168
-
169
- include MockStdoutTestCase
170
-
171
- tag_method :test_showImages, :fails_on_ie
172
- def test_showImages
173
- goto_page("images1.html")
174
- $stdout = @mockout
175
- browser.showImages
176
- assert_equal(<<END_OF_MESSAGE, @mockout)
177
- There are 6 images
178
- image: name:
179
- id:
180
- src: images/triangle.jpg
181
- index: 1
182
- image: name:
183
- id: square
184
- src: images/square.jpg
185
- index: 2
186
- image: name: circle
187
- id:
188
- src: images/circle.jpg
189
- index: 3
190
- image: name: themissingimage
191
- id:
192
- src: images/missing.jpg
193
- index: 4
194
- image: name: disabler_test
195
- id:
196
- src: images/button.jpg
197
- index: 5
198
- image: name:
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
+