watir 1.4.1 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/watir-console +1 -0
- data/changes.rb +119 -0
- data/license.rb +37 -0
- data/readme.rb +55 -120
- data/unittests/buttons_test.rb +107 -104
- data/unittests/buttons_xpath_test.rb +69 -0
- data/unittests/checkbox_test.rb +154 -141
- data/unittests/checkbox_xpath_test.rb +107 -0
- data/unittests/core_tests.rb +6 -2
- data/unittests/css_test.rb +50 -50
- data/unittests/defer_test.rb +47 -0
- data/unittests/dialog_test.rb +78 -0
- data/unittests/div2_xpath_test.rb +22 -0
- data/unittests/div_test.rb +159 -159
- data/unittests/div_xpath_test.rb +96 -0
- data/unittests/errorchecker_test.rb +22 -22
- data/unittests/filefield_test.rb +30 -23
- data/unittests/filefield_xpath_test.rb +35 -0
- data/unittests/form_test.rb +250 -229
- data/unittests/form_xpath_test.rb +253 -0
- data/unittests/frame_test.rb +123 -108
- data/unittests/google_form_test.rb +17 -0
- data/unittests/html/JavascriptClick.html +39 -0
- data/unittests/html/buttons1.html +3 -2
- data/unittests/html/checkboxes1.html +32 -14
- data/unittests/html/complex_table.html +1 -1
- data/unittests/html/depot_store.html +59 -0
- data/unittests/html/div.html +3 -21
- data/unittests/html/div_xml.html +21 -0
- data/unittests/html/fileupload.html +2 -2
- data/unittests/html/forms2.html +3 -3
- data/unittests/html/forms3.html +2 -2
- data/unittests/html/frame_links.html +2 -2
- data/unittests/html/google_india.html +119 -0
- data/unittests/html/iframeTest.html +2 -2
- data/unittests/html/images/map.GIF +0 -0
- data/unittests/html/images/map2.gif +0 -0
- data/unittests/html/images1.html +17 -2
- data/unittests/html/javascriptevents.html +3 -7
- data/unittests/html/links1.html +9 -8
- data/unittests/html/links_multi.html +14 -0
- data/unittests/html/list_matters.html +720 -0
- data/unittests/html/lists.html +18 -0
- data/unittests/html/map_test.html +31 -0
- data/unittests/html/modal_dialog.html +10 -0
- data/unittests/html/modal_dialog_launcher.html +12 -0
- data/unittests/html/new_browser.html +17 -0
- data/unittests/html/pass.html +3 -0
- data/unittests/html/popups1.html +1 -1
- data/unittests/html/pre.html +28 -0
- data/unittests/html/radioButtons1.html +6 -5
- data/unittests/html/selectboxes1.html +12 -11
- data/unittests/html/simple_table.html +1 -1
- data/unittests/html/simple_table_columns.html +1 -1
- data/unittests/html/table1.html +1 -1
- data/unittests/html/tableCell_using_xpath.html +19 -0
- data/unittests/html/textfields1.html +6 -4
- data/unittests/html/xpath_nbsp.html +12 -0
- data/unittests/ie_exists_test.rb +32 -0
- data/unittests/ie_mock.rb +78 -79
- data/unittests/ie_test.rb +39 -39
- data/unittests/images_test.rb +132 -155
- data/unittests/images_xpath_test.rb +91 -0
- data/unittests/links_multi_test.rb +36 -0
- data/unittests/links_test.rb +158 -152
- data/unittests/links_xpath_test.rb +40 -0
- data/unittests/lists_test.rb +29 -0
- data/unittests/map_test.rb +99 -0
- data/unittests/minmax_test.rb +23 -23
- data/unittests/navigate_test.rb +43 -51
- data/unittests/nbsp_xpath_test.rb +18 -0
- data/unittests/other/WindowLogonExample.rb +28 -0
- data/unittests/{WindowLogonExtra.rb → other/WindowLogonExtra.rb} +0 -0
- data/unittests/{all_tests_concurrent.rb → other/all_tests_concurrent.rb} +23 -23
- data/unittests/other/navigate_exception_test.rb +14 -0
- data/unittests/other/rexml_unit_test.rb +24 -0
- data/unittests/other/testcase_method_order_test.rb +36 -0
- data/unittests/other/testcase_verify_test.rb +25 -0
- data/unittests/other/wait_until_test.rb +99 -0
- data/unittests/pagecontainstext_test.rb +56 -37
- data/unittests/parent_child_test.rb +55 -0
- data/unittests/popups_test.rb +37 -37
- data/unittests/pre_test.rb +52 -0
- data/unittests/radios_test.rb +186 -155
- data/unittests/radios_xpath_test.rb +101 -0
- data/unittests/screen_capture_test.rb +41 -41
- data/unittests/selectbox_test.rb +223 -181
- data/unittests/selectbox_xpath_test.rb +113 -0
- data/unittests/setup.rb +29 -25
- data/unittests/speed_settings_test.rb +22 -0
- data/unittests/table_cell_using_xpath_test.rb +40 -0
- data/unittests/table_test.rb +315 -284
- data/unittests/table_xpath_test.rb +114 -0
- data/unittests/textarea_test.rb +81 -0
- data/unittests/textarea_xpath_test.rb +82 -0
- data/unittests/textfields_test.rb +205 -229
- data/unittests/textfields_xpath_test.rb +111 -0
- data/unittests/window_tests.rb +7 -0
- data/unittests/windows/attach_to_existing_window_test.rb +52 -0
- data/unittests/windows/attach_to_new_window_test.rb +82 -0
- data/unittests/windows/close_window_test.rb +22 -0
- data/unittests/windows/frame_links_test.rb +25 -0
- data/unittests/windows/ie-each_test.rb +48 -0
- data/unittests/windows/iedialog_test.rb +55 -0
- data/unittests/windows/js_events_test.rb +57 -0
- data/unittests/windows/jscriptExtraAlert.rb +6 -0
- data/unittests/windows/jscriptExtraConfirmCancel.rb +7 -0
- data/unittests/windows/jscriptExtraConfirmOk.rb +7 -0
- data/unittests/{jscriptPushButton.rb → windows/jscriptPushButton.rb} +1 -1
- data/unittests/windows/jscript_test.rb +64 -0
- data/unittests/windows/modal_dialog_test.rb +127 -0
- data/unittests/windows/new.rb +56 -0
- data/unittests/windows/open_close_test.rb +22 -0
- data/unittests/windows/send_keys_test.rb +34 -0
- data/unittests/xpath_tests.rb +10 -0
- data/watir.rb +4344 -3565
- data/watir/IEDialog/Release/IEDialog.dll +0 -0
- data/watir/WindowHelper.rb +13 -11
- data/watir/assertions.rb +36 -0
- data/watir/camel_case.rb +14 -5
- data/watir/close_all.rb +38 -0
- data/watir/contrib/enabled_popup.rb +21 -0
- data/watir/contrib/ie-new-process.rb +27 -0
- data/watir/contrib/page_checker.rb +29 -0
- data/watir/contrib/visible.rb +47 -0
- data/watir/cookiemanager.rb +4 -4
- data/watir/datahandler.rb +107 -0
- data/watir/dialog.rb +46 -0
- data/watir/elements.rb +65 -0
- data/watir/exceptions.rb +18 -36
- data/watir/ie-process.rb +40 -0
- data/watir/irb-history.rb +31 -0
- data/watir/process.rb +20 -0
- data/watir/testUnitAddons.rb +3 -42
- data/watir/testcase.rb +58 -0
- data/watir/utils.rb +20 -0
- data/watir/waiter.rb +88 -0
- data/watir/watir_simple.rb +4 -4
- data/watir/win32ole.rb +8 -0
- data/watir/win32ole/win32ole.so +0 -0
- data/watir/winClicker.rb +374 -400
- metadata +209 -128
- data/unittests/WindowLogonExample.rb +0 -30
- data/unittests/attachToExistingWindow_test.rb +0 -40
- data/unittests/js_events_test.rb +0 -77
- data/unittests/jscriptExtraAlert.rb +0 -6
- data/unittests/jscriptExtraConfirmCancel.rb +0 -7
- data/unittests/jscriptExtraConfirmOk.rb +0 -7
- data/unittests/jscript_test.rb +0 -57
- data/unittests/send_keys_test.rb +0 -29
- data/unittests/textAreafields_test.rb +0 -81
|
@@ -1,49 +1,68 @@
|
|
|
1
1
|
# feature tests for IE::contains_text
|
|
2
|
-
# revision: $Revision:
|
|
2
|
+
# revision: $Revision: 1100 $
|
|
3
3
|
|
|
4
4
|
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
|
5
5
|
require 'unittests/setup'
|
|
6
6
|
|
|
7
7
|
class TC_contains_text < Test::Unit::TestCase
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
include Watir
|
|
9
|
+
|
|
10
|
+
def setup
|
|
11
|
+
$ie.goto($htmlRoot + "textsearch.html")
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def test_text_found
|
|
15
|
+
assert($ie.contains_text('slings and arrows of outrageous fortune'))
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def test_text_not_found
|
|
19
|
+
assert(!$ie.contains_text('So are they all, all honourable men'))
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def test_regexp_found
|
|
23
|
+
assert($ie.contains_text(/bodkin.*fardels/))
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def test_regexp_not_found
|
|
27
|
+
assert(!$ie.contains_text(/winding.*watch.*wit/))
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def test_match_regexp_found
|
|
31
|
+
$~ = $ie.contains_text(/Messages ([0-9]+)/)
|
|
32
|
+
assert_equal('42', $1)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def test_bad_search_argument
|
|
36
|
+
assert_raises(ArgumentError) do
|
|
37
|
+
$ie.contains_text
|
|
20
38
|
end
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
assert($ie.contains_text(/bodkin.*fardels/))
|
|
39
|
+
assert_raises(ArgumentError) do
|
|
40
|
+
$ie.contains_text(nil)
|
|
24
41
|
end
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
assert_false($ie.contains_text(/winding.*watch.*wit/))
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def test_match_regexp_found
|
|
31
|
-
$~ = $ie.contains_text(/Messages ([0-9]+)/)
|
|
32
|
-
assert_equal('42', $1)
|
|
42
|
+
assert_raises(ArgumentError) do
|
|
43
|
+
$ie.contains_text(42)
|
|
33
44
|
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
end
|
|
34
48
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
end
|
|
46
|
-
|
|
49
|
+
class TC_contains_text_in_new_ie < Test::Unit::TestCase
|
|
50
|
+
def setup
|
|
51
|
+
@ie = Watir::IE.new
|
|
52
|
+
end
|
|
53
|
+
def test_nothing_raised
|
|
54
|
+
assert_nothing_raised {@ie.contains_text ''}
|
|
55
|
+
end
|
|
56
|
+
def teardown
|
|
57
|
+
@ie.close
|
|
58
|
+
end
|
|
47
59
|
end
|
|
48
60
|
|
|
49
|
-
|
|
61
|
+
class TC_contains_text_in_frame < Test::Unit::TestCase
|
|
62
|
+
def setup
|
|
63
|
+
$ie.goto($htmlRoot + "frame_links.html")
|
|
64
|
+
end
|
|
65
|
+
def test_in_frame
|
|
66
|
+
assert $ie.frame('linkFrame').contains_text('The button is really a link')
|
|
67
|
+
end
|
|
68
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# feature tests for relative navigation/specification
|
|
2
|
+
|
|
3
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
|
4
|
+
require 'unittests/setup'
|
|
5
|
+
|
|
6
|
+
# These tests are based on the rails depot application, which requires some
|
|
7
|
+
# modifications...
|
|
8
|
+
|
|
9
|
+
module Watir
|
|
10
|
+
class H3 < NonControlElement
|
|
11
|
+
TAG = 'h3'
|
|
12
|
+
end
|
|
13
|
+
module Container
|
|
14
|
+
def h3(how, what)
|
|
15
|
+
return H3.new(self, how, what)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class TC_Relative < Test::Unit::TestCase
|
|
22
|
+
|
|
23
|
+
def setup
|
|
24
|
+
$ie.goto($htmlRoot + "depot_store.html")
|
|
25
|
+
@headline = $ie.h3(:text, 'Pragmatic Version Control')
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def test_parent
|
|
29
|
+
catalog_entry = @headline.parent
|
|
30
|
+
link = catalog_entry.link(:class, 'addtocart')
|
|
31
|
+
assert_equal 'http://localhost:3000/store/add_to_cart/12', link.href
|
|
32
|
+
assert_nothing_raised{link.click}
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def test_parent_page_container
|
|
36
|
+
catalog_entry = @headline.parent
|
|
37
|
+
assert_not_nil catalog_entry.page_container
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def test_before_and_after
|
|
41
|
+
link = $ie.link(:class => 'addtocart', :index => 2)
|
|
42
|
+
assert_equal 'http://localhost:3000/store/add_to_cart/12', link.href
|
|
43
|
+
assert(link.after?(@headline))
|
|
44
|
+
assert(@headline.before?(link))
|
|
45
|
+
assert !(link.before? @headline)
|
|
46
|
+
assert !(@headline.after? link)
|
|
47
|
+
assert !(link.after? link)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def test_find_after
|
|
51
|
+
link = $ie.link(:class => 'addtocart', :after? => @headline)
|
|
52
|
+
assert_equal 'http://localhost:3000/store/add_to_cart/12', link.href
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
end
|
data/unittests/popups_test.rb
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
# revision: $Revision:
|
|
1
|
+
|
|
2
|
+
# revision: $Revision: 958 $
|
|
3
3
|
|
|
4
4
|
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
|
5
5
|
require 'unittests/setup'
|
|
6
6
|
|
|
7
7
|
class TC_PopUps < Test::Unit::TestCase
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
8
|
+
include Watir
|
|
9
|
+
|
|
10
|
+
def setup
|
|
11
|
+
$ie.goto("file://#{$myDir}/html/popups1.html")
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def startClicker( button , waitTime = 0.5)
|
|
15
|
+
w = WinClicker.new
|
|
16
|
+
longName = $ie.dir.gsub("/" , "\\" )
|
|
17
|
+
shortName = w.getShortFileName(longName)
|
|
18
|
+
c = "start rubyw #{shortName }\\watir\\clickJSDialog.rb #{button } #{ waitTime} "
|
|
19
|
+
puts "Starting #{c}"
|
|
20
|
+
w.winsystem(c )
|
|
21
|
+
w=nil
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def test_simple
|
|
25
|
+
startClicker("OK")
|
|
26
|
+
$ie.button("Alert").click
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def test_confirm
|
|
30
|
+
startClicker("OK")
|
|
31
|
+
$ie.button("Confirm").click
|
|
32
|
+
assert( $ie.text_field(:name , "confirmtext").verify_contains("OK") )
|
|
33
|
+
|
|
34
|
+
startClicker("Cancel")
|
|
35
|
+
$ie.button("Confirm").click
|
|
36
|
+
assert( $ie.text_field(:name , "confirmtext").verify_contains("Cancel") )
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def xtest_Prompt
|
|
40
|
+
startClicker("OK")
|
|
41
|
+
$ie.button("Prompt").click
|
|
42
|
+
end
|
|
43
43
|
end
|
|
44
44
|
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# feature tests for Pre
|
|
2
|
+
# revision: $Revision: 962 $
|
|
3
|
+
|
|
4
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
|
5
|
+
require 'unittests/setup'
|
|
6
|
+
|
|
7
|
+
class TC_Pre < Test::Unit::TestCase
|
|
8
|
+
include Watir
|
|
9
|
+
|
|
10
|
+
def setup
|
|
11
|
+
$ie.goto($htmlRoot + "pre.html")
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def test_Pre_Count
|
|
15
|
+
assert( $ie.pres.length == 3 )
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def test_Pre_Exists
|
|
19
|
+
assert(! $ie.pre( :id, 'missingPre' ).exists? )
|
|
20
|
+
assert(! $ie.pre( :index, 33 ).exists? )
|
|
21
|
+
|
|
22
|
+
assert( $ie.pre( :id, '1' ).exists? )
|
|
23
|
+
assert( $ie.pre( :id, /[3-9]/ ).exists? )
|
|
24
|
+
|
|
25
|
+
assert(! $ie.pre( :id, /missing_pre/ ).exists? )
|
|
26
|
+
|
|
27
|
+
assert( $ie.pre( :index, 1 ).exists? )
|
|
28
|
+
assert( $ie.pre( :index, 2 ).exists? )
|
|
29
|
+
assert( $ie.pre( :index, 3 ).exists? )
|
|
30
|
+
|
|
31
|
+
assert( $ie.pre( :name, '3' ).exists? )
|
|
32
|
+
assert(! $ie.pre( :name, "name_missing" ).exists? )
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def test_simple_access
|
|
36
|
+
pre = $ie.pre( :index, 1 )
|
|
37
|
+
assert( pre.text.include?( "simple pre space" ) )
|
|
38
|
+
assert(! pre.text.include?( "A second block" ) )
|
|
39
|
+
|
|
40
|
+
assert( pre.html.include?( "id=1 name=\"1\"" ) )
|
|
41
|
+
|
|
42
|
+
pre = $ie.pre( :index, 2 )
|
|
43
|
+
assert( pre.text.include?( "A second block" ) )
|
|
44
|
+
assert(! pre.text.include?( "this is the last block" ) )
|
|
45
|
+
|
|
46
|
+
pre = $ie.pre( :index, 3 )
|
|
47
|
+
assert( pre.text.include?( "continue to work" ) )
|
|
48
|
+
assert(! pre.text.include?( "Pre Tag Test" ) )
|
|
49
|
+
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
end
|
data/unittests/radios_test.rb
CHANGED
|
@@ -1,164 +1,195 @@
|
|
|
1
1
|
# feature tests for Radio Buttons
|
|
2
|
-
# revision: $Revision:
|
|
2
|
+
# revision: $Revision: 1164 $
|
|
3
3
|
|
|
4
4
|
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
|
5
5
|
require 'unittests/setup'
|
|
6
6
|
|
|
7
7
|
class TC_Radios < Test::Unit::TestCase
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
8
|
+
include Watir
|
|
9
|
+
|
|
10
|
+
def setup
|
|
11
|
+
$ie.goto($htmlRoot + "radioButtons1.html")
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def test_Radio_Exists
|
|
15
|
+
assert($ie.radio(:name, "box1").exists?)
|
|
16
|
+
assert($ie.radio(:id, "box5").exists?)
|
|
17
|
+
|
|
18
|
+
assert(!$ie.radio(:name, "missingname").exists?)
|
|
19
|
+
assert(!$ie.radio(:id, "missingid").exists?)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def test_radio_class
|
|
23
|
+
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.radio(:name, "noName").class_name }
|
|
24
|
+
assert_equal("radio_style" , $ie.radio(:name, "box1").class_name)
|
|
25
|
+
assert_equal("" , $ie.radio(:id, "box5").class_name)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def test_Radio_Enabled
|
|
32
|
+
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.radio(:name, "noName").enabled? }
|
|
33
|
+
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.radio(:id, "noName").enabled? }
|
|
34
|
+
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.radio(:name, "box4" , 6).enabled? }
|
|
35
|
+
|
|
36
|
+
assert(!$ie.radio(:name, "box2").enabled?)
|
|
37
|
+
assert($ie.radio(:id, "box5").enabled?)
|
|
38
|
+
assert($ie.radio(:name, "box1").enabled?)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def test_little
|
|
42
|
+
assert(!$ie.button(:value , "foo").enabled?)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def test_onClick
|
|
46
|
+
|
|
47
|
+
assert(!$ie.radio(:name, "box5").isSet?)
|
|
48
|
+
assert(!$ie.button(:value , "foo").enabled?)
|
|
49
|
+
|
|
50
|
+
# first click the button is enabled and the radio is set
|
|
51
|
+
$ie.radio(:name, "box5" , 1).set
|
|
52
|
+
assert($ie.radio(:name, "box5",1).isSet?)
|
|
53
|
+
assert($ie.radio(:name, "box5",1).checked?)
|
|
54
|
+
assert($ie.button(:value , "foo").enabled?)
|
|
55
|
+
|
|
56
|
+
# second click the button is disabled and the radio is still set
|
|
57
|
+
$ie.radio(:name, "box5", 1).set
|
|
58
|
+
assert($ie.radio(:name, "box5",1).isSet?)
|
|
59
|
+
assert($ie.radio(:name, "box5",1).checked?)
|
|
60
|
+
assert(!$ie.button(:value , "foo").enabled?)
|
|
61
|
+
|
|
62
|
+
# third click the button is enabled and the radio is still set
|
|
63
|
+
$ie.radio(:name, "box5", 1).set
|
|
64
|
+
assert($ie.radio(:name, "box5",1 ).isSet?)
|
|
65
|
+
assert($ie.radio(:name, "box5",1 ).checked?)
|
|
66
|
+
assert($ie.button(:value , "foo").enabled?)
|
|
67
|
+
|
|
68
|
+
# click the radio with a value of 2 , button is disabled and the radio is still set
|
|
69
|
+
$ie.radio(:name, "box5", 2).set
|
|
70
|
+
assert(!$ie.radio(:name, "box5" ,1).isSet?)
|
|
71
|
+
assert(!$ie.radio(:name, "box5" ,1).checked?)
|
|
72
|
+
assert($ie.radio(:name, "box5" ,2).isSet?)
|
|
73
|
+
assert($ie.radio(:name, "box5" ,2).checked?)
|
|
74
|
+
assert(!$ie.button(:value , "foo").enabled?)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def test_Radio_isSet
|
|
78
|
+
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.radio(:name, "noName").isSet? }
|
|
79
|
+
|
|
80
|
+
assert(!$ie.radio(:name, "box1").isSet?)
|
|
81
|
+
assert( $ie.radio(:name, "box3").isSet?)
|
|
82
|
+
assert(!$ie.radio(:name, "box2").isSet?)
|
|
83
|
+
assert( $ie.radio(:name, "box4" , 1 ).isSet?)
|
|
84
|
+
assert(!$ie.radio(:name, "box4" , 2 ).isSet?)
|
|
85
|
+
|
|
86
|
+
assert(!$ie.radio(:name, "box1").checked?)
|
|
87
|
+
assert( $ie.radio(:name, "box3").checked?)
|
|
88
|
+
assert(!$ie.radio(:name, "box2").checked?)
|
|
89
|
+
assert( $ie.radio(:name, "box4" , 1 ).checked?)
|
|
90
|
+
assert(!$ie.radio(:name, "box4" , 2 ).checked?)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def test_radio_clear
|
|
94
|
+
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.radio(:name, "noName").clear }
|
|
95
|
+
|
|
96
|
+
$ie.radio(:name, "box1").clear
|
|
97
|
+
assert(!$ie.radio(:name, "box1").isSet?)
|
|
98
|
+
|
|
99
|
+
assert_raises(ObjectDisabledException, "ObjectDisabledException was supposed to be thrown" ) { $ie.radio(:name, "box2").clear }
|
|
100
|
+
assert(!$ie.radio(:name, "box2").isSet?)
|
|
101
|
+
|
|
102
|
+
$ie.radio(:name, "box3").clear
|
|
103
|
+
assert(!$ie.radio(:name, "box3").isSet?)
|
|
104
|
+
|
|
105
|
+
$ie.radio(:name, "box4" , 1).clear
|
|
106
|
+
assert(!$ie.radio(:name, "box4" , 1).isSet?)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def test_radio_getState
|
|
110
|
+
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.radio(:name, "noName").getState }
|
|
111
|
+
|
|
112
|
+
assert_equal( false , $ie.radio(:name, "box1").getState )
|
|
113
|
+
assert_equal( true , $ie.radio(:name, "box3").getState)
|
|
114
|
+
|
|
115
|
+
# radioes that have the same name but different values
|
|
116
|
+
assert_equal( false , $ie.radio(:name, "box4" , 2).getState )
|
|
117
|
+
assert_equal( true , $ie.radio(:name, "box4" , 1).getState)
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def test_radio_set
|
|
121
|
+
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.radio(:name, "noName").set }
|
|
122
|
+
$ie.radio(:name, "box1").set
|
|
123
|
+
assert($ie.radio(:name, "box1").isSet?)
|
|
124
|
+
|
|
125
|
+
assert_raises(ObjectDisabledException, "ObjectDisabledException was supposed to be thrown" ) { $ie.radio(:name, "box2").set }
|
|
126
|
+
|
|
127
|
+
$ie.radio(:name, "box3").set
|
|
128
|
+
assert($ie.radio(:name, "box3").isSet?)
|
|
129
|
+
|
|
130
|
+
# radioes that have the same name but different values
|
|
131
|
+
$ie.radio(:name, "box4" , 3).set
|
|
132
|
+
assert($ie.radio(:name, "box4" , 3).isSet?)
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def test_radio_properties
|
|
136
|
+
|
|
137
|
+
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.radio(:index, 199).value}
|
|
138
|
+
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.radio(:index, 199).name }
|
|
139
|
+
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.radio(:index, 199).id }
|
|
140
|
+
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.radio(:index, 199).disabled }
|
|
141
|
+
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.radio(:index, 199).type }
|
|
142
|
+
|
|
143
|
+
assert_equal("on" , $ie.radio(:index, 1).value)
|
|
144
|
+
assert_equal("box1" , $ie.radio(:index, 1).name )
|
|
145
|
+
assert_equal("" , $ie.radio(:index, 1).id )
|
|
146
|
+
assert_equal("radio", $ie.radio(:index, 1).type )
|
|
147
|
+
|
|
148
|
+
assert_equal( false, $ie.radio(:index, 1).disabled )
|
|
149
|
+
assert_equal( true, $ie.radio(:index, 3).disabled )
|
|
150
|
+
|
|
151
|
+
assert_equal("box5" , $ie.radio(:index, 2).id )
|
|
152
|
+
assert_equal("" , $ie.radio(:index, 2).name )
|
|
153
|
+
|
|
154
|
+
assert_equal("box4-value5", $ie.radio(:name , "box4" , 5 ).title )
|
|
155
|
+
assert_equal("", $ie.radio(:name , "box4" , 4 ).title )
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def test_radio_iterators
|
|
161
|
+
|
|
162
|
+
assert_equal(13, $ie.radios.length)
|
|
163
|
+
assert_equal("box5" , $ie.radios[2].id )
|
|
164
|
+
assert_equal(true , $ie.radios[3].disabled )
|
|
165
|
+
assert_equal(false , $ie.radios[1].disabled )
|
|
166
|
+
|
|
167
|
+
index = 1
|
|
168
|
+
$ie.radios.each do |r|
|
|
169
|
+
assert_equal( $ie.radio(:index, index).name , r.name )
|
|
170
|
+
assert_equal( $ie.radio(:index, index).id , r.id )
|
|
171
|
+
assert_equal( $ie.radio(:index, index).value, r.value)
|
|
172
|
+
assert_equal( $ie.radio(:index, index).disabled , r.disabled )
|
|
173
|
+
index+=1
|
|
142
174
|
end
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
175
|
+
assert_equal(index -1, $ie.radios.length)
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# test radio buttons that have a string as a value
|
|
179
|
+
def test_value_string
|
|
180
|
+
assert($ie.radio(:name, 'box6', 'Tea').exists?)
|
|
181
|
+
assert($ie.radio(:name, 'box6', 'Milk').exists?)
|
|
182
|
+
$ie.radio(:name, "box6" , 'Milk').set
|
|
183
|
+
assert($ie.radio(:name, "box6" , 'Milk').isSet?)
|
|
184
|
+
assert(!$ie.radio(:name, "box6" , 'Tea').isSet?)
|
|
185
|
+
|
|
186
|
+
$ie.radio(:name, "box6" , 'Tea').set
|
|
187
|
+
assert(!$ie.radio(:name, "box6" , 'Milk').isSet?)
|
|
188
|
+
assert($ie.radio(:name, "box6" , 'Tea').isSet?)
|
|
189
|
+
$ie.radio(:name, "box6", 'Tea').clear
|
|
190
|
+
assert(!$ie.radio(:name, "box6" , 'Tea').isSet?)
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
|
|
163
194
|
end
|
|
164
195
|
|