watir 1.5.6 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/{changes.rb → CHANGES} +12 -3
- data/bin/watir-console +7 -1
- data/lib/changes.rb +3 -0
- data/{license.rb → lib/license.rb} +2 -1
- data/{readme.rb → lib/readme.rb} +4 -6
- data/{watir → lib/watir}/AutoItX3.dll +0 -0
- data/{watir → lib/watir}/IEDialog/Release/IEDialog.dll +0 -0
- data/{watir → lib/watir}/WindowHelper.rb +1 -1
- data/{watir → lib/watir}/camel_case.rb +0 -0
- data/{watir → lib/watir}/clickJSDialog.rb +0 -0
- data/{watir → lib/watir}/close_all.rb +1 -1
- data/{watir → lib/watir}/collections.rb +1 -1
- data/{watir → lib/watir}/container.rb +17 -8
- data/{watir → lib/watir}/contrib/enabled_popup.rb +0 -0
- data/{watir → lib/watir}/contrib/ie-new-process.rb +0 -0
- data/{watir → lib/watir}/contrib/page_checker.rb +0 -0
- data/{watir → lib/watir}/contrib/visible.rb +2 -2
- data/{watir → lib/watir}/cookiemanager.rb +0 -0
- data/{watir → lib/watir}/datahandler.rb +0 -0
- data/{watir → lib/watir}/dialog.rb +1 -1
- data/{watir → lib/watir}/element.rb +3 -7
- data/{watir → lib/watir}/element_collections.rb +0 -0
- data/{watir → lib/watir}/form.rb +31 -11
- data/{watir → lib/watir}/frame.rb +0 -0
- data/{watir/ie.rb → lib/watir/ie-class.rb} +22 -22
- data/{watir → lib/watir}/ie-process.rb +0 -0
- data/{watir.rb → lib/watir/ie.rb} +11 -27
- data/{watir → lib/watir}/image.rb +0 -0
- data/{watir → lib/watir}/input_elements.rb +33 -44
- data/{watir → lib/watir}/irb-history.rb +0 -0
- data/{watir → lib/watir}/link.rb +0 -0
- data/{watir → lib/watir}/locator.rb +56 -43
- data/{watir → lib/watir}/logger.rb +0 -0
- data/{watir → lib/watir}/modal_dialog.rb +0 -0
- data/{watir → lib/watir}/non_control_elements.rb +0 -0
- data/{watir → lib/watir}/page-container.rb +2 -2
- data/{watir → lib/watir}/popup.rb +0 -0
- data/{watir → lib/watir}/process.rb +0 -0
- data/{watir → lib/watir}/screen_capture.rb +0 -0
- data/{watir → lib/watir}/setFileDialog.rb +0 -0
- data/{watir → lib/watir}/table.rb +7 -2
- data/{watir → lib/watir}/utils.rb +0 -0
- data/lib/watir/version.rb +5 -0
- data/{watir → lib/watir}/watir_simple.rb +3 -3
- data/{watir → lib/watir}/win32.rb +0 -0
- data/lib/watir/win32ole.rb +6 -0
- data/lib/watir/win32ole/win32ole.so +0 -0
- data/{watir → lib/watir}/winClicker.rb +0 -0
- data/unittests/buttons_xpath_test.rb +32 -32
- data/unittests/checkbox_test.rb +113 -99
- data/unittests/checkbox_xpath_test.rb +57 -57
- data/unittests/core_tests.rb +10 -7
- data/unittests/css_test.rb +12 -32
- data/unittests/defer_test.rb +22 -22
- data/unittests/dialog_test.rb +13 -13
- data/unittests/div2_xpath_test.rb +3 -3
- data/unittests/div_test.rb +23 -19
- data/unittests/div_xpath_test.rb +50 -50
- data/unittests/errorchecker_test.rb +7 -9
- data/unittests/filefield_test.rb +12 -11
- data/unittests/filefield_xpath_test.rb +10 -10
- data/unittests/form_test.rb +144 -151
- data/unittests/form_xpath_test.rb +99 -99
- data/unittests/frame_test.rb +46 -44
- data/unittests/google_form_test.rb +2 -2
- data/unittests/html/checkboxes1.html +19 -16
- data/unittests/html/forms3.html +2 -2
- data/unittests/html/wallofcheckboxes.html +1003 -0
- data/unittests/ie_exists_test.rb +5 -3
- data/unittests/ie_test.rb +2 -2
- data/unittests/images_test.rb +83 -82
- data/unittests/images_xpath_test.rb +40 -40
- data/unittests/iostring_test.rb +1 -1
- data/unittests/links_multi_test.rb +7 -8
- data/unittests/links_test.rb +73 -71
- data/unittests/links_xpath_test.rb +15 -15
- data/unittests/lists_test.rb +10 -10
- data/unittests/map_test.rb +65 -65
- data/unittests/minmax_test.rb +10 -9
- data/unittests/navigate_test.rb +19 -23
- data/unittests/nbsp_xpath_test.rb +2 -2
- data/unittests/non_core_tests.rb +5 -2
- data/unittests/other/WindowLogonExample.rb +2 -2
- data/unittests/other/WindowLogonExtra.rb +1 -1
- data/unittests/other/navigate_exception_test.rb +14 -3
- data/unittests/other/screen_capture_test.rb +3 -2
- data/unittests/other/testcase_method_order_test.rb +1 -1
- data/unittests/pagecontainstext_test.rb +17 -14
- data/unittests/parent_child_test.rb +11 -7
- data/unittests/perf_test.rb +20 -0
- data/unittests/popups_test.rb +13 -14
- data/unittests/pre_test.rb +30 -28
- data/unittests/radios_test.rb +128 -107
- data/unittests/radios_xpath_test.rb +47 -47
- data/unittests/security_setting_test.rb +24 -0
- data/unittests/selectbox_test.rb +65 -157
- data/unittests/selectbox_xpath_test.rb +51 -51
- data/unittests/setup.rb +52 -48
- data/unittests/speed_settings_test.rb +31 -20
- data/unittests/table_cell_using_xpath_test.rb +12 -12
- data/unittests/table_test.rb +30 -16
- data/unittests/table_xpath_test.rb +25 -25
- data/unittests/test_tests.rb +9 -0
- data/unittests/textarea_test.rb +33 -33
- data/unittests/textarea_xpath_test.rb +37 -37
- data/unittests/textfield_for_ch_char_test.rb +9 -9
- data/unittests/textfields_test.rb +103 -98
- data/unittests/textfields_xpath_test.rb +50 -50
- data/unittests/windows/attach_to_existing_window_test.rb +2 -2
- data/unittests/windows/attach_to_new_window_test.rb +10 -10
- data/unittests/windows/close_window_test.rb +2 -2
- data/unittests/windows/frame_links_test.rb +6 -6
- data/unittests/windows/ie-each_test.rb +1 -1
- data/unittests/windows/iedialog_test.rb +4 -5
- data/unittests/windows/js_events_test.rb +14 -14
- data/unittests/windows/jscriptExtraAlert.rb +2 -1
- data/unittests/windows/jscriptExtraConfirmCancel.rb +1 -1
- data/unittests/windows/jscriptExtraConfirmOk.rb +1 -1
- data/unittests/windows/jscriptPushButton.rb +2 -1
- data/unittests/windows/jscript_test.rb +7 -7
- data/unittests/windows/modal_dialog_test.rb +28 -29
- data/unittests/windows/{new.rb → new_test.rb} +1 -1
- data/unittests/windows/open_close_test.rb +4 -7
- data/unittests/windows/send_keys_test.rb +11 -11
- data/unittests/xpath_tests.rb +4 -3
- metadata +82 -58
- data/unittests/buttons_test.rb +0 -107
- data/watir/assertions.rb +0 -44
- data/watir/exceptions.rb +0 -42
- data/watir/testcase.rb +0 -58
- data/watir/waiter.rb +0 -88
- data/watir/win32ole.rb +0 -8
- data/watir/win32ole/win32ole.so +0 -0
data/unittests/checkbox_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# feature tests for Check Boxes
|
2
|
-
# revision: $Revision:
|
2
|
+
# revision: $Revision: 1542 $
|
3
3
|
|
4
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..')
|
4
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
5
5
|
require 'unittests/setup'
|
6
6
|
|
7
7
|
class TC_CheckBox < Test::Unit::TestCase
|
@@ -10,153 +10,167 @@ class TC_CheckBox < Test::Unit::TestCase
|
|
10
10
|
def setup
|
11
11
|
goto_page "checkboxes1.html"
|
12
12
|
end
|
13
|
+
|
14
|
+
def test_checkbox_exceptions
|
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
|
+
end
|
13
21
|
|
22
|
+
def test_checkbox_properties_with_index
|
23
|
+
assert_equal("box1", browser.checkbox(:index, 1).name )
|
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
|
+
end
|
14
29
|
def test_checkbox_properties
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
assert_equal("
|
22
|
-
assert_equal(""
|
23
|
-
assert_equal(
|
24
|
-
assert_equal("
|
25
|
-
|
26
|
-
|
27
|
-
assert_equal("
|
28
|
-
assert_equal("" , $ie.checkbox(:name, "box2").class_name)
|
29
|
-
|
30
|
-
assert_equal("1" , $ie.checkbox(:name,"box4").value )
|
31
|
-
assert_equal("3" , $ie.checkbox(:name,"box4" , 3).value )
|
32
|
-
assert($ie.checkbox(:name, "box6").exists?)
|
33
|
-
assert_equal("checkbox" , $ie.checkbox(:name,"box4" , 3).type )
|
34
|
-
assert_equal("checkbox" , $ie.checkbox(:name,"box6" , 'Milk').type )
|
35
|
-
assert_equal(false , $ie.checkbox(:name,"box4" , 3).disabled )
|
36
|
-
assert_equal("" , $ie.checkbox(:name,"box4" , 3).id )
|
37
|
-
|
38
|
-
assert_equal("box4-value5" , $ie.checkbox(:name,"box4" , 5).title)
|
39
|
-
assert_equal("" , $ie.checkbox(:name,"box4" , 4).title)
|
30
|
+
assert_equal("check_box_style", browser.checkbox(:name, "box1").class_name)
|
31
|
+
assert_equal("", browser.checkbox(:name, "box2").class_name)
|
32
|
+
|
33
|
+
assert_equal("1", browser.checkbox(:name, "box4").value )
|
34
|
+
assert_equal("3", browser.checkbox(:name, "box4", 3).value )
|
35
|
+
assert(browser.checkbox(:name, "box6").exists?)
|
36
|
+
assert_equal("checkbox", browser.checkbox(:name, "box4", 3).type )
|
37
|
+
assert_equal("checkbox", browser.checkbox(:name, "box6", 'Milk').type )
|
38
|
+
assert_equal(false, browser.checkbox(:name, "box4", 3).disabled )
|
39
|
+
assert_equal("", browser.checkbox(:name, "box4", 3).id )
|
40
|
+
|
41
|
+
assert_equal("box4-value5", browser.checkbox(:name, "box4", 5).title)
|
42
|
+
assert_equal("", browser.checkbox(:name,"box4", 4).title)
|
40
43
|
end
|
41
44
|
|
42
45
|
def test_onClick
|
43
|
-
|
44
|
-
|
45
|
-
assert(
|
46
|
+
assert_false(browser.button(:value, "foo").enabled?)
|
47
|
+
browser.checkbox(:name, "box5").set
|
48
|
+
assert(browser.button(:value, "foo").enabled?)
|
46
49
|
|
47
|
-
|
48
|
-
|
50
|
+
browser.checkbox(:name, "box5").clear
|
51
|
+
assert_false(browser.button(:value, "foo").enabled?)
|
49
52
|
|
50
|
-
|
51
|
-
|
53
|
+
browser.checkbox(:name, "box5").clear
|
54
|
+
assert_false(browser.button(:value, "foo").enabled?)
|
52
55
|
end
|
53
56
|
|
54
57
|
def test_CheckBox_Exists
|
55
|
-
assert(
|
56
|
-
|
58
|
+
assert(browser.checkbox(:name, "box1").exists?)
|
59
|
+
assert_false(browser.checkbox(:name, "missing").exists?)
|
57
60
|
|
58
|
-
assert(
|
59
|
-
|
61
|
+
assert(browser.checkbox(:name, "box4", 1).exists?)
|
62
|
+
assert_false(browser.checkbox(:name, "box4", 22).exists?)
|
60
63
|
end
|
61
64
|
|
62
65
|
def test_checkbox_Enabled
|
63
|
-
assert_raises(UnknownObjectException) {
|
64
|
-
assert_raises(UnknownObjectException) {
|
65
|
-
assert_raises(UnknownObjectException) {
|
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? }
|
66
69
|
|
67
|
-
assert(
|
68
|
-
|
70
|
+
assert(browser.checkbox(:name, "box1").enabled?)
|
71
|
+
assert_false(browser.checkbox(:name, "box2").enabled?)
|
69
72
|
|
70
|
-
assert(
|
71
|
-
|
73
|
+
assert(browser.checkbox(:name, "box4", 4).enabled?)
|
74
|
+
assert_false(browser.checkbox(:name, "box4", 5 ).enabled?)
|
72
75
|
end
|
73
76
|
|
74
77
|
def test_checkbox_isSet
|
75
|
-
assert_raises(UnknownObjectException ) {
|
78
|
+
assert_raises(UnknownObjectException ) { browser.checkbox(:name, "noName").isSet? }
|
76
79
|
|
77
|
-
|
78
|
-
|
79
|
-
assert(
|
80
|
+
assert_false(browser.checkbox(:name, "box1").isSet?)
|
81
|
+
assert_false(browser.checkbox(:name, "box2").isSet?)
|
82
|
+
assert(browser.checkbox(:name, "box3").isSet?)
|
80
83
|
|
81
|
-
|
82
|
-
assert(
|
83
|
-
|
84
|
+
assert_false(browser.checkbox(:name, "box4", 2 ).isSet?)
|
85
|
+
assert(browser.checkbox(:name, "box4", 1 ).isSet?)
|
86
|
+
|
87
|
+
assert_false(browser.checkbox(:name, 'box6', 'Milk').isSet?)
|
84
88
|
end
|
85
89
|
|
86
90
|
def test_checkbox_clear
|
87
|
-
assert_raises(UnknownObjectException) {
|
88
|
-
|
89
|
-
|
91
|
+
assert_raises(UnknownObjectException) { browser.checkbox(:name, "noName").clear }
|
92
|
+
browser.checkbox(:name, "box1").clear
|
93
|
+
assert_false(browser.checkbox(:name, "box1").isSet?)
|
90
94
|
|
91
|
-
assert_raises(ObjectDisabledException) {
|
92
|
-
|
95
|
+
assert_raises(ObjectDisabledException) { browser.checkbox(:name, "box2").clear }
|
96
|
+
assert_false(browser.checkbox(:name, "box2").isSet?)
|
93
97
|
|
94
|
-
|
95
|
-
|
98
|
+
browser.checkbox(:name, "box3").clear
|
99
|
+
assert_false(browser.checkbox(:name, "box3").isSet?)
|
96
100
|
|
97
|
-
|
98
|
-
|
101
|
+
browser.checkbox(:name, "box4" , 1).clear
|
102
|
+
assert_false(browser.checkbox(:name, "box4", 1).isSet?)
|
99
103
|
|
100
|
-
|
101
|
-
|
102
|
-
|
104
|
+
browser.checkbox(:name, "box6" , 'Tea').clear
|
105
|
+
assert_false(browser.checkbox(:name, "box6", 'Tea').isSet?)
|
103
106
|
end
|
104
107
|
|
105
108
|
def test_checkbox_getState
|
106
|
-
assert_raises(UnknownObjectException) {
|
107
|
-
assert_equal( false
|
108
|
-
assert_equal( true
|
109
|
+
assert_raises(UnknownObjectException) { browser.checkbox(:name, "noName").getState }
|
110
|
+
assert_equal( false, browser.checkbox(:name, "box1").getState )
|
111
|
+
assert_equal( true, browser.checkbox(:name, "box3").getState)
|
109
112
|
|
110
113
|
# checkboxes that have the same name but different values
|
111
|
-
assert_equal( false
|
112
|
-
assert_equal( true
|
114
|
+
assert_equal( false, browser.checkbox(:name, "box4", 2).getState )
|
115
|
+
assert_equal( true, browser.checkbox(:name, "box4", 1).getState)
|
113
116
|
end
|
114
117
|
|
115
118
|
def test_checkbox_set
|
116
|
-
assert_raises(UnknownObjectException) {
|
117
|
-
|
118
|
-
assert(
|
119
|
+
assert_raises(UnknownObjectException) { browser.checkbox(:name, "noName").set }
|
120
|
+
browser.checkbox(:name, "box1").set
|
121
|
+
assert(browser.checkbox(:name, "box1").isSet?)
|
119
122
|
|
120
|
-
assert_raises(ObjectDisabledException) {
|
123
|
+
assert_raises(ObjectDisabledException) { browser.checkbox(:name, "box2").set }
|
121
124
|
|
122
|
-
|
123
|
-
assert(
|
125
|
+
browser.checkbox(:name, "box3").set
|
126
|
+
assert(browser.checkbox(:name, "box3").isSet?)
|
124
127
|
|
125
128
|
# checkboxes that have the same name but different values
|
126
|
-
|
127
|
-
assert(
|
129
|
+
browser.checkbox(:name, "box4", 3).set
|
130
|
+
assert(browser.checkbox(:name, "box4", 3).isSet?)
|
128
131
|
|
129
132
|
# test set using the optinal true/false
|
130
133
|
# assumes the checkbox is already checked
|
131
|
-
|
132
|
-
|
134
|
+
browser.checkbox(:name, "box1").set( false )
|
135
|
+
assert_false(browser.checkbox(:name, "box1").isSet?)
|
133
136
|
|
134
|
-
|
135
|
-
assert(
|
137
|
+
browser.checkbox(:name, "box1").set( true )
|
138
|
+
assert(browser.checkbox(:name, "box1").isSet?)
|
136
139
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
$ie.checkbox(:name, "box6", 'Tea').set( true )
|
141
|
-
assert($ie.checkbox(:name, "box6", 'Tea').isSet?)
|
140
|
+
browser.checkbox(:name, "box6", 'Tea').set( false )
|
141
|
+
assert_false(browser.checkbox(:name, "box6", 'Tea').isSet?)
|
142
142
|
|
143
|
+
browser.checkbox(:name, "box6", 'Tea').set( true )
|
144
|
+
assert(browser.checkbox(:name, "box6", 'Tea').isSet?)
|
145
|
+
end
|
146
|
+
|
147
|
+
def test_checkbox_specifying_value
|
148
|
+
browser.checkbox(:name => "box6", :value => 'Tea').set( false )
|
149
|
+
assert_false(browser.checkbox(:name => "box6", :value => 'Tea').isSet?)
|
150
|
+
end
|
151
|
+
|
152
|
+
def test_checkboxes_access
|
153
|
+
assert_equal("box1" , browser.checkboxes[1].name )
|
143
154
|
end
|
144
155
|
|
145
156
|
def test_checkbox_iterator
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
assert_equal(
|
153
|
-
|
154
|
-
assert_equal( $ie.checkbox(:index, index).value, c.value )
|
155
|
-
index+=1
|
157
|
+
assert_equal(13, browser.checkboxes.length)
|
158
|
+
index = 1
|
159
|
+
browser.checkboxes.each do |c|
|
160
|
+
# puts "#{index}: #{c.name}"
|
161
|
+
assert_equal( browser.checkbox(:index, index).name , c.name )
|
162
|
+
assert_equal( browser.checkbox(:index, index).id, c.id )
|
163
|
+
assert_equal( browser.checkbox(:index, index).value, c.value )
|
164
|
+
index += 1
|
156
165
|
end
|
157
|
-
assert_equal(index-1,
|
158
|
-
|
166
|
+
assert_equal(index - 1, browser.checkboxes.length)
|
167
|
+
end
|
168
|
+
|
169
|
+
# bug 217
|
170
|
+
tag_method :test_checkbox_access_by_ole_object, :fails_on_firefox
|
171
|
+
def test_checkbox_access_by_ole_object
|
172
|
+
ole = browser.checkboxes[1].locate
|
173
|
+
browser.checkbox(:ole_object, ole).flash
|
159
174
|
end
|
160
|
-
|
161
175
|
|
162
176
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# feature tests for Check Boxes
|
2
|
-
# revision: $Revision:
|
2
|
+
# revision: $Revision: 1544 $
|
3
3
|
|
4
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..')
|
4
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
5
5
|
require 'unittests/setup'
|
6
6
|
|
7
7
|
class TC_CheckBox_XPath < Test::Unit::TestCase
|
@@ -12,96 +12,96 @@ class TC_CheckBox_XPath < Test::Unit::TestCase
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_checkbox_properties
|
15
|
-
assert_raises(UnknownObjectException
|
16
|
-
assert_raises(UnknownObjectException
|
17
|
-
assert_raises(UnknownObjectException
|
18
|
-
assert_raises(UnknownObjectException
|
19
|
-
assert_raises(UnknownObjectException
|
20
|
-
|
21
|
-
assert_equal("1" ,
|
22
|
-
assert_equal("3" ,
|
23
|
-
assert_equal("checkbox" ,
|
24
|
-
assert_equal(false ,
|
25
|
-
assert_equal("" ,
|
26
|
-
|
27
|
-
assert_equal("box4-value5" ,
|
28
|
-
assert_equal("" ,
|
15
|
+
assert_raises(UnknownObjectException) { browser.checkbox(:xpath , "//input[@name='noName']/").id }
|
16
|
+
assert_raises(UnknownObjectException) { browser.checkbox(:xpath , "//input[@name='noName']/").name }
|
17
|
+
assert_raises(UnknownObjectException) { browser.checkbox(:xpath , "//input[@name='noName']/").disabled }
|
18
|
+
assert_raises(UnknownObjectException) { browser.checkbox(:xpath , "//input[@name='noName']/").type }
|
19
|
+
assert_raises(UnknownObjectException) { browser.checkbox(:xpath , "//input[@name='noName']/").value }
|
20
|
+
|
21
|
+
assert_equal("1" , browser.checkbox(:xpath , "//input[@name='box4']/").value )
|
22
|
+
assert_equal("3" , browser.checkbox(:xpath , "//input[@name='box4' and @value='3']/").value )
|
23
|
+
assert_equal("checkbox" , browser.checkbox(:xpath , "//input[@name='box4' and @value='3']/").type )
|
24
|
+
assert_equal(false , browser.checkbox(:xpath , "//input[@name='box4' and @value='3']/").disabled )
|
25
|
+
assert_equal("" , browser.checkbox(:xpath , "//input[@name='box4' and @value='3']/").id )
|
26
|
+
|
27
|
+
assert_equal("box4-value5" , browser.checkbox(:xpath , "//input[@name='box4' and @value='5']/").title)
|
28
|
+
assert_equal("" , browser.checkbox(:xpath , "//input[@name='box4' and @value='4']/").title)
|
29
29
|
end
|
30
30
|
|
31
31
|
def test_CheckBox_Exists
|
32
|
-
assert(
|
33
|
-
|
32
|
+
assert(browser.checkbox(:xpath , "//input[@name='box4' and @value='1']/").exists?)
|
33
|
+
assert_false(browser.checkbox(:xpath , "//input[@name='box4' and @value='22']/").exists?)
|
34
34
|
end
|
35
35
|
|
36
36
|
def test_checkbox_Enabled
|
37
|
-
assert_raises(UnknownObjectException) {
|
38
|
-
assert_raises(UnknownObjectException) {
|
39
|
-
assert_raises(UnknownObjectException) {
|
37
|
+
assert_raises(UnknownObjectException) { browser.checkbox(:xpath , "//input[@name='noName']/").enabled? }
|
38
|
+
assert_raises(UnknownObjectException) { browser.checkbox(:xpath , "//input[@id='noName']/").enabled? }
|
39
|
+
assert_raises(UnknownObjectException) { browser.checkbox(:xpath , "//input[@name='box4' and @value='6']/").enabled? }
|
40
40
|
|
41
|
-
assert(
|
42
|
-
|
41
|
+
assert(browser.checkbox(:xpath , "//input[@name='box1']/").enabled?)
|
42
|
+
assert_false(browser.checkbox(:xpath , "//input[@name='box2']/").enabled?)
|
43
43
|
|
44
|
-
assert(
|
45
|
-
|
44
|
+
assert(browser.checkbox(:xpath , "//input[@name='box4' and @value='4']/").enabled?)
|
45
|
+
assert_false(browser.checkbox(:xpath , "//input[@name='box4' and @value='5']/").enabled?)
|
46
46
|
end
|
47
47
|
|
48
48
|
def test_checkbox_isSet
|
49
|
-
assert_raises(UnknownObjectException ) {
|
49
|
+
assert_raises(UnknownObjectException ) { browser.checkbox(:xpath , "//input[@name='noName']/").isSet? }
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
assert(
|
51
|
+
assert_false(browser.checkbox(:xpath , "//input[@name='box1']/").isSet?)
|
52
|
+
assert_false(browser.checkbox(:xpath , "//input[@name='box2']/").isSet?)
|
53
|
+
assert(browser.checkbox(:xpath , "//input[@name='box3']/").isSet?)
|
54
54
|
|
55
|
-
|
56
|
-
assert(
|
55
|
+
assert_false(browser.checkbox(:xpath , "//input[@name='box4' and @value='2']/").isSet?)
|
56
|
+
assert(browser.checkbox(:xpath , "//input[@name='box4' and @value='1']/").isSet?)
|
57
57
|
end
|
58
58
|
|
59
59
|
def test_checkbox_clear
|
60
|
-
assert_raises(UnknownObjectException) {
|
61
|
-
|
62
|
-
|
60
|
+
assert_raises(UnknownObjectException) { browser.checkbox(:xpath , "//input[@name='noName']/").clear }
|
61
|
+
browser.checkbox(:xpath , "//input[@name='box1']/").clear
|
62
|
+
assert_false(browser.checkbox(:xpath , "//input[@name='box1']/").isSet?)
|
63
63
|
|
64
|
-
assert_raises(ObjectDisabledException) {
|
65
|
-
|
64
|
+
assert_raises(ObjectDisabledException) { browser.checkbox(:xpath , "//input[@name='box2']/").clear }
|
65
|
+
assert_false(browser.checkbox(:xpath , "//input[@name='box2']/").isSet?)
|
66
66
|
|
67
|
-
|
68
|
-
|
67
|
+
browser.checkbox(:xpath , "//input[@name='box3']/").clear
|
68
|
+
assert_false(browser.checkbox(:xpath , "//input[@name='box3']/").isSet?)
|
69
69
|
|
70
|
-
|
71
|
-
|
70
|
+
browser.checkbox(:xpath , "//input[@name='box4' and @value='1']/").clear
|
71
|
+
assert_false(browser.checkbox(:xpath , "//input[@name='box4' and @value='1']/").isSet?)
|
72
72
|
end
|
73
73
|
|
74
74
|
def test_checkbox_getState
|
75
|
-
assert_raises(UnknownObjectException) {
|
76
|
-
assert_equal( false ,
|
77
|
-
assert_equal( true ,
|
75
|
+
assert_raises(UnknownObjectException) { browser.checkbox(:xpath , "//input[@name='noName']/").getState }
|
76
|
+
assert_equal( false , browser.checkbox(:xpath , "//input[@name='box1']/").getState )
|
77
|
+
assert_equal( true , browser.checkbox(:xpath , "//input[@name='box3']/").getState)
|
78
78
|
|
79
79
|
# checkboxes that have the same name but different values
|
80
|
-
assert_equal( false ,
|
81
|
-
assert_equal( true ,
|
80
|
+
assert_equal( false , browser.checkbox(:xpath , "//input[@name='box4' and @value='2']/").getState )
|
81
|
+
assert_equal( true , browser.checkbox(:xpath , "//input[@name='box4' and @value='1']/").getState)
|
82
82
|
end
|
83
83
|
|
84
84
|
def test_checkbox_set
|
85
|
-
assert_raises(UnknownObjectException) {
|
86
|
-
|
87
|
-
assert(
|
85
|
+
assert_raises(UnknownObjectException) { browser.checkbox(:xpath , "//input[@name='noName']/").set }
|
86
|
+
browser.checkbox(:xpath , "//input[@name='box1']/").set
|
87
|
+
assert(browser.checkbox(:xpath , "//input[@name='box1']/").isSet?)
|
88
88
|
|
89
|
-
assert_raises(ObjectDisabledException) {
|
89
|
+
assert_raises(ObjectDisabledException) { browser.checkbox(:xpath , "//input[@name='box2']/").set }
|
90
90
|
|
91
|
-
|
92
|
-
assert(
|
91
|
+
browser.checkbox(:xpath , "//input[@name='box3']/").set
|
92
|
+
assert(browser.checkbox(:xpath , "//input[@name='box3']/").isSet?)
|
93
93
|
|
94
94
|
# checkboxes that have the same name but different values
|
95
|
-
|
96
|
-
assert(
|
95
|
+
browser.checkbox(:xpath , "//input[@name='box4' and @value='3']/").set
|
96
|
+
assert(browser.checkbox(:xpath , "//input[@name='box4' and @value='3']/").isSet?)
|
97
97
|
|
98
98
|
# test set using the optinal true/false
|
99
99
|
# assumes the checkbox is already checked
|
100
|
-
|
101
|
-
|
100
|
+
browser.checkbox(:xpath , "//input[@name='box1']/").set( false )
|
101
|
+
assert_false(browser.checkbox(:xpath , "//input[@name='box1']/").isSet?)
|
102
102
|
|
103
|
-
|
104
|
-
assert(
|
103
|
+
browser.checkbox(:xpath , "//input[@name='box1']/").set( true )
|
104
|
+
assert(browser.checkbox(:xpath , "//input[@name='box1']/").isSet?)
|
105
105
|
|
106
106
|
end
|
107
107
|
end
|
data/unittests/core_tests.rb
CHANGED
@@ -1,13 +1,16 @@
|
|
1
|
-
# these are the tests that
|
2
|
-
|
3
|
-
TOPDIR = File.join(File.dirname(__FILE__), '..')
|
4
|
-
$LOAD_PATH.unshift TOPDIR
|
5
|
-
|
6
|
-
require 'watir'
|
1
|
+
# these are the non-xpath tests that do not need to be visible
|
7
2
|
|
8
3
|
$HIDE_IE = true
|
9
4
|
|
5
|
+
TOPDIR = File.join(File.dirname(__FILE__), '..')
|
6
|
+
|
7
|
+
$LOAD_PATH.unshift TOPDIR
|
10
8
|
require 'unittests/setup'
|
11
9
|
|
12
10
|
Dir.chdir TOPDIR
|
13
|
-
$
|
11
|
+
$all_tests.each {|x| require x}
|
12
|
+
|
13
|
+
Watir::UnitTest.filter_out do |test|
|
14
|
+
test.class.to_s =~ /xpath/i
|
15
|
+
end
|
16
|
+
Watir::UnitTest.filter_out_tests_tagged :must_be_visible
|