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.
- data/CHANGES +461 -0
- data/LICENSE +31 -31
- data/README.rdoc +112 -0
- data/VERSION +1 -0
- data/lib/firewatir.rb +41 -40
- data/lib/firewatir/container.rb +491 -491
- data/lib/firewatir/document.rb +239 -239
- data/lib/firewatir/element.rb +1364 -1364
- data/lib/firewatir/element_collections.rb +314 -314
- data/lib/firewatir/elements/button.rb +15 -15
- data/lib/firewatir/elements/file_field.rb +29 -29
- data/lib/firewatir/elements/form.rb +40 -40
- data/lib/firewatir/elements/frame.rb +55 -55
- data/lib/firewatir/elements/hidden.rb +56 -56
- data/lib/firewatir/elements/image.rb +139 -139
- data/lib/firewatir/elements/input_element.rb +44 -44
- data/lib/firewatir/elements/link.rb +76 -76
- data/lib/firewatir/elements/non_control_element.rb +53 -53
- data/lib/firewatir/elements/non_control_elements.rb +108 -108
- data/lib/firewatir/elements/not_used.rb +278 -278
- data/lib/firewatir/elements/option.rb +130 -130
- data/lib/firewatir/elements/radio_check_common.rb +163 -163
- data/lib/firewatir/elements/select_list.rb +188 -188
- data/lib/firewatir/elements/table.rb +218 -218
- data/lib/firewatir/elements/table_cell.rb +54 -54
- data/lib/firewatir/elements/table_row.rb +100 -100
- data/lib/firewatir/elements/text_field.rb +218 -218
- data/lib/firewatir/exceptions.rb +10 -10
- data/lib/firewatir/firefox.rb +984 -1040
- data/lib/firewatir/jssh_socket.rb +100 -100
- data/lib/firewatir/winClicker.rb +122 -122
- data/lib/firewatir/x11.rb +192 -192
- data/rakefile.rb +15 -0
- data/unittests/attach_to_new_window_test.rb +49 -49
- data/unittests/bug_fixes_test.rb +195 -195
- data/unittests/buttons_xpath_test.rb +88 -88
- data/unittests/checkbox_test.rb +158 -158
- data/unittests/checkbox_xpath_test.rb +107 -107
- data/unittests/div_test.rb +275 -275
- data/unittests/ff_test.rb +47 -0
- data/unittests/filefield_test.rb +49 -49
- data/unittests/filefield_xpath_test.rb +35 -35
- data/unittests/form_test.rb +296 -296
- data/unittests/frame_test.rb +159 -159
- data/unittests/hidden_test.rb +85 -85
- data/unittests/hidden_xpath_test.rb +72 -72
- data/unittests/html/JavascriptClick.html +42 -42
- data/unittests/html/blankpage.html +11 -11
- data/unittests/html/buttons1.html +61 -61
- data/unittests/html/checkboxes1.html +70 -70
- data/unittests/html/complex_table.html +36 -36
- data/unittests/html/cssTest.html +42 -42
- data/unittests/html/div.html +72 -72
- data/unittests/html/div_xml.html +20 -20
- data/unittests/html/fileupload.html +45 -45
- data/unittests/html/formTest1.html +38 -38
- data/unittests/html/forms2.html +45 -45
- data/unittests/html/forms3.html +132 -132
- data/unittests/html/forms4.html +27 -27
- data/unittests/html/frame_buttons.html +3 -3
- data/unittests/html/frame_links.html +3 -3
- data/unittests/html/frame_multi.html +4 -4
- data/unittests/html/iframeTest.html +14 -14
- data/unittests/html/iframeTest1.html +13 -13
- data/unittests/html/iframeTest2.html +5 -5
- data/unittests/html/images1.html +66 -66
- data/unittests/html/javascriptevents.html +35 -35
- data/unittests/html/link_pass.html +10 -10
- data/unittests/html/links1.html +42 -42
- data/unittests/html/links2.html +10 -10
- data/unittests/html/modal_dialog.html +8 -8
- data/unittests/html/modal_dialog_launcher.html +11 -11
- data/unittests/html/nestedFrames.html +6 -6
- data/unittests/html/new_browser.html +17 -17
- data/unittests/html/new_browser_popup.html +7 -7
- data/unittests/html/pass.html +9 -9
- data/unittests/html/popups1.html +60 -60
- data/unittests/html/pre.html +27 -27
- data/unittests/html/radioButtons1.html +70 -70
- 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/select_tealeaf.html +54 -54
- data/unittests/html/selectboxes1.html +55 -55
- data/unittests/html/simple_table.html +26 -26
- data/unittests/html/simple_table_buttons.html +104 -104
- data/unittests/html/simple_table_columns.html +74 -74
- data/unittests/html/table1.html +165 -165
- data/unittests/html/tableCell_using_xpath.html +19 -19
- data/unittests/html/textarea.html +30 -30
- data/unittests/html/textfields1.html +62 -62
- data/unittests/html/textsearch.html +44 -44
- data/unittests/images_test.rb +198 -198
- data/unittests/images_xpath_test.rb +118 -118
- data/unittests/javascript_test.rb +75 -75
- data/unittests/links_test.rb +231 -231
- data/unittests/links_xpath_test.rb +79 -79
- data/unittests/mozilla_all_tests.rb +7 -7
- data/unittests/pre_test.rb +75 -75
- data/unittests/radios_test.rb +166 -166
- 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 -29
- data/unittests/table_test.rb +385 -385
- data/unittests/table_xpath_test.rb +185 -185
- data/unittests/textfields_test.rb +234 -234
- data/unittests/textfields_xpath_test.rb +113 -113
- metadata +51 -19
- data/lib/firewatir/version.rb +0 -5
@@ -1,101 +1,101 @@
|
|
1
|
-
# feature tests for Radio 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_Radios_XPath < Test::Unit::TestCase
|
8
|
-
|
9
|
-
|
10
|
-
def setup()
|
11
|
-
goto_page("radioButtons1.html")
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_Radio_Exists
|
15
|
-
assert(browser.radio(:xpath, "//input[@name='box1']").exists?)
|
16
|
-
assert(browser.radio(:xpath, "//input[@id='box5']").exists?)
|
17
|
-
|
18
|
-
assert_false(browser.radio(:xpath, "//input[@name='missingname']").exists?)
|
19
|
-
assert_false(browser.radio(:xpath, "//input[@id='missingid']").exists?)
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_Radio_Enabled
|
23
|
-
assert_raises(UnknownObjectException) { browser.radio(:xpath, "//input[@name='noName']").enabled? }
|
24
|
-
assert_raises(UnknownObjectException) { browser.radio(:xpath, "//input[@id='noName']").enabled? }
|
25
|
-
assert_raises(UnknownObjectException) { browser.radio(:xpath, "//input[@name='box4' and @value='6']").enabled? }
|
26
|
-
|
27
|
-
assert_false(browser.radio(:xpath, "//input[@name='box2']").enabled?)
|
28
|
-
assert(browser.radio(:xpath, "//input[@id='box5']").enabled?)
|
29
|
-
assert(browser.radio(:xpath, "//input[@name='box1']").enabled?)
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_little
|
33
|
-
assert_false(browser.button(:xpath,"//input[@name='foo']").enabled?)
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_onClick
|
37
|
-
assert_false(browser.button(:xpath,"//input[@name='foo']").enabled?)
|
38
|
-
browser.radio(:xpath, "//input[@name='box5' and @value='1']").set
|
39
|
-
assert(browser.button(:xpath,"//input[@name='foo']").enabled?)
|
40
|
-
|
41
|
-
browser.radio(:xpath, "//input[@name='box5' and @value='2']").set
|
42
|
-
assert_false(browser.button(:xpath,"//input[@name='foo']").enabled?)
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_Radio_isSet
|
46
|
-
assert_raises(UnknownObjectException) { browser.radio(:xpath, "//input[@name='noName']").isSet? }
|
47
|
-
|
48
|
-
puts "radio 1 is set : #{ browser.radio(:xpath, "//input[@name='box1']").isSet? } "
|
49
|
-
assert_false(browser.radio(:xpath, "//input[@name='box1']").isSet?)
|
50
|
-
|
51
|
-
assert(browser.radio(:xpath, "//input[@name='box3']").isSet?)
|
52
|
-
assert_false(browser.radio(:xpath, "//input[@name='box2']").isSet?)
|
53
|
-
|
54
|
-
assert( browser.radio(:xpath, "//input[@name='box4' and @value='1']").isSet?)
|
55
|
-
assert_false(browser.radio(:xpath, "//input[@name='box4' and @value='2']").isSet?)
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_radio_clear
|
59
|
-
assert_raises(UnknownObjectException) { browser.radio(:xpath, "//input[@name='noName']").clear }
|
60
|
-
|
61
|
-
browser.radio(:xpath, "//input[@name='box1']").clear
|
62
|
-
assert_false(browser.radio(:xpath, "//input[@name='box1']").isSet?)
|
63
|
-
|
64
|
-
assert_raises(ObjectDisabledException, "ObjectDisabledException was supposed to be thrown" ) { browser.radio(:xpath, "//input[@name='box2']").clear }
|
65
|
-
assert_false(browser.radio(:xpath, "//input[@name='box2']").isSet?)
|
66
|
-
|
67
|
-
browser.radio(:xpath, "//input[@name='box3']").clear
|
68
|
-
assert_false(browser.radio(:xpath, "//input[@name='box3']").isSet?)
|
69
|
-
|
70
|
-
browser.radio(:xpath, "//input[@name='box4' and @value='1']").clear
|
71
|
-
assert_false(browser.radio(:xpath, "//input[@name='box4' and @value='1']").isSet?)
|
72
|
-
end
|
73
|
-
|
74
|
-
def test_radio_getState
|
75
|
-
assert_raises(UnknownObjectException) { browser.radio(:xpath, "//input[@name='noName']").getState }
|
76
|
-
|
77
|
-
assert_equal( false , browser.radio(:xpath, "//input[@name='box1']").getState )
|
78
|
-
assert_equal( true , browser.radio(:xpath, "//input[@name='box3']").getState)
|
79
|
-
|
80
|
-
# radioes that have the same name but different values
|
81
|
-
assert_equal( false , browser.radio(:xpath, "//input[@name='box4' and @value='2']").getState )
|
82
|
-
assert_equal( true , browser.radio(:xpath, "//input[@name='box4' and @value='1']").getState)
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_radio_set
|
86
|
-
assert_raises(UnknownObjectException) { browser.radio(:xpath, "//input[@name='noName']").set }
|
87
|
-
browser.radio(:xpath, "//input[@name='box1']").set
|
88
|
-
assert(browser.radio(:xpath, "//input[@name='box1']").isSet?)
|
89
|
-
|
90
|
-
assert_raises(ObjectDisabledException, "ObjectDisabledException was supposed to be thrown" ) { browser.radio(:xpath, "//input[@name='box2']").set }
|
91
|
-
|
92
|
-
browser.radio(:xpath, "//input[@name='box3']").set
|
93
|
-
assert(browser.radio(:xpath, "//input[@name='box3']").isSet?)
|
94
|
-
|
95
|
-
# radioes that have the same name but different values
|
96
|
-
browser.radio(:xpath, "//input[@name='box4' and @value='3']").set
|
97
|
-
assert(browser.radio(:xpath, "//input[@name='box4' and @value='3']").isSet?)
|
98
|
-
end
|
99
|
-
|
100
|
-
end
|
101
|
-
|
1
|
+
# feature tests for Radio 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_Radios_XPath < Test::Unit::TestCase
|
8
|
+
|
9
|
+
|
10
|
+
def setup()
|
11
|
+
goto_page("radioButtons1.html")
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_Radio_Exists
|
15
|
+
assert(browser.radio(:xpath, "//input[@name='box1']").exists?)
|
16
|
+
assert(browser.radio(:xpath, "//input[@id='box5']").exists?)
|
17
|
+
|
18
|
+
assert_false(browser.radio(:xpath, "//input[@name='missingname']").exists?)
|
19
|
+
assert_false(browser.radio(:xpath, "//input[@id='missingid']").exists?)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_Radio_Enabled
|
23
|
+
assert_raises(UnknownObjectException) { browser.radio(:xpath, "//input[@name='noName']").enabled? }
|
24
|
+
assert_raises(UnknownObjectException) { browser.radio(:xpath, "//input[@id='noName']").enabled? }
|
25
|
+
assert_raises(UnknownObjectException) { browser.radio(:xpath, "//input[@name='box4' and @value='6']").enabled? }
|
26
|
+
|
27
|
+
assert_false(browser.radio(:xpath, "//input[@name='box2']").enabled?)
|
28
|
+
assert(browser.radio(:xpath, "//input[@id='box5']").enabled?)
|
29
|
+
assert(browser.radio(:xpath, "//input[@name='box1']").enabled?)
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_little
|
33
|
+
assert_false(browser.button(:xpath,"//input[@name='foo']").enabled?)
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_onClick
|
37
|
+
assert_false(browser.button(:xpath,"//input[@name='foo']").enabled?)
|
38
|
+
browser.radio(:xpath, "//input[@name='box5' and @value='1']").set
|
39
|
+
assert(browser.button(:xpath,"//input[@name='foo']").enabled?)
|
40
|
+
|
41
|
+
browser.radio(:xpath, "//input[@name='box5' and @value='2']").set
|
42
|
+
assert_false(browser.button(:xpath,"//input[@name='foo']").enabled?)
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_Radio_isSet
|
46
|
+
assert_raises(UnknownObjectException) { browser.radio(:xpath, "//input[@name='noName']").isSet? }
|
47
|
+
|
48
|
+
puts "radio 1 is set : #{ browser.radio(:xpath, "//input[@name='box1']").isSet? } "
|
49
|
+
assert_false(browser.radio(:xpath, "//input[@name='box1']").isSet?)
|
50
|
+
|
51
|
+
assert(browser.radio(:xpath, "//input[@name='box3']").isSet?)
|
52
|
+
assert_false(browser.radio(:xpath, "//input[@name='box2']").isSet?)
|
53
|
+
|
54
|
+
assert( browser.radio(:xpath, "//input[@name='box4' and @value='1']").isSet?)
|
55
|
+
assert_false(browser.radio(:xpath, "//input[@name='box4' and @value='2']").isSet?)
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_radio_clear
|
59
|
+
assert_raises(UnknownObjectException) { browser.radio(:xpath, "//input[@name='noName']").clear }
|
60
|
+
|
61
|
+
browser.radio(:xpath, "//input[@name='box1']").clear
|
62
|
+
assert_false(browser.radio(:xpath, "//input[@name='box1']").isSet?)
|
63
|
+
|
64
|
+
assert_raises(ObjectDisabledException, "ObjectDisabledException was supposed to be thrown" ) { browser.radio(:xpath, "//input[@name='box2']").clear }
|
65
|
+
assert_false(browser.radio(:xpath, "//input[@name='box2']").isSet?)
|
66
|
+
|
67
|
+
browser.radio(:xpath, "//input[@name='box3']").clear
|
68
|
+
assert_false(browser.radio(:xpath, "//input[@name='box3']").isSet?)
|
69
|
+
|
70
|
+
browser.radio(:xpath, "//input[@name='box4' and @value='1']").clear
|
71
|
+
assert_false(browser.radio(:xpath, "//input[@name='box4' and @value='1']").isSet?)
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_radio_getState
|
75
|
+
assert_raises(UnknownObjectException) { browser.radio(:xpath, "//input[@name='noName']").getState }
|
76
|
+
|
77
|
+
assert_equal( false , browser.radio(:xpath, "//input[@name='box1']").getState )
|
78
|
+
assert_equal( true , browser.radio(:xpath, "//input[@name='box3']").getState)
|
79
|
+
|
80
|
+
# radioes that have the same name but different values
|
81
|
+
assert_equal( false , browser.radio(:xpath, "//input[@name='box4' and @value='2']").getState )
|
82
|
+
assert_equal( true , browser.radio(:xpath, "//input[@name='box4' and @value='1']").getState)
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_radio_set
|
86
|
+
assert_raises(UnknownObjectException) { browser.radio(:xpath, "//input[@name='noName']").set }
|
87
|
+
browser.radio(:xpath, "//input[@name='box1']").set
|
88
|
+
assert(browser.radio(:xpath, "//input[@name='box1']").isSet?)
|
89
|
+
|
90
|
+
assert_raises(ObjectDisabledException, "ObjectDisabledException was supposed to be thrown" ) { browser.radio(:xpath, "//input[@name='box2']").set }
|
91
|
+
|
92
|
+
browser.radio(:xpath, "//input[@name='box3']").set
|
93
|
+
assert(browser.radio(:xpath, "//input[@name='box3']").isSet?)
|
94
|
+
|
95
|
+
# radioes that have the same name but different values
|
96
|
+
browser.radio(:xpath, "//input[@name='box4' and @value='3']").set
|
97
|
+
assert(browser.radio(:xpath, "//input[@name='box4' and @value='3']").isSet?)
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
|
data/unittests/redirect_test.rb
CHANGED
@@ -1,41 +1,41 @@
|
|
1
|
-
# feature tests for Javascript redirect
|
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_Redirect < Test::Unit::TestCase
|
8
|
-
|
9
|
-
def setup
|
10
|
-
goto_page("redirect.html")
|
11
|
-
end
|
12
|
-
|
13
|
-
def goto_multiple_redirect
|
14
|
-
goto_page("redirect1.html")
|
15
|
-
end
|
16
|
-
|
17
|
-
tag_method :test_single_redirect, :fails_on_ie
|
18
|
-
def test_single_redirect
|
19
|
-
assert_raises(UnknownObjectException) {browser.div(:id , "div77").click }
|
20
|
-
assert_raises(UnknownObjectException) {browser.div(:title , "div77").click }
|
21
|
-
|
22
|
-
assert(browser.text_field(:name, "text1").verify_contains("0") )
|
23
|
-
browser.div(:id , "div3").click
|
24
|
-
assert(browser.text_field(:name, "text1").verify_contains("1") )
|
25
|
-
browser.div(:id , "div4").click
|
26
|
-
assert(browser.text_field(:name, "text1").verify_contains("0") )
|
27
|
-
end
|
28
|
-
|
29
|
-
tag_method :test_multiple_redirect, :fails_on_ie
|
30
|
-
def test_multiple_redirect
|
31
|
-
goto_multiple_redirect()
|
32
|
-
assert_raises(UnknownObjectException) {browser.div(:id , "div77").click }
|
33
|
-
assert_raises(UnknownObjectException) {browser.div(:title , "div77").click }
|
34
|
-
|
35
|
-
assert(browser.text_field(:name, "text1").verify_contains("0") )
|
36
|
-
browser.div(:id , "div3").click
|
37
|
-
assert(browser.text_field(:name, "text1").verify_contains("1") )
|
38
|
-
browser.div(:id , "div4").click
|
39
|
-
assert(browser.text_field(:name, "text1").verify_contains("0") )
|
40
|
-
end
|
41
|
-
end
|
1
|
+
# feature tests for Javascript redirect
|
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_Redirect < Test::Unit::TestCase
|
8
|
+
|
9
|
+
def setup
|
10
|
+
goto_page("redirect.html")
|
11
|
+
end
|
12
|
+
|
13
|
+
def goto_multiple_redirect
|
14
|
+
goto_page("redirect1.html")
|
15
|
+
end
|
16
|
+
|
17
|
+
tag_method :test_single_redirect, :fails_on_ie
|
18
|
+
def test_single_redirect
|
19
|
+
assert_raises(UnknownObjectException) {browser.div(:id , "div77").click }
|
20
|
+
assert_raises(UnknownObjectException) {browser.div(:title , "div77").click }
|
21
|
+
|
22
|
+
assert(browser.text_field(:name, "text1").verify_contains("0") )
|
23
|
+
browser.div(:id , "div3").click
|
24
|
+
assert(browser.text_field(:name, "text1").verify_contains("1") )
|
25
|
+
browser.div(:id , "div4").click
|
26
|
+
assert(browser.text_field(:name, "text1").verify_contains("0") )
|
27
|
+
end
|
28
|
+
|
29
|
+
tag_method :test_multiple_redirect, :fails_on_ie
|
30
|
+
def test_multiple_redirect
|
31
|
+
goto_multiple_redirect()
|
32
|
+
assert_raises(UnknownObjectException) {browser.div(:id , "div77").click }
|
33
|
+
assert_raises(UnknownObjectException) {browser.div(:title , "div77").click }
|
34
|
+
|
35
|
+
assert(browser.text_field(:name, "text1").verify_contains("0") )
|
36
|
+
browser.div(:id , "div3").click
|
37
|
+
assert(browser.text_field(:name, "text1").verify_contains("1") )
|
38
|
+
browser.div(:id , "div4").click
|
39
|
+
assert(browser.text_field(:name, "text1").verify_contains("0") )
|
40
|
+
end
|
41
|
+
end
|
data/unittests/selectbox_test.rb
CHANGED
@@ -1,142 +1,142 @@
|
|
1
|
-
# feature tests for Select 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_SelectList < Test::Unit::TestCase
|
8
|
-
|
9
|
-
|
10
|
-
def setup()
|
11
|
-
goto_page("selectboxes1.html")
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_textBox_Exists
|
15
|
-
assert(browser.select_list(:name, "sel1").exists?)
|
16
|
-
assert_false(browser.select_list(:name, "missing").exists?)
|
17
|
-
assert_false(browser.select_list(:id, "missing").exists?)
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_select_list_enabled
|
21
|
-
assert(browser.select_list(:name, "sel1").enabled?)
|
22
|
-
assert_raises(UnknownObjectException) { browser.select_list(:name, "NoName").enabled? }
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_select_list_getAllContents
|
26
|
-
assert_raises(UnknownObjectException) { browser.select_list(:name, "NoName").getAllContents }
|
27
|
-
assert_equal( ["Option 1" ,"Option 2" , "Option 3" , "Option 4"] ,
|
28
|
-
browser.select_list(:name, "sel1").getAllContents)
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_Option_text_select
|
32
|
-
assert_raises(UnknownObjectException) { browser.select_list(:name, "sel1").option(:text, "missing item").select }
|
33
|
-
assert_raises(UnknownObjectException) { browser.select_list(:name, "sel1").option(:text, /missing/).select }
|
34
|
-
assert_raises(MissingWayOfFindingObjectException) { browser.select_list(:name, "sel1").option(:missing, "Option 1").select }
|
35
|
-
|
36
|
-
# the select method keeps any currently selected items - use the clear selection method first
|
37
|
-
browser.select_list( :name , "sel1").clearSelection
|
38
|
-
browser.select_list( :name , "sel1").option(:text, "Option 1").select
|
39
|
-
assert_equal( ["Option 1" ] , browser.select_list(:name, "sel1").getSelectedItems)
|
40
|
-
end
|
41
|
-
|
42
|
-
|
43
|
-
tag_method :test_option_class_name, :fails_on_ie
|
44
|
-
def test_option_class_name
|
45
|
-
|
46
|
-
# the option object doesnt inherit from element, so this doesnt work
|
47
|
-
assert_raises(UnknownObjectException) { browser.select_list(:name, "sel1").option(:text, "missing item").class_name }
|
48
|
-
assert_equal("option_style" , browser.select_list(:name, "sel2").option(:value , 'o2').class_name)
|
49
|
-
assert_equal("" , browser.select_list(:name, "sel2").option(:value , 'o1').class_name)
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_selectBox_select_using_value
|
54
|
-
assert_raises(UnknownObjectException) { browser.select_list(:name, "NoName").getSelectedItems }
|
55
|
-
assert_raises(NoValueFoundException) { browser.select_list(:name, "sel1").select_value("missing item") }
|
56
|
-
assert_raises(NoValueFoundException) { browser.select_list(:name, "sel1").select_value(/missing/) }
|
57
|
-
|
58
|
-
# the select method keeps any currently selected items - use the clear selectcion method first
|
59
|
-
browser.select_list( :name , "sel1").clearSelection
|
60
|
-
browser.select_list( :name , "sel1").select_value("o1")
|
61
|
-
assert_equal( ["Option 1" ] , browser.select_list(:name, "sel1").getSelectedItems)
|
62
|
-
|
63
|
-
browser.select_list( :name , "sel1").clearSelection
|
64
|
-
browser.select_list( :name , "sel1").select_value(/2/)
|
65
|
-
assert_equal( ["Option 2" ] , browser.select_list(:name, "sel1").getSelectedItems)
|
66
|
-
|
67
|
-
browser.select_list( :name , "sel2").clearSelection
|
68
|
-
browser.select_list( :name , "sel2").select_value(/4/)
|
69
|
-
browser.select_list( :name , "sel2").select_value(/2/)
|
70
|
-
assert_equal( ["Option 2" , "Option 4" ] ,
|
71
|
-
browser.select_list(:name, "sel2").getSelectedItems)
|
72
|
-
|
73
|
-
# these are to test the onchange event
|
74
|
-
# the event shouldnt get fired, as this is the selected item
|
75
|
-
browser.select_list( :name , "sel3").select_value( /3/ )
|
76
|
-
assert_false(browser.text.include?("Pass") )
|
77
|
-
end
|
78
|
-
|
79
|
-
def test_select_list_select_using_value2
|
80
|
-
# the event should get fired
|
81
|
-
browser.select_list( :name , "sel3").select_value( /2/ )
|
82
|
-
assert(browser.text.include?("PASS") )
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_select_list_properties
|
86
|
-
assert_raises(UnknownObjectException) { browser.select_list(:index, 199).value }
|
87
|
-
assert_raises(UnknownObjectException) { browser.select_list(:index, 199).name }
|
88
|
-
assert_raises(UnknownObjectException) { browser.select_list(:index, 199).id }
|
89
|
-
assert_raises(UnknownObjectException) { browser.select_list(:index, 199).disabled }
|
90
|
-
assert_raises(UnknownObjectException) { browser.select_list(:index, 199).type }
|
91
|
-
|
92
|
-
assert_equal("o3" , browser.select_list(:index, 1).value)
|
93
|
-
assert_equal("sel1" , browser.select_list(:index, 1).name )
|
94
|
-
assert_equal("" , browser.select_list(:index, 1).id )
|
95
|
-
assert_equal("select-one", browser.select_list(:index, 1).type )
|
96
|
-
assert_equal("select-multiple", browser.select_list(:index, 2).type )
|
97
|
-
|
98
|
-
browser.select_list(:index,1).select(/1/)
|
99
|
-
assert_equal("o1" , browser.select_list(:index, 1).value)
|
100
|
-
|
101
|
-
assert_false( browser.select_list(:index, 1).disabled )
|
102
|
-
assert( browser.select_list(:index, 4).disabled )
|
103
|
-
assert( browser.select_list(:id, 'selectbox_4').disabled )
|
104
|
-
end
|
105
|
-
|
106
|
-
def test_select_list_iterator
|
107
|
-
assert_equal(5, browser.select_lists.length)
|
108
|
-
assert_equal("o3" , browser.select_lists[1].value)
|
109
|
-
assert_equal("sel1" , browser.select_lists[1].name )
|
110
|
-
assert_equal("select-one", browser.select_lists[1].type )
|
111
|
-
assert_equal("select-multiple" , browser.select_lists[2].type )
|
112
|
-
|
113
|
-
index=1
|
114
|
-
browser.select_lists.each do |l|
|
115
|
-
assert_equal( browser.select_list(:index, index).name , l.name )
|
116
|
-
assert_equal( browser.select_list(:index, index).id , l.id )
|
117
|
-
assert_equal( browser.select_list(:index, index).type , l.type )
|
118
|
-
assert_equal( browser.select_list(:index, index).value , l.value )
|
119
|
-
index+=1
|
120
|
-
end
|
121
|
-
assert_equal( index-1, browser.select_lists.length)
|
122
|
-
# Bug Fix 25
|
123
|
-
browser.select_lists.each { |list| puts list.getAllContents() }
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
class TC_Select_Options < Test::Unit::TestCase
|
128
|
-
tags :fails_on_ie
|
129
|
-
|
130
|
-
def setup()
|
131
|
-
goto_page("select_tealeaf.html")
|
132
|
-
end
|
133
|
-
|
134
|
-
def test_options_text
|
135
|
-
browser.select_list(:name, 'op_numhits').option(:text, '>=').select
|
136
|
-
assert(browser.select_list(:name, 'op_numhits').option(:text, '>=').selected)
|
137
|
-
assert_equal( [">=" ] , browser.select_list(:name, "op_numhits").getSelectedItems)
|
138
|
-
assert_equal( "=" , browser.select_list(:name, "op_numhits")[1].text)
|
139
|
-
assert_equal( "0" , browser.select_list(:name, "op_numhits")[1].value)
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
1
|
+
# feature tests for Select 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_SelectList < Test::Unit::TestCase
|
8
|
+
|
9
|
+
|
10
|
+
def setup()
|
11
|
+
goto_page("selectboxes1.html")
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_textBox_Exists
|
15
|
+
assert(browser.select_list(:name, "sel1").exists?)
|
16
|
+
assert_false(browser.select_list(:name, "missing").exists?)
|
17
|
+
assert_false(browser.select_list(:id, "missing").exists?)
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_select_list_enabled
|
21
|
+
assert(browser.select_list(:name, "sel1").enabled?)
|
22
|
+
assert_raises(UnknownObjectException) { browser.select_list(:name, "NoName").enabled? }
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_select_list_getAllContents
|
26
|
+
assert_raises(UnknownObjectException) { browser.select_list(:name, "NoName").getAllContents }
|
27
|
+
assert_equal( ["Option 1" ,"Option 2" , "Option 3" , "Option 4"] ,
|
28
|
+
browser.select_list(:name, "sel1").getAllContents)
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_Option_text_select
|
32
|
+
assert_raises(UnknownObjectException) { browser.select_list(:name, "sel1").option(:text, "missing item").select }
|
33
|
+
assert_raises(UnknownObjectException) { browser.select_list(:name, "sel1").option(:text, /missing/).select }
|
34
|
+
assert_raises(MissingWayOfFindingObjectException) { browser.select_list(:name, "sel1").option(:missing, "Option 1").select }
|
35
|
+
|
36
|
+
# the select method keeps any currently selected items - use the clear selection method first
|
37
|
+
browser.select_list( :name , "sel1").clearSelection
|
38
|
+
browser.select_list( :name , "sel1").option(:text, "Option 1").select
|
39
|
+
assert_equal( ["Option 1" ] , browser.select_list(:name, "sel1").getSelectedItems)
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
tag_method :test_option_class_name, :fails_on_ie
|
44
|
+
def test_option_class_name
|
45
|
+
|
46
|
+
# the option object doesnt inherit from element, so this doesnt work
|
47
|
+
assert_raises(UnknownObjectException) { browser.select_list(:name, "sel1").option(:text, "missing item").class_name }
|
48
|
+
assert_equal("option_style" , browser.select_list(:name, "sel2").option(:value , 'o2').class_name)
|
49
|
+
assert_equal("" , browser.select_list(:name, "sel2").option(:value , 'o1').class_name)
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_selectBox_select_using_value
|
54
|
+
assert_raises(UnknownObjectException) { browser.select_list(:name, "NoName").getSelectedItems }
|
55
|
+
assert_raises(NoValueFoundException) { browser.select_list(:name, "sel1").select_value("missing item") }
|
56
|
+
assert_raises(NoValueFoundException) { browser.select_list(:name, "sel1").select_value(/missing/) }
|
57
|
+
|
58
|
+
# the select method keeps any currently selected items - use the clear selectcion method first
|
59
|
+
browser.select_list( :name , "sel1").clearSelection
|
60
|
+
browser.select_list( :name , "sel1").select_value("o1")
|
61
|
+
assert_equal( ["Option 1" ] , browser.select_list(:name, "sel1").getSelectedItems)
|
62
|
+
|
63
|
+
browser.select_list( :name , "sel1").clearSelection
|
64
|
+
browser.select_list( :name , "sel1").select_value(/2/)
|
65
|
+
assert_equal( ["Option 2" ] , browser.select_list(:name, "sel1").getSelectedItems)
|
66
|
+
|
67
|
+
browser.select_list( :name , "sel2").clearSelection
|
68
|
+
browser.select_list( :name , "sel2").select_value(/4/)
|
69
|
+
browser.select_list( :name , "sel2").select_value(/2/)
|
70
|
+
assert_equal( ["Option 2" , "Option 4" ] ,
|
71
|
+
browser.select_list(:name, "sel2").getSelectedItems)
|
72
|
+
|
73
|
+
# these are to test the onchange event
|
74
|
+
# the event shouldnt get fired, as this is the selected item
|
75
|
+
browser.select_list( :name , "sel3").select_value( /3/ )
|
76
|
+
assert_false(browser.text.include?("Pass") )
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_select_list_select_using_value2
|
80
|
+
# the event should get fired
|
81
|
+
browser.select_list( :name , "sel3").select_value( /2/ )
|
82
|
+
assert(browser.text.include?("PASS") )
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_select_list_properties
|
86
|
+
assert_raises(UnknownObjectException) { browser.select_list(:index, 199).value }
|
87
|
+
assert_raises(UnknownObjectException) { browser.select_list(:index, 199).name }
|
88
|
+
assert_raises(UnknownObjectException) { browser.select_list(:index, 199).id }
|
89
|
+
assert_raises(UnknownObjectException) { browser.select_list(:index, 199).disabled }
|
90
|
+
assert_raises(UnknownObjectException) { browser.select_list(:index, 199).type }
|
91
|
+
|
92
|
+
assert_equal("o3" , browser.select_list(:index, 1).value)
|
93
|
+
assert_equal("sel1" , browser.select_list(:index, 1).name )
|
94
|
+
assert_equal("" , browser.select_list(:index, 1).id )
|
95
|
+
assert_equal("select-one", browser.select_list(:index, 1).type )
|
96
|
+
assert_equal("select-multiple", browser.select_list(:index, 2).type )
|
97
|
+
|
98
|
+
browser.select_list(:index,1).select(/1/)
|
99
|
+
assert_equal("o1" , browser.select_list(:index, 1).value)
|
100
|
+
|
101
|
+
assert_false( browser.select_list(:index, 1).disabled )
|
102
|
+
assert( browser.select_list(:index, 4).disabled )
|
103
|
+
assert( browser.select_list(:id, 'selectbox_4').disabled )
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_select_list_iterator
|
107
|
+
assert_equal(5, browser.select_lists.length)
|
108
|
+
assert_equal("o3" , browser.select_lists[1].value)
|
109
|
+
assert_equal("sel1" , browser.select_lists[1].name )
|
110
|
+
assert_equal("select-one", browser.select_lists[1].type )
|
111
|
+
assert_equal("select-multiple" , browser.select_lists[2].type )
|
112
|
+
|
113
|
+
index=1
|
114
|
+
browser.select_lists.each do |l|
|
115
|
+
assert_equal( browser.select_list(:index, index).name , l.name )
|
116
|
+
assert_equal( browser.select_list(:index, index).id , l.id )
|
117
|
+
assert_equal( browser.select_list(:index, index).type , l.type )
|
118
|
+
assert_equal( browser.select_list(:index, index).value , l.value )
|
119
|
+
index+=1
|
120
|
+
end
|
121
|
+
assert_equal( index-1, browser.select_lists.length)
|
122
|
+
# Bug Fix 25
|
123
|
+
browser.select_lists.each { |list| puts list.getAllContents() }
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
class TC_Select_Options < Test::Unit::TestCase
|
128
|
+
tags :fails_on_ie
|
129
|
+
|
130
|
+
def setup()
|
131
|
+
goto_page("select_tealeaf.html")
|
132
|
+
end
|
133
|
+
|
134
|
+
def test_options_text
|
135
|
+
browser.select_list(:name, 'op_numhits').option(:text, '>=').select
|
136
|
+
assert(browser.select_list(:name, 'op_numhits').option(:text, '>=').selected)
|
137
|
+
assert_equal( [">=" ] , browser.select_list(:name, "op_numhits").getSelectedItems)
|
138
|
+
assert_equal( "=" , browser.select_list(:name, "op_numhits")[1].text)
|
139
|
+
assert_equal( "0" , browser.select_list(:name, "op_numhits")[1].value)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|