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 IE::contains_text
|
2
|
-
# revision: $Revision:
|
2
|
+
# revision: $Revision: 1579 $
|
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_contains_text < Test::Unit::TestCase
|
@@ -11,49 +11,52 @@ class TC_contains_text < Test::Unit::TestCase
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def test_text_found
|
14
|
-
assert(
|
14
|
+
assert(browser.contains_text('slings and arrows of outrageous fortune'))
|
15
15
|
end
|
16
16
|
|
17
17
|
def test_text_not_found
|
18
|
-
|
18
|
+
assert_false(browser.contains_text('So are they all, all honourable men'))
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_regexp_found
|
22
|
-
assert(
|
22
|
+
assert(browser.contains_text(/bodkin.*fardels/))
|
23
23
|
end
|
24
24
|
|
25
25
|
def test_regexp_not_found
|
26
|
-
|
26
|
+
assert_false(browser.contains_text(/winding.*watch.*wit/))
|
27
27
|
end
|
28
28
|
|
29
29
|
def test_match_regexp_found
|
30
|
-
$~ =
|
30
|
+
$~ = browser.contains_text(/Messages ([0-9]+)/)
|
31
31
|
assert_equal('42', $1)
|
32
32
|
end
|
33
33
|
|
34
34
|
def test_bad_search_argument
|
35
35
|
assert_raises(ArgumentError) do
|
36
|
-
|
36
|
+
browser.contains_text
|
37
37
|
end
|
38
38
|
assert_raises(ArgumentError) do
|
39
|
-
|
39
|
+
browser.contains_text(nil)
|
40
40
|
end
|
41
41
|
assert_raises(ArgumentError) do
|
42
|
-
|
42
|
+
browser.contains_text(42)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
46
|
end
|
47
47
|
|
48
48
|
class TC_contains_text_in_new_ie < Test::Unit::TestCase
|
49
|
+
tags :fails_on_firefox
|
50
|
+
# Doesn't actually raise an error, but fails to close the window afterwards
|
51
|
+
# http://jira.openqa.org/browse/WTR-265
|
49
52
|
def setup
|
50
|
-
@
|
53
|
+
@new_browser = Watir::Browser.new
|
51
54
|
end
|
52
55
|
def test_nothing_raised
|
53
|
-
assert_nothing_raised {@
|
56
|
+
assert_nothing_raised {@new_browser.text.include? ''}
|
54
57
|
end
|
55
58
|
def teardown
|
56
|
-
@
|
59
|
+
@new_browser.close
|
57
60
|
end
|
58
61
|
end
|
59
62
|
|
@@ -62,6 +65,6 @@ class TC_contains_text_in_frame < Test::Unit::TestCase
|
|
62
65
|
goto_page "frame_links.html"
|
63
66
|
end
|
64
67
|
def test_in_frame
|
65
|
-
assert
|
68
|
+
assert browser.frame('linkFrame').contains_text('The button is really a link')
|
66
69
|
end
|
67
70
|
end
|
@@ -1,15 +1,16 @@
|
|
1
1
|
# feature tests for relative navigation/specification
|
2
2
|
|
3
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..')
|
3
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
4
4
|
require 'unittests/setup'
|
5
5
|
|
6
6
|
class TC_Relative < Test::Unit::TestCase
|
7
7
|
|
8
8
|
def setup
|
9
9
|
goto_page "depot_store.html"
|
10
|
-
@headline =
|
10
|
+
@headline = browser.h3(:text, 'Pragmatic Version Control')
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
|
+
tag_method :test_parent, :fails_on_firefox
|
13
14
|
def test_parent
|
14
15
|
catalog_entry = @headline.parent
|
15
16
|
link = catalog_entry.link(:class, 'addtocart')
|
@@ -17,13 +18,15 @@ class TC_Relative < Test::Unit::TestCase
|
|
17
18
|
assert_nothing_raised{link.click}
|
18
19
|
end
|
19
20
|
|
21
|
+
tag_method :test_parent_page_container, :fails_on_firefox
|
20
22
|
def test_parent_page_container
|
21
23
|
catalog_entry = @headline.parent
|
22
24
|
assert_not_nil catalog_entry.page_container
|
23
25
|
end
|
24
|
-
|
26
|
+
|
27
|
+
tag_method :test_before_and_after, :fails_on_firefox
|
25
28
|
def test_before_and_after
|
26
|
-
link =
|
29
|
+
link = browser.link(:class => 'addtocart', :index => 2)
|
27
30
|
assert_equal 'http://localhost:3000/store/add_to_cart/12', link.href
|
28
31
|
assert(link.after?(@headline))
|
29
32
|
assert(@headline.before?(link))
|
@@ -31,9 +34,10 @@ class TC_Relative < Test::Unit::TestCase
|
|
31
34
|
assert !(@headline.after? link)
|
32
35
|
assert !(link.after? link)
|
33
36
|
end
|
34
|
-
|
37
|
+
|
38
|
+
tag_method :test_find_after, :fails_on_firefox
|
35
39
|
def test_find_after
|
36
|
-
link =
|
40
|
+
link = browser.link(:class => 'addtocart', :after? => @headline)
|
37
41
|
assert_equal 'http://localhost:3000/store/add_to_cart/12', link.href
|
38
42
|
end
|
39
43
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
2
|
+
require 'unittests/setup'
|
3
|
+
|
4
|
+
class TC_Performance < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
uses_page 'wallofcheckboxes.html'
|
7
|
+
end
|
8
|
+
|
9
|
+
# http://jira.openqa.org/browse/WTR-216
|
10
|
+
# This should take about a quarter of a second. When the bug showed up (because the
|
11
|
+
# fast_locate method was broken), it took nearly 10 seconds.
|
12
|
+
def test_access_checkbox
|
13
|
+
start_time = Time.now
|
14
|
+
browser.checkbox(:name, 'custom_monetary_value10:config.admin.required999').set
|
15
|
+
elapsed_time = Time.now - start_time
|
16
|
+
assert(elapsed_time < 1.5,
|
17
|
+
"Elapsed time is #{elapsed_time}, should be less than 1.5 seconds.")
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
data/unittests/popups_test.rb
CHANGED
@@ -1,44 +1,43 @@
|
|
1
|
+
# revision: $Revision: 1431 $
|
1
2
|
|
2
|
-
|
3
|
-
|
4
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
3
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
5
4
|
require 'unittests/setup'
|
6
5
|
|
7
6
|
class TC_PopUps < Test::Unit::TestCase
|
8
|
-
|
9
|
-
|
7
|
+
tags :must_be_visible, :creates_windows, :unreliable
|
8
|
+
|
10
9
|
def setup
|
11
|
-
|
10
|
+
browser.goto("file://#{$myDir}/html/popups1.html")
|
12
11
|
end
|
13
12
|
|
14
13
|
def startClicker( button , waitTime = 0.5)
|
15
14
|
w = WinClicker.new
|
16
|
-
longName =
|
15
|
+
longName = browser.dir.gsub("/" , "\\" )
|
17
16
|
shortName = w.getShortFileName(longName)
|
18
17
|
c = "start rubyw #{shortName }\\watir\\clickJSDialog.rb #{button } #{ waitTime} "
|
19
18
|
puts "Starting #{c}"
|
20
19
|
w.winsystem(c )
|
21
|
-
w=nil
|
20
|
+
w = nil
|
22
21
|
end
|
23
22
|
|
24
23
|
def test_simple
|
25
24
|
startClicker("OK")
|
26
|
-
|
25
|
+
browser.button("Alert").click
|
27
26
|
end
|
28
27
|
|
29
28
|
def test_confirm
|
30
29
|
startClicker("OK")
|
31
|
-
|
32
|
-
assert(
|
30
|
+
browser.button("Confirm").click
|
31
|
+
assert( browser.text_field(:name , "confirmtext").verify_contains("OK") )
|
33
32
|
|
34
33
|
startClicker("Cancel")
|
35
|
-
|
36
|
-
assert(
|
34
|
+
browser.button("Confirm").click
|
35
|
+
assert( browser.text_field(:name , "confirmtext").verify_contains("Cancel") )
|
37
36
|
end
|
38
37
|
|
39
38
|
def xtest_Prompt
|
40
39
|
startClicker("OK")
|
41
|
-
|
40
|
+
browser.button("Prompt").click
|
42
41
|
end
|
43
42
|
end
|
44
43
|
|
data/unittests/pre_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# feature tests for Pre
|
2
|
-
# revision: $Revision:
|
2
|
+
# revision: $Revision: 1595 $
|
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_Pre < Test::Unit::TestCase
|
@@ -11,41 +11,43 @@ class TC_Pre < Test::Unit::TestCase
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def test_Pre_Count
|
14
|
-
assert(
|
14
|
+
assert( browser.pres.length == 3 )
|
15
15
|
end
|
16
16
|
|
17
17
|
def test_Pre_Exists
|
18
|
-
|
19
|
-
assert(
|
20
|
-
|
21
|
-
assert(
|
22
|
-
assert(
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
assert(
|
27
|
-
|
28
|
-
assert( $ie.pre( :index, 3 ).exists? )
|
29
|
-
|
30
|
-
assert( $ie.pre( :name, '3' ).exists? )
|
31
|
-
assert(! $ie.pre( :name, "name_missing" ).exists? )
|
18
|
+
assert_false( browser.pre( :index, 33 ).exists? )
|
19
|
+
assert( browser.pre( :index, 3 ).exists? )
|
20
|
+
|
21
|
+
assert( browser.pre( :id, '1' ).exists? )
|
22
|
+
assert( browser.pre( :id, /[3-9]/ ).exists? )
|
23
|
+
assert_false( browser.pre( :id, /missing_pre/ ).exists? )
|
24
|
+
assert_false( browser.pre( :id, 'missingPre' ).exists? )
|
25
|
+
|
26
|
+
assert( browser.pre( :name, '3' ).exists? )
|
27
|
+
assert_false( browser.pre( :name, "name_missing" ).exists? )
|
32
28
|
end
|
33
|
-
|
29
|
+
|
34
30
|
def test_simple_access
|
35
|
-
pre =
|
31
|
+
pre = browser.pre( :index, 1 )
|
36
32
|
assert( pre.text.include?( "simple pre space" ) )
|
37
|
-
|
38
|
-
|
39
|
-
assert( pre.html.include?( "id=1 name=\"1\"" ) )
|
33
|
+
assert_false( pre.text.include?( "A second block" ) )
|
40
34
|
|
41
|
-
pre =
|
35
|
+
pre = browser.pre( :index, 2 )
|
42
36
|
assert( pre.text.include?( "A second block" ) )
|
43
|
-
|
44
|
-
|
45
|
-
|
37
|
+
assert_false( pre.text.include?( "this is the last block" ) )
|
38
|
+
end
|
39
|
+
|
40
|
+
tag_method :test_embedded_spaces, :fails_on_firefox # http://jira.openqa.org/browse/WTR-267
|
41
|
+
def test_embedded_spaces
|
42
|
+
pre = browser.pre( :index, 3 )
|
46
43
|
assert( pre.text.include?( "continue to work" ) )
|
47
|
-
|
48
|
-
|
44
|
+
assert_false( pre.text.include?( "Pre Tag Test" ) )
|
45
|
+
end
|
46
|
+
|
47
|
+
tag_method :test_html, :fails_on_firefox # http://jira.openqa.org/browse/WTR-260
|
48
|
+
def test_html
|
49
|
+
pre = browser.pre(:index, 1)
|
50
|
+
assert( pre.html.include?( "id=1 name=\"1\"" ) )
|
49
51
|
end
|
50
52
|
|
51
53
|
end
|
data/unittests/radios_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# feature tests for Radio Buttons
|
2
|
-
# revision: $Revision:
|
2
|
+
# revision: $Revision: 1505 $
|
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 < Test::Unit::TestCase
|
@@ -12,179 +12,200 @@ class TC_Radios < Test::Unit::TestCase
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_Radio_Exists
|
15
|
-
assert(
|
16
|
-
assert(
|
15
|
+
assert(browser.radio(:name, "box1").exists?)
|
16
|
+
assert(browser.radio(:id, "box5").exists?)
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
assert_false(browser.radio(:name, "missingname").exists?)
|
19
|
+
assert_false(browser.radio(:id, "missingid").exists?)
|
20
20
|
end
|
21
21
|
|
22
22
|
def test_radio_class
|
23
|
-
assert_raises(UnknownObjectException
|
24
|
-
assert_equal("radio_style"
|
25
|
-
assert_equal(""
|
23
|
+
assert_raises(UnknownObjectException) { browser.radio(:name, "noName").class_name }
|
24
|
+
assert_equal("radio_style", browser.radio(:name, "box1").class_name)
|
25
|
+
assert_equal("", browser.radio(:id, "box5").class_name)
|
26
26
|
end
|
27
27
|
|
28
28
|
def test_Radio_Enabled
|
29
|
-
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) {
|
30
|
-
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) {
|
31
|
-
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) {
|
29
|
+
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { browser.radio(:name, "noName").enabled? }
|
30
|
+
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { browser.radio(:id, "noName").enabled? }
|
31
|
+
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { browser.radio(:name, "box4" , 6).enabled? }
|
32
32
|
|
33
|
-
|
34
|
-
assert(
|
35
|
-
assert(
|
33
|
+
assert_false(browser.radio(:name, "box2").enabled?)
|
34
|
+
assert(browser.radio(:id, "box5").enabled?)
|
35
|
+
assert(browser.radio(:name, "box1").enabled?)
|
36
36
|
end
|
37
37
|
|
38
38
|
def test_little
|
39
|
-
|
39
|
+
assert_false(browser.button(:value, "foo").enabled?)
|
40
40
|
end
|
41
41
|
|
42
42
|
def test_onClick
|
43
43
|
|
44
|
-
|
45
|
-
|
44
|
+
assert_false(browser.radio(:name, "box5").isSet?)
|
45
|
+
assert_false(browser.button(:value , "foo").enabled?)
|
46
46
|
|
47
47
|
# first click the button is enabled and the radio is set
|
48
|
-
|
49
|
-
assert(
|
50
|
-
assert(
|
51
|
-
assert(
|
48
|
+
browser.radio(:name, "box5", 1).set
|
49
|
+
assert(browser.radio(:name, "box5",1).isSet?)
|
50
|
+
assert(browser.radio(:name, "box5",1).checked?)
|
51
|
+
assert(browser.button(:value, "foo").enabled?)
|
52
52
|
|
53
53
|
# second click the button is disabled and the radio is still set
|
54
|
-
|
55
|
-
assert(
|
56
|
-
assert(
|
57
|
-
|
54
|
+
browser.radio(:name, "box5", 1).set
|
55
|
+
assert(browser.radio(:name, "box5",1).isSet?)
|
56
|
+
assert(browser.radio(:name, "box5",1).checked?)
|
57
|
+
assert_false(browser.button(:value, "foo").enabled?)
|
58
58
|
|
59
59
|
# third click the button is enabled and the radio is still set
|
60
|
-
|
61
|
-
assert(
|
62
|
-
assert(
|
63
|
-
assert(
|
60
|
+
browser.radio(:name, "box5", 1).set
|
61
|
+
assert(browser.radio(:name, "box5", 1).isSet?)
|
62
|
+
assert(browser.radio(:name, "box5", 1).checked?)
|
63
|
+
assert(browser.button(:value, "foo").enabled?)
|
64
64
|
|
65
65
|
# click the radio with a value of 2 , button is disabled and the radio is still set
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
assert(
|
70
|
-
assert(
|
71
|
-
|
66
|
+
browser.radio(:name, "box5", 2).set
|
67
|
+
assert_false(browser.radio(:name, "box5", 1).isSet?)
|
68
|
+
assert_false(browser.radio(:name, "box5", 1).checked?)
|
69
|
+
assert(browser.radio(:name, "box5", 2).isSet?)
|
70
|
+
assert(browser.radio(:name, "box5", 2).checked?)
|
71
|
+
assert_false(browser.button(:value, "foo").enabled?)
|
72
72
|
end
|
73
73
|
|
74
74
|
def test_Radio_isSet
|
75
|
-
assert_raises(UnknownObjectException
|
75
|
+
assert_raises(UnknownObjectException) { browser.radio(:name, "noName").isSet? }
|
76
76
|
|
77
|
-
|
78
|
-
assert(
|
79
|
-
|
80
|
-
assert(
|
81
|
-
|
77
|
+
assert_false(browser.radio(:name, "box1").isSet?)
|
78
|
+
assert( browser.radio(:name, "box3").isSet?)
|
79
|
+
assert_false(browser.radio(:name, "box2").isSet?)
|
80
|
+
assert( browser.radio(:name, "box4", 1).isSet?)
|
81
|
+
assert_false(browser.radio(:name, "box4", 2).isSet?)
|
82
82
|
|
83
|
-
|
84
|
-
assert(
|
85
|
-
|
86
|
-
assert(
|
87
|
-
|
83
|
+
assert_false(browser.radio(:name, "box1").checked?)
|
84
|
+
assert( browser.radio(:name, "box3").checked?)
|
85
|
+
assert_false(browser.radio(:name, "box2").checked?)
|
86
|
+
assert( browser.radio(:name, "box4", 1).checked?)
|
87
|
+
assert_false(browser.radio(:name, "box4", 2).checked?)
|
88
88
|
end
|
89
89
|
|
90
90
|
def test_radio_clear
|
91
|
-
assert_raises(UnknownObjectException
|
91
|
+
assert_raises(UnknownObjectException) { browser.radio(:name, "noName").clear }
|
92
92
|
|
93
|
-
|
94
|
-
|
93
|
+
browser.radio(:name, "box1").clear
|
94
|
+
assert_false(browser.radio(:name, "box1").isSet?)
|
95
95
|
|
96
|
-
assert_raises(ObjectDisabledException, "ObjectDisabledException was supposed to be thrown" ) {
|
97
|
-
|
96
|
+
assert_raises(ObjectDisabledException, "ObjectDisabledException was supposed to be thrown" ) { browser.radio(:name, "box2").clear }
|
97
|
+
assert_false(browser.radio(:name, "box2").isSet?)
|
98
98
|
|
99
|
-
|
100
|
-
|
99
|
+
browser.radio(:name, "box3").clear
|
100
|
+
assert_false(browser.radio(:name, "box3").isSet?)
|
101
101
|
|
102
|
-
|
103
|
-
|
102
|
+
browser.radio(:name, "box4" , 1).clear
|
103
|
+
assert_false(browser.radio(:name, "box4" , 1).isSet?)
|
104
104
|
end
|
105
105
|
|
106
106
|
def test_radio_getState
|
107
|
-
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) {
|
107
|
+
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { browser.radio(:name, "noName").getState }
|
108
108
|
|
109
|
-
assert_equal( false ,
|
110
|
-
assert_equal( true ,
|
109
|
+
assert_equal( false , browser.radio(:name, "box1").getState )
|
110
|
+
assert_equal( true , browser.radio(:name, "box3").getState)
|
111
111
|
|
112
112
|
# radioes that have the same name but different values
|
113
|
-
assert_equal( false ,
|
114
|
-
assert_equal( true ,
|
113
|
+
assert_equal( false , browser.radio(:name, "box4" , 2).getState )
|
114
|
+
assert_equal( true , browser.radio(:name, "box4" , 1).getState)
|
115
115
|
end
|
116
116
|
|
117
117
|
def test_radio_set
|
118
|
-
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) {
|
119
|
-
|
120
|
-
assert(
|
118
|
+
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { browser.radio(:name, "noName").set }
|
119
|
+
browser.radio(:name, "box1").set
|
120
|
+
assert(browser.radio(:name, "box1").isSet?)
|
121
121
|
|
122
|
-
assert_raises(ObjectDisabledException, "ObjectDisabledException was supposed to be thrown" ) {
|
122
|
+
assert_raises(ObjectDisabledException, "ObjectDisabledException was supposed to be thrown" ) { browser.radio(:name, "box2").set }
|
123
123
|
|
124
|
-
|
125
|
-
assert(
|
124
|
+
browser.radio(:name, "box3").set
|
125
|
+
assert(browser.radio(:name, "box3").isSet?)
|
126
126
|
|
127
127
|
# radioes that have the same name but different values
|
128
|
-
|
129
|
-
assert(
|
128
|
+
browser.radio(:name, "box4" , 3).set
|
129
|
+
assert(browser.radio(:name, "box4" , 3).isSet?)
|
130
130
|
end
|
131
131
|
|
132
132
|
def test_radio_properties
|
133
133
|
|
134
|
-
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) {
|
135
|
-
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) {
|
136
|
-
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) {
|
137
|
-
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) {
|
138
|
-
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) {
|
134
|
+
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { browser.radio(:index, 199).value}
|
135
|
+
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { browser.radio(:index, 199).name }
|
136
|
+
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { browser.radio(:index, 199).id }
|
137
|
+
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { browser.radio(:index, 199).disabled }
|
138
|
+
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { browser.radio(:index, 199).type }
|
139
139
|
|
140
|
-
assert_equal("on" ,
|
141
|
-
assert_equal("box1" ,
|
142
|
-
assert_equal("" ,
|
143
|
-
assert_equal("radio",
|
140
|
+
assert_equal("on" , browser.radio(:index, 1).value)
|
141
|
+
assert_equal("box1" , browser.radio(:index, 1).name )
|
142
|
+
assert_equal("" , browser.radio(:index, 1).id )
|
143
|
+
assert_equal("radio", browser.radio(:index, 1).type )
|
144
144
|
|
145
|
-
assert_equal( false,
|
146
|
-
assert_equal( true,
|
147
|
-
|
148
|
-
assert_equal("box5" , $ie.radio(:index, 2).id )
|
149
|
-
assert_equal("" , $ie.radio(:index, 2).name )
|
150
|
-
|
151
|
-
assert_equal("box4-value5", $ie.radio(:name , "box4" , 5 ).title )
|
152
|
-
assert_equal("", $ie.radio(:name , "box4" , 4 ).title )
|
145
|
+
assert_equal( false, browser.radio(:index, 1).disabled )
|
146
|
+
assert_equal( true, browser.radio(:index, 3).disabled )
|
153
147
|
|
148
|
+
assert_equal("box5" , browser.radio(:index, 2).id )
|
149
|
+
assert_equal("" , browser.radio(:index, 2).name )
|
154
150
|
|
151
|
+
assert_equal("box4-value5", browser.radio(:name , "box4" , 5 ).title )
|
152
|
+
assert_equal("", browser.radio(:name , "box4" , 4 ).title )
|
155
153
|
end
|
156
154
|
|
157
155
|
def test_radio_iterators
|
158
|
-
|
159
|
-
assert_equal(
|
160
|
-
assert_equal(
|
161
|
-
assert_equal(
|
162
|
-
assert_equal(false , $ie.radios[1].disabled )
|
156
|
+
assert_equal(13, browser.radios.length)
|
157
|
+
assert_equal("box5" , browser.radios[2].id )
|
158
|
+
assert_equal(true , browser.radios[3].disabled )
|
159
|
+
assert_equal(false , browser.radios[1].disabled )
|
163
160
|
|
164
161
|
index = 1
|
165
|
-
|
166
|
-
assert_equal(
|
167
|
-
assert_equal(
|
168
|
-
assert_equal(
|
169
|
-
assert_equal(
|
162
|
+
browser.radios.each do |r|
|
163
|
+
assert_equal( browser.radio(:index, index).name , r.name )
|
164
|
+
assert_equal( browser.radio(:index, index).id , r.id )
|
165
|
+
assert_equal( browser.radio(:index, index).value, r.value)
|
166
|
+
assert_equal( browser.radio(:index, index).disabled , r.disabled )
|
170
167
|
index+=1
|
171
168
|
end
|
172
|
-
assert_equal(index -1,
|
169
|
+
assert_equal(index -1, browser.radios.length)
|
173
170
|
end
|
174
171
|
|
175
172
|
# test radio buttons that have a string as a value
|
176
173
|
def test_value_string
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
assert(
|
181
|
-
assert(
|
174
|
+
tea = browser.radio(:name, 'box6', 'Tea')
|
175
|
+
milk = browser.radio(:name, 'box6', 'Milk')
|
176
|
+
|
177
|
+
assert(tea.exists?)
|
178
|
+
assert(milk.exists?)
|
179
|
+
|
180
|
+
milk.set
|
181
|
+
assert(milk.isSet?)
|
182
|
+
assert_false(tea.isSet?)
|
183
|
+
|
184
|
+
tea.set
|
185
|
+
assert_false(milk.isSet?)
|
186
|
+
assert(tea.isSet?)
|
187
|
+
|
188
|
+
tea.clear
|
189
|
+
assert_false(tea.isSet?)
|
190
|
+
end
|
191
|
+
|
192
|
+
def test_value_specified
|
193
|
+
tea = browser.radio(:name => 'box6', :value => 'Tea')
|
194
|
+
milk = browser.radio(:name => 'box6', :value => 'Milk')
|
195
|
+
|
196
|
+
assert(tea.exists?)
|
197
|
+
assert(milk.exists?)
|
198
|
+
|
199
|
+
milk.set
|
200
|
+
assert(milk.isSet?)
|
201
|
+
assert_false(tea.isSet?)
|
202
|
+
|
203
|
+
tea.set
|
204
|
+
assert_false(milk.isSet?)
|
205
|
+
assert(tea.isSet?)
|
182
206
|
|
183
|
-
|
184
|
-
|
185
|
-
assert($ie.radio(:name, "box6" , 'Tea').isSet?)
|
186
|
-
$ie.radio(:name, "box6", 'Tea').clear
|
187
|
-
assert(!$ie.radio(:name, "box6" , 'Tea').isSet?)
|
207
|
+
tea.clear
|
208
|
+
assert_false(tea.isSet?)
|
188
209
|
end
|
189
210
|
|
190
211
|
end
|