firewatir 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. data/MozillaBaseElement.rb +1778 -0
  2. data/container.rb +889 -0
  3. data/firewatir/exceptions.rb +44 -0
  4. data/firewatir/testUnitAddons.rb +8 -0
  5. data/firewatir.rb +1130 -0
  6. data/htmlelements.rb +2277 -0
  7. data/unittests/attach_to_new_window_test.rb +34 -0
  8. data/unittests/bug_fixes_test.rb +188 -0
  9. data/unittests/buttons_test.rb +215 -0
  10. data/unittests/buttons_xpath_test.rb +87 -0
  11. data/unittests/checkbox_test.rb +154 -0
  12. data/unittests/checkbox_xpath_test.rb +107 -0
  13. data/unittests/div_test.rb +274 -0
  14. data/unittests/filefield_test.rb +45 -0
  15. data/unittests/filefield_xpath_test.rb +35 -0
  16. data/unittests/form_test.rb +307 -0
  17. data/unittests/frame_test.rb +151 -0
  18. data/unittests/hidden_test.rb +85 -0
  19. data/unittests/hidden_xpath_test.rb +72 -0
  20. data/unittests/html/JavascriptClick.html +42 -0
  21. data/unittests/html/blankpage.html +12 -0
  22. data/unittests/html/buttons1.html +61 -0
  23. data/unittests/html/checkboxes1.html +71 -0
  24. data/unittests/html/complex_table.html +36 -0
  25. data/unittests/html/cssTest.html +42 -0
  26. data/unittests/html/div.html +72 -0
  27. data/unittests/html/div_xml.html +21 -0
  28. data/unittests/html/fileupload.html +45 -0
  29. data/unittests/html/formTest1.html +39 -0
  30. data/unittests/html/forms2.html +45 -0
  31. data/unittests/html/forms3.html +132 -0
  32. data/unittests/html/forms4.html +27 -0
  33. data/unittests/html/frame_buttons.html +4 -0
  34. data/unittests/html/frame_links.html +4 -0
  35. data/unittests/html/frame_multi.html +5 -0
  36. data/unittests/html/iframeTest.html +15 -0
  37. data/unittests/html/iframeTest1.html +14 -0
  38. data/unittests/html/iframeTest2.html +6 -0
  39. data/unittests/html/images/1.gif +0 -0
  40. data/unittests/html/images/2.GIF +0 -0
  41. data/unittests/html/images/3.GIF +0 -0
  42. data/unittests/html/images/button.jpg +0 -0
  43. data/unittests/html/images/circle.jpg +0 -0
  44. data/unittests/html/images/minus.GIF +0 -0
  45. data/unittests/html/images/originaltriangle.jpg +0 -0
  46. data/unittests/html/images/plus.gif +0 -0
  47. data/unittests/html/images/square.jpg +0 -0
  48. data/unittests/html/images/triangle.jpg +0 -0
  49. data/unittests/html/images1.html +67 -0
  50. data/unittests/html/javascriptevents.html +35 -0
  51. data/unittests/html/link_pass.html +11 -0
  52. data/unittests/html/links1.html +42 -0
  53. data/unittests/html/links2.html +11 -0
  54. data/unittests/html/modal_dialog.html +8 -0
  55. data/unittests/html/modal_dialog_launcher.html +12 -0
  56. data/unittests/html/nestedFrames.html +6 -0
  57. data/unittests/html/new_browser.html +17 -0
  58. data/unittests/html/pass.html +10 -0
  59. data/unittests/html/popups1.html +60 -0
  60. data/unittests/html/pre.html +28 -0
  61. data/unittests/html/radioButtons1.html +71 -0
  62. data/unittests/html/redirect.html +10 -0
  63. data/unittests/html/redirect1.html +9 -0
  64. data/unittests/html/redirect2.html +9 -0
  65. data/unittests/html/redirect3.html +9 -0
  66. data/unittests/html/select_tealeaf.html +54 -0
  67. data/unittests/html/selectboxes1.html +55 -0
  68. data/unittests/html/simple_table.html +26 -0
  69. data/unittests/html/simple_table_buttons.html +104 -0
  70. data/unittests/html/simple_table_columns.html +74 -0
  71. data/unittests/html/table1.html +165 -0
  72. data/unittests/html/tableCell_using_xpath.html +19 -0
  73. data/unittests/html/textarea.html +30 -0
  74. data/unittests/html/textfields1.html +62 -0
  75. data/unittests/html/textsearch.html +44 -0
  76. data/unittests/images_test.rb +204 -0
  77. data/unittests/images_xpath_test.rb +118 -0
  78. data/unittests/iostring.rb +30 -0
  79. data/unittests/iostring_test.rb +48 -0
  80. data/unittests/javascript_test.rb +71 -0
  81. data/unittests/links_test.rb +230 -0
  82. data/unittests/links_xpath_test.rb +79 -0
  83. data/unittests/mozilla_all_tests.rb +18 -0
  84. data/unittests/pre_test.rb +74 -0
  85. data/unittests/radios_test.rb +166 -0
  86. data/unittests/radios_xpath_test.rb +101 -0
  87. data/unittests/redirect_test.rb +40 -0
  88. data/unittests/selectbox_test.rb +141 -0
  89. data/unittests/selectbox_xpath_test.rb +127 -0
  90. data/unittests/setup.rb +35 -0
  91. data/unittests/table_test.rb +372 -0
  92. data/unittests/table_xpath_test.rb +184 -0
  93. data/unittests/textfields_test.rb +230 -0
  94. data/unittests/textfields_xpath_test.rb +112 -0
  95. metadata +144 -0
@@ -0,0 +1,204 @@
1
+ # feature tests for Images
2
+ # revision: $Revision: 1.0 $
3
+
4
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
5
+ require 'unittests/setup'
6
+ require 'ftools'
7
+ require 'webrick'
8
+
9
+ class TC_Images < Test::Unit::TestCase
10
+ include FireWatir
11
+
12
+ def setup
13
+ $ff.goto($htmlRoot + "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
+ # $ff.show_all_objects
23
+ # end
24
+
25
+ def test_imageExists
26
+ assert( ! $ff.image(:name , "missing_name").exists? )
27
+ assert( $ff.image(:name , "circle").exists? )
28
+ assert( $ff.image(:name , /circ/ ).exists? )
29
+
30
+ assert( ! $ff.image(:id , "missing_id").exists? )
31
+ assert( $ff.image(:id , "square").exists? )
32
+ assert( $ff.image(:id , /squ/ ).exists? )
33
+
34
+ assert( ! $ff.image(:src, "missingsrc.gif").exists? )
35
+
36
+ assert( $ff.image(:src, /images\/triangle.jpg/).exists? )
37
+ assert( $ff.image(:src , /triangle/ ).exists? )
38
+
39
+ assert( $ff.image(:alt , "circle" ).exists? )
40
+ assert( $ff.image(:alt , /cir/ ).exists? )
41
+
42
+ assert( ! $ff.image(:alt , "triangle" ).exists? )
43
+ assert( ! $ff.image(:alt , /tri/ ).exists? )
44
+
45
+ assert( $ff.image(:title, 'square_image').exists? )
46
+ assert( ! $ff.image(:title, 'pentagram').exists? )
47
+ end
48
+
49
+ def test_image_click
50
+ assert_raises(UnknownObjectException ) { $ff.image(:name, "no_image_with_this").click }
51
+ assert_raises(UnknownObjectException ) { $ff.image(:id, "no_image_with_this").click }
52
+ assert_raises(UnknownObjectException ) { $ff.image(:src, "no_image_with_this").click}
53
+ assert_raises(UnknownObjectException ) { $ff.image(:alt, "no_image_with_this").click}
54
+
55
+ # test for bug 1882
56
+ $ff.text_field(:name , "text1").clear
57
+ $ff.button(:value , /Pos/ ).click
58
+ assert_equal('clicked' , $ff.text_field(:name , "text1" ).value )
59
+
60
+ # test for disabled button. Click the button to make it disabled
61
+ $ff.button(:name , 'disable_img').click
62
+ assert( $ff.image(:name , 'disabler_test').disabled )
63
+
64
+ # Click button again to make it enabled.
65
+ $ff.button(:name , 'disable_img').click
66
+ assert( ! $ff.image(:name , 'disabler_test').disabled )
67
+
68
+
69
+ $ff.image(:src, /button/).click
70
+ #assert($ff.text.include?("PASS") )
71
+ assert($ff.contains_text("PASS") )
72
+ end
73
+
74
+ # TODO: Need to see alternative for this in Mozilla
75
+ #def test_imageHasLoaded
76
+ # assert_raises(UnknownObjectException ) { $ff.image(:name, "no_image_with_this").hasLoaded? }
77
+ # assert_raises(UnknownObjectException ) { $ff.image(:id, "no_image_with_this").hasLoaded? }
78
+ # assert_raises(UnknownObjectException ) { $ff.image(:src, "no_image_with_this").hasLoaded? }
79
+ # assert_raises(UnknownObjectException ) { $ff.image(:alt, "no_image_with_this").hasLoaded? }
80
+ #
81
+ # assert( ! $ff.image(:name, "themissingimage").hasLoaded? )
82
+ # assert( $ff.image(:name, "circle").hasLoaded? )
83
+ #
84
+ # assert( $ff.image(:alt, "circle").hasLoaded? )
85
+ # assert( $ff.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 ) { $ff.image(:name, "no_image_with_this").hasLoaded? }
91
+ #assert_raises(UnknownObjectException ) { $ff.image(:id, "no_image_with_this").hasLoaded? }
92
+ #assert_raises(UnknownObjectException ) { $ff.image(:src, "no_image_with_this").hasLoaded? }
93
+ #assert_raises(UnknownObjectException ) { $ff.image(:index, 82).hasLoaded? }
94
+
95
+ assert_raises(UnknownObjectException ) { $ff.image(:index, 82).name }
96
+ assert_raises(UnknownObjectException ) { $ff.image(:index, 82).id }
97
+ assert_raises(UnknownObjectException ) { $ff.image(:index, 82).src }
98
+ assert_raises(UnknownObjectException ) { $ff.image(:index, 82).value }
99
+ assert_raises(UnknownObjectException ) { $ff.image(:index, 82).height }
100
+ assert_raises(UnknownObjectException ) { $ff.image(:index, 82).width }
101
+
102
+ # TODO: Need to see alternative for this in Mozilla
103
+ #assert_raises(UnknownObjectException ) { $ff.image(:index, 82).fileCreatedDate }
104
+ #assert_raises(UnknownObjectException ) { $ff.image(:index, 82).fileSize }
105
+
106
+ assert_raises(UnknownObjectException ) { $ff.image(:index, 82).alt}
107
+ assert_raises(UnknownObjectException ) { $ff.image(:index, 82).title}
108
+
109
+ assert_equal( "" , $ff.image(:index, 2).name )
110
+ assert_equal( "square" , $ff.image(:index, 2).id )
111
+ assert_match( /square\.jpg/i ,$ff.image(:index, 2).src )
112
+ assert_equal( "" , $ff.image(:index, 2).value )
113
+ assert_equal( "88" , $ff.image(:index, 2).height )
114
+ assert_equal( "88" , $ff.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" , $ff.image(:index, 2).fileCreatedDate )
118
+ #assert_equal( "788", $ff.image(:index, 2).fileSize )
119
+
120
+ # tool tips: alt text + title
121
+ assert_equal('circle' , $ff.image(:index, 6).alt)
122
+ assert_equal( "" , $ff.image(:index, 2).alt)
123
+ assert_equal('square_image', $ff.image(:id, 'square').title)
124
+
125
+ # to string tests -- output should be verified!
126
+ puts $ff.image(:name , "circle").to_s
127
+ puts $ff.image(:index , 2).to_s
128
+ end
129
+
130
+ def test_image_iterator
131
+ assert_equal(6 , $ff.images.length)
132
+ assert_equal("" , $ff.images[2].name )
133
+ assert_equal("square", $ff.images[2].id )
134
+ assert_match(/square/, $ff.images[2].src )
135
+
136
+ index = 1
137
+ $ff.images.each do |i|
138
+ assert_equal( $ff.image(:index, index).id , i.id )
139
+ assert_equal( $ff.image(:index, index).name , i.name )
140
+ assert_equal( $ff.image(:index, index).src , i.src )
141
+ assert_equal( $ff.image(:index, index).height , i.height.to_s )
142
+ assert_equal( $ff.image(:index, index).width , i.width.to_s )
143
+
144
+ index+=1
145
+ end
146
+ assert_equal( index-1 , $ff.images.length )
147
+ end
148
+
149
+ #def test_save_local_image
150
+ # $ff.images[1].save(build_windows_path("sample.img.dat"))
151
+ # assert(File.compare(@saved_img_path, $ff.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
+ include FireWatir
169
+ include MockStdoutTestCase
170
+
171
+ def test_showImages
172
+ $ff.goto($htmlRoot + "images1.html")
173
+ $stdout = @mockout
174
+ $ff.showImages
175
+ assert_equal(<<END_OF_MESSAGE, @mockout)
176
+ There are 6 images
177
+ image: name:
178
+ id:
179
+ src: images/triangle.jpg
180
+ index: 1
181
+ image: name:
182
+ id: square
183
+ src: images/square.jpg
184
+ index: 2
185
+ image: name: circle
186
+ id:
187
+ src: images/circle.jpg
188
+ index: 3
189
+ image: name: themissingimage
190
+ id:
191
+ src: images/missing.jpg
192
+ index: 4
193
+ image: name: disabler_test
194
+ id:
195
+ src: images/button.jpg
196
+ index: 5
197
+ image: name:
198
+ id:
199
+ src: images/circle.jpg
200
+ index: 6
201
+ END_OF_MESSAGE
202
+ end
203
+ end
204
+
@@ -0,0 +1,118 @@
1
+ # feature tests for Images
2
+ # revision: $Revision: 1.0 $
3
+
4
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
5
+ require 'unittests/setup'
6
+ require 'ftools'
7
+ require 'webrick'
8
+
9
+ class TC_Images_XPath < Test::Unit::TestCase
10
+ include FireWatir
11
+
12
+ def setup
13
+ gotoImagePage
14
+ end
15
+
16
+ def gotoImagePage()
17
+ $ff.goto($htmlRoot + "images1.html")
18
+ end
19
+
20
+ def test_imageExists
21
+ assert_false( $ff.image(:xpath , "//img[@name='missing_name']").exists? )
22
+ assert( $ff.image(:xpath , "//img[@name='circle']").exists? )
23
+ assert( $ff.image(:xpath , "//img[contains(@name , 'circ')]" ).exists? )
24
+
25
+ assert_false( $ff.image(:xpath , "//img[@id='missing_id']").exists? )
26
+ assert( $ff.image(:xpath , "//img[@id='square']").exists? )
27
+ assert( $ff.image(:xpath , "//img[contains(@id, 'squ')]" ).exists? )
28
+
29
+ assert_false( $ff.image(:xpath , "//img[@src='missingsrc.gif']").exists? )
30
+
31
+ # BP -- This fails for me but not for Paul. It doesn't make sense to me that it should pass.
32
+ # assert( $ff.image(:src , "file:///#{$myDir}/html/images/triangle.jpg").exists? )
33
+ assert( $ff.image(:xpath , "//img[contains(@src , 'triangle')]" ).exists? )
34
+
35
+ assert( $ff.image(:alt , "circle" ).exists? )
36
+ assert( $ff.image(:xpath , "//img[contains(@alt , 'cir')]" ).exists? )
37
+
38
+ assert_false( $ff.image(:alt , "triangle" ).exists? )
39
+ assert_false( $ff.image(:xpath , "//img[contains(@alt , 'tri')]" ).exists? )
40
+ end
41
+
42
+ def test_element_by_xpath_class
43
+ # FIXME getting HTMLAnchorElement instead of HTMLImageElement
44
+ # TODO: This should return null if object is not there.
45
+ #element = $ff.element_by_xpath("//img[@name='missing_name']")
46
+ #assert(element.instance_of?(Image),"element class should be #{Image}; got #{element.class}")
47
+ element = $ff.element_by_xpath("//img[@name='circle']")
48
+ assert(element.instance_of?(Image),"element class should be #{Image}; got #{element.class}")
49
+ element = $ff.element_by_xpath("//img[contains(@name , 'circ')]")
50
+ assert(element.instance_of?(Image),"element class should be #{Image}; got #{element.class}")
51
+ # TODO: This should return null if object is not there.
52
+ #element = $ff.element_by_xpath("//img[@id='missing_id']")
53
+ #assert(element.instance_of?(Image),"element class should be #{Image}; got #{element.class}")
54
+ element = $ff.element_by_xpath("//img[@id='square']")
55
+ assert(element.instance_of?(Image),"element class should be #{Image}; got #{element.class}")
56
+ element = $ff.element_by_xpath("//img[contains(@id, 'squ')]")
57
+ assert(element.instance_of?(Image),"element class should be #{Image}; got #{element.class}")
58
+ element = $ff.element_by_xpath("//img[contains(@src , 'triangle')]")
59
+ assert(element.instance_of?(Image),"element class should be #{Image}; got #{element.class}")
60
+ element = $ff.element_by_xpath("//img[contains(@alt , 'cir')]")
61
+ assert(element.instance_of?(Image),"element class should be #{Image}; got #{element.class}")
62
+ # TODO: This should return null if object is not there.
63
+ #element = $ff.element_by_xpath("//img[contains(@alt , 'tri')]")
64
+ #assert(element.instance_of?(Image),"element class should be #{Image}; got #{element.class}")
65
+ end
66
+
67
+ def test_image_click
68
+ assert_raises(UnknownObjectException ) { $ff.image(:xpath , "//img[@name='no_image_with_this']").click }
69
+ assert_raises(UnknownObjectException ) { $ff.image(:xpath , "//img[@id='no_image_with_this']").click }
70
+ assert_raises(UnknownObjectException ) { $ff.image(:xpath , "//img[@src='no_image_with_this']").click}
71
+ assert_raises(UnknownObjectException ) { $ff.image(:xpath , "//img[@alt='no_image_with_this']").click}
72
+
73
+ # test for bug 1882
74
+ $ff.text_field(:name , "text1").clear
75
+ $ff.button(:value , /Pos/ ).click
76
+ assert_equal('clicked' , $ff.text_field(:name , "text1" ).value )
77
+
78
+
79
+ # test for disabled button. Click the button to make it disabled
80
+ $ff.button(:name , 'disable_img').click
81
+ assert( $ff.image(:name , 'disabler_test').disabled )
82
+
83
+ # Click button again to make it enabled.
84
+ $ff.button(:name , 'disable_img').click
85
+ assert( ! $ff.image(:name , 'disabler_test').disabled )
86
+
87
+ $ff.image(:src, /button/).click
88
+ assert($ff.text.include?("PASS") )
89
+
90
+ end
91
+
92
+
93
+ # TODO: Need to see alternative for this in Mozilla
94
+ #def test_imageHasLoaded
95
+ # assert_raises(UnknownObjectException ) { $ff.image(:xpath , "//img[@name='no_image_with_this']").hasLoaded? }
96
+ # assert_raises(UnknownObjectException ) { $ff.image(:xpath , "//img[@id='no_image_with_this']").hasLoaded? }
97
+ # assert_raises(UnknownObjectException ) { $ff.image(:xpath , "//img[@src='no_image_with_this']").hasLoaded? }
98
+ # assert_raises(UnknownObjectException ) { $ff.image(:xpath , "//img[@alt='no_image_with_this']").hasLoaded? }
99
+ #
100
+ # assert_false( $ff.image(:xpath , "//img[@name='themissingimage']").hasLoaded? )
101
+ # assert( $ff.image(:xpath , "//img[@name='circle']").hasLoaded? )
102
+ #
103
+ # assert( $ff.image(:xpath , "//img[@alt='circle']").hasLoaded? )
104
+ # # assert( $ff.image(:alt, /cir/ ).hasLoaded? )
105
+ #end
106
+
107
+ def test_image_properties
108
+ # TODO: Need to see alternative for this in Mozilla
109
+ #assert_raises(UnknownObjectException ) { $ff.image(:xpath , "//img[@name='no_image_with_this']").hasLoaded? }
110
+ #assert_raises(UnknownObjectException ) { $ff.image(:xpath , "//img[@id='no_image_with_this']").hasLoaded? }
111
+ #assert_raises(UnknownObjectException ) { $ff.image(:xpath , "//img[@src='no_image_with_this']").hasLoaded? }
112
+
113
+ # to string tests -- output should be verified!
114
+ puts $ff.image(:xpath , "//img[@name='circle']").to_s
115
+ end
116
+
117
+ end
118
+
@@ -0,0 +1,30 @@
1
+ # class useful for testing output to stdout
2
+ class IOString < String
3
+ def write x
4
+ self.<< x
5
+ end
6
+ def readline!
7
+ line = slice!(/^.*(\n|$)/)
8
+ if $1 == "\n" then line.chop!
9
+ elsif line == "" then nil
10
+ else line
11
+ end
12
+ end
13
+ def puts( x )
14
+ stdout_orig = $stdout
15
+ $stdout = self
16
+ Kernel.puts x
17
+ $stdout = stdout_orig
18
+ end
19
+ end
20
+
21
+ module MockStdoutTestCase
22
+ def setup
23
+ @mockout = IOString.new ""
24
+ end
25
+ def teardown
26
+ $stdout = STDOUT
27
+ end
28
+ end
29
+
30
+
@@ -0,0 +1,48 @@
1
+ # unit tests for IOString in iostring.rb
2
+
3
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
4
+ require 'unittests/iostring'
5
+ require 'test/unit'
6
+
7
+ class IOStringTests < Test::Unit::TestCase
8
+ include MockStdoutTestCase
9
+ def setup
10
+ @mockout = IOString.new ""
11
+ $stdout = @mockout
12
+ end
13
+ def test_io_string_write
14
+ puts "hello"
15
+ assert_equal "hello\n", @mockout
16
+ end
17
+ def test_iostring_readline
18
+ puts "hello"
19
+ puts "there"
20
+ $stdout = STDOUT
21
+ assert_equal "hello", @mockout.readline!
22
+ assert_equal "there", @mockout.readline!
23
+ end
24
+ def test_iostring_realine_no_final_cr
25
+ print "hello"
26
+ $stdout = STDOUT
27
+ assert_equal "hello", @mockout.readline!
28
+ end
29
+ def test_ending_with_cr
30
+ puts "hello"
31
+ @mockout.readline!
32
+ assert_equal nil, @mockout.readline!
33
+ end
34
+ def test_ending_without_cr
35
+ print "hello"
36
+ @mockout.readline!
37
+ assert_equal nil, @mockout.readline!
38
+ end
39
+ def test_blank_line
40
+ puts "hello"
41
+ puts
42
+ puts "there"
43
+ @mockout.readline!
44
+ assert_equal "", @mockout.readline!
45
+ end
46
+ end
47
+
48
+
@@ -0,0 +1,71 @@
1
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
2
+ require 'unittests/setup'
3
+
4
+ class TC_JavaScript_Test < Test::Unit::TestCase
5
+ include FireWatir
6
+ # include FireWatir::Dialog
7
+
8
+ def setup
9
+ $ff.goto($htmlRoot + 'JavascriptClick.html')
10
+ end
11
+
12
+ def test_alert
13
+ #$ff.button(:id, "btnAlert").click_no_wait()
14
+
15
+ #$ff.click_jspopup_button("OK")
16
+ $ff.startClicker("ok", 1, '', "Press OK")
17
+ $ff.button(:id, "btnAlert").click
18
+
19
+ assert_equal($ff.text_field(:id, "testResult").value , "You pressed the Alert button!")
20
+ assert_equal("Press OK", $ff.get_popup_text)
21
+
22
+ $ff.startClicker("ok")
23
+ $ff.button(:id, "btnAlert").click
24
+
25
+ assert_equal($ff.text_field(:id, "testResult").value , "You pressed the Alert button!")
26
+ assert_equal("Press OK", $ff.get_popup_text)
27
+ end
28
+
29
+ def test_confirm_ok
30
+ #$ff.button(:id, "btnConfirm").click_no_wait()
31
+
32
+ #$ff.click_jspopup_button("OK")
33
+ $ff.startClicker("ok", 1, '', "Press a button")
34
+ $ff.button(:id, "btnConfirm").click
35
+
36
+ assert_equal($ff.text_field(:id, "testResult").value , "You pressed the Confirm and OK button!")
37
+ assert_equal("Press a button", $ff.get_popup_text)
38
+
39
+ $ff.startClicker("ok")
40
+ $ff.button(:id, "btnConfirm").click
41
+
42
+ assert_equal($ff.text_field(:id, "testResult").value , "You pressed the Confirm and OK button!")
43
+ assert_equal("Press a button", $ff.get_popup_text)
44
+ end
45
+
46
+ def test_confirm_cancel
47
+ #$ff.button(:id, "btnConfirm").click_no_wait()
48
+
49
+ #$ff.click_jspopup_button("Cancel")
50
+ $ff.startClicker("cancel", 1, '', "Press a button")
51
+ $ff.button(:id, "btnConfirm").click
52
+
53
+ assert_equal($ff.text_field(:id, "testResult").value, "You pressed the Confirm and Cancel button!")
54
+ assert_equal("Press a button", $ff.get_popup_text)
55
+
56
+ $ff.startClicker("cancel")
57
+ $ff.button(:id, "btnConfirm").click
58
+
59
+ assert_equal($ff.text_field(:id, "testResult").value, "You pressed the Confirm and Cancel button!")
60
+ assert_equal("Press a button", $ff.get_popup_text)
61
+ end
62
+
63
+ def test_ok_selectbox
64
+ $ff.goto($htmlRoot + "selectboxes1.html")
65
+ $ff.startClicker("ok")
66
+ $ff.select_list(:id , "selectbox_5").select_value(/2/)
67
+
68
+ assert_equal($ff.text_field(:id, "txtAlert").value , "You pressed OK button")
69
+ assert_equal("Press OK", $ff.get_popup_text)
70
+ end
71
+ end