firewatir 1.6.2 → 1.6.5
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +32 -0
- data/lib/firewatir.rb +40 -50
- data/lib/firewatir/container.rb +491 -534
- data/lib/firewatir/document.rb +239 -0
- data/lib/firewatir/element.rb +1365 -0
- data/lib/firewatir/element_collections.rb +314 -0
- data/lib/firewatir/elements/button.rb +15 -0
- data/lib/firewatir/elements/file_field.rb +29 -0
- data/lib/firewatir/elements/form.rb +40 -0
- data/lib/firewatir/elements/frame.rb +55 -0
- data/lib/firewatir/elements/hidden.rb +56 -0
- data/lib/firewatir/elements/image.rb +139 -0
- data/lib/firewatir/elements/input_element.rb +44 -0
- data/lib/firewatir/elements/link.rb +76 -0
- data/lib/firewatir/elements/non_control_element.rb +53 -0
- data/lib/firewatir/elements/non_control_elements.rb +108 -0
- data/lib/firewatir/elements/not_used.rb +278 -0
- data/lib/firewatir/elements/option.rb +131 -0
- data/lib/firewatir/elements/radio_check_common.rb +163 -0
- data/lib/firewatir/elements/select_list.rb +188 -0
- data/lib/firewatir/elements/table.rb +218 -0
- data/lib/firewatir/elements/table_cell.rb +54 -0
- data/lib/firewatir/elements/table_row.rb +100 -0
- data/lib/firewatir/elements/text_field.rb +218 -0
- data/lib/firewatir/exceptions.rb +10 -10
- data/lib/firewatir/firefox.rb +1040 -1127
- data/lib/firewatir/jssh_socket.rb +101 -0
- data/lib/firewatir/version.rb +5 -5
- data/unittests/attach_to_new_window_test.rb +49 -42
- data/unittests/bug_fixes_test.rb +195 -198
- data/unittests/buttons_xpath_test.rb +88 -88
- data/unittests/checkbox_test.rb +158 -155
- data/unittests/checkbox_xpath_test.rb +107 -107
- data/unittests/div_test.rb +275 -276
- data/unittests/filefield_test.rb +49 -45
- data/unittests/filefield_xpath_test.rb +35 -35
- data/unittests/form_test.rb +296 -308
- data/unittests/frame_test.rb +159 -152
- data/unittests/hidden_test.rb +85 -85
- data/unittests/hidden_xpath_test.rb +72 -72
- data/unittests/html/blankpage.html +11 -11
- data/unittests/html/buttons1.html +61 -61
- data/unittests/html/cssTest.html +42 -42
- data/unittests/html/div.html +72 -72
- data/unittests/html/fileupload.html +45 -45
- data/unittests/html/formTest1.html +38 -38
- data/unittests/html/forms2.html +45 -45
- data/unittests/html/frame_buttons.html +3 -3
- data/unittests/html/iframeTest.html +14 -14
- data/unittests/html/iframeTest1.html +13 -13
- data/unittests/html/iframeTest2.html +5 -5
- data/unittests/html/links1.html +42 -42
- data/unittests/html/nestedFrames.html +6 -6
- data/unittests/html/new_browser.html +1 -0
- data/unittests/html/new_browser_popup.html +8 -0
- data/unittests/html/pass.html +9 -9
- data/unittests/html/pre.html +27 -27
- data/unittests/html/redirect.html +10 -10
- data/unittests/html/redirect1.html +8 -8
- data/unittests/html/redirect2.html +8 -8
- data/unittests/html/redirect3.html +8 -8
- data/unittests/html/simple_table_columns.html +74 -74
- data/unittests/html/table1.html +165 -165
- data/unittests/html/textfields1.html +62 -62
- data/unittests/images_test.rb +198 -205
- data/unittests/images_xpath_test.rb +118 -119
- data/unittests/javascript_test.rb +75 -75
- data/unittests/links_test.rb +231 -232
- data/unittests/links_xpath_test.rb +79 -79
- data/unittests/mozilla_all_tests.rb +7 -7
- data/unittests/pre_test.rb +75 -76
- data/unittests/radios_xpath_test.rb +101 -101
- data/unittests/redirect_test.rb +41 -41
- data/unittests/selectbox_test.rb +142 -142
- data/unittests/selectbox_xpath_test.rb +129 -129
- data/unittests/setup.rb +29 -30
- data/unittests/table_test.rb +385 -373
- data/unittests/table_xpath_test.rb +185 -185
- data/unittests/textfields_test.rb +234 -233
- data/unittests/textfields_xpath_test.rb +113 -113
- metadata +33 -11
- data/lib/firewatir/MozillaBaseElement.rb +0 -1863
- data/lib/firewatir/htmlelements.rb +0 -1911
- data/unittests/iostring.rb +0 -30
- data/unittests/iostring_test.rb +0 -48
@@ -1,79 +1,79 @@
|
|
1
|
-
# feature tests for Links
|
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_Links_XPath < Test::Unit::TestCase
|
8
|
-
|
9
|
-
def setup()
|
10
|
-
goto_page("links1.html")
|
11
|
-
end
|
12
|
-
|
13
|
-
def xtest_new_link_exists
|
14
|
-
assert(exists?{browser.link(:xpath , "//a[contains(.,'test1')]")})
|
15
|
-
assert(exists?{browser.link(:xpath, "//a[contains(., /TEST/i)]")})
|
16
|
-
assert_false(exists?{browser.link(:xpath , "//a[contains(.,'missing')]")})
|
17
|
-
assert_false(exists?{browser.link(:xpath, "//a[contains(., /miss/)]")})
|
18
|
-
end
|
19
|
-
|
20
|
-
tag_method :test_element_by_xpath_class, :fails_on_ie
|
21
|
-
def test_element_by_xpath_class
|
22
|
-
# TODO: If element is not present this should return null
|
23
|
-
#element = browser.element_by_xpath("//a[contains(., /miss/)]")
|
24
|
-
#assert(element.instance_of?(Link),"element class should be #{Link}; got #{element.class}")
|
25
|
-
#element = browser.element_by_xpath("//a[contains(.,'missing')]")
|
26
|
-
#assert(element.instance_of?(Link),"element class should be #{Link}; got #{element.class}")
|
27
|
-
element = browser.element_by_xpath("//a[contains(., /TEST/i)]")
|
28
|
-
assert_class(element, 'Link')
|
29
|
-
element = browser.element_by_xpath("//a[contains(.,'test1')]")
|
30
|
-
assert_class(element, 'Link')
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_element_by_xpath_behavior
|
34
|
-
# TODO implement this, acquiring objects through element_by_xpath and
|
35
|
-
# then testing their properties to see if they behave normally, as if
|
36
|
-
# they had been created with browser.link
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_Link_Exists
|
40
|
-
assert(browser.link(:xpath , "//a[contains(.,'test1')]").exists?)
|
41
|
-
assert(browser.link(:xpath, "//a[contains(., /TEST/i)]").exists?)
|
42
|
-
assert_false(browser.link(:xpath , "//a[contains(.,'missing')]").exists?)
|
43
|
-
|
44
|
-
assert_false(browser.link(:xpath , "//a[@url='alsomissing.html']").exists?)
|
45
|
-
|
46
|
-
assert(browser.link(:xpath , "//a[@id='link_id']").exists?)
|
47
|
-
assert_false(browser.link(:xpath , "//a[@id='alsomissing']").exists?)
|
48
|
-
|
49
|
-
assert(browser.link(:xpath , "//a[@name='link_name']").exists?)
|
50
|
-
assert_false(browser.link(:xpath , "//a[@name='alsomissing']").exists?)
|
51
|
-
assert(browser.link(:xpath , "//a[@title='link_title']").exists?)
|
52
|
-
|
53
|
-
end
|
54
|
-
|
55
|
-
def test_Link_click
|
56
|
-
browser.link(:xpath , "//a[contains(.,'test1')]").click
|
57
|
-
assert( browser.text.include?("Links2-Pass") )
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_link_properties
|
61
|
-
|
62
|
-
assert_match( /links2/ ,browser.link(:xpath , "//a[contains(.,'test1')]").href )
|
63
|
-
assert_equal( "" , browser.link(:xpath , "//a[contains(.,'test1')]").value)
|
64
|
-
assert_equal( "test1" , browser.link(:xpath , "//a[contains(.,'test1')]").text )
|
65
|
-
assert_equal( "" , browser.link(:xpath , "//a[contains(.,'test1')]").name )
|
66
|
-
assert_equal( "" , browser.link(:xpath , "//a[contains(.,'test1')]").id )
|
67
|
-
assert_equal( false , browser.link(:xpath , "//a[contains(.,'test1')]").disabled )
|
68
|
-
assert_equal( "" , browser.link(:xpath , "//a[contains(.,'test1')]").class_name)
|
69
|
-
assert_equal( "link_class_1" , browser.link(:xpath , "//a[@class='link_class_1']").class_name)
|
70
|
-
|
71
|
-
assert_equal( "link_id" , browser.link(:xpath , "//a[@id='link_id']").id )
|
72
|
-
assert_equal( "link_name" , browser.link(:xpath , "//a[@name='link_name']").name )
|
73
|
-
|
74
|
-
assert_equal( "" , browser.link(:xpath , "//a[@name='link_name']").title)
|
75
|
-
|
76
|
-
assert_equal( "link_title" , browser.link(:xpath , "//a[@title='link_title']").title)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
1
|
+
# feature tests for Links
|
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_Links_XPath < Test::Unit::TestCase
|
8
|
+
|
9
|
+
def setup()
|
10
|
+
goto_page("links1.html")
|
11
|
+
end
|
12
|
+
|
13
|
+
def xtest_new_link_exists
|
14
|
+
assert(exists?{browser.link(:xpath , "//a[contains(.,'test1')]")})
|
15
|
+
assert(exists?{browser.link(:xpath, "//a[contains(., /TEST/i)]")})
|
16
|
+
assert_false(exists?{browser.link(:xpath , "//a[contains(.,'missing')]")})
|
17
|
+
assert_false(exists?{browser.link(:xpath, "//a[contains(., /miss/)]")})
|
18
|
+
end
|
19
|
+
|
20
|
+
tag_method :test_element_by_xpath_class, :fails_on_ie
|
21
|
+
def test_element_by_xpath_class
|
22
|
+
# TODO: If element is not present this should return null
|
23
|
+
#element = browser.element_by_xpath("//a[contains(., /miss/)]")
|
24
|
+
#assert(element.instance_of?(Link),"element class should be #{Link}; got #{element.class}")
|
25
|
+
#element = browser.element_by_xpath("//a[contains(.,'missing')]")
|
26
|
+
#assert(element.instance_of?(Link),"element class should be #{Link}; got #{element.class}")
|
27
|
+
element = browser.element_by_xpath("//a[contains(., /TEST/i)]")
|
28
|
+
assert_class(element, 'Link')
|
29
|
+
element = browser.element_by_xpath("//a[contains(.,'test1')]")
|
30
|
+
assert_class(element, 'Link')
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_element_by_xpath_behavior
|
34
|
+
# TODO implement this, acquiring objects through element_by_xpath and
|
35
|
+
# then testing their properties to see if they behave normally, as if
|
36
|
+
# they had been created with browser.link
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_Link_Exists
|
40
|
+
assert(browser.link(:xpath , "//a[contains(.,'test1')]").exists?)
|
41
|
+
assert(browser.link(:xpath, "//a[contains(., /TEST/i)]").exists?)
|
42
|
+
assert_false(browser.link(:xpath , "//a[contains(.,'missing')]").exists?)
|
43
|
+
|
44
|
+
assert_false(browser.link(:xpath , "//a[@url='alsomissing.html']").exists?)
|
45
|
+
|
46
|
+
assert(browser.link(:xpath , "//a[@id='link_id']").exists?)
|
47
|
+
assert_false(browser.link(:xpath , "//a[@id='alsomissing']").exists?)
|
48
|
+
|
49
|
+
assert(browser.link(:xpath , "//a[@name='link_name']").exists?)
|
50
|
+
assert_false(browser.link(:xpath , "//a[@name='alsomissing']").exists?)
|
51
|
+
assert(browser.link(:xpath , "//a[@title='link_title']").exists?)
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_Link_click
|
56
|
+
browser.link(:xpath , "//a[contains(.,'test1')]").click
|
57
|
+
assert( browser.text.include?("Links2-Pass") )
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_link_properties
|
61
|
+
|
62
|
+
assert_match( /links2/ ,browser.link(:xpath , "//a[contains(.,'test1')]").href )
|
63
|
+
assert_equal( "" , browser.link(:xpath , "//a[contains(.,'test1')]").value)
|
64
|
+
assert_equal( "test1" , browser.link(:xpath , "//a[contains(.,'test1')]").text )
|
65
|
+
assert_equal( "" , browser.link(:xpath , "//a[contains(.,'test1')]").name )
|
66
|
+
assert_equal( "" , browser.link(:xpath , "//a[contains(.,'test1')]").id )
|
67
|
+
assert_equal( false , browser.link(:xpath , "//a[contains(.,'test1')]").disabled )
|
68
|
+
assert_equal( "" , browser.link(:xpath , "//a[contains(.,'test1')]").class_name)
|
69
|
+
assert_equal( "link_class_1" , browser.link(:xpath , "//a[@class='link_class_1']").class_name)
|
70
|
+
|
71
|
+
assert_equal( "link_id" , browser.link(:xpath , "//a[@id='link_id']").id )
|
72
|
+
assert_equal( "link_name" , browser.link(:xpath , "//a[@name='link_name']").name )
|
73
|
+
|
74
|
+
assert_equal( "" , browser.link(:xpath , "//a[@name='link_name']").title)
|
75
|
+
|
76
|
+
assert_equal( "link_title" , browser.link(:xpath , "//a[@title='link_title']").title)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
@@ -1,7 +1,7 @@
|
|
1
|
-
TOPDIR = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
2
|
-
$LOAD_PATH.unshift TOPDIR
|
3
|
-
require 'unittests/setup'
|
4
|
-
|
5
|
-
Dir.chdir TOPDIR
|
6
|
-
$all_tests.each {|x| require x }
|
7
|
-
|
1
|
+
TOPDIR = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
2
|
+
$LOAD_PATH.unshift TOPDIR
|
3
|
+
require 'unittests/setup'
|
4
|
+
|
5
|
+
Dir.chdir TOPDIR do
|
6
|
+
$all_tests.each {|x| require x }
|
7
|
+
end
|
data/unittests/pre_test.rb
CHANGED
@@ -1,76 +1,75 @@
|
|
1
|
-
# feature tests for Pre
|
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_Pre < Test::Unit::TestCase
|
8
|
-
|
9
|
-
|
10
|
-
def setup
|
11
|
-
goto_page("pre.html")
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_Pre_Count
|
15
|
-
assert( browser.pres.length == 3 )
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_Pre_Exists
|
19
|
-
assert_false( browser.pre( :id, 'missingPre' ).exists? )
|
20
|
-
assert_false( browser.pre( :index, 33 ).exists? )
|
21
|
-
|
22
|
-
assert( browser.pre( :id, '1' ).exists? )
|
23
|
-
assert( browser.pre( :id, /[3-9]/ ).exists? )
|
24
|
-
|
25
|
-
assert_false( browser.pre( :id, /missing_pre/ ).exists? )
|
26
|
-
|
27
|
-
assert( browser.pre( :index, 1 ).exists? )
|
28
|
-
assert( browser.pre( :index, 2 ).exists? )
|
29
|
-
assert( browser.pre( :index, 3 ).exists? )
|
30
|
-
|
31
|
-
assert( browser.pre( :name, '3' ).exists? )
|
32
|
-
assert_false( browser.pre( :name, "name_missing" ).exists? )
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_simple_access
|
36
|
-
pre = browser.pre( :index, 1 )
|
37
|
-
assert( pre.text.include?( "simple pre space" ) )
|
38
|
-
assert_false( pre.text.include?( "A second block" ) )
|
39
|
-
|
40
|
-
pre = browser.pre( :index, 2 )
|
41
|
-
assert( pre.text.include?( "A second block" ) )
|
42
|
-
assert_false( pre.text.include?( "this is the last block" ) )
|
43
|
-
end
|
44
|
-
|
45
|
-
tag_method :test_embedded_spaces, :fails_on_firefox # http://jira.openqa.org/browse/WTR-267
|
46
|
-
def test_embedded_spaces
|
47
|
-
pre = browser.pre( :index, 3 )
|
48
|
-
assert( pre.text.include?( "continue to work" ) )
|
49
|
-
assert_false( pre.text.include?( "Pre Tag Test" ) )
|
50
|
-
end
|
51
|
-
|
52
|
-
end
|
53
|
-
|
54
|
-
|
55
|
-
class TC_Pres_Display < Test::Unit::TestCase
|
56
|
-
include
|
57
|
-
|
58
|
-
tag_method :test_showPres, :fails_on_ie
|
59
|
-
def test_showPres
|
60
|
-
goto_page("pre.html")
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
end
|
1
|
+
# feature tests for Pre
|
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_Pre < Test::Unit::TestCase
|
8
|
+
|
9
|
+
|
10
|
+
def setup
|
11
|
+
goto_page("pre.html")
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_Pre_Count
|
15
|
+
assert( browser.pres.length == 3 )
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_Pre_Exists
|
19
|
+
assert_false( browser.pre( :id, 'missingPre' ).exists? )
|
20
|
+
assert_false( browser.pre( :index, 33 ).exists? )
|
21
|
+
|
22
|
+
assert( browser.pre( :id, '1' ).exists? )
|
23
|
+
assert( browser.pre( :id, /[3-9]/ ).exists? )
|
24
|
+
|
25
|
+
assert_false( browser.pre( :id, /missing_pre/ ).exists? )
|
26
|
+
|
27
|
+
assert( browser.pre( :index, 1 ).exists? )
|
28
|
+
assert( browser.pre( :index, 2 ).exists? )
|
29
|
+
assert( browser.pre( :index, 3 ).exists? )
|
30
|
+
|
31
|
+
assert( browser.pre( :name, '3' ).exists? )
|
32
|
+
assert_false( browser.pre( :name, "name_missing" ).exists? )
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_simple_access
|
36
|
+
pre = browser.pre( :index, 1 )
|
37
|
+
assert( pre.text.include?( "simple pre space" ) )
|
38
|
+
assert_false( pre.text.include?( "A second block" ) )
|
39
|
+
|
40
|
+
pre = browser.pre( :index, 2 )
|
41
|
+
assert( pre.text.include?( "A second block" ) )
|
42
|
+
assert_false( pre.text.include?( "this is the last block" ) )
|
43
|
+
end
|
44
|
+
|
45
|
+
tag_method :test_embedded_spaces, :fails_on_firefox # http://jira.openqa.org/browse/WTR-267
|
46
|
+
def test_embedded_spaces
|
47
|
+
pre = browser.pre( :index, 3 )
|
48
|
+
assert( pre.text.include?( "continue to work" ) )
|
49
|
+
assert_false( pre.text.include?( "Pre Tag Test" ) )
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
class TC_Pres_Display < Test::Unit::TestCase
|
56
|
+
include CaptureIOHelper
|
57
|
+
|
58
|
+
tag_method :test_showPres, :fails_on_ie
|
59
|
+
def test_showPres
|
60
|
+
goto_page("pre.html")
|
61
|
+
actual = capture_stdout { browser.showPres }
|
62
|
+
assert_equal(<<END_OF_MESSAGE, actual)
|
63
|
+
There are 3 pres
|
64
|
+
pre: id: 1
|
65
|
+
name: 1
|
66
|
+
index: 1
|
67
|
+
pre: id: 2
|
68
|
+
name: 2
|
69
|
+
index: 2
|
70
|
+
pre: id: 3
|
71
|
+
name: 3
|
72
|
+
index: 3
|
73
|
+
END_OF_MESSAGE
|
74
|
+
end
|
75
|
+
end
|
@@ -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
|
+
|