firewatir 1.6.2 → 1.6.5
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +32 -0
- data/lib/firewatir.rb +40 -50
- data/lib/firewatir/container.rb +491 -534
- data/lib/firewatir/document.rb +239 -0
- data/lib/firewatir/element.rb +1365 -0
- data/lib/firewatir/element_collections.rb +314 -0
- data/lib/firewatir/elements/button.rb +15 -0
- data/lib/firewatir/elements/file_field.rb +29 -0
- data/lib/firewatir/elements/form.rb +40 -0
- data/lib/firewatir/elements/frame.rb +55 -0
- data/lib/firewatir/elements/hidden.rb +56 -0
- data/lib/firewatir/elements/image.rb +139 -0
- data/lib/firewatir/elements/input_element.rb +44 -0
- data/lib/firewatir/elements/link.rb +76 -0
- data/lib/firewatir/elements/non_control_element.rb +53 -0
- data/lib/firewatir/elements/non_control_elements.rb +108 -0
- data/lib/firewatir/elements/not_used.rb +278 -0
- data/lib/firewatir/elements/option.rb +131 -0
- data/lib/firewatir/elements/radio_check_common.rb +163 -0
- data/lib/firewatir/elements/select_list.rb +188 -0
- data/lib/firewatir/elements/table.rb +218 -0
- data/lib/firewatir/elements/table_cell.rb +54 -0
- data/lib/firewatir/elements/table_row.rb +100 -0
- data/lib/firewatir/elements/text_field.rb +218 -0
- data/lib/firewatir/exceptions.rb +10 -10
- data/lib/firewatir/firefox.rb +1040 -1127
- data/lib/firewatir/jssh_socket.rb +101 -0
- data/lib/firewatir/version.rb +5 -5
- data/unittests/attach_to_new_window_test.rb +49 -42
- data/unittests/bug_fixes_test.rb +195 -198
- data/unittests/buttons_xpath_test.rb +88 -88
- data/unittests/checkbox_test.rb +158 -155
- data/unittests/checkbox_xpath_test.rb +107 -107
- data/unittests/div_test.rb +275 -276
- data/unittests/filefield_test.rb +49 -45
- data/unittests/filefield_xpath_test.rb +35 -35
- data/unittests/form_test.rb +296 -308
- data/unittests/frame_test.rb +159 -152
- data/unittests/hidden_test.rb +85 -85
- data/unittests/hidden_xpath_test.rb +72 -72
- data/unittests/html/blankpage.html +11 -11
- data/unittests/html/buttons1.html +61 -61
- data/unittests/html/cssTest.html +42 -42
- data/unittests/html/div.html +72 -72
- data/unittests/html/fileupload.html +45 -45
- data/unittests/html/formTest1.html +38 -38
- data/unittests/html/forms2.html +45 -45
- data/unittests/html/frame_buttons.html +3 -3
- data/unittests/html/iframeTest.html +14 -14
- data/unittests/html/iframeTest1.html +13 -13
- data/unittests/html/iframeTest2.html +5 -5
- data/unittests/html/links1.html +42 -42
- data/unittests/html/nestedFrames.html +6 -6
- data/unittests/html/new_browser.html +1 -0
- data/unittests/html/new_browser_popup.html +8 -0
- data/unittests/html/pass.html +9 -9
- data/unittests/html/pre.html +27 -27
- data/unittests/html/redirect.html +10 -10
- data/unittests/html/redirect1.html +8 -8
- data/unittests/html/redirect2.html +8 -8
- data/unittests/html/redirect3.html +8 -8
- data/unittests/html/simple_table_columns.html +74 -74
- data/unittests/html/table1.html +165 -165
- data/unittests/html/textfields1.html +62 -62
- data/unittests/images_test.rb +198 -205
- data/unittests/images_xpath_test.rb +118 -119
- data/unittests/javascript_test.rb +75 -75
- data/unittests/links_test.rb +231 -232
- data/unittests/links_xpath_test.rb +79 -79
- data/unittests/mozilla_all_tests.rb +7 -7
- data/unittests/pre_test.rb +75 -76
- data/unittests/radios_xpath_test.rb +101 -101
- data/unittests/redirect_test.rb +41 -41
- data/unittests/selectbox_test.rb +142 -142
- data/unittests/selectbox_xpath_test.rb +129 -129
- data/unittests/setup.rb +29 -30
- data/unittests/table_test.rb +385 -373
- data/unittests/table_xpath_test.rb +185 -185
- data/unittests/textfields_test.rb +234 -233
- data/unittests/textfields_xpath_test.rb +113 -113
- metadata +33 -11
- data/lib/firewatir/MozillaBaseElement.rb +0 -1863
- data/lib/firewatir/htmlelements.rb +0 -1911
- data/unittests/iostring.rb +0 -30
- data/unittests/iostring_test.rb +0 -48
@@ -1,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
|
+
|
data/unittests/checkbox_test.rb
CHANGED
@@ -1,155 +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
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
#
|
66
|
-
#
|
67
|
-
#
|
68
|
-
#
|
69
|
-
#
|
70
|
-
# assert(browser.checkbox(:name, "
|
71
|
-
#
|
72
|
-
#
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
assert_false(browser.checkbox(:name, "
|
82
|
-
assert(browser.checkbox(:name, "
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
assert_false(browser.checkbox(:name, "
|
92
|
-
|
93
|
-
browser.checkbox(:name, "
|
94
|
-
assert_false(browser.checkbox(:name, "
|
95
|
-
|
96
|
-
browser.checkbox(:name, "
|
97
|
-
assert_false(browser.checkbox(:name, "
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
assert_equal(
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
browser.checkbox(:name, "
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
browser.checkbox(:name, "box1").set(
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
browser.checkboxes.
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
assert_equal( browser.checkbox(:index, index).
|
148
|
-
index
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
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
|