firewatir 1.6.5 → 1.6.6.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. data/CHANGES +461 -0
  2. data/LICENSE +31 -31
  3. data/README.rdoc +112 -0
  4. data/VERSION +1 -0
  5. data/lib/firewatir.rb +41 -40
  6. data/lib/firewatir/container.rb +491 -491
  7. data/lib/firewatir/document.rb +239 -239
  8. data/lib/firewatir/element.rb +1364 -1364
  9. data/lib/firewatir/element_collections.rb +314 -314
  10. data/lib/firewatir/elements/button.rb +15 -15
  11. data/lib/firewatir/elements/file_field.rb +29 -29
  12. data/lib/firewatir/elements/form.rb +40 -40
  13. data/lib/firewatir/elements/frame.rb +55 -55
  14. data/lib/firewatir/elements/hidden.rb +56 -56
  15. data/lib/firewatir/elements/image.rb +139 -139
  16. data/lib/firewatir/elements/input_element.rb +44 -44
  17. data/lib/firewatir/elements/link.rb +76 -76
  18. data/lib/firewatir/elements/non_control_element.rb +53 -53
  19. data/lib/firewatir/elements/non_control_elements.rb +108 -108
  20. data/lib/firewatir/elements/not_used.rb +278 -278
  21. data/lib/firewatir/elements/option.rb +130 -130
  22. data/lib/firewatir/elements/radio_check_common.rb +163 -163
  23. data/lib/firewatir/elements/select_list.rb +188 -188
  24. data/lib/firewatir/elements/table.rb +218 -218
  25. data/lib/firewatir/elements/table_cell.rb +54 -54
  26. data/lib/firewatir/elements/table_row.rb +100 -100
  27. data/lib/firewatir/elements/text_field.rb +218 -218
  28. data/lib/firewatir/exceptions.rb +10 -10
  29. data/lib/firewatir/firefox.rb +984 -1040
  30. data/lib/firewatir/jssh_socket.rb +100 -100
  31. data/lib/firewatir/winClicker.rb +122 -122
  32. data/lib/firewatir/x11.rb +192 -192
  33. data/rakefile.rb +15 -0
  34. data/unittests/attach_to_new_window_test.rb +49 -49
  35. data/unittests/bug_fixes_test.rb +195 -195
  36. data/unittests/buttons_xpath_test.rb +88 -88
  37. data/unittests/checkbox_test.rb +158 -158
  38. data/unittests/checkbox_xpath_test.rb +107 -107
  39. data/unittests/div_test.rb +275 -275
  40. data/unittests/ff_test.rb +47 -0
  41. data/unittests/filefield_test.rb +49 -49
  42. data/unittests/filefield_xpath_test.rb +35 -35
  43. data/unittests/form_test.rb +296 -296
  44. data/unittests/frame_test.rb +159 -159
  45. data/unittests/hidden_test.rb +85 -85
  46. data/unittests/hidden_xpath_test.rb +72 -72
  47. data/unittests/html/JavascriptClick.html +42 -42
  48. data/unittests/html/blankpage.html +11 -11
  49. data/unittests/html/buttons1.html +61 -61
  50. data/unittests/html/checkboxes1.html +70 -70
  51. data/unittests/html/complex_table.html +36 -36
  52. data/unittests/html/cssTest.html +42 -42
  53. data/unittests/html/div.html +72 -72
  54. data/unittests/html/div_xml.html +20 -20
  55. data/unittests/html/fileupload.html +45 -45
  56. data/unittests/html/formTest1.html +38 -38
  57. data/unittests/html/forms2.html +45 -45
  58. data/unittests/html/forms3.html +132 -132
  59. data/unittests/html/forms4.html +27 -27
  60. data/unittests/html/frame_buttons.html +3 -3
  61. data/unittests/html/frame_links.html +3 -3
  62. data/unittests/html/frame_multi.html +4 -4
  63. data/unittests/html/iframeTest.html +14 -14
  64. data/unittests/html/iframeTest1.html +13 -13
  65. data/unittests/html/iframeTest2.html +5 -5
  66. data/unittests/html/images1.html +66 -66
  67. data/unittests/html/javascriptevents.html +35 -35
  68. data/unittests/html/link_pass.html +10 -10
  69. data/unittests/html/links1.html +42 -42
  70. data/unittests/html/links2.html +10 -10
  71. data/unittests/html/modal_dialog.html +8 -8
  72. data/unittests/html/modal_dialog_launcher.html +11 -11
  73. data/unittests/html/nestedFrames.html +6 -6
  74. data/unittests/html/new_browser.html +17 -17
  75. data/unittests/html/new_browser_popup.html +7 -7
  76. data/unittests/html/pass.html +9 -9
  77. data/unittests/html/popups1.html +60 -60
  78. data/unittests/html/pre.html +27 -27
  79. data/unittests/html/radioButtons1.html +70 -70
  80. data/unittests/html/redirect.html +10 -10
  81. data/unittests/html/redirect1.html +8 -8
  82. data/unittests/html/redirect2.html +8 -8
  83. data/unittests/html/redirect3.html +8 -8
  84. data/unittests/html/select_tealeaf.html +54 -54
  85. data/unittests/html/selectboxes1.html +55 -55
  86. data/unittests/html/simple_table.html +26 -26
  87. data/unittests/html/simple_table_buttons.html +104 -104
  88. data/unittests/html/simple_table_columns.html +74 -74
  89. data/unittests/html/table1.html +165 -165
  90. data/unittests/html/tableCell_using_xpath.html +19 -19
  91. data/unittests/html/textarea.html +30 -30
  92. data/unittests/html/textfields1.html +62 -62
  93. data/unittests/html/textsearch.html +44 -44
  94. data/unittests/images_test.rb +198 -198
  95. data/unittests/images_xpath_test.rb +118 -118
  96. data/unittests/javascript_test.rb +75 -75
  97. data/unittests/links_test.rb +231 -231
  98. data/unittests/links_xpath_test.rb +79 -79
  99. data/unittests/mozilla_all_tests.rb +7 -7
  100. data/unittests/pre_test.rb +75 -75
  101. data/unittests/radios_test.rb +166 -166
  102. data/unittests/radios_xpath_test.rb +101 -101
  103. data/unittests/redirect_test.rb +41 -41
  104. data/unittests/selectbox_test.rb +142 -142
  105. data/unittests/selectbox_xpath_test.rb +129 -129
  106. data/unittests/setup.rb +29 -29
  107. data/unittests/table_test.rb +385 -385
  108. data/unittests/table_xpath_test.rb +185 -185
  109. data/unittests/textfields_test.rb +234 -234
  110. data/unittests/textfields_xpath_test.rb +113 -113
  111. metadata +51 -19
  112. data/lib/firewatir/version.rb +0 -5
@@ -1,88 +1,88 @@
1
- # feature tests for Buttons
2
- # revision: $Revision: 1.0 $
3
-
4
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
5
- require 'unittests/setup'
6
-
7
- class TC_Buttons_XPath < Test::Unit::TestCase
8
-
9
-
10
- def setup
11
- goto_page("buttons1.html")
12
- end
13
-
14
- def test_properties
15
- assert_raises(UnknownObjectException) { browser.button(:xpath, "//input[@name='noName']").id }
16
- assert_raises(UnknownObjectException) { browser.button(:xpath, "//input[@name='noName']").name }
17
- assert_raises(UnknownObjectException) { browser.button(:xpath, "//input[@name='noName']").disabled }
18
- assert_raises(UnknownObjectException) { browser.button(:xpath, "//input[@name='noName']").type }
19
- assert_raises(UnknownObjectException) { browser.button(:xpath, "//input[@name='noName']").value }
20
-
21
- assert_equal("b1" , browser.button(:xpath, "//input[@id='b2']").name )
22
- assert_equal("b2" , browser.button(:xpath, "//input[@id='b2']").id )
23
- assert_equal("button" , browser.button(:xpath, "//input[@id='b2']").type )
24
- end
25
-
26
- def test_button_using_default
27
- # since most of the time, a button will be accessed based on its caption, there is a default way of accessing it....
28
- assert_raises(UnknownObjectException) { browser.button(:xpath, "//input[@value='Missing Caption']").click }
29
-
30
- browser.button(:xpath, "//input[@value='Click Me']").click
31
- assert(browser.text.include?("PASS") )
32
- end
33
-
34
- def test_Button_click_only
35
- browser.button(:xpath, "//input[@value='Click Me']").click
36
- assert(browser.text.include?("PASS") )
37
- end
38
-
39
- def test_button_click
40
- assert_raises(UnknownObjectException) { browser.button(:xpath, "//input[@value='Missing Caption']").click }
41
- assert_raises(UnknownObjectException) { browser.button(:xpath, "//input[@id='MissingId']").click }
42
-
43
- assert_raises(ObjectDisabledException , "ObjectDisabledException was supposed to be thrown" ) { browser.button(:xpath, "//input[@value='Disabled Button']").click }
44
-
45
- browser.button(:xpath, "//input[@value='Click Me']").click
46
- assert(browser.text.include?("PASS") )
47
- end
48
-
49
- def test_Button_Exists
50
- assert(browser.button(:xpath, "//input[@value='Click Me']").exists?)
51
- assert(browser.button(:xpath, "//input[@value='Submit']").exists?)
52
- assert(browser.button(:xpath, "//input[@name='b1']").exists?)
53
- assert(browser.button(:xpath, "//input[@id='b2']").exists?)
54
-
55
- assert_false(browser.button(:xpath, "//input[@value='Missing Caption']").exists?)
56
- assert_false(browser.button(:xpath, "//input[@name='missingname']").exists?)
57
- assert_false(browser.button(:xpath, "//input[@id='missingid']").exists?)
58
- end
59
-
60
- tag_method :test_element_by_xpath_class, :fails_on_ie
61
- def test_element_by_xpath_class
62
- element = browser.element_by_xpath("//input[@value='Click Me']")
63
- assert_class element, 'Button'
64
- element = browser.element_by_xpath("//input[@value='Submit']")
65
- assert_class element, 'Button'
66
- element = browser.element_by_xpath("//input[@name='b1']")
67
- assert_class element, 'Button'
68
- element = browser.element_by_xpath("//input[@id='b2']")
69
- assert_class element, 'Button'
70
- # TODO: If object is not there this should return null
71
- #element = browser.element_by_xpath("//input[@value='Missing Caption']")
72
- #assert(element.instance_of?(Button),"element class should be #{Button}; got #{element.class}")
73
- #element = browser.element_by_xpath("//input[@name='missingname']")
74
- #assert(element.instance_of?(Button),"element class should be #{Button}; got #{element.class}")
75
- #element = browser.element_by_xpath("//input[@id='missingid']")
76
- #assert(element.instance_of?(Button),"element class should be #{Button}; got #{element.class}")
77
- end
78
-
79
- def test_Button_Enabled
80
- assert(browser.button(:xpath, "//input[@value='Click Me']").enabled?)
81
- assert_false(browser.button(:xpath, "//input[@value='Disabled Button']").enabled?)
82
- assert_false(browser.button(:xpath, "//input[@name='b4']").enabled?)
83
- assert_false(browser.button(:xpath, "//input[@id='b5']").enabled?)
84
-
85
- assert_raises(UnknownObjectException) { browser.button(:xpath, "//input[@name='noName']").enabled? }
86
- end
87
- end
88
-
1
+ # feature tests for Buttons
2
+ # revision: $Revision: 1.0 $
3
+
4
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
5
+ require 'unittests/setup'
6
+
7
+ class TC_Buttons_XPath < Test::Unit::TestCase
8
+
9
+
10
+ def setup
11
+ goto_page("buttons1.html")
12
+ end
13
+
14
+ def test_properties
15
+ assert_raises(UnknownObjectException) { browser.button(:xpath, "//input[@name='noName']").id }
16
+ assert_raises(UnknownObjectException) { browser.button(:xpath, "//input[@name='noName']").name }
17
+ assert_raises(UnknownObjectException) { browser.button(:xpath, "//input[@name='noName']").disabled }
18
+ assert_raises(UnknownObjectException) { browser.button(:xpath, "//input[@name='noName']").type }
19
+ assert_raises(UnknownObjectException) { browser.button(:xpath, "//input[@name='noName']").value }
20
+
21
+ assert_equal("b1" , browser.button(:xpath, "//input[@id='b2']").name )
22
+ assert_equal("b2" , browser.button(:xpath, "//input[@id='b2']").id )
23
+ assert_equal("button" , browser.button(:xpath, "//input[@id='b2']").type )
24
+ end
25
+
26
+ def test_button_using_default
27
+ # since most of the time, a button will be accessed based on its caption, there is a default way of accessing it....
28
+ assert_raises(UnknownObjectException) { browser.button(:xpath, "//input[@value='Missing Caption']").click }
29
+
30
+ browser.button(:xpath, "//input[@value='Click Me']").click
31
+ assert(browser.text.include?("PASS") )
32
+ end
33
+
34
+ def test_Button_click_only
35
+ browser.button(:xpath, "//input[@value='Click Me']").click
36
+ assert(browser.text.include?("PASS") )
37
+ end
38
+
39
+ def test_button_click
40
+ assert_raises(UnknownObjectException) { browser.button(:xpath, "//input[@value='Missing Caption']").click }
41
+ assert_raises(UnknownObjectException) { browser.button(:xpath, "//input[@id='MissingId']").click }
42
+
43
+ assert_raises(ObjectDisabledException , "ObjectDisabledException was supposed to be thrown" ) { browser.button(:xpath, "//input[@value='Disabled Button']").click }
44
+
45
+ browser.button(:xpath, "//input[@value='Click Me']").click
46
+ assert(browser.text.include?("PASS") )
47
+ end
48
+
49
+ def test_Button_Exists
50
+ assert(browser.button(:xpath, "//input[@value='Click Me']").exists?)
51
+ assert(browser.button(:xpath, "//input[@value='Submit']").exists?)
52
+ assert(browser.button(:xpath, "//input[@name='b1']").exists?)
53
+ assert(browser.button(:xpath, "//input[@id='b2']").exists?)
54
+
55
+ assert_false(browser.button(:xpath, "//input[@value='Missing Caption']").exists?)
56
+ assert_false(browser.button(:xpath, "//input[@name='missingname']").exists?)
57
+ assert_false(browser.button(:xpath, "//input[@id='missingid']").exists?)
58
+ end
59
+
60
+ tag_method :test_element_by_xpath_class, :fails_on_ie
61
+ def test_element_by_xpath_class
62
+ element = browser.element_by_xpath("//input[@value='Click Me']")
63
+ assert_class element, 'Button'
64
+ element = browser.element_by_xpath("//input[@value='Submit']")
65
+ assert_class element, 'Button'
66
+ element = browser.element_by_xpath("//input[@name='b1']")
67
+ assert_class element, 'Button'
68
+ element = browser.element_by_xpath("//input[@id='b2']")
69
+ assert_class element, 'Button'
70
+ # TODO: If object is not there this should return null
71
+ #element = browser.element_by_xpath("//input[@value='Missing Caption']")
72
+ #assert(element.instance_of?(Button),"element class should be #{Button}; got #{element.class}")
73
+ #element = browser.element_by_xpath("//input[@name='missingname']")
74
+ #assert(element.instance_of?(Button),"element class should be #{Button}; got #{element.class}")
75
+ #element = browser.element_by_xpath("//input[@id='missingid']")
76
+ #assert(element.instance_of?(Button),"element class should be #{Button}; got #{element.class}")
77
+ end
78
+
79
+ def test_Button_Enabled
80
+ assert(browser.button(:xpath, "//input[@value='Click Me']").enabled?)
81
+ assert_false(browser.button(:xpath, "//input[@value='Disabled Button']").enabled?)
82
+ assert_false(browser.button(:xpath, "//input[@name='b4']").enabled?)
83
+ assert_false(browser.button(:xpath, "//input[@id='b5']").enabled?)
84
+
85
+ assert_raises(UnknownObjectException) { browser.button(:xpath, "//input[@name='noName']").enabled? }
86
+ end
87
+ end
88
+
@@ -1,158 +1,158 @@
1
- # feature tests for Check Boxes
2
- # revision: $Revision: 1.0 $
3
-
4
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
5
- require 'unittests/setup'
6
-
7
- class TC_CheckBox < Test::Unit::TestCase
8
-
9
-
10
- def setup()
11
- goto_page("checkboxes1.html")
12
- end
13
-
14
- def test_checkbox_properties
15
- assert_raises(UnknownObjectException) { browser.checkbox(:name, "noName").id }
16
- assert_raises(UnknownObjectException) { browser.checkbox(:name, "noName").name }
17
- assert_raises(UnknownObjectException) { browser.checkbox(:name, "noName").disabled }
18
- assert_raises(UnknownObjectException) { browser.checkbox(:name, "noName").type }
19
- assert_raises(UnknownObjectException) { browser.checkbox(:name, "noName").value }
20
-
21
- assert_equal("box1" , browser.checkbox(:index, 1).name )
22
- assert_class(browser.checkbox(:index,1), 'Checkbox')
23
-
24
- assert_equal("" , browser.checkbox(:index, 1).id )
25
- assert_equal("checkbox" , browser.checkbox(:index, 1).type )
26
- assert_equal("on" , browser.checkbox(:index, 1).value )
27
- assert_equal(false , browser.checkbox(:index, 1).disabled )
28
-
29
- assert_equal("check_box_style" , browser.checkbox(:name, "box1").class_name)
30
- assert_equal("" , browser.checkbox(:name, "box2").class_name)
31
-
32
- assert_equal("1" , browser.checkbox(:name,"box4").value )
33
- assert_equal("3" , browser.checkbox(:name,"box4" , 3).value )
34
- assert_equal("checkbox" , browser.checkbox(:name,"box4" , 3).type )
35
- assert_equal(false , browser.checkbox(:name,"box4" , 3).disabled )
36
- assert_equal("" , browser.checkbox(:name,"box4" , 3).id )
37
-
38
- assert_equal("box4-value5" , browser.checkbox(:name,"box4" , 5).title)
39
- assert_equal("" , browser.checkbox(:name,"box4" , 4).title)
40
- end
41
-
42
- def test_onClick
43
- assert_false(browser.button(:value , "foo").enabled?)
44
- browser.checkbox(:name, "box5").set
45
- assert(browser.button(:value , "foo").enabled?)
46
-
47
- browser.checkbox(:name, "box5").clear
48
- assert_false(browser.button(:value , "foo").enabled?)
49
-
50
- browser.checkbox(:name, "box5").clear
51
- assert_false(browser.button(:value , "foo").enabled?)
52
- end
53
-
54
- def test_CheckBox_Exists
55
- assert(browser.checkbox(:name, "box1").exists?)
56
- assert_false(browser.checkbox(:name, "missing").exists?)
57
-
58
- assert(browser.checkbox(:name, "box4" , 1).exists?)
59
- assert_false(browser.checkbox(:name, "box4" , 22).exists?)
60
-
61
- assert(browser.checkbox(:name, "box4" , /[0-9]/).exists?)
62
- assert_false(browser.checkbox(:name, "box4" , /\d\d\d/).exists?)
63
- end
64
-
65
- #def test_checkbox_Enabled
66
- # assert_raises(UnknownObjectException) { browser.checkbox(:name, "noName").enabled? }
67
- # assert_raises(UnknownObjectException) { browser.checkbox(:id, "noName").enabled? }
68
- # assert_raises(UnknownObjectException) { browser.checkbox(:name, "box4" , 6).enabled? }
69
- #
70
- # assert(browser.checkbox(:name, "box1").enabled?)
71
- # assert_false(browser.checkbox(:name, "box2").enabled?)
72
- #
73
- # assert(browser.checkbox(:name, "box4", 4).enabled?)
74
- # assert_false(browser.checkbox(:name, "box4" , 5 ).enabled?)
75
- #end
76
-
77
- def test_checkbox_isSet
78
- assert_raises(UnknownObjectException ) { browser.checkbox(:name, "noName").isSet? }
79
-
80
- assert_false(browser.checkbox(:name, "box1").isSet?)
81
- assert_false(browser.checkbox(:name, "box2").isSet?)
82
- assert(browser.checkbox(:name, "box3").isSet?)
83
-
84
- assert_false(browser.checkbox(:name, "box4" , 2 ).isSet?)
85
- assert(browser.checkbox(:name, "box4" , 1 ).isSet?)
86
- end
87
-
88
- def test_checkbox_clear
89
- assert_raises(UnknownObjectException) { browser.checkbox(:name, "noName").clear }
90
- browser.checkbox(:name, "box1").clear
91
- assert_false(browser.checkbox(:name, "box1").isSet?)
92
-
93
- assert_raises(ObjectDisabledException) { browser.checkbox(:name, "box2").clear }
94
- assert_false(browser.checkbox(:name, "box2").isSet?)
95
-
96
- browser.checkbox(:name, "box3").clear
97
- assert_false(browser.checkbox(:name, "box3").isSet?)
98
-
99
- browser.checkbox(:name, "box4" , 1).clear
100
- assert_false(browser.checkbox(:name, "box4" , 1).isSet?)
101
- end
102
-
103
- def test_checkbox_getState
104
- assert_raises(UnknownObjectException) { browser.checkbox(:name, "noName").getState }
105
- assert_equal( false , browser.checkbox(:name, "box1").getState )
106
- assert_equal( true , browser.checkbox(:name, "box3").getState)
107
-
108
- # checkboxes that have the same name but different values
109
- assert_equal( false , browser.checkbox(:name, "box4" , 2).getState )
110
- assert_equal( true , browser.checkbox(:name, "box4" , 1).getState)
111
- end
112
-
113
- def test_checkbox_set
114
- assert_raises(UnknownObjectException) { browser.checkbox(:name, "noName").set }
115
- browser.checkbox(:name, "box1").set
116
- assert(browser.checkbox(:name, "box1").isSet?)
117
-
118
- assert_raises(ObjectDisabledException) { browser.checkbox(:name, "box2").set }
119
-
120
- browser.checkbox(:name, "box3").set
121
- assert(browser.checkbox(:name, "box3").isSet?)
122
-
123
- # checkboxes that have the same name but different values
124
- browser.checkbox(:name, "box4" , 3).set
125
- assert(browser.checkbox(:name, "box4" , 3).isSet?)
126
-
127
- # test set using the optinal true/false
128
- # assumes the checkbox is already checked
129
- browser.checkbox(:name, "box1").set( false )
130
- assert_false(browser.checkbox(:name, "box1").isSet?)
131
-
132
- browser.checkbox(:name, "box1").set( true )
133
- assert(browser.checkbox(:name, "box1").isSet?)
134
-
135
-
136
-
137
-
138
- end
139
-
140
- def test_checkbox_iterator
141
-
142
- assert_equal(11, browser.checkboxes.length)
143
- assert_equal("box1" , browser.checkboxes[1].name )
144
-
145
- index=1
146
- browser.checkboxes.each do |c|
147
- assert_equal( browser.checkbox(:index, index).name , c.name )
148
- assert_equal( browser.checkbox(:index, index).id, c.id )
149
- assert_equal( browser.checkbox(:index, index).value, c.value )
150
- assert_equal( browser.checkbox(:index, index).isSet?, c.isSet? )
151
- index+=1
152
- end
153
- assert_equal(index-1, browser.checkboxes.length)
154
-
155
- end
156
-
157
-
158
- end
1
+ # feature tests for Check Boxes
2
+ # revision: $Revision: 1.0 $
3
+
4
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
5
+ require 'unittests/setup'
6
+
7
+ class TC_CheckBox < Test::Unit::TestCase
8
+
9
+
10
+ def setup()
11
+ goto_page("checkboxes1.html")
12
+ end
13
+
14
+ def test_checkbox_properties
15
+ assert_raises(UnknownObjectException) { browser.checkbox(:name, "noName").id }
16
+ assert_raises(UnknownObjectException) { browser.checkbox(:name, "noName").name }
17
+ assert_raises(UnknownObjectException) { browser.checkbox(:name, "noName").disabled }
18
+ assert_raises(UnknownObjectException) { browser.checkbox(:name, "noName").type }
19
+ assert_raises(UnknownObjectException) { browser.checkbox(:name, "noName").value }
20
+
21
+ assert_equal("box1" , browser.checkbox(:index, 1).name )
22
+ assert_class(browser.checkbox(:index,1), 'Checkbox')
23
+
24
+ assert_equal("" , browser.checkbox(:index, 1).id )
25
+ assert_equal("checkbox" , browser.checkbox(:index, 1).type )
26
+ assert_equal("on" , browser.checkbox(:index, 1).value )
27
+ assert_equal(false , browser.checkbox(:index, 1).disabled )
28
+
29
+ assert_equal("check_box_style" , browser.checkbox(:name, "box1").class_name)
30
+ assert_equal("" , browser.checkbox(:name, "box2").class_name)
31
+
32
+ assert_equal("1" , browser.checkbox(:name,"box4").value )
33
+ assert_equal("3" , browser.checkbox(:name,"box4" , 3).value )
34
+ assert_equal("checkbox" , browser.checkbox(:name,"box4" , 3).type )
35
+ assert_equal(false , browser.checkbox(:name,"box4" , 3).disabled )
36
+ assert_equal("" , browser.checkbox(:name,"box4" , 3).id )
37
+
38
+ assert_equal("box4-value5" , browser.checkbox(:name,"box4" , 5).title)
39
+ assert_equal("" , browser.checkbox(:name,"box4" , 4).title)
40
+ end
41
+
42
+ def test_onClick
43
+ assert_false(browser.button(:value , "foo").enabled?)
44
+ browser.checkbox(:name, "box5").set
45
+ assert(browser.button(:value , "foo").enabled?)
46
+
47
+ browser.checkbox(:name, "box5").clear
48
+ assert_false(browser.button(:value , "foo").enabled?)
49
+
50
+ browser.checkbox(:name, "box5").clear
51
+ assert_false(browser.button(:value , "foo").enabled?)
52
+ end
53
+
54
+ def test_CheckBox_Exists
55
+ assert(browser.checkbox(:name, "box1").exists?)
56
+ assert_false(browser.checkbox(:name, "missing").exists?)
57
+
58
+ assert(browser.checkbox(:name, "box4" , 1).exists?)
59
+ assert_false(browser.checkbox(:name, "box4" , 22).exists?)
60
+
61
+ assert(browser.checkbox(:name, "box4" , /[0-9]/).exists?)
62
+ assert_false(browser.checkbox(:name, "box4" , /\d\d\d/).exists?)
63
+ end
64
+
65
+ #def test_checkbox_Enabled
66
+ # assert_raises(UnknownObjectException) { browser.checkbox(:name, "noName").enabled? }
67
+ # assert_raises(UnknownObjectException) { browser.checkbox(:id, "noName").enabled? }
68
+ # assert_raises(UnknownObjectException) { browser.checkbox(:name, "box4" , 6).enabled? }
69
+ #
70
+ # assert(browser.checkbox(:name, "box1").enabled?)
71
+ # assert_false(browser.checkbox(:name, "box2").enabled?)
72
+ #
73
+ # assert(browser.checkbox(:name, "box4", 4).enabled?)
74
+ # assert_false(browser.checkbox(:name, "box4" , 5 ).enabled?)
75
+ #end
76
+
77
+ def test_checkbox_isSet
78
+ assert_raises(UnknownObjectException ) { browser.checkbox(:name, "noName").isSet? }
79
+
80
+ assert_false(browser.checkbox(:name, "box1").isSet?)
81
+ assert_false(browser.checkbox(:name, "box2").isSet?)
82
+ assert(browser.checkbox(:name, "box3").isSet?)
83
+
84
+ assert_false(browser.checkbox(:name, "box4" , 2 ).isSet?)
85
+ assert(browser.checkbox(:name, "box4" , 1 ).isSet?)
86
+ end
87
+
88
+ def test_checkbox_clear
89
+ assert_raises(UnknownObjectException) { browser.checkbox(:name, "noName").clear }
90
+ browser.checkbox(:name, "box1").clear
91
+ assert_false(browser.checkbox(:name, "box1").isSet?)
92
+
93
+ assert_raises(ObjectDisabledException) { browser.checkbox(:name, "box2").clear }
94
+ assert_false(browser.checkbox(:name, "box2").isSet?)
95
+
96
+ browser.checkbox(:name, "box3").clear
97
+ assert_false(browser.checkbox(:name, "box3").isSet?)
98
+
99
+ browser.checkbox(:name, "box4" , 1).clear
100
+ assert_false(browser.checkbox(:name, "box4" , 1).isSet?)
101
+ end
102
+
103
+ def test_checkbox_getState
104
+ assert_raises(UnknownObjectException) { browser.checkbox(:name, "noName").getState }
105
+ assert_equal( false , browser.checkbox(:name, "box1").getState )
106
+ assert_equal( true , browser.checkbox(:name, "box3").getState)
107
+
108
+ # checkboxes that have the same name but different values
109
+ assert_equal( false , browser.checkbox(:name, "box4" , 2).getState )
110
+ assert_equal( true , browser.checkbox(:name, "box4" , 1).getState)
111
+ end
112
+
113
+ def test_checkbox_set
114
+ assert_raises(UnknownObjectException) { browser.checkbox(:name, "noName").set }
115
+ browser.checkbox(:name, "box1").set
116
+ assert(browser.checkbox(:name, "box1").isSet?)
117
+
118
+ assert_raises(ObjectDisabledException) { browser.checkbox(:name, "box2").set }
119
+
120
+ browser.checkbox(:name, "box3").set
121
+ assert(browser.checkbox(:name, "box3").isSet?)
122
+
123
+ # checkboxes that have the same name but different values
124
+ browser.checkbox(:name, "box4" , 3).set
125
+ assert(browser.checkbox(:name, "box4" , 3).isSet?)
126
+
127
+ # test set using the optinal true/false
128
+ # assumes the checkbox is already checked
129
+ browser.checkbox(:name, "box1").set( false )
130
+ assert_false(browser.checkbox(:name, "box1").isSet?)
131
+
132
+ browser.checkbox(:name, "box1").set( true )
133
+ assert(browser.checkbox(:name, "box1").isSet?)
134
+
135
+
136
+
137
+
138
+ end
139
+
140
+ def test_checkbox_iterator
141
+
142
+ assert_equal(11, browser.checkboxes.length)
143
+ assert_equal("box1" , browser.checkboxes[1].name )
144
+
145
+ index=1
146
+ browser.checkboxes.each do |c|
147
+ assert_equal( browser.checkbox(:index, index).name , c.name )
148
+ assert_equal( browser.checkbox(:index, index).id, c.id )
149
+ assert_equal( browser.checkbox(:index, index).value, c.value )
150
+ assert_equal( browser.checkbox(:index, index).isSet?, c.isSet? )
151
+ index+=1
152
+ end
153
+ assert_equal(index-1, browser.checkboxes.length)
154
+
155
+ end
156
+
157
+
158
+ end