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
@@ -1,7 +1,7 @@
|
|
1
1
|
# feature tests for Radio Buttons
|
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_Radios_XPath < Test::Unit::TestCase
|
@@ -12,89 +12,89 @@ class TC_Radios_XPath < Test::Unit::TestCase
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_Radio_Exists
|
15
|
-
assert(
|
16
|
-
assert(
|
15
|
+
assert(browser.radio(:xpath, "//input[@name='box1']/").exists?)
|
16
|
+
assert(browser.radio(:xpath, "//input[@id='box5']/").exists?)
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
assert_false(browser.radio(:xpath, "//input[@name='missingname']/").exists?)
|
19
|
+
assert_false(browser.radio(:xpath, "//input[@id='missingid']/").exists?)
|
20
20
|
end
|
21
21
|
|
22
22
|
def test_Radio_Enabled
|
23
|
-
assert_raises(UnknownObjectException
|
24
|
-
assert_raises(UnknownObjectException
|
25
|
-
assert_raises(UnknownObjectException
|
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
26
|
|
27
|
-
|
28
|
-
assert(
|
29
|
-
assert(
|
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
30
|
end
|
31
31
|
|
32
32
|
def test_little
|
33
|
-
|
33
|
+
assert_false(browser.button(:xpath,"//input[@name='foo']/").enabled?)
|
34
34
|
end
|
35
35
|
|
36
36
|
def test_onClick
|
37
|
-
|
38
|
-
|
39
|
-
assert(
|
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
40
|
|
41
|
-
|
42
|
-
|
41
|
+
browser.radio(:xpath, "//input[@name='box5' and @value='2']/").set
|
42
|
+
assert_false(browser.button(:xpath,"//input[@name='foo']/").enabled?)
|
43
43
|
end
|
44
44
|
|
45
45
|
def test_Radio_isSet
|
46
|
-
assert_raises(UnknownObjectException
|
46
|
+
assert_raises(UnknownObjectException) { browser.radio(:xpath, "//input[@name='noName']/").isSet? }
|
47
47
|
|
48
|
-
puts "radio 1 is set : #{
|
49
|
-
|
48
|
+
puts "radio 1 is set : #{ browser.radio(:xpath, "//input[@name='box1']/").isSet? } "
|
49
|
+
assert_false(browser.radio(:xpath, "//input[@name='box1']/").isSet?)
|
50
50
|
|
51
|
-
assert(
|
52
|
-
|
51
|
+
assert(browser.radio(:xpath, "//input[@name='box3']/").isSet?)
|
52
|
+
assert_false(browser.radio(:xpath, "//input[@name='box2']/").isSet?)
|
53
53
|
|
54
|
-
assert(
|
55
|
-
|
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
56
|
end
|
57
57
|
|
58
58
|
def test_radio_clear
|
59
|
-
assert_raises(UnknownObjectException
|
59
|
+
assert_raises(UnknownObjectException) { browser.radio(:xpath, "//input[@name='noName']/").clear }
|
60
60
|
|
61
|
-
|
62
|
-
|
61
|
+
browser.radio(:xpath, "//input[@name='box1']/").clear
|
62
|
+
assert_false(browser.radio(:xpath, "//input[@name='box1']/").isSet?)
|
63
63
|
|
64
|
-
assert_raises(ObjectDisabledException, "ObjectDisabledException was supposed to be thrown" ) {
|
65
|
-
|
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
66
|
|
67
|
-
|
68
|
-
|
67
|
+
browser.radio(:xpath, "//input[@name='box3']/").clear
|
68
|
+
assert_false(browser.radio(:xpath, "//input[@name='box3']/").isSet?)
|
69
69
|
|
70
|
-
|
71
|
-
|
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
72
|
end
|
73
73
|
|
74
74
|
def test_radio_getState
|
75
|
-
assert_raises(UnknownObjectException
|
75
|
+
assert_raises(UnknownObjectException) { browser.radio(:xpath, "//input[@name='noName']/").getState }
|
76
76
|
|
77
|
-
assert_equal( false ,
|
78
|
-
assert_equal( true ,
|
77
|
+
assert_equal( false , browser.radio(:xpath, "//input[@name='box1']/").getState )
|
78
|
+
assert_equal( true , browser.radio(:xpath, "//input[@name='box3']/").getState)
|
79
79
|
|
80
80
|
# radioes that have the same name but different values
|
81
|
-
assert_equal( false ,
|
82
|
-
assert_equal( true ,
|
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
83
|
end
|
84
84
|
|
85
85
|
def test_radio_set
|
86
|
-
assert_raises(UnknownObjectException
|
87
|
-
|
88
|
-
assert(
|
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
89
|
|
90
|
-
assert_raises(ObjectDisabledException, "ObjectDisabledException was supposed to be thrown" ) {
|
90
|
+
assert_raises(ObjectDisabledException, "ObjectDisabledException was supposed to be thrown" ) { browser.radio(:xpath, "//input[@name='box2']/").set }
|
91
91
|
|
92
|
-
|
93
|
-
assert(
|
92
|
+
browser.radio(:xpath, "//input[@name='box3']/").set
|
93
|
+
assert(browser.radio(:xpath, "//input[@name='box3']/").isSet?)
|
94
94
|
|
95
95
|
# radioes that have the same name but different values
|
96
|
-
|
97
|
-
assert(
|
96
|
+
browser.radio(:xpath, "//input[@name='box4' and @value='3']/").set
|
97
|
+
assert(browser.radio(:xpath, "//input[@name='box4' and @value='3']/").isSet?)
|
98
98
|
end
|
99
99
|
|
100
100
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# The purpose of this test is to verify that IE has been manually
|
2
|
+
# configured to allow active content from local files.
|
3
|
+
# This setting is not really required for normal use of Watir, but
|
4
|
+
# it is essential for many of our unit tests.
|
5
|
+
|
6
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
7
|
+
require 'unittests/setup'
|
8
|
+
|
9
|
+
class TC_AAA_Security_Settings < Test::Unit::TestCase
|
10
|
+
def setup
|
11
|
+
uses_page "div.html"
|
12
|
+
end
|
13
|
+
|
14
|
+
@@security_instructions = "\
|
15
|
+
You must change your IE security settings to run these tests.
|
16
|
+
Tools -> Internet Options -> Advanced -> Security ->
|
17
|
+
'Allow active content to run in files on My Computer'"
|
18
|
+
|
19
|
+
def test_active_content
|
20
|
+
browser.span(:id, "span3").click
|
21
|
+
value = browser.text_field(:name, "text2").value
|
22
|
+
fail(@@security_instructions) if value == '0'
|
23
|
+
end
|
24
|
+
end
|
data/unittests/selectbox_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# feature tests for Select Boxes
|
2
|
-
# revision: $Revision:
|
2
|
+
# revision: $Revision: 1531 $
|
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_SelectList < Test::Unit::TestCase
|
@@ -12,208 +12,116 @@ class TC_SelectList < Test::Unit::TestCase
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_SelectList_exists
|
15
|
-
assert(
|
16
|
-
|
17
|
-
|
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
18
|
end
|
19
19
|
|
20
20
|
def test_SelectList_enabled
|
21
|
-
assert(
|
22
|
-
assert_raises(UnknownObjectException) {
|
23
|
-
|
21
|
+
assert(browser.select_list(:name, "sel1").enabled?)
|
22
|
+
assert_raises(UnknownObjectException) { browser.select_list(:name, "NoName").enabled? }
|
23
|
+
assert_false(browser.select_list(:id, 'selectbox_4').enabled?)
|
24
24
|
end
|
25
25
|
|
26
26
|
def test_SelectList_class_name
|
27
|
-
assert_raises(UnknownObjectException) {
|
28
|
-
assert_equal("list_style" ,
|
29
|
-
assert_equal("" ,
|
27
|
+
assert_raises(UnknownObjectException) { browser.select_list(:name, "missing").class_name }
|
28
|
+
assert_equal("list_style" , browser.select_list(:name, "sel1").class_name)
|
29
|
+
assert_equal("" , browser.select_list(:name, "sel2").class_name )
|
30
30
|
end
|
31
31
|
|
32
32
|
def test_Option_text_select
|
33
|
-
assert_raises(UnknownObjectException) {
|
34
|
-
assert_raises(UnknownObjectException) {
|
35
|
-
assert_raises(MissingWayOfFindingObjectException) {
|
33
|
+
assert_raises(UnknownObjectException) { browser.select_list(:name, "sel1").option(:text, "missing item").select }
|
34
|
+
assert_raises(UnknownObjectException) { browser.select_list(:name, "sel1").option(:text, /missing/).select }
|
35
|
+
assert_raises(MissingWayOfFindingObjectException) { browser.select_list(:name, "sel1").option(:missing, "Option 1").select }
|
36
36
|
|
37
37
|
# the select method keeps any currently selected items - use the clear selection method first
|
38
|
-
|
39
|
-
|
40
|
-
assert_equal( ["Option 1" ] ,
|
38
|
+
browser.select_list( :name , "sel1").clearSelection
|
39
|
+
browser.select_list( :name , "sel1").option(:text, "Option 1").select
|
40
|
+
assert_equal( ["Option 1" ] , browser.select_list(:name, "sel1").getSelectedItems)
|
41
41
|
end
|
42
42
|
|
43
43
|
def xtest_option_class_name
|
44
44
|
# the option object doesnt inherit from element, so this doesnt work
|
45
|
-
assert_raises(UnknownObjectException) {
|
46
|
-
assert_equal("list_style" ,
|
47
|
-
assert_equal("" ,
|
45
|
+
assert_raises(UnknownObjectException) { browser.select_list(:name, "sel1").option(:text, "missing item").class_name }
|
46
|
+
assert_equal("list_style" , browser.select_list(:name, "sel2").option(:value , 'o2').class_name)
|
47
|
+
assert_equal("" , browser.select_list(:name, "sel2").option(:value , 'o1').class_name)
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
|
+
tag_method :test_includes, :fails_on_firefox
|
50
51
|
def test_includes
|
51
|
-
assert
|
52
|
-
assert
|
52
|
+
assert browser.select_list(:name, 'sel1').includes?('Option 1')
|
53
|
+
assert browser.select_list(:name, 'sel1').includes?(/option/i)
|
54
|
+
assert ! browser.select_list(:name, 'sel1').includes?('Option 6')
|
55
|
+
assert ! browser.select_list(:name, 'sel1').includes?(/foobar/)
|
53
56
|
end
|
54
57
|
|
58
|
+
tag_method :test_selected, :fails_on_firefox
|
55
59
|
def test_selected
|
56
|
-
assert
|
57
|
-
assert
|
60
|
+
assert browser.select_list(:name, 'sel1').selected?('Option 3')
|
61
|
+
assert browser.select_list(:name, 'sel1').selected?(/option/i)
|
62
|
+
assert ! browser.select_list(:name, 'sel1').selected?('Option 1')
|
63
|
+
assert ! browser.select_list(:name, 'sel1').selected?(/option 1/i)
|
58
64
|
end
|
59
65
|
|
66
|
+
tag_method :test_selected_not_found, :fails_on_firefox
|
60
67
|
def test_selected_not_found
|
61
|
-
selectbox =
|
62
|
-
assert_raises(Watir::Exception::UnknownObjectException) {selectbox.selected?('
|
68
|
+
selectbox = browser.select_list(:name, 'sel1')
|
69
|
+
assert_raises(Watir::Exception::UnknownObjectException) {selectbox.selected?("option doesn't exist")}
|
70
|
+
assert_raises(Watir::Exception::UnknownObjectException) {selectbox.selected?(/option doesn't exist/)}
|
63
71
|
end
|
64
72
|
|
65
73
|
end
|
66
74
|
|
67
|
-
# Tests for the old interface
|
68
75
|
class TC_Selectbox < Test::Unit::TestCase
|
69
76
|
include Watir::Exception
|
70
77
|
|
71
78
|
def setup
|
72
79
|
goto_page "selectboxes1.html"
|
73
80
|
end
|
74
|
-
|
75
|
-
def test_selectBox_Exists
|
76
|
-
assert($ie.selectBox(:name, "sel1").exists?)
|
77
|
-
assert(!$ie.selectBox(:name, "missing").exists?)
|
78
|
-
assert(!$ie.selectBox(:id, "missing").exists?)
|
79
|
-
end
|
80
|
-
|
81
|
-
def test_selectBox_enabled
|
82
|
-
assert($ie.selectBox(:name, "sel1").enabled?)
|
83
|
-
assert_raises(UnknownObjectException) { $ie.selectBox(:name, "NoName").enabled? }
|
84
|
-
end
|
85
|
-
|
86
|
-
def test_SelectList_class_name
|
87
|
-
assert_raises(UnknownObjectException) { $ie.select_list(:name, "missing").class_name }
|
88
|
-
assert_equal("list_style" , $ie.select_list(:name, "sel1").class_name)
|
89
|
-
assert_equal("" , $ie.selectBox(:name, "sel2").class_name )
|
90
|
-
end
|
91
|
-
|
92
|
-
def test_selectBox_getAllContents
|
93
|
-
assert_raises(UnknownObjectException) { $ie.selectBox(:name, "NoName").getAllContents }
|
94
|
-
assert_equal( ["Option 1" ,"Option 2" , "Option 3" , "Option 4"] ,
|
95
|
-
$ie.selectBox(:name, "sel1").getAllContents)
|
96
|
-
end
|
97
|
-
|
98
|
-
def test_selectBox_getSelectedItems
|
99
|
-
assert_raises(UnknownObjectException) { $ie.selectBox(:name, "NoName").getSelectedItems }
|
100
|
-
assert_equal( ["Option 3" ] ,
|
101
|
-
$ie.selectBox(:name, "sel1").getSelectedItems)
|
102
|
-
assert_equal( ["Option 3" , "Option 6" ] ,
|
103
|
-
$ie.selectBox(:name, "sel2").getSelectedItems)
|
104
|
-
end
|
105
|
-
|
106
|
-
def test_clearSelection
|
107
|
-
assert_raises(UnknownObjectException) { $ie.selectBox(:name, "NoName").clearSelection }
|
108
|
-
$ie.selectBox( :name , "sel1").clearSelection
|
109
|
-
|
110
|
-
# the box sel1 has no ability to have a de-selected item
|
111
|
-
assert_equal( ["Option 3" ] , $ie.selectBox(:name, "sel1").getSelectedItems)
|
112
|
-
|
113
|
-
$ie.selectBox( :name , "sel2").clearSelection
|
114
|
-
assert_equal( [ ] , $ie.selectBox(:name, "sel2").getSelectedItems)
|
115
|
-
end
|
116
|
-
|
117
|
-
def test_selectBox_select
|
118
|
-
assert_raises(NoValueFoundException) { $ie.selectBox(:name, "sel1").select("missing item") }
|
119
|
-
assert_raises(NoValueFoundException) { $ie.selectBox(:name, "sel1").select(/missing/) }
|
120
|
-
|
121
|
-
# the select method keeps any currently selected items - use the clear selectcion method first
|
122
|
-
$ie.selectBox( :name , "sel1").clearSelection
|
123
|
-
$ie.selectBox( :name , "sel1").select("Option 1")
|
124
|
-
assert_equal( ["Option 1" ] , $ie.selectBox(:name, "sel1").getSelectedItems)
|
125
|
-
|
126
|
-
$ie.selectBox( :name , "sel1").clearSelection
|
127
|
-
$ie.selectBox( :name , "sel1").select(/2/)
|
128
|
-
assert_equal( ["Option 2" ] , $ie.selectBox(:name, "sel1").getSelectedItems)
|
129
|
-
|
130
|
-
$ie.selectBox( :name , "sel2").clearSelection
|
131
|
-
$ie.selectBox( :name , "sel2").select(/2/)
|
132
|
-
$ie.selectBox( :name , "sel2").select(/4/)
|
133
|
-
assert_equal( ["Option 2" , "Option 4" ] ,
|
134
|
-
$ie.selectBox(:name, "sel2").getSelectedItems)
|
135
|
-
|
136
|
-
# these are to test the onchange event
|
137
|
-
# the event shouldnt get fired, as this is the selected item
|
138
|
-
$ie.selectBox( :name , "sel3").select( /3/ )
|
139
|
-
assert(!$ie.text.include?("Pass") )
|
140
|
-
end
|
141
|
-
|
142
|
-
def test_selectBox_select2
|
143
|
-
# the event should get fired
|
144
|
-
$ie.selectBox( :name , "sel3").select( /2/ )
|
145
|
-
assert($ie.text.include?("PASS") )
|
146
|
-
end
|
147
|
-
|
148
|
-
def test_selectBox_select_using_value
|
149
|
-
assert_raises(UnknownObjectException) { $ie.select_list(:name, "NoName").getSelectedItems }
|
150
|
-
assert_raises(NoValueFoundException) { $ie.select_list(:name, "sel1").select_value("missing item") }
|
151
|
-
assert_raises(NoValueFoundException) { $ie.select_list(:name, "sel1").select_value(/missing/) }
|
152
|
-
|
153
|
-
# the select method keeps any currently selected items - use the clear selectcion method first
|
154
|
-
$ie.select_list( :name , "sel1").clearSelection
|
155
|
-
$ie.select_list( :name , "sel1").select_value("o1")
|
156
|
-
assert_equal( ["Option 1" ] , $ie.select_list(:name, "sel1").getSelectedItems)
|
157
81
|
|
158
|
-
$ie.select_list( :name , "sel1").clearSelection
|
159
|
-
$ie.select_list( :name , "sel1").select_value(/2/)
|
160
|
-
assert_equal( ["Option 2" ] , $ie.select_list(:name, "sel1").getSelectedItems)
|
161
|
-
|
162
|
-
$ie.select_list( :name , "sel2").clearSelection
|
163
|
-
$ie.select_list( :name , "sel2").select_value(/4/)
|
164
|
-
$ie.select_list( :name , "sel2").select_value(/2/)
|
165
|
-
assert_equal( ["Option 2" , "Option 4" ] ,
|
166
|
-
$ie.select_list(:name, "sel2").getSelectedItems)
|
167
|
-
|
168
|
-
# these are to test the onchange event
|
169
|
-
# the event shouldnt get fired, as this is the selected item
|
170
|
-
$ie.select_list( :name , "sel3").select_value( /3/ )
|
171
|
-
assert(!$ie.text.include?("Pass") )
|
172
|
-
end
|
173
|
-
|
174
82
|
def test_select_list_select_using_value2
|
175
83
|
# the event should get fired
|
176
|
-
|
177
|
-
assert(
|
84
|
+
browser.select_list( :name , "sel3").select_value( /2/ )
|
85
|
+
assert(browser.text.include?("PASS") )
|
178
86
|
end
|
179
87
|
|
180
88
|
def test_select_list_properties
|
181
|
-
assert_raises(UnknownObjectException) {
|
182
|
-
assert_raises(UnknownObjectException) {
|
183
|
-
assert_raises(UnknownObjectException) {
|
184
|
-
assert_raises(UnknownObjectException) {
|
185
|
-
assert_raises(UnknownObjectException) {
|
89
|
+
assert_raises(UnknownObjectException) { browser.select_list(:index, 199).value }
|
90
|
+
assert_raises(UnknownObjectException) { browser.select_list(:index, 199).name }
|
91
|
+
assert_raises(UnknownObjectException) { browser.select_list(:index, 199).id }
|
92
|
+
assert_raises(UnknownObjectException) { browser.select_list(:index, 199).disabled }
|
93
|
+
assert_raises(UnknownObjectException) { browser.select_list(:index, 199).type }
|
186
94
|
|
187
|
-
assert_equal("o3" ,
|
188
|
-
assert_equal("sel1" ,
|
189
|
-
assert_equal("" ,
|
190
|
-
assert_equal("select-one",
|
191
|
-
assert_equal("select-multiple",
|
95
|
+
assert_equal("o3" , browser.select_list(:index, 1).value)
|
96
|
+
assert_equal("sel1" , browser.select_list(:index, 1).name )
|
97
|
+
assert_equal("" , browser.select_list(:index, 1).id )
|
98
|
+
assert_equal("select-one", browser.select_list(:index, 1).type )
|
99
|
+
assert_equal("select-multiple", browser.select_list(:index, 2).type )
|
192
100
|
|
193
|
-
|
194
|
-
assert_equal("o1" ,
|
101
|
+
browser.select_list(:index,1).select(/1/)
|
102
|
+
assert_equal("o1" , browser.select_list(:index, 1).value)
|
195
103
|
|
196
|
-
|
197
|
-
assert(
|
198
|
-
assert(
|
104
|
+
assert_false( browser.select_list(:index, 1).disabled )
|
105
|
+
assert( browser.select_list(:index, 4).disabled )
|
106
|
+
assert( browser.select_list(:id, 'selectbox_4').disabled )
|
199
107
|
end
|
200
108
|
|
201
109
|
def test_select_list_iterator
|
202
|
-
assert_equal(4,
|
203
|
-
assert_equal("o3" ,
|
204
|
-
assert_equal("sel1" ,
|
205
|
-
assert_equal("select-one",
|
206
|
-
assert_equal("select-multiple" ,
|
110
|
+
assert_equal(4, browser.select_lists.length)
|
111
|
+
assert_equal("o3" , browser.select_lists[1].value)
|
112
|
+
assert_equal("sel1" , browser.select_lists[1].name )
|
113
|
+
assert_equal("select-one", browser.select_lists[1].type )
|
114
|
+
assert_equal("select-multiple" , browser.select_lists[2].type )
|
207
115
|
|
208
116
|
index=1
|
209
|
-
|
210
|
-
assert_equal(
|
211
|
-
assert_equal(
|
212
|
-
assert_equal(
|
213
|
-
assert_equal(
|
117
|
+
browser.select_lists.each do |l|
|
118
|
+
assert_equal( browser.select_list(:index, index).name , l.name )
|
119
|
+
assert_equal( browser.select_list(:index, index).id , l.id )
|
120
|
+
assert_equal( browser.select_list(:index, index).type , l.type )
|
121
|
+
assert_equal( browser.select_list(:index, index).value , l.value )
|
214
122
|
index+=1
|
215
123
|
end
|
216
|
-
assert_equal( index-1,
|
124
|
+
assert_equal( index-1, browser.select_lists.length)
|
217
125
|
end
|
218
126
|
end
|
219
127
|
|
@@ -224,8 +132,8 @@ class TC_Select_Options < Test::Unit::TestCase
|
|
224
132
|
end
|
225
133
|
|
226
134
|
def test_options_text
|
227
|
-
|
228
|
-
assert(
|
135
|
+
browser.select_list(:name, 'op_numhits').option(:text, '>=').select
|
136
|
+
assert(browser.select_list(:name, 'op_numhits').option(:text, '>=').selected)
|
229
137
|
end
|
230
138
|
end
|
231
139
|
|