watir 1.5.4 → 1.5.5
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/watir-console +1 -0
- data/changes.rb +16 -2
- data/readme.rb +2 -16
- data/unittests/buttons_test.rb +74 -101
- data/unittests/buttons_xpath_test.rb +3 -3
- data/unittests/checkbox_test.rb +3 -3
- data/unittests/checkbox_xpath_test.rb +3 -3
- data/unittests/core_tests.rb +1 -1
- data/unittests/css_test.rb +2 -7
- data/unittests/defer_test.rb +2 -2
- data/unittests/dialog_test.rb +2 -2
- data/unittests/div2_xpath_test.rb +1 -1
- data/unittests/div_test.rb +122 -121
- data/unittests/div_xpath_test.rb +3 -3
- data/unittests/errorchecker_test.rb +3 -8
- data/unittests/filefield_test.rb +4 -7
- data/unittests/filefield_xpath_test.rb +3 -5
- data/unittests/form_test.rb +7 -7
- data/unittests/form_xpath_test.rb +6 -6
- data/unittests/frame_test.rb +8 -9
- data/unittests/google_form_test.rb +1 -2
- data/unittests/html/div.html +7 -1
- data/unittests/html/lists.html +1 -1
- data/unittests/ie_mock.rb +4 -2
- data/unittests/ie_test.rb +2 -2
- data/unittests/images_test.rb +2 -2
- data/unittests/images_xpath_test.rb +2 -2
- data/unittests/links_multi_test.rb +23 -9
- data/unittests/links_test.rb +7 -7
- data/unittests/links_xpath_test.rb +2 -3
- data/unittests/lists_test.rb +6 -3
- data/unittests/map_test.rb +1 -2
- data/unittests/minmax_test.rb +4 -5
- data/unittests/navigate_test.rb +18 -23
- data/unittests/nbsp_xpath_test.rb +4 -5
- data/unittests/{screen_capture_test.rb → other/screen_capture_test.rb} +1 -1
- data/unittests/pagecontainstext_test.rb +3 -4
- data/unittests/parent_child_test.rb +1 -1
- data/unittests/pre_test.rb +2 -3
- data/unittests/radios_test.rb +13 -17
- data/unittests/radios_xpath_test.rb +3 -3
- data/unittests/selectbox_test.rb +6 -14
- data/unittests/selectbox_xpath_test.rb +3 -3
- data/unittests/setup.rb +30 -10
- data/unittests/speed_settings_test.rb +2 -3
- data/unittests/table_cell_using_xpath_test.rb +2 -7
- data/unittests/table_test.rb +144 -136
- data/unittests/table_xpath_test.rb +5 -9
- data/unittests/textarea_test.rb +3 -7
- data/unittests/textarea_xpath_test.rb +5 -9
- data/unittests/textfield_for_ch_char_test.rb +1 -1
- data/unittests/textfields_test.rb +3 -4
- data/unittests/textfields_xpath_test.rb +3 -3
- data/unittests/windows/attach_to_existing_window_test.rb +2 -2
- data/unittests/windows/attach_to_new_window_test.rb +2 -2
- data/unittests/windows/close_window_test.rb +2 -3
- data/unittests/windows/frame_links_test.rb +1 -1
- data/unittests/windows/iedialog_test.rb +3 -3
- data/unittests/windows/js_events_test.rb +2 -4
- data/unittests/windows/modal_dialog_test.rb +2 -2
- data/unittests/windows/send_keys_test.rb +2 -4
- data/watir.rb +4 -13
- data/watir/assertions.rb +9 -1
- data/watir/collections.rb +6 -11
- data/watir/container.rb +9 -99
- data/watir/cookiemanager.rb +4 -1
- data/watir/element.rb +8 -1
- data/watir/ie.rb +2 -2
- data/watir/input_elements.rb +2 -2
- data/watir/non_control_elements.rb +39 -2
- data/watir/page-container.rb +1 -1
- data/watir/table.rb +25 -23
- metadata +68 -54
- data/watir/bonus-elements.rb +0 -65
- data/watir/testUnitAddons.rb +0 -8
@@ -1,14 +1,13 @@
|
|
1
1
|
# feature tests for Links
|
2
|
-
# revision: $Revision:
|
2
|
+
# revision: $Revision: 1348 $
|
3
3
|
|
4
4
|
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
5
5
|
require 'unittests/setup'
|
6
6
|
|
7
7
|
class TC_Links_XPath < Test::Unit::TestCase
|
8
|
-
include Watir
|
9
8
|
|
10
9
|
def setup
|
11
|
-
|
10
|
+
goto_page "links1.html"
|
12
11
|
end
|
13
12
|
|
14
13
|
def test_link_exists
|
data/unittests/lists_test.rb
CHANGED
@@ -2,10 +2,9 @@ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
|
2
2
|
require 'unittests/setup'
|
3
3
|
|
4
4
|
class Lists_Tests < Watir::TestCase
|
5
|
-
include Watir
|
6
5
|
|
7
6
|
def setup
|
8
|
-
|
7
|
+
goto_page 'lists.html'
|
9
8
|
end
|
10
9
|
|
11
10
|
def test_list_items_exist
|
@@ -17,13 +16,17 @@ class Lists_Tests < Watir::TestCase
|
|
17
16
|
end
|
18
17
|
|
19
18
|
def test_list_item_exists_by_name
|
20
|
-
assert($ie.li(:name, '
|
19
|
+
assert($ie.li(:name, 'x1').exists?)
|
21
20
|
assert ! ($ie.li(:name, 'maptest02').exists?)
|
22
21
|
end
|
23
22
|
|
24
23
|
def test_li_length
|
25
24
|
assert_equal(6, $ie.lis.length)
|
26
25
|
end
|
26
|
+
|
27
|
+
def test_multiple_attributes
|
28
|
+
assert_equal('Phil', $ie.li(:id => 'ordered1', :name => 'x1').text)
|
29
|
+
end
|
27
30
|
|
28
31
|
end
|
29
32
|
|
data/unittests/map_test.rb
CHANGED
@@ -2,10 +2,9 @@ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
|
2
2
|
require 'unittests/setup'
|
3
3
|
|
4
4
|
class Map_Tests < Watir::TestCase
|
5
|
-
include Watir
|
6
5
|
|
7
6
|
def setup
|
8
|
-
|
7
|
+
goto_page 'map_test.html'
|
9
8
|
end
|
10
9
|
|
11
10
|
def test_01
|
data/unittests/minmax_test.rb
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
# feature tests for minimizing and maximizing IE windows
|
2
|
-
# revision: $Revision:
|
2
|
+
# revision: $Revision: 1348 $
|
3
3
|
|
4
4
|
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
5
5
|
require 'unittests/setup'
|
6
6
|
|
7
7
|
class TC_MinMax< Test::Unit::TestCase
|
8
|
-
include Watir
|
9
8
|
def setup
|
10
|
-
|
9
|
+
goto_page 'pass.html'
|
11
10
|
end
|
12
11
|
def teardown
|
13
12
|
$ie.restore
|
@@ -20,9 +19,9 @@ class TC_MinMax< Test::Unit::TestCase
|
|
20
19
|
end
|
21
20
|
def test_front
|
22
21
|
assert $ie.front?
|
23
|
-
ie2 = IE.start($htmlRoot + 'blankpage.html')
|
22
|
+
ie2 = Watir::IE.start($htmlRoot + 'blankpage.html')
|
24
23
|
assert ie2.front?
|
25
|
-
|
24
|
+
assert ! $ie.front?
|
26
25
|
$ie.bring_to_front
|
27
26
|
assert $ie.front?
|
28
27
|
ie2.close
|
data/unittests/navigate_test.rb
CHANGED
@@ -1,48 +1,43 @@
|
|
1
1
|
# feature tests for navigation
|
2
|
-
# revision: $Revision:
|
2
|
+
# revision: $Revision: 1348 $
|
3
3
|
|
4
4
|
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
5
5
|
require 'unittests/setup'
|
6
6
|
require 'cgi'
|
7
7
|
|
8
8
|
class TC_Navigate < Test::Unit::TestCase
|
9
|
-
include Watir
|
10
|
-
|
11
|
-
def goto_page(a)
|
12
|
-
$ie.goto($htmlRoot + a)
|
13
|
-
end
|
14
9
|
|
15
10
|
def test_navigation
|
16
11
|
$ie.clear_url_list
|
17
|
-
goto_page
|
18
|
-
url = $ie.url.downcase
|
19
|
-
url = CGI::unescape
|
20
|
-
assert_equal(
|
21
|
-
|
12
|
+
goto_page 'buttons1.html'
|
13
|
+
url = $ie.url.downcase
|
14
|
+
url = CGI::unescape url
|
15
|
+
assert_equal(($htmlRoot + 'buttons1.html').downcase, url) # sometimes we get capital drive letters
|
16
|
+
|
22
17
|
assert_equal(1, $ie.url_list.length)
|
23
|
-
assert_equal(url, $ie.url_list[0].
|
18
|
+
assert_equal(url, $ie.url_list[0].downcase)
|
24
19
|
|
25
|
-
goto_page
|
26
|
-
url = $ie.url.downcase
|
27
|
-
url = CGI::unescape
|
28
|
-
|
29
|
-
|
20
|
+
goto_page 'checkboxes1.html'
|
21
|
+
url = $ie.url.downcase
|
22
|
+
url = CGI::unescape url
|
23
|
+
assert_equal("Test page for Check Boxes", $ie.title)
|
24
|
+
|
30
25
|
assert_equal(2, $ie.url_list.length)
|
31
|
-
assert_equal(url, $ie.url_list[1].
|
26
|
+
assert_equal(url, $ie.url_list[1].downcase)
|
32
27
|
|
33
28
|
$ie.clear_url_list
|
34
29
|
assert_equal(0, $ie.url_list.length )
|
35
30
|
|
36
31
|
$ie.back
|
37
|
-
assert_equal(
|
32
|
+
assert_equal("Test page for buttons", $ie.title)
|
38
33
|
|
39
34
|
$ie.forward
|
40
|
-
assert_equal(
|
41
|
-
|
42
|
-
$ie.
|
43
|
-
assert($ie.checkBox(:name, "box1").isSet?)
|
35
|
+
assert_equal("Test page for Check Boxes", $ie.title)
|
36
|
+
$ie.checkbox(:name, "box1").set
|
37
|
+
assert($ie.checkbox(:name, "box1").isSet?)
|
44
38
|
|
45
39
|
$ie.refresh
|
46
40
|
# Not sure how we test this. Text fields and checkboxes dont get reset if you click the browser refresh button
|
41
|
+
# -- this could be tested with the add-row page.
|
47
42
|
end
|
48
43
|
end
|
@@ -4,15 +4,14 @@
|
|
4
4
|
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
5
5
|
require 'unittests/setup'
|
6
6
|
|
7
|
-
class
|
8
|
-
include Watir
|
7
|
+
class TC_Nbsp_Xpath < Test::Unit::TestCase
|
9
8
|
|
10
9
|
def setup
|
11
|
-
|
10
|
+
goto_page "xpath_nbsp.html"
|
12
11
|
end
|
13
12
|
|
14
13
|
def test_nbsp
|
15
|
-
|
16
|
-
|
14
|
+
div = $ie.element_by_xpath("//div")
|
15
|
+
assert(div.innerText, "Hello world")
|
17
16
|
end
|
18
17
|
end
|
@@ -1,14 +1,13 @@
|
|
1
1
|
# feature tests for IE::contains_text
|
2
|
-
# revision: $Revision:
|
2
|
+
# revision: $Revision: 1348 $
|
3
3
|
|
4
4
|
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
5
5
|
require 'unittests/setup'
|
6
6
|
|
7
7
|
class TC_contains_text < Test::Unit::TestCase
|
8
|
-
include Watir
|
9
8
|
|
10
9
|
def setup
|
11
|
-
|
10
|
+
goto_page "textsearch.html"
|
12
11
|
end
|
13
12
|
|
14
13
|
def test_text_found
|
@@ -60,7 +59,7 @@ end
|
|
60
59
|
|
61
60
|
class TC_contains_text_in_frame < Test::Unit::TestCase
|
62
61
|
def setup
|
63
|
-
|
62
|
+
goto_page "frame_links.html"
|
64
63
|
end
|
65
64
|
def test_in_frame
|
66
65
|
assert $ie.frame('linkFrame').contains_text('The button is really a link')
|
data/unittests/pre_test.rb
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
# feature tests for Pre
|
2
|
-
# revision: $Revision:
|
2
|
+
# revision: $Revision: 1348 $
|
3
3
|
|
4
4
|
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
5
5
|
require 'unittests/setup'
|
6
6
|
|
7
7
|
class TC_Pre < Test::Unit::TestCase
|
8
|
-
include Watir
|
9
8
|
|
10
9
|
def setup
|
11
|
-
|
10
|
+
goto_page "pre.html"
|
12
11
|
end
|
13
12
|
|
14
13
|
def test_Pre_Count
|
data/unittests/radios_test.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# feature tests for Radio Buttons
|
2
|
-
# revision: $Revision:
|
2
|
+
# revision: $Revision: 1348 $
|
3
3
|
|
4
4
|
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
5
5
|
require 'unittests/setup'
|
6
6
|
|
7
7
|
class TC_Radios < Test::Unit::TestCase
|
8
|
-
include Watir
|
8
|
+
include Watir::Exception
|
9
9
|
|
10
10
|
def setup
|
11
|
-
|
11
|
+
goto_page "radioButtons1.html"
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_Radio_Exists
|
@@ -23,15 +23,12 @@ class TC_Radios < Test::Unit::TestCase
|
|
23
23
|
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.radio(:name, "noName").class_name }
|
24
24
|
assert_equal("radio_style" , $ie.radio(:name, "box1").class_name)
|
25
25
|
assert_equal("" , $ie.radio(:id, "box5").class_name)
|
26
|
-
|
27
|
-
|
28
|
-
|
29
26
|
end
|
30
27
|
|
31
28
|
def test_Radio_Enabled
|
32
|
-
assert_raises(UnknownObjectException
|
33
|
-
assert_raises(UnknownObjectException
|
34
|
-
assert_raises(UnknownObjectException
|
29
|
+
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { $ie.radio(:name, "noName").enabled? }
|
30
|
+
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { $ie.radio(:id, "noName").enabled? }
|
31
|
+
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { $ie.radio(:name, "box4" , 6).enabled? }
|
35
32
|
|
36
33
|
assert(!$ie.radio(:name, "box2").enabled?)
|
37
34
|
assert($ie.radio(:id, "box5").enabled?)
|
@@ -107,7 +104,7 @@ class TC_Radios < Test::Unit::TestCase
|
|
107
104
|
end
|
108
105
|
|
109
106
|
def test_radio_getState
|
110
|
-
assert_raises(UnknownObjectException
|
107
|
+
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { $ie.radio(:name, "noName").getState }
|
111
108
|
|
112
109
|
assert_equal( false , $ie.radio(:name, "box1").getState )
|
113
110
|
assert_equal( true , $ie.radio(:name, "box3").getState)
|
@@ -118,7 +115,7 @@ class TC_Radios < Test::Unit::TestCase
|
|
118
115
|
end
|
119
116
|
|
120
117
|
def test_radio_set
|
121
|
-
assert_raises(UnknownObjectException
|
118
|
+
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { $ie.radio(:name, "noName").set }
|
122
119
|
$ie.radio(:name, "box1").set
|
123
120
|
assert($ie.radio(:name, "box1").isSet?)
|
124
121
|
|
@@ -134,11 +131,11 @@ class TC_Radios < Test::Unit::TestCase
|
|
134
131
|
|
135
132
|
def test_radio_properties
|
136
133
|
|
137
|
-
assert_raises(UnknownObjectException
|
138
|
-
assert_raises(UnknownObjectException
|
139
|
-
assert_raises(UnknownObjectException
|
140
|
-
assert_raises(UnknownObjectException
|
141
|
-
assert_raises(UnknownObjectException
|
134
|
+
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { $ie.radio(:index, 199).value}
|
135
|
+
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { $ie.radio(:index, 199).name }
|
136
|
+
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { $ie.radio(:index, 199).id }
|
137
|
+
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { $ie.radio(:index, 199).disabled }
|
138
|
+
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { $ie.radio(:index, 199).type }
|
142
139
|
|
143
140
|
assert_equal("on" , $ie.radio(:index, 1).value)
|
144
141
|
assert_equal("box1" , $ie.radio(:index, 1).name )
|
@@ -190,6 +187,5 @@ class TC_Radios < Test::Unit::TestCase
|
|
190
187
|
assert(!$ie.radio(:name, "box6" , 'Tea').isSet?)
|
191
188
|
end
|
192
189
|
|
193
|
-
|
194
190
|
end
|
195
191
|
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# feature tests for Radio Buttons
|
2
|
-
# revision: $Revision:
|
2
|
+
# revision: $Revision: 1348 $
|
3
3
|
|
4
4
|
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
5
5
|
require 'unittests/setup'
|
6
6
|
|
7
7
|
class TC_Radios_XPath < Test::Unit::TestCase
|
8
|
-
include Watir
|
8
|
+
include Watir::Exception
|
9
9
|
|
10
10
|
def setup
|
11
|
-
|
11
|
+
goto_page "radioButtons1.html"
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_Radio_Exists
|
data/unittests/selectbox_test.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# feature tests for Select Boxes
|
2
|
-
# revision: $Revision:
|
2
|
+
# revision: $Revision: 1348 $
|
3
3
|
|
4
4
|
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
5
5
|
require 'unittests/setup'
|
6
6
|
|
7
7
|
class TC_SelectList < Test::Unit::TestCase
|
8
|
-
include Watir
|
8
|
+
include Watir::Exception
|
9
9
|
|
10
10
|
def setup
|
11
|
-
|
11
|
+
goto_page "selectboxes1.html"
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_SelectList_exists
|
@@ -29,8 +29,6 @@ class TC_SelectList < Test::Unit::TestCase
|
|
29
29
|
assert_equal("" , $ie.selectBox(:name, "sel2").class_name )
|
30
30
|
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
32
|
def test_Option_text_select
|
35
33
|
assert_raises(UnknownObjectException) { $ie.select_list(:name, "sel1").option(:text, "missing item").select }
|
36
34
|
assert_raises(UnknownObjectException) { $ie.select_list(:name, "sel1").option(:text, /missing/).select }
|
@@ -42,14 +40,11 @@ class TC_SelectList < Test::Unit::TestCase
|
|
42
40
|
assert_equal( ["Option 1" ] , $ie.select_list(:name, "sel1").getSelectedItems)
|
43
41
|
end
|
44
42
|
|
45
|
-
|
46
43
|
def xtest_option_class_name
|
47
|
-
|
48
44
|
# the option object doesnt inherit from element, so this doesnt work
|
49
45
|
assert_raises(UnknownObjectException) { $ie.select_list(:name, "sel1").option(:text, "missing item").class_name }
|
50
46
|
assert_equal("list_style" , $ie.select_list(:name, "sel2").option(:value , 'o2').class_name)
|
51
47
|
assert_equal("" , $ie.select_list(:name, "sel2").option(:value , 'o1').class_name)
|
52
|
-
|
53
48
|
end
|
54
49
|
|
55
50
|
def test_includes
|
@@ -71,10 +66,10 @@ end
|
|
71
66
|
|
72
67
|
# Tests for the old interface
|
73
68
|
class TC_Selectbox < Test::Unit::TestCase
|
74
|
-
include Watir
|
69
|
+
include Watir::Exception
|
75
70
|
|
76
71
|
def setup
|
77
|
-
|
72
|
+
goto_page "selectboxes1.html"
|
78
73
|
end
|
79
74
|
|
80
75
|
def test_selectBox_Exists
|
@@ -88,14 +83,12 @@ class TC_Selectbox < Test::Unit::TestCase
|
|
88
83
|
assert_raises(UnknownObjectException) { $ie.selectBox(:name, "NoName").enabled? }
|
89
84
|
end
|
90
85
|
|
91
|
-
|
92
86
|
def test_SelectList_class_name
|
93
87
|
assert_raises(UnknownObjectException) { $ie.select_list(:name, "missing").class_name }
|
94
88
|
assert_equal("list_style" , $ie.select_list(:name, "sel1").class_name)
|
95
89
|
assert_equal("" , $ie.selectBox(:name, "sel2").class_name )
|
96
90
|
end
|
97
91
|
|
98
|
-
|
99
92
|
def test_selectBox_getAllContents
|
100
93
|
assert_raises(UnknownObjectException) { $ie.selectBox(:name, "NoName").getAllContents }
|
101
94
|
assert_equal( ["Option 1" ,"Option 2" , "Option 3" , "Option 4"] ,
|
@@ -225,10 +218,9 @@ class TC_Selectbox < Test::Unit::TestCase
|
|
225
218
|
end
|
226
219
|
|
227
220
|
class TC_Select_Options < Test::Unit::TestCase
|
228
|
-
include Watir
|
229
221
|
|
230
222
|
def setup
|
231
|
-
|
223
|
+
goto_page "select_tealeaf.html"
|
232
224
|
end
|
233
225
|
|
234
226
|
def test_options_text
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# feature tests for Select Boxes
|
2
|
-
# revision: $Revision:
|
2
|
+
# revision: $Revision: 1348 $
|
3
3
|
|
4
4
|
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
5
5
|
require 'unittests/setup'
|
6
6
|
|
7
7
|
class TC_Selectbox_XPath < Test::Unit::TestCase
|
8
|
-
include Watir
|
8
|
+
include Watir::Exception
|
9
9
|
|
10
10
|
def setup
|
11
|
-
|
11
|
+
goto_page "selectboxes1.html"
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_textBox_Exists
|
data/unittests/setup.rb
CHANGED
@@ -3,10 +3,27 @@ require 'watir'
|
|
3
3
|
END {$ie.close if $ie && $ie.exists?; Watir::IE.quit} # close ie at completion of the tests
|
4
4
|
|
5
5
|
require 'test/unit'
|
6
|
-
require 'test/unit/ui/console/testrunner'
|
7
|
-
require 'watir/testUnitAddons'
|
8
6
|
require 'watir/testcase'
|
9
7
|
|
8
|
+
# rename goto_page to be goto_page
|
9
|
+
|
10
|
+
# Better would be to add this to a module that was included in all the tests.
|
11
|
+
class Test::Unit::TestCase
|
12
|
+
# navigate the browser to the specified page in unittests/html
|
13
|
+
def goto_page page
|
14
|
+
new_url = $htmlRoot + page
|
15
|
+
browser.goto new_url
|
16
|
+
end
|
17
|
+
# navigate the browser to the specified page in unittests/html IF the browser is not already on that page.
|
18
|
+
def uses_page page
|
19
|
+
new_url = $htmlRoot + page
|
20
|
+
browser.goto new_url unless browser.url == new_url
|
21
|
+
end
|
22
|
+
def browser
|
23
|
+
$ie
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
10
27
|
topdir = File.join(File.dirname(__FILE__), '..')
|
11
28
|
Dir.chdir topdir do
|
12
29
|
$all_tests = Dir["unittests/*_test.rb"]
|
@@ -14,16 +31,19 @@ Dir.chdir topdir do
|
|
14
31
|
end
|
15
32
|
|
16
33
|
$window_tests =
|
17
|
-
[
|
18
|
-
'modal_dialog', # modal is visible
|
34
|
+
[
|
19
35
|
'attach_to_existing_window', # could actually run robustly as part of the core suite!
|
20
36
|
'attach_to_new_window', # creates new window
|
21
|
-
'jscript',
|
22
|
-
'send_keys', # visible
|
23
|
-
'iedialog', # visible
|
24
37
|
'close_window', # creates new window
|
25
38
|
'frame_links', # visible
|
39
|
+
'iedialog', # visible
|
40
|
+
#ie-each
|
41
|
+
'js_events', # is always visible
|
42
|
+
'jscript',
|
43
|
+
'modal_dialog', # modal is visible
|
44
|
+
#new (named oddly)
|
26
45
|
'open_close',
|
46
|
+
'send_keys', # visible
|
27
47
|
].collect {|x| "unittests/windows/#{x}_test.rb"}
|
28
48
|
|
29
49
|
$non_core_tests =
|
@@ -32,7 +52,7 @@ $non_core_tests =
|
|
32
52
|
# will be revised to use autoit
|
33
53
|
# takes 15 seconds to run
|
34
54
|
'images', # save file must must be visible
|
35
|
-
'screen_capture', # is always visible; takes 25 seconds
|
55
|
+
# 'screen_capture', # is always visible; takes 25 seconds
|
36
56
|
'filefield', # is always visible; takes 40 seconds
|
37
57
|
'minmax', # becomes visible
|
38
58
|
'dialog' # visible
|
@@ -45,7 +65,7 @@ $ie.speed = :fast
|
|
45
65
|
|
46
66
|
$myDir = File.expand_path(File.dirname(__FILE__))
|
47
67
|
$myDir.sub!( %r{/cygdrive/(\w)/}, '\1:/' ) # convert from cygwin to dos
|
48
|
-
# if you run the unit tests
|
49
|
-
$htmlRoot = "file
|
68
|
+
# if you run the unit tests from a local file system use this line
|
69
|
+
$htmlRoot = "file:///#{$myDir}/html/"
|
50
70
|
# if you run the unit tests from a web server use this line
|
51
71
|
# $htmlRoot = "http://localhost:8080/watir/html/"
|