watir 1.5.6 → 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. data/{changes.rb → CHANGES} +12 -3
  2. data/bin/watir-console +7 -1
  3. data/lib/changes.rb +3 -0
  4. data/{license.rb → lib/license.rb} +2 -1
  5. data/{readme.rb → lib/readme.rb} +4 -6
  6. data/{watir → lib/watir}/AutoItX3.dll +0 -0
  7. data/{watir → lib/watir}/IEDialog/Release/IEDialog.dll +0 -0
  8. data/{watir → lib/watir}/WindowHelper.rb +1 -1
  9. data/{watir → lib/watir}/camel_case.rb +0 -0
  10. data/{watir → lib/watir}/clickJSDialog.rb +0 -0
  11. data/{watir → lib/watir}/close_all.rb +1 -1
  12. data/{watir → lib/watir}/collections.rb +1 -1
  13. data/{watir → lib/watir}/container.rb +17 -8
  14. data/{watir → lib/watir}/contrib/enabled_popup.rb +0 -0
  15. data/{watir → lib/watir}/contrib/ie-new-process.rb +0 -0
  16. data/{watir → lib/watir}/contrib/page_checker.rb +0 -0
  17. data/{watir → lib/watir}/contrib/visible.rb +2 -2
  18. data/{watir → lib/watir}/cookiemanager.rb +0 -0
  19. data/{watir → lib/watir}/datahandler.rb +0 -0
  20. data/{watir → lib/watir}/dialog.rb +1 -1
  21. data/{watir → lib/watir}/element.rb +3 -7
  22. data/{watir → lib/watir}/element_collections.rb +0 -0
  23. data/{watir → lib/watir}/form.rb +31 -11
  24. data/{watir → lib/watir}/frame.rb +0 -0
  25. data/{watir/ie.rb → lib/watir/ie-class.rb} +22 -22
  26. data/{watir → lib/watir}/ie-process.rb +0 -0
  27. data/{watir.rb → lib/watir/ie.rb} +11 -27
  28. data/{watir → lib/watir}/image.rb +0 -0
  29. data/{watir → lib/watir}/input_elements.rb +33 -44
  30. data/{watir → lib/watir}/irb-history.rb +0 -0
  31. data/{watir → lib/watir}/link.rb +0 -0
  32. data/{watir → lib/watir}/locator.rb +56 -43
  33. data/{watir → lib/watir}/logger.rb +0 -0
  34. data/{watir → lib/watir}/modal_dialog.rb +0 -0
  35. data/{watir → lib/watir}/non_control_elements.rb +0 -0
  36. data/{watir → lib/watir}/page-container.rb +2 -2
  37. data/{watir → lib/watir}/popup.rb +0 -0
  38. data/{watir → lib/watir}/process.rb +0 -0
  39. data/{watir → lib/watir}/screen_capture.rb +0 -0
  40. data/{watir → lib/watir}/setFileDialog.rb +0 -0
  41. data/{watir → lib/watir}/table.rb +7 -2
  42. data/{watir → lib/watir}/utils.rb +0 -0
  43. data/lib/watir/version.rb +5 -0
  44. data/{watir → lib/watir}/watir_simple.rb +3 -3
  45. data/{watir → lib/watir}/win32.rb +0 -0
  46. data/lib/watir/win32ole.rb +6 -0
  47. data/lib/watir/win32ole/win32ole.so +0 -0
  48. data/{watir → lib/watir}/winClicker.rb +0 -0
  49. data/unittests/buttons_xpath_test.rb +32 -32
  50. data/unittests/checkbox_test.rb +113 -99
  51. data/unittests/checkbox_xpath_test.rb +57 -57
  52. data/unittests/core_tests.rb +10 -7
  53. data/unittests/css_test.rb +12 -32
  54. data/unittests/defer_test.rb +22 -22
  55. data/unittests/dialog_test.rb +13 -13
  56. data/unittests/div2_xpath_test.rb +3 -3
  57. data/unittests/div_test.rb +23 -19
  58. data/unittests/div_xpath_test.rb +50 -50
  59. data/unittests/errorchecker_test.rb +7 -9
  60. data/unittests/filefield_test.rb +12 -11
  61. data/unittests/filefield_xpath_test.rb +10 -10
  62. data/unittests/form_test.rb +144 -151
  63. data/unittests/form_xpath_test.rb +99 -99
  64. data/unittests/frame_test.rb +46 -44
  65. data/unittests/google_form_test.rb +2 -2
  66. data/unittests/html/checkboxes1.html +19 -16
  67. data/unittests/html/forms3.html +2 -2
  68. data/unittests/html/wallofcheckboxes.html +1003 -0
  69. data/unittests/ie_exists_test.rb +5 -3
  70. data/unittests/ie_test.rb +2 -2
  71. data/unittests/images_test.rb +83 -82
  72. data/unittests/images_xpath_test.rb +40 -40
  73. data/unittests/iostring_test.rb +1 -1
  74. data/unittests/links_multi_test.rb +7 -8
  75. data/unittests/links_test.rb +73 -71
  76. data/unittests/links_xpath_test.rb +15 -15
  77. data/unittests/lists_test.rb +10 -10
  78. data/unittests/map_test.rb +65 -65
  79. data/unittests/minmax_test.rb +10 -9
  80. data/unittests/navigate_test.rb +19 -23
  81. data/unittests/nbsp_xpath_test.rb +2 -2
  82. data/unittests/non_core_tests.rb +5 -2
  83. data/unittests/other/WindowLogonExample.rb +2 -2
  84. data/unittests/other/WindowLogonExtra.rb +1 -1
  85. data/unittests/other/navigate_exception_test.rb +14 -3
  86. data/unittests/other/screen_capture_test.rb +3 -2
  87. data/unittests/other/testcase_method_order_test.rb +1 -1
  88. data/unittests/pagecontainstext_test.rb +17 -14
  89. data/unittests/parent_child_test.rb +11 -7
  90. data/unittests/perf_test.rb +20 -0
  91. data/unittests/popups_test.rb +13 -14
  92. data/unittests/pre_test.rb +30 -28
  93. data/unittests/radios_test.rb +128 -107
  94. data/unittests/radios_xpath_test.rb +47 -47
  95. data/unittests/security_setting_test.rb +24 -0
  96. data/unittests/selectbox_test.rb +65 -157
  97. data/unittests/selectbox_xpath_test.rb +51 -51
  98. data/unittests/setup.rb +52 -48
  99. data/unittests/speed_settings_test.rb +31 -20
  100. data/unittests/table_cell_using_xpath_test.rb +12 -12
  101. data/unittests/table_test.rb +30 -16
  102. data/unittests/table_xpath_test.rb +25 -25
  103. data/unittests/test_tests.rb +9 -0
  104. data/unittests/textarea_test.rb +33 -33
  105. data/unittests/textarea_xpath_test.rb +37 -37
  106. data/unittests/textfield_for_ch_char_test.rb +9 -9
  107. data/unittests/textfields_test.rb +103 -98
  108. data/unittests/textfields_xpath_test.rb +50 -50
  109. data/unittests/windows/attach_to_existing_window_test.rb +2 -2
  110. data/unittests/windows/attach_to_new_window_test.rb +10 -10
  111. data/unittests/windows/close_window_test.rb +2 -2
  112. data/unittests/windows/frame_links_test.rb +6 -6
  113. data/unittests/windows/ie-each_test.rb +1 -1
  114. data/unittests/windows/iedialog_test.rb +4 -5
  115. data/unittests/windows/js_events_test.rb +14 -14
  116. data/unittests/windows/jscriptExtraAlert.rb +2 -1
  117. data/unittests/windows/jscriptExtraConfirmCancel.rb +1 -1
  118. data/unittests/windows/jscriptExtraConfirmOk.rb +1 -1
  119. data/unittests/windows/jscriptPushButton.rb +2 -1
  120. data/unittests/windows/jscript_test.rb +7 -7
  121. data/unittests/windows/modal_dialog_test.rb +28 -29
  122. data/unittests/windows/{new.rb → new_test.rb} +1 -1
  123. data/unittests/windows/open_close_test.rb +4 -7
  124. data/unittests/windows/send_keys_test.rb +11 -11
  125. data/unittests/xpath_tests.rb +4 -3
  126. metadata +82 -58
  127. data/unittests/buttons_test.rb +0 -107
  128. data/watir/assertions.rb +0 -44
  129. data/watir/exceptions.rb +0 -42
  130. data/watir/testcase.rb +0 -58
  131. data/watir/waiter.rb +0 -88
  132. data/watir/win32ole.rb +0 -8
  133. data/watir/win32ole/win32ole.so +0 -0
@@ -1,7 +1,7 @@
1
1
  # feature tests for Text Fields
2
- # revision: $Revision: 1348 $
2
+ # revision: $Revision: 1544 $
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_Fields_XPath < Test::Unit::TestCase
@@ -12,48 +12,48 @@ class TC_Fields_XPath < Test::Unit::TestCase
12
12
  end
13
13
 
14
14
  def test_text_field_exists
15
- assert($ie.text_field(:xpath , "//input[@name='text1']/").exists?)
16
- assert(!$ie.text_field(:xpath , "//input[@name='missing']/").exists?)
15
+ assert(browser.text_field(:xpath , "//input[@name='text1']/").exists?)
16
+ assert_false(browser.text_field(:xpath , "//input[@name='missing']/").exists?)
17
17
 
18
- assert($ie.text_field(:xpath , "//input[@id='text2']/").exists?)
19
- assert(!$ie.text_field(:xpath , "//input[@id='alsomissing']/").exists?)
18
+ assert(browser.text_field(:xpath , "//input[@id='text2']/").exists?)
19
+ assert_false(browser.text_field(:xpath , "//input[@id='alsomissing']/").exists?)
20
20
 
21
- #assert($ie.text_field(:xpath , "//input[@beforeText='This Text After']/").exists? )
22
- #assert($ie.text_field(:xpath , "//input[@afterText='This Text Before']/").exists? )
21
+ #assert(browser.text_field(:xpath , "//input[@beforeText='This Text After']/").exists? )
22
+ #assert(browser.text_field(:xpath , "//input[@afterText='This Text Before']/").exists? )
23
23
  end
24
24
 
25
25
  def test_text_field_dragContentsTo
26
- $ie.text_field(:xpath , "//input[@name='text1']/").dragContentsTo(:xpath , "//input[@id='text2']/")
27
- assert_equal($ie.text_field(:xpath , "//input[@name='text1']/").value, "" )
28
- assert_equal($ie.text_field(:xpath , "//input[@id='text2']/").value, "goodbye allHello World" )
26
+ browser.text_field(:xpath , "//input[@name='text1']/").dragContentsTo(:xpath , "//input[@id='text2']/")
27
+ assert_equal(browser.text_field(:xpath , "//input[@name='text1']/").value, "" )
28
+ assert_equal(browser.text_field(:xpath , "//input[@id='text2']/").value, "goodbye allHello World" )
29
29
  end
30
30
 
31
31
  def test_text_field_VerifyContents
32
- assert($ie.text_field(:xpath , "//input[@name='text1']/").verify_contains("Hello World") )
33
- assert($ie.text_field(:xpath , "//input[@name='text1']/").verify_contains(/Hello\sW/ ) )
34
- assert(!$ie.text_field(:xpath , "//input[@name='text1']/").verify_contains("Ruby") )
35
- assert(!$ie.text_field(:xpath , "//input[@name='text1']/").verify_contains(/R/) )
36
- assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.text_field(:xpath , "//input[@name='NoName']/").verify_contains("No field to get a value of") }
32
+ assert(browser.text_field(:xpath , "//input[@name='text1']/").verify_contains("Hello World") )
33
+ assert(browser.text_field(:xpath , "//input[@name='text1']/").verify_contains(/Hello\sW/ ) )
34
+ assert_false(browser.text_field(:xpath , "//input[@name='text1']/").verify_contains("Ruby") )
35
+ assert_false(browser.text_field(:xpath , "//input[@name='text1']/").verify_contains(/R/) )
36
+ assert_raises(UnknownObjectException) { browser.text_field(:xpath , "//input[@name='NoName']/").verify_contains("No field to get a value of") }
37
37
 
38
- assert($ie.text_field(:xpath , "//input[@id='text2']/").verify_contains("goodbye all") )
39
- assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.text_field(:xpath , "//input[@id='noID']/").verify_contains("No field to get a value of") }
38
+ assert(browser.text_field(:xpath , "//input[@id='text2']/").verify_contains("goodbye all") )
39
+ assert_raises(UnknownObjectException) { browser.text_field(:xpath , "//input[@id='noID']/").verify_contains("No field to get a value of") }
40
40
  end
41
41
 
42
42
  def test_text_field_enabled
43
- assert(!$ie.text_field(:xpath , "//input[@name='disabled']/").enabled? )
44
- assert($ie.text_field(:xpath , "//input[@name='text1']/").enabled? )
45
- assert($ie.text_field(:xpath , "//input[@id='text2']/").enabled? )
43
+ assert_false(browser.text_field(:xpath , "//input[@name='disabled']/").enabled? )
44
+ assert(browser.text_field(:xpath , "//input[@name='text1']/").enabled? )
45
+ assert(browser.text_field(:xpath , "//input[@id='text2']/").enabled? )
46
46
  end
47
47
 
48
48
  def test_text_field_readOnly
49
- assert(!$ie.text_field(:xpath , "//input[@name='disabled']/").readonly? )
50
- assert($ie.text_field(:xpath , "//input[@name='readOnly']/").readonly? )
51
- assert($ie.text_field(:xpath , "//input[@id='readOnly2']/").readonly? )
49
+ assert_false(browser.text_field(:xpath , "//input[@name='disabled']/").readonly? )
50
+ assert(browser.text_field(:xpath , "//input[@name='readOnly']/").readonly? )
51
+ assert(browser.text_field(:xpath , "//input[@id='readOnly2']/").readonly? )
52
52
  end
53
53
 
54
54
  def test_text_field_value
55
- assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:xpath , "//input[@name='missing_field']/").append("Some Text") }
56
- assert_equal( "Hello World" , $ie.text_field(:xpath , "//input[@name='text1']/").value )
55
+ assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//input[@name='missing_field']/").append("Some Text") }
56
+ assert_equal( "Hello World" , browser.text_field(:xpath , "//input[@name='text1']/").value )
57
57
  end
58
58
 
59
59
  def build_to_s_regex(lhs, rhs)
@@ -61,51 +61,51 @@ class TC_Fields_XPath < Test::Unit::TestCase
61
61
  end
62
62
 
63
63
  def test_text_field_Append
64
- assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:xpath , "//input[@id='readOnly2']/").append("Some Text") }
65
- assert_raises(ObjectDisabledException , "ObjectDisabledException was supposed to be thrown" ) { $ie.text_field(:xpath , "//input[@name='disabled']/").append("Some Text") }
66
- assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.text_field(:xpath , "//input[@name='missing_field']/").append("Some Text") }
64
+ assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//input[@id='readOnly2']/").append("Some Text") }
65
+ assert_raises(ObjectDisabledException , "ObjectDisabledException was supposed to be thrown" ) { browser.text_field(:xpath , "//input[@name='disabled']/").append("Some Text") }
66
+ assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { browser.text_field(:xpath , "//input[@name='missing_field']/").append("Some Text") }
67
67
 
68
- $ie.text_field(:xpath , "//input[@name='text1']/").append(" Some Text")
69
- assert_equal( "Hello World Some Text" , $ie.text_field(:xpath , "//input[@name='text1']/").value )
68
+ browser.text_field(:xpath , "//input[@name='text1']/").append(" Some Text")
69
+ assert_equal( "Hello World Some Text" , browser.text_field(:xpath , "//input[@name='text1']/").value )
70
70
  end
71
71
 
72
72
 
73
73
  def test_text_field_Clear
74
- assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:xpath , "//input[@id='readOnly2']/").append("Some Text") }
75
- assert_raises(ObjectDisabledException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:xpath , "//input[@name='disabled']/").append("Some Text") }
76
- assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:xpath , "//input[@name='missing_field']/").append("Some Text") }
74
+ assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//input[@id='readOnly2']/").append("Some Text") }
75
+ assert_raises(ObjectDisabledException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//input[@name='disabled']/").append("Some Text") }
76
+ assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//input[@name='missing_field']/").append("Some Text") }
77
77
 
78
- $ie.text_field(:xpath , "//input[@name='text1']/").clear
79
- assert_equal( "" , $ie.text_field(:xpath , "//input[@name='text1']/").value )
78
+ browser.text_field(:xpath , "//input[@name='text1']/").clear
79
+ assert_equal( "" , browser.text_field(:xpath , "//input[@name='text1']/").value )
80
80
  end
81
81
 
82
82
  def test_text_field_Set
83
- assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:xpath , "//input[@id='readOnly2']/").append("Some Text") }
84
- assert_raises(ObjectDisabledException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:xpath , "//input[@name='disabled']/").append("Some Text") }
85
- assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:xpath , "//input[@name='missing_field']/").append("Some Text") }
83
+ assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//input[@id='readOnly2']/").append("Some Text") }
84
+ assert_raises(ObjectDisabledException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//input[@name='disabled']/").append("Some Text") }
85
+ assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//input[@name='missing_field']/").append("Some Text") }
86
86
 
87
- $ie.text_field(:xpath , "//input[@name='text1']/").set("watir IE Controller")
88
- assert_equal( "watir IE Controller" , $ie.text_field(:xpath , "//input[@name='text1']/").value )
87
+ browser.text_field(:xpath , "//input[@name='text1']/").set("watir IE Controller")
88
+ assert_equal( "watir IE Controller" , browser.text_field(:xpath , "//input[@name='text1']/").value )
89
89
  end
90
90
 
91
91
  def test_JS_Events
92
- $ie.text_field(:xpath , "//input[@name='events_tester']/").set('p')
92
+ browser.text_field(:xpath , "//input[@name='events_tester']/").set('p')
93
93
 
94
94
  # the following line has an extra keypress at the begining, as we mimic the delete key being pressed
95
- assert_equal( "keypresskeydownkeypresskeyup" , $ie.text_field(:xpath , "//textarea[@name='events_text']/").value.gsub("\r\n" , "") )
96
- $ie.button(:value , "Clear Events Box").click
97
- $ie.text_field(:xpath , "//input[@name='events_tester']/").set('ab')
95
+ assert_equal( "keypresskeydownkeypresskeyup" , browser.text_field(:xpath , "//textarea[@name='events_text']/").value.gsub("\r\n" , "") )
96
+ browser.button(:value , "Clear Events Box").click
97
+ browser.text_field(:xpath , "//input[@name='events_tester']/").set('ab')
98
98
 
99
99
  # the following line has an extra keypress at the begining, as we mimic the delete key being pressed
100
- assert_equal( "keypresskeydownkeypresskeyupkeydownkeypresskeyup" , $ie.text_field(:xpath , "//textarea[@name='events_text']/").value.gsub("\r\n" , "") )
100
+ assert_equal( "keypresskeydownkeypresskeyupkeydownkeypresskeyup" , browser.text_field(:xpath , "//textarea[@name='events_text']/").value.gsub("\r\n" , "") )
101
101
  end
102
102
 
103
103
  def test_password
104
- $ie.text_field(:xpath , "//input[@name='password1']/").set("secret")
105
- assert( 'secret' , $ie.text_field(:xpath , "//input[@name='password1']/").value )
104
+ browser.text_field(:xpath , "//input[@name='password1']/").set("secret")
105
+ assert( 'secret' , browser.text_field(:xpath , "//input[@name='password1']/").value )
106
106
 
107
- $ie.text_field(:xpath , "//input[@id='password1']/").set("top_secret")
108
- assert( 'top_secret' , $ie.text_field(:xpath , "//input[@id='password1']/").value )
107
+ browser.text_field(:xpath , "//input[@id='password1']/").set("top_secret")
108
+ assert( 'top_secret' , browser.text_field(:xpath , "//input[@id='password1']/").value )
109
109
  end
110
110
 
111
111
  end
@@ -1,7 +1,7 @@
1
1
  # feature tests for attaching to existing IE windows
2
- # revision: $Revision: 1348 $
2
+ # revision: $Revision: 1417 $
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_ExistingWindow< Test::Unit::TestCase
@@ -1,7 +1,7 @@
1
1
  # feature tests for attaching to new IE windows
2
- # revision: $Revision: 1348 $
2
+ # revision: $Revision: 1544 $
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
  require 'watir/testcase'
7
7
 
@@ -17,14 +17,14 @@ class TC_NewWindow< Watir::TestCase
17
17
 
18
18
  def test_simply_attach_to_new_window
19
19
  IE.attach_timeout = 0.2
20
- $ie.link(:text, 'New Window').click
20
+ browser.link(:text, 'New Window').click
21
21
  ie_new = IE.attach(:title, 'Pass Page')
22
22
  assert(ie_new.text.include?('PASS'))
23
23
  ie_new.close
24
24
  end
25
25
 
26
26
  def test_attach_to_new_window_using_separate_process
27
- $ie.eval_in_spawned_process "link(:text, 'New Window').click"
27
+ browser.eval_in_spawned_process "link(:text, 'New Window').click"
28
28
  IE.attach_timeout = 6.0
29
29
  ie_new = IE.attach(:title, 'Pass Page')
30
30
  assert(ie_new.text.include?('PASS'))
@@ -35,7 +35,7 @@ class TC_NewWindow< Watir::TestCase
35
35
  # this test is sometimes failing with a "Canvas does not allow drawing" error
36
36
  # this is with IE7. I think the problem could be with the highlighting of the
37
37
  # button from the separate process.
38
- $ie.link(:text, 'New Window').click_no_wait
38
+ browser.link(:text, 'New Window').click_no_wait
39
39
  IE.attach_timeout = 6.0
40
40
  ie_new = IE.attach(:title, 'Pass Page')
41
41
  assert(ie_new.text.include?('PASS'))
@@ -43,7 +43,7 @@ class TC_NewWindow< Watir::TestCase
43
43
  end
44
44
 
45
45
  def test_click_no_wait_works_in_a_container
46
- $ie.p(:index, 1).link(:text, 'New Window').click_no_wait
46
+ browser.p(:index, 1).link(:text, 'New Window').click_no_wait
47
47
  IE.attach_timeout = 6.0
48
48
  ie_new = IE.attach(:title, 'Pass Page')
49
49
  assert(ie_new.text.include?('PASS'))
@@ -51,7 +51,7 @@ class TC_NewWindow< Watir::TestCase
51
51
  end
52
52
 
53
53
  def test_attach_to_slow_window_works_with_delay
54
- $ie.span(:text, 'New Window Slowly').click
54
+ browser.span(:text, 'New Window Slowly').click
55
55
  IE.attach_timeout = 4.0
56
56
  sleep 1.0
57
57
  ie_new = IE.attach(:title, 'Test page for buttons')
@@ -60,7 +60,7 @@ class TC_NewWindow< Watir::TestCase
60
60
  end
61
61
 
62
62
  def test_attach_to_slow_window_works_without_waiting
63
- $ie.span(:text, 'New Window Slowly').click
63
+ browser.span(:text, 'New Window Slowly').click
64
64
  IE.attach_timeout = 3.0
65
65
  ie_new = IE.attach(:title, 'Test page for buttons')
66
66
  assert(ie_new.text.include?('Blank page to fill in the frames'))
@@ -69,8 +69,8 @@ class TC_NewWindow< Watir::TestCase
69
69
 
70
70
  def test_attach_timesout_when_window_takes_too_long
71
71
  IE.attach_timeout = 0.2
72
- $ie.text_field(:name, 'delay').set('2')
73
- $ie.span(:text, 'New Window Slowly').click
72
+ browser.text_field(:name, 'delay').set('2')
73
+ browser.span(:text, 'New Window Slowly').click
74
74
  assert_raise(Watir::Exception::NoMatchingWindowFoundException) do
75
75
  IE.attach(:title, 'Test page for buttons')
76
76
  end
@@ -1,7 +1,7 @@
1
1
  # feature tests for closed windows
2
2
  # revision: $Revision: 958 $
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_CloseWindow < Watir::TestCase
@@ -13,7 +13,7 @@ class TC_CloseWindow < Watir::TestCase
13
13
 
14
14
  # reproduces defect http://jira.openqa.org/browse/WTR-16
15
15
  def test_close_window_with_button
16
- $ie.link(:text, 'New Window').click
16
+ browser.link(:text, 'New Window').click
17
17
  ie_new = Watir::IE.attach(:title, 'Pass Page')
18
18
  assert(ie_new.text.include?('PASS'))
19
19
  assert_nothing_raised {ie_new.close}
@@ -1,7 +1,7 @@
1
1
  # tests of click_no_wait for links in frames
2
2
  # revision: $Revision: 1078 $
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_Frame_Links < Test::Unit::TestCase
@@ -12,14 +12,14 @@ class TC_Frame_Links < Test::Unit::TestCase
12
12
  end
13
13
 
14
14
  def test_click_in_a_frame
15
- $ie.frame('linkFrame').link(:text, 'test1').click
16
- assert($ie.frame('linkFrame').text.include?('Links2-Pass'))
15
+ browser.frame('linkFrame').link(:text, 'test1').click
16
+ assert(browser.frame('linkFrame').text.include?('Links2-Pass'))
17
17
  end
18
18
 
19
19
  def test_click_no_wait_in_a_frame
20
- $ie.frame('linkFrame').link(:text, 'test1').click_no_wait
21
- wait_until(2){$ie.frame('linkFrame').text.include?('Links2-Pass')}
22
- assert($ie.frame('linkFrame').text.include?('Links2-Pass'))
20
+ browser.frame('linkFrame').link(:text, 'test1').click_no_wait
21
+ wait_until(2){browser.frame('linkFrame').text.include?('Links2-Pass')}
22
+ assert(browser.frame('linkFrame').text.include?('Links2-Pass'))
23
23
  end
24
24
 
25
25
  end
@@ -1,6 +1,6 @@
1
1
  # Not intended to be run as part of a larger suite.
2
2
 
3
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..') if $0 == __FILE__
3
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..') unless $SETUP_LOADED
4
4
  require 'test/unit'
5
5
  require 'watir'
6
6
  require 'watir/process'
@@ -1,16 +1,15 @@
1
1
  # unit tests for iedialog.dll and customized win32ole.so
2
- # revision: $Revision: 1348 $
2
+ # revision: $Revision: 1541 $
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
  require 'Win32API'
7
7
 
8
- if VERSION == '1.8.2'
9
8
  class TC_IEDialog < Test::Unit::TestCase
10
9
  include Watir
11
10
 
12
11
  # this will find the IEDialog.dll file in its build location
13
- @@iedialog_file = (File.expand_path(File.dirname(__FILE__)) + "/../../watir/IEDialog/Release/IEDialog.dll").gsub('/', '\\')
12
+ @@iedialog_file = (File.expand_path(File.dirname(__FILE__)) + "/../../lib/watir/IEDialog/Release/IEDialog.dll").gsub('/', '\\')
14
13
 
15
14
  # commented out because it currently requires a manual click
16
15
  # a better idea would be to automate the click...
@@ -52,4 +51,4 @@ class TC_IEDialog < Test::Unit::TestCase
52
51
  assert_match(/^PASS/, body.innerHTML.strip)
53
52
  end
54
53
  end
55
- end
54
+
@@ -1,7 +1,7 @@
1
1
  # feature tests for JavaScript events
2
- # revision: $Revision: 1348 $
2
+ # revision: $Revision: 1544 $
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_JSEvents < Test::Unit::TestCase
@@ -10,27 +10,27 @@ class TC_JSEvents < Test::Unit::TestCase
10
10
  end
11
11
 
12
12
  def test_Button_disabled
13
- assert(! $ie.button(:caption, "Button 1").enabled?)
13
+ assert_false( browser.button(:caption, "Button 1").enabled?)
14
14
  end
15
15
 
16
16
  def test_Button_Enabled
17
- $ie.text_field(:name, "entertext").fire_event("onkeyup")
18
- assert($ie.button(:caption, "Button 1").enabled?)
17
+ browser.text_field(:name, "entertext").fire_event("onkeyup")
18
+ assert(browser.button(:caption, "Button 1").enabled?)
19
19
  end
20
20
 
21
21
  def test_Button_click
22
22
  # Firing event to make button enabled
23
- $ie.text_field(:name, "entertext").fire_event("onKeyUp")
23
+ browser.text_field(:name, "entertext").fire_event("onKeyUp")
24
24
  # Clicking the button
25
- $ie.button(:caption, "Button 1").click
26
- assert($ie.text.include?("PASS") )
25
+ browser.button(:caption, "Button 1").click
26
+ assert(browser.text.include?("PASS") )
27
27
  end
28
28
 
29
29
  #onMouseOver tests
30
30
  #window status
31
31
 
32
32
  def test_no_status_bar_exception
33
- $ie.link(:text, "New Window No Status Bar").click
33
+ browser.link(:text, "New Window No Status Bar").click
34
34
  status_bar_test_win = nil
35
35
  # Note: this test will fail if the Google toolbar popup blocker is turned on
36
36
  assert_nothing_raised { status_bar_test_win = Watir::IE.attach(:title, "Pass Page") }
@@ -40,16 +40,16 @@ class TC_JSEvents < Test::Unit::TestCase
40
40
  end
41
41
 
42
42
  def test_page_nostatus
43
- assert_equal("Done", $ie.status)
43
+ assert_equal("Done", browser.status)
44
44
  end
45
45
 
46
46
  def test_set_page_status
47
- $ie.link(:text, "Check the Status").fire_event("onMouseOver")
48
- assert_equal("It worked", $ie.status)
47
+ browser.link(:text, "Check the Status").fire_event("onMouseOver")
48
+ assert_equal("It worked", browser.status)
49
49
  end
50
50
 
51
51
  def test_clear_page_status
52
- $ie.link(:text, "Clear the Status").fire_event("onMouseOver")
53
- assert_equal("Done", $ie.status)
52
+ browser.link(:text, "Clear the Status").fire_event("onMouseOver")
53
+ assert_equal("Done", browser.status)
54
54
  end
55
55
  end
@@ -1,4 +1,5 @@
1
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..') if $0 == __FILE__
1
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
2
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'watir-common', 'lib')
2
3
 
3
4
  require 'watir/WindowHelper'
4
5
 
@@ -1,4 +1,4 @@
1
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..') if $0 == __FILE__
1
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..') unless $SETUP_LOADED
2
2
 
3
3
  require 'watir/WindowHelper'
4
4
 
@@ -1,4 +1,4 @@
1
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..') if $0 == __FILE__
1
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..') unless $SETUP_LOADED
2
2
 
3
3
  require 'watir/WindowHelper'
4
4
 
@@ -1,4 +1,5 @@
1
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..') if $0 == __FILE__
1
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
2
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'watir-common', 'lib')
2
3
  require 'watir'
3
4
 
4
5
  ie = Watir::IE.attach(:title, 'Alert Test')
@@ -1,7 +1,7 @@
1
1
  # feature tests for AutoIt wrapper
2
- # revision: $Revision: 1189 $
2
+ # revision: $Revision: 1544 $
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
  require 'watir/WindowHelper'
7
7
  require 'watir/process'
@@ -29,17 +29,17 @@ class TC_JavaScript_Test < Test::Unit::TestCase
29
29
  end
30
30
 
31
31
  def check_dialog(extra_file, expected_result, &block)
32
- $ie.goto(@@javascript_page)
32
+ browser.goto(@@javascript_page)
33
33
  Thread.new { system("rubyw \"#{$mydir}\\#{extra_file}.rb\"") }
34
34
 
35
35
  block.call
36
- testResult = $ie.text_field(:id, "testResult").value
36
+ testResult = browser.text_field(:id, "testResult").value
37
37
  assert_match( expected_result, testResult )
38
38
  end
39
39
 
40
40
  def test_alert_button
41
41
  check_dialog('jscriptExtraAlert', /Alert button!/) do
42
- $ie.button(:id, 'btnAlert').click
42
+ browser.button(:id, 'btnAlert').click
43
43
  end
44
44
 
45
45
  end
@@ -52,12 +52,12 @@ class TC_JavaScript_Test < Test::Unit::TestCase
52
52
  end
53
53
  def test_confirm_button_ok
54
54
  check_dialog('jscriptExtraConfirmOk', /Confirm and OK button!/) do
55
- $ie.button(:id, 'btnConfirm').click
55
+ browser.button(:id, 'btnConfirm').click
56
56
  end
57
57
  end
58
58
  def test_confirm_button_Cancel
59
59
  check_dialog('jscriptExtraConfirmCancel', /Confirm and Cancel button!/) do
60
- $ie.button(:id, 'btnConfirm').click
60
+ browser.button(:id, 'btnConfirm').click
61
61
  end
62
62
  end
63
63