firewatir 1.2.1 → 1.6.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.
Files changed (47) hide show
  1. data/lib/firewatir.rb +50 -0
  2. data/lib/firewatir/MozillaBaseElement.rb +1863 -0
  3. data/lib/firewatir/container.rb +534 -0
  4. data/lib/firewatir/exceptions.rb +10 -0
  5. data/lib/firewatir/firefox.rb +1127 -0
  6. data/lib/firewatir/htmlelements.rb +1911 -0
  7. data/lib/firewatir/version.rb +5 -0
  8. data/{firewatir → lib/firewatir}/winClicker.rb +0 -0
  9. data/{firewatir → lib/firewatir}/x11.rb +0 -0
  10. data/unittests/attach_to_new_window_test.rb +20 -12
  11. data/unittests/bug_fixes_test.rb +79 -69
  12. data/unittests/buttons_xpath_test.rb +45 -44
  13. data/unittests/checkbox_test.rb +86 -85
  14. data/unittests/checkbox_xpath_test.rb +58 -58
  15. data/unittests/div_test.rb +117 -115
  16. data/unittests/filefield_test.rb +12 -12
  17. data/unittests/filefield_xpath_test.rb +11 -11
  18. data/unittests/form_test.rb +134 -133
  19. data/unittests/frame_test.rb +42 -41
  20. data/unittests/hidden_test.rb +40 -40
  21. data/unittests/hidden_xpath_test.rb +32 -32
  22. data/unittests/images_test.rb +85 -84
  23. data/unittests/images_xpath_test.rb +57 -56
  24. data/unittests/iostring_test.rb +1 -1
  25. data/unittests/javascript_test.rb +42 -38
  26. data/unittests/links_test.rb +88 -86
  27. data/unittests/links_xpath_test.rb +38 -38
  28. data/unittests/mozilla_all_tests.rb +2 -14
  29. data/unittests/pre_test.rb +27 -25
  30. data/unittests/radios_test.rb +86 -86
  31. data/unittests/radios_xpath_test.rb +48 -48
  32. data/unittests/redirect_test.rb +20 -19
  33. data/unittests/selectbox_test.rb +72 -71
  34. data/unittests/selectbox_xpath_test.rb +58 -56
  35. data/unittests/setup.rb +22 -27
  36. data/unittests/table_test.rb +89 -88
  37. data/unittests/table_xpath_test.rb +37 -36
  38. data/unittests/textfields_test.rb +105 -102
  39. data/unittests/textfields_xpath_test.rb +53 -52
  40. metadata +37 -18
  41. data/MozillaBaseElement.rb +0 -1780
  42. data/container.rb +0 -900
  43. data/firewatir.rb +0 -1195
  44. data/firewatir/exceptions.rb +0 -44
  45. data/firewatir/testUnitAddons.rb +0 -8
  46. data/htmlelements.rb +0 -2281
  47. data/unittests/buttons_test.rb +0 -215
@@ -1,79 +1,79 @@
1
1
  # feature tests for Links
2
2
  # revision: $Revision: 1.0 $
3
3
 
4
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
4
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
5
5
  require 'unittests/setup'
6
6
 
7
7
  class TC_Links_XPath < Test::Unit::TestCase
8
- include FireWatir
9
-
8
+
10
9
  def setup()
11
- $ff.goto($htmlRoot + "links1.html")
10
+ goto_page("links1.html")
12
11
  end
13
12
 
14
13
  def xtest_new_link_exists
15
- assert(exists?{$ff.link(:xpath , "//a[contains(.,'test1')]")})
16
- assert(exists?{$ff.link(:xpath, "//a[contains(., /TEST/i)]")})
17
- assert_false(exists?{$ff.link(:xpath , "//a[contains(.,'missing')]")})
18
- assert_false(exists?{$ff.link(:xpath, "//a[contains(., /miss/)]")})
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/)]")})
19
18
  end
20
19
 
20
+ tag_method :test_element_by_xpath_class, :fails_on_ie
21
21
  def test_element_by_xpath_class
22
22
  # TODO: If element is not present this should return null
23
- #element = $ff.element_by_xpath("//a[contains(., /miss/)]")
23
+ #element = browser.element_by_xpath("//a[contains(., /miss/)]")
24
24
  #assert(element.instance_of?(Link),"element class should be #{Link}; got #{element.class}")
25
- #element = $ff.element_by_xpath("//a[contains(.,'missing')]")
25
+ #element = browser.element_by_xpath("//a[contains(.,'missing')]")
26
26
  #assert(element.instance_of?(Link),"element class should be #{Link}; got #{element.class}")
27
- element = $ff.element_by_xpath("//a[contains(., /TEST/i)]")
28
- assert(element.instance_of?(Link),"element class should be #{Link}; got #{element.class}")
29
- element = $ff.element_by_xpath("//a[contains(.,'test1')]")
30
- 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
31
  end
32
32
 
33
33
  def test_element_by_xpath_behavior
34
34
  # TODO implement this, acquiring objects through element_by_xpath and
35
35
  # then testing their properties to see if they behave normally, as if
36
- # they had been created with $ff.link
36
+ # they had been created with browser.link
37
37
  end
38
38
 
39
39
  def test_Link_Exists
40
- assert($ff.link(:xpath , "//a[contains(.,'test1')]").exists?)
41
- assert($ff.link(:xpath, "//a[contains(., /TEST/i)]").exists?)
42
- assert_false($ff.link(:xpath , "//a[contains(.,'missing')]").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
43
 
44
- assert_false($ff.link(:xpath , "//a[@url='alsomissing.html']").exists?)
44
+ assert_false(browser.link(:xpath , "//a[@url='alsomissing.html']").exists?)
45
45
 
46
- assert($ff.link(:xpath , "//a[@id='link_id']").exists?)
47
- assert_false($ff.link(:xpath , "//a[@id='alsomissing']").exists?)
46
+ assert(browser.link(:xpath , "//a[@id='link_id']").exists?)
47
+ assert_false(browser.link(:xpath , "//a[@id='alsomissing']").exists?)
48
48
 
49
- assert($ff.link(:xpath , "//a[@name='link_name']").exists?)
50
- assert_false($ff.link(:xpath , "//a[@name='alsomissing']").exists?)
51
- assert($ff.link(:xpath , "//a[@title='link_title']").exists?)
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
52
 
53
53
  end
54
54
 
55
55
  def test_Link_click
56
- $ff.link(:xpath , "//a[contains(.,'test1')]").click
57
- assert( $ff.text.include?("Links2-Pass") )
56
+ browser.link(:xpath , "//a[contains(.,'test1')]").click
57
+ assert( browser.text.include?("Links2-Pass") )
58
58
  end
59
59
 
60
60
  def test_link_properties
61
61
 
62
- assert_match( /links2/ ,$ff.link(:xpath , "//a[contains(.,'test1')]").href )
63
- assert_equal( "" , $ff.link(:xpath , "//a[contains(.,'test1')]").value)
64
- assert_equal( "test1" , $ff.link(:xpath , "//a[contains(.,'test1')]").text )
65
- assert_equal( "" , $ff.link(:xpath , "//a[contains(.,'test1')]").name )
66
- assert_equal( "" , $ff.link(:xpath , "//a[contains(.,'test1')]").id )
67
- #assert_equal( false , $ff.link(:xpath , "//a[contains(.,'test1')]").disabled )
68
- assert_equal( "" , $ff.link(:xpath , "//a[contains(.,'test1')]").class_name)
69
- assert_equal( "link_class_1" , $ff.link(:xpath , "//a[@class='link_class_1']").class_name)
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
70
 
71
- assert_equal( "link_id" , $ff.link(:xpath , "//a[@id='link_id']").id )
72
- assert_equal( "link_name" , $ff.link(:xpath , "//a[@name='link_name']").name )
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
73
 
74
- assert_equal( "" , $ff.link(:xpath , "//a[@name='link_name']").title)
74
+ assert_equal( "" , browser.link(:xpath , "//a[@name='link_name']").title)
75
75
 
76
- assert_equal( "link_title" , $ff.link(:xpath , "//a[@title='link_title']").title)
76
+ assert_equal( "link_title" , browser.link(:xpath , "//a[@title='link_title']").title)
77
77
  end
78
78
  end
79
79
 
@@ -1,19 +1,7 @@
1
- # these are the tests that run reliably and invisibly
2
-
3
1
  TOPDIR = File.expand_path(File.join(File.dirname(__FILE__), '..'))
4
2
  $LOAD_PATH.unshift TOPDIR
5
-
6
- puts $LOAD_PATH
7
- require 'unittests/setup.rb'
3
+ require 'unittests/setup'
8
4
 
9
5
  Dir.chdir TOPDIR
6
+ $all_tests.each {|x| require x }
10
7
 
11
- #tests = ["unittests/test.rb",
12
- # "unittests/test_xpath.rb"
13
- # ]
14
-
15
- #tests.each { |x| require x }
16
- $core_tests.each {|x| require x }
17
-
18
- #$HIDE_IE = true
19
- #$ff.visible = false
@@ -1,63 +1,65 @@
1
1
  # feature tests for Pre
2
2
  # revision: $Revision: 1.0 $
3
3
 
4
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __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
8
- include FireWatir
8
+
9
9
 
10
10
  def setup
11
- $ff.goto($htmlRoot + "pre.html")
11
+ goto_page("pre.html")
12
12
  end
13
13
 
14
14
  def test_Pre_Count
15
- assert( $ff.pres.length == 3 )
15
+ assert( browser.pres.length == 3 )
16
16
  end
17
17
 
18
18
  def test_Pre_Exists
19
- assert(! $ff.pre( :id, 'missingPre' ).exists? )
20
- assert(! $ff.pre( :index, 33 ).exists? )
19
+ assert_false( browser.pre( :id, 'missingPre' ).exists? )
20
+ assert_false( browser.pre( :index, 33 ).exists? )
21
21
 
22
- assert( $ff.pre( :id, '1' ).exists? )
23
- assert( $ff.pre( :id, /[3-9]/ ).exists? )
22
+ assert( browser.pre( :id, '1' ).exists? )
23
+ assert( browser.pre( :id, /[3-9]/ ).exists? )
24
24
 
25
- assert(! $ff.pre( :id, /missing_pre/ ).exists? )
25
+ assert_false( browser.pre( :id, /missing_pre/ ).exists? )
26
26
 
27
- assert( $ff.pre( :index, 1 ).exists? )
28
- assert( $ff.pre( :index, 2 ).exists? )
29
- assert( $ff.pre( :index, 3 ).exists? )
27
+ assert( browser.pre( :index, 1 ).exists? )
28
+ assert( browser.pre( :index, 2 ).exists? )
29
+ assert( browser.pre( :index, 3 ).exists? )
30
30
 
31
- assert( $ff.pre( :name, '3' ).exists? )
32
- assert(! $ff.pre( :name, "name_missing" ).exists? )
31
+ assert( browser.pre( :name, '3' ).exists? )
32
+ assert_false( browser.pre( :name, "name_missing" ).exists? )
33
33
  end
34
34
 
35
35
  def test_simple_access
36
- pre = $ff.pre( :index, 1 )
36
+ pre = browser.pre( :index, 1 )
37
37
  assert( pre.text.include?( "simple pre space" ) )
38
- assert(! pre.text.include?( "A second block" ) )
38
+ assert_false( pre.text.include?( "A second block" ) )
39
39
 
40
- pre = $ff.pre( :index, 2 )
40
+ pre = browser.pre( :index, 2 )
41
41
  assert( pre.text.include?( "A second block" ) )
42
- assert(! pre.text.include?( "this is the last block" ) )
43
-
44
- pre = $ff.pre( :index, 3 )
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 )
45
48
  assert( pre.text.include?( "continue to work" ) )
46
- assert(! pre.text.include?( "Pre Tag Test" ) )
47
-
49
+ assert_false( pre.text.include?( "Pre Tag Test" ) )
48
50
  end
49
51
 
50
52
  end
51
53
 
52
54
 
53
55
  class TC_Pres_Display < Test::Unit::TestCase
54
- include FireWatir
55
56
  include MockStdoutTestCase
56
57
 
58
+ tag_method :test_showPres, :fails_on_ie
57
59
  def test_showPres
58
- $ff.goto($htmlRoot + "pre.html")
60
+ goto_page("pre.html")
59
61
  $stdout = @mockout
60
- $ff.showPres
62
+ browser.showPres
61
63
  assert_equal(<<END_OF_MESSAGE, @mockout)
62
64
  There are 3 pres
63
65
  pre: id: 1
@@ -1,164 +1,164 @@
1
1
  # feature tests for Radio Buttons
2
2
  # revision: $Revision: 1.0 $
3
3
 
4
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __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
8
- include FireWatir
8
+
9
9
 
10
10
  def setup()
11
- $ff.goto($htmlRoot + "radioButtons1.html")
11
+ goto_page("radioButtons1.html")
12
12
  end
13
13
 
14
14
  def test_Radio_Exists
15
- assert($ff.radio(:name, "box1").exists?)
16
- assert($ff.radio(:id, "box5").exists?)
15
+ assert(browser.radio(:name, "box1").exists?)
16
+ assert(browser.radio(:id, "box5").exists?)
17
17
 
18
- assert_false($ff.radio(:name, "missingname").exists?)
19
- assert_false($ff.radio(:id, "missingid").exists?)
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 , "UnknownObjectException was supposed to be thrown" ) { $ff.radio(:name, "noName").class_name }
24
- assert_equal("radio_style" , $ff.radio(:name, "box1").class_name)
25
- assert_equal("" , $ff.radio(:id, "box5").class_name)
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" ) { $ff.radio(:name, "noName").enabled? }
30
- assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ff.radio(:id, "noName").enabled? }
31
- assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ff.radio(:name, "box4" , 6).enabled? }
29
+ assert_raises(UnknownObjectException) { browser.radio(:name, "noName").enabled? }
30
+ assert_raises(UnknownObjectException) { browser.radio(:id, "noName").enabled? }
31
+ assert_raises(UnknownObjectException) { browser.radio(:name, "box4" , 6).enabled? }
32
32
 
33
- assert_false($ff.radio(:name, "box2").enabled?)
34
- assert($ff.radio(:id, "box5").enabled?)
35
- assert($ff.radio(:name, "box1").enabled?)
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
- assert_false($ff.button(:value , "foo").enabled?)
39
+ assert_false(browser.button(:value , "foo").enabled?)
40
40
  end
41
41
 
42
42
  def test_onClick
43
43
 
44
- assert_false($ff.radio(:name, "box5").isSet?)
45
- assert_false($ff.button(:value , "foo").enabled?)
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
- $ff.radio(:name, "box5" , 1).click
49
- assert($ff.radio(:name, "box5",1).isSet?)
50
- #assert($ff.button(:value , "foo").enabled?)
48
+ browser.radio(:name, "box5" , 1).click
49
+ assert(browser.radio(:name, "box5",1).isSet?)
50
+ #assert(browser.button(:value , "foo").enabled?)
51
51
 
52
52
  # second click the button is disabled and the radio is still set
53
- $ff.radio(:name, "box5", 1).click
54
- assert($ff.radio(:name, "box5",1).isSet?)
55
- assert_false($ff.button(:value , "foo").enabled?)
53
+ browser.radio(:name, "box5", 1).click
54
+ assert(browser.radio(:name, "box5",1).isSet?)
55
+ assert_false(browser.button(:value , "foo").enabled?)
56
56
 
57
57
  # third click the button is enabled and the radio is still set
58
- $ff.radio(:name, "box5", 1).click
59
- assert($ff.radio(:name, "box5",1 ).isSet?)
60
- assert($ff.button(:value , "foo").enabled?)
58
+ browser.radio(:name, "box5", 1).click
59
+ assert(browser.radio(:name, "box5",1 ).isSet?)
60
+ assert(browser.button(:value , "foo").enabled?)
61
61
 
62
62
  # click the radio with a value of 2 , button is disabled and the radio is still set
63
- $ff.radio(:name, "box5", 2).click
64
- assert_false($ff.radio(:name, "box5" ,1).isSet?)
65
- assert($ff.radio(:name, "box5" ,2).isSet?)
66
- assert_false($ff.button(:value , "foo").enabled?)
63
+ browser.radio(:name, "box5", 2).click
64
+ assert_false(browser.radio(:name, "box5" ,1).isSet?)
65
+ assert(browser.radio(:name, "box5" ,2).isSet?)
66
+ assert_false(browser.button(:value , "foo").enabled?)
67
67
  end
68
68
 
69
69
  def test_Radio_isSet
70
- assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ff.radio(:name, "noName").isSet? }
70
+ assert_raises(UnknownObjectException) { browser.radio(:name, "noName").isSet? }
71
71
 
72
- assert_false($ff.radio(:name, "box1").isSet?)
73
- assert( $ff.radio(:name, "box3").isSet?)
74
- assert_false($ff.radio(:name, "box2").isSet?)
75
- assert( $ff.radio(:name, "box4" , 1 ).isSet?)
76
- assert_false($ff.radio(:name, "box4" , 2 ).isSet?)
72
+ assert_false(browser.radio(:name, "box1").isSet?)
73
+ assert( browser.radio(:name, "box3").isSet?)
74
+ assert_false(browser.radio(:name, "box2").isSet?)
75
+ assert( browser.radio(:name, "box4" , 1 ).isSet?)
76
+ assert_false(browser.radio(:name, "box4" , 2 ).isSet?)
77
77
  end
78
78
 
79
79
  def test_radio_clear
80
- assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ff.radio(:name, "noName").clear }
80
+ assert_raises(UnknownObjectException) { browser.radio(:name, "noName").clear }
81
81
 
82
- $ff.radio(:name, "box1").clear
83
- assert_false($ff.radio(:name, "box1").isSet?)
82
+ browser.radio(:name, "box1").clear
83
+ assert_false(browser.radio(:name, "box1").isSet?)
84
84
 
85
- assert_raises(ObjectDisabledException, "ObjectDisabledException was supposed to be thrown" ) { $ff.radio(:name, "box2").clear }
86
- assert_false($ff.radio(:name, "box2").isSet?)
85
+ assert_raises(ObjectDisabledException, "ObjectDisabledException was supposed to be thrown" ) { browser.radio(:name, "box2").clear }
86
+ assert_false(browser.radio(:name, "box2").isSet?)
87
87
 
88
- $ff.radio(:name, "box3").clear
89
- assert_false($ff.radio(:name, "box3").isSet?)
88
+ browser.radio(:name, "box3").clear
89
+ assert_false(browser.radio(:name, "box3").isSet?)
90
90
 
91
- $ff.radio(:name, "box4" , 1).clear
92
- assert_false($ff.radio(:name, "box4" , 1).isSet?)
91
+ browser.radio(:name, "box4" , 1).clear
92
+ assert_false(browser.radio(:name, "box4" , 1).isSet?)
93
93
  end
94
94
 
95
95
  def test_radio_getState
96
- assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ff.radio(:name, "noName").getState }
96
+ assert_raises(UnknownObjectException) { browser.radio(:name, "noName").getState }
97
97
 
98
- assert_equal( false , $ff.radio(:name, "box1").getState )
99
- assert_equal( true , $ff.radio(:name, "box3").getState)
98
+ assert_equal( false , browser.radio(:name, "box1").getState )
99
+ assert_equal( true , browser.radio(:name, "box3").getState)
100
100
 
101
101
  # radioes that have the same name but different values
102
- assert_equal( false , $ff.radio(:name, "box4" , 2).getState )
103
- assert_equal( true , $ff.radio(:name, "box4" , 1).getState)
102
+ assert_equal( false , browser.radio(:name, "box4" , 2).getState )
103
+ assert_equal( true , browser.radio(:name, "box4" , 1).getState)
104
104
  end
105
105
 
106
106
  def test_radio_set
107
- assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ff.radio(:name, "noName").set }
108
- $ff.radio(:name, "box1").set
109
- assert($ff.radio(:name, "box1").isSet?)
107
+ assert_raises(UnknownObjectException) { browser.radio(:name, "noName").set }
108
+ browser.radio(:name, "box1").set
109
+ assert(browser.radio(:name, "box1").isSet?)
110
110
 
111
- assert_raises(ObjectDisabledException, "ObjectDisabledException was supposed to be thrown" ) { $ff.radio(:name, "box2").set }
111
+ assert_raises(ObjectDisabledException, "ObjectDisabledException was supposed to be thrown" ) { browser.radio(:name, "box2").set }
112
112
 
113
- $ff.radio(:name, "box3").set
114
- assert($ff.radio(:name, "box3").isSet?)
113
+ browser.radio(:name, "box3").set
114
+ assert(browser.radio(:name, "box3").isSet?)
115
115
 
116
116
  # radioes that have the same name but different values
117
- $ff.radio(:name, "box4" , 3).set
118
- assert($ff.radio(:name, "box4" , 3).isSet?)
117
+ browser.radio(:name, "box4" , 3).set
118
+ assert(browser.radio(:name, "box4" , 3).isSet?)
119
119
  end
120
120
 
121
121
  def test_radio_properties
122
122
 
123
- assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ff.radio(:index, 199).value}
124
- assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ff.radio(:index, 199).name }
125
- assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ff.radio(:index, 199).id }
126
- assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ff.radio(:index, 199).disabled }
127
- assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ff.radio(:index, 199).type }
123
+ assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { browser.radio(:index, 199).value}
124
+ assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { browser.radio(:index, 199).name }
125
+ assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { browser.radio(:index, 199).id }
126
+ assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { browser.radio(:index, 199).disabled }
127
+ assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { browser.radio(:index, 199).type }
128
128
 
129
- assert_equal("on" , $ff.radio(:index, 1).value)
130
- assert_equal("box1" , $ff.radio(:index, 1).name )
131
- assert_equal("" , $ff.radio(:index, 1).id )
132
- assert_equal("radio", $ff.radio(:index, 1).type )
129
+ assert_equal("on" , browser.radio(:index, 1).value)
130
+ assert_equal("box1" , browser.radio(:index, 1).name )
131
+ assert_equal("" , browser.radio(:index, 1).id )
132
+ assert_equal("radio", browser.radio(:index, 1).type )
133
133
 
134
- assert_equal( false, $ff.radio(:index, 1).disabled )
135
- assert_equal( true, $ff.radio(:index, 3).disabled )
134
+ assert_equal( false, browser.radio(:index, 1).disabled )
135
+ assert_equal( true, browser.radio(:index, 3).disabled )
136
136
 
137
- assert_equal("box5" , $ff.radio(:index, 2).id )
138
- assert_equal("" , $ff.radio(:index, 2).name )
137
+ assert_equal("box5" , browser.radio(:index, 2).id )
138
+ assert_equal("" , browser.radio(:index, 2).name )
139
139
 
140
- assert_equal("box4-value5", $ff.radio(:name , "box4" , 5 ).title )
141
- assert_equal("", $ff.radio(:name , "box4" , 4 ).title )
140
+ assert_equal("box4-value5", browser.radio(:name , "box4" , 5 ).title )
141
+ assert_equal("", browser.radio(:name , "box4" , 4 ).title )
142
142
 
143
143
 
144
144
  end
145
145
 
146
146
  def test_radio_iterators
147
147
 
148
- assert_equal(11, $ff.radios.length)
149
- assert_equal("box5" , $ff.radios[2].id )
150
- assert_equal(true , $ff.radios[3].disabled )
151
- assert_equal(false , $ff.radios[1].disabled )
148
+ assert_equal(11, browser.radios.length)
149
+ assert_equal("box5" , browser.radios[2].id )
150
+ assert_equal(true , browser.radios[3].disabled )
151
+ assert_equal(false , browser.radios[1].disabled )
152
152
  index = 1
153
- $ff.radios.each do |r|
154
- assert_equal( $ff.radio(:index, index).name , r.name )
155
- assert_equal( $ff.radio(:index, index).id , r.id )
156
- assert_equal( $ff.radio(:index, index).value, r.value)
157
- assert_equal( $ff.radio(:index, index).disabled , r.disabled )
158
- assert_equal( $ff.radio(:index, index).isSet? , r.isSet? )
153
+ browser.radios.each do |r|
154
+ assert_equal( browser.radio(:index, index).name , r.name )
155
+ assert_equal( browser.radio(:index, index).id , r.id )
156
+ assert_equal( browser.radio(:index, index).value, r.value)
157
+ assert_equal( browser.radio(:index, index).disabled , r.disabled )
158
+ assert_equal( browser.radio(:index, index).isSet? , r.isSet? )
159
159
  index+=1
160
160
  end
161
- assert_equal(index -1, $ff.radios.length)
161
+ assert_equal(index -1, browser.radios.length)
162
162
  end
163
163
 
164
164