firewatir 1.1.1
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.
- data/MozillaBaseElement.rb +1778 -0
- data/container.rb +889 -0
- data/firewatir/exceptions.rb +44 -0
- data/firewatir/testUnitAddons.rb +8 -0
- data/firewatir.rb +1130 -0
- data/htmlelements.rb +2277 -0
- data/unittests/attach_to_new_window_test.rb +34 -0
- data/unittests/bug_fixes_test.rb +188 -0
- data/unittests/buttons_test.rb +215 -0
- data/unittests/buttons_xpath_test.rb +87 -0
- data/unittests/checkbox_test.rb +154 -0
- data/unittests/checkbox_xpath_test.rb +107 -0
- data/unittests/div_test.rb +274 -0
- data/unittests/filefield_test.rb +45 -0
- data/unittests/filefield_xpath_test.rb +35 -0
- data/unittests/form_test.rb +307 -0
- data/unittests/frame_test.rb +151 -0
- data/unittests/hidden_test.rb +85 -0
- data/unittests/hidden_xpath_test.rb +72 -0
- data/unittests/html/JavascriptClick.html +42 -0
- data/unittests/html/blankpage.html +12 -0
- data/unittests/html/buttons1.html +61 -0
- data/unittests/html/checkboxes1.html +71 -0
- data/unittests/html/complex_table.html +36 -0
- data/unittests/html/cssTest.html +42 -0
- data/unittests/html/div.html +72 -0
- data/unittests/html/div_xml.html +21 -0
- data/unittests/html/fileupload.html +45 -0
- data/unittests/html/formTest1.html +39 -0
- data/unittests/html/forms2.html +45 -0
- data/unittests/html/forms3.html +132 -0
- data/unittests/html/forms4.html +27 -0
- data/unittests/html/frame_buttons.html +4 -0
- data/unittests/html/frame_links.html +4 -0
- data/unittests/html/frame_multi.html +5 -0
- data/unittests/html/iframeTest.html +15 -0
- data/unittests/html/iframeTest1.html +14 -0
- data/unittests/html/iframeTest2.html +6 -0
- data/unittests/html/images/1.gif +0 -0
- data/unittests/html/images/2.GIF +0 -0
- data/unittests/html/images/3.GIF +0 -0
- data/unittests/html/images/button.jpg +0 -0
- data/unittests/html/images/circle.jpg +0 -0
- data/unittests/html/images/minus.GIF +0 -0
- data/unittests/html/images/originaltriangle.jpg +0 -0
- data/unittests/html/images/plus.gif +0 -0
- data/unittests/html/images/square.jpg +0 -0
- data/unittests/html/images/triangle.jpg +0 -0
- data/unittests/html/images1.html +67 -0
- data/unittests/html/javascriptevents.html +35 -0
- data/unittests/html/link_pass.html +11 -0
- data/unittests/html/links1.html +42 -0
- data/unittests/html/links2.html +11 -0
- data/unittests/html/modal_dialog.html +8 -0
- data/unittests/html/modal_dialog_launcher.html +12 -0
- data/unittests/html/nestedFrames.html +6 -0
- data/unittests/html/new_browser.html +17 -0
- data/unittests/html/pass.html +10 -0
- data/unittests/html/popups1.html +60 -0
- data/unittests/html/pre.html +28 -0
- data/unittests/html/radioButtons1.html +71 -0
- data/unittests/html/redirect.html +10 -0
- data/unittests/html/redirect1.html +9 -0
- data/unittests/html/redirect2.html +9 -0
- data/unittests/html/redirect3.html +9 -0
- data/unittests/html/select_tealeaf.html +54 -0
- data/unittests/html/selectboxes1.html +55 -0
- data/unittests/html/simple_table.html +26 -0
- data/unittests/html/simple_table_buttons.html +104 -0
- data/unittests/html/simple_table_columns.html +74 -0
- data/unittests/html/table1.html +165 -0
- data/unittests/html/tableCell_using_xpath.html +19 -0
- data/unittests/html/textarea.html +30 -0
- data/unittests/html/textfields1.html +62 -0
- data/unittests/html/textsearch.html +44 -0
- data/unittests/images_test.rb +204 -0
- data/unittests/images_xpath_test.rb +118 -0
- data/unittests/iostring.rb +30 -0
- data/unittests/iostring_test.rb +48 -0
- data/unittests/javascript_test.rb +71 -0
- data/unittests/links_test.rb +230 -0
- data/unittests/links_xpath_test.rb +79 -0
- data/unittests/mozilla_all_tests.rb +18 -0
- data/unittests/pre_test.rb +74 -0
- data/unittests/radios_test.rb +166 -0
- data/unittests/radios_xpath_test.rb +101 -0
- data/unittests/redirect_test.rb +40 -0
- data/unittests/selectbox_test.rb +141 -0
- data/unittests/selectbox_xpath_test.rb +127 -0
- data/unittests/setup.rb +35 -0
- data/unittests/table_test.rb +372 -0
- data/unittests/table_xpath_test.rb +184 -0
- data/unittests/textfields_test.rb +230 -0
- data/unittests/textfields_xpath_test.rb +112 -0
- metadata +144 -0
@@ -0,0 +1,40 @@
|
|
1
|
+
# feature tests for Javascript redirect
|
2
|
+
# revision: $Revision: 1.0 $
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
5
|
+
require 'unittests/setup'
|
6
|
+
|
7
|
+
class TC_Redirect < Test::Unit::TestCase
|
8
|
+
include FireWatir
|
9
|
+
|
10
|
+
def setup
|
11
|
+
$ff.goto($htmlRoot + "redirect.html")
|
12
|
+
end
|
13
|
+
|
14
|
+
def goto_multiple_redirect
|
15
|
+
$ff.goto($htmlRoot + "redirect1.html")
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_single_redirect
|
19
|
+
assert_raises(UnknownObjectException) {$ff.div(:id , "div77").click }
|
20
|
+
assert_raises(UnknownObjectException) {$ff.div(:title , "div77").click }
|
21
|
+
|
22
|
+
assert($ff.text_field(:name, "text1").verify_contains("0") )
|
23
|
+
$ff.div(:id , "div3").click
|
24
|
+
assert($ff.text_field(:name, "text1").verify_contains("1") )
|
25
|
+
$ff.div(:id , "div4").click
|
26
|
+
assert($ff.text_field(:name, "text1").verify_contains("0") )
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_multiple_redirect
|
30
|
+
goto_multiple_redirect()
|
31
|
+
assert_raises(UnknownObjectException) {$ff.div(:id , "div77").click }
|
32
|
+
assert_raises(UnknownObjectException) {$ff.div(:title , "div77").click }
|
33
|
+
|
34
|
+
assert($ff.text_field(:name, "text1").verify_contains("0") )
|
35
|
+
$ff.div(:id , "div3").click
|
36
|
+
assert($ff.text_field(:name, "text1").verify_contains("1") )
|
37
|
+
$ff.div(:id , "div4").click
|
38
|
+
assert($ff.text_field(:name, "text1").verify_contains("0") )
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,141 @@
|
|
1
|
+
# feature tests for Select Boxes
|
2
|
+
# revision: $Revision: 1.0 $
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
5
|
+
require 'unittests/setup'
|
6
|
+
|
7
|
+
class TC_SelectList < Test::Unit::TestCase
|
8
|
+
include FireWatir
|
9
|
+
|
10
|
+
def setup()
|
11
|
+
$ff.goto($htmlRoot + "selectboxes1.html")
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_textBox_Exists
|
15
|
+
assert($ff.select_list(:name, "sel1").exists?)
|
16
|
+
assert_false($ff.select_list(:name, "missing").exists?)
|
17
|
+
assert_false($ff.select_list(:id, "missing").exists?)
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_select_list_enabled
|
21
|
+
assert($ff.select_list(:name, "sel1").enabled?)
|
22
|
+
assert_raises(UnknownObjectException) { $ff.select_list(:name, "NoName").enabled? }
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_select_list_getAllContents
|
26
|
+
assert_raises(UnknownObjectException) { $ff.select_list(:name, "NoName").getAllContents }
|
27
|
+
assert_equal( ["Option 1" ,"Option 2" , "Option 3" , "Option 4"] ,
|
28
|
+
$ff.select_list(:name, "sel1").getAllContents)
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_Option_text_select
|
32
|
+
assert_raises(UnknownObjectException) { $ff.select_list(:name, "sel1").option(:text, "missing item").select }
|
33
|
+
assert_raises(UnknownObjectException) { $ff.select_list(:name, "sel1").option(:text, /missing/).select }
|
34
|
+
assert_raises(MissingWayOfFindingObjectException) { $ff.select_list(:name, "sel1").option(:missing, "Option 1").select }
|
35
|
+
|
36
|
+
# the select method keeps any currently selected items - use the clear selection method first
|
37
|
+
$ff.select_list( :name , "sel1").clearSelection
|
38
|
+
$ff.select_list( :name , "sel1").option(:text, "Option 1").select
|
39
|
+
assert_equal( ["Option 1" ] , $ff.select_list(:name, "sel1").getSelectedItems)
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
def test_option_class_name
|
44
|
+
|
45
|
+
# the option object doesnt inherit from element, so this doesnt work
|
46
|
+
assert_raises(UnknownObjectException) { $ff.select_list(:name, "sel1").option(:text, "missing item").class_name }
|
47
|
+
assert_equal("option_style" , $ff.select_list(:name, "sel2").option(:value , 'o2').class_name)
|
48
|
+
assert_equal("" , $ff.select_list(:name, "sel2").option(:value , 'o1').class_name)
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_selectBox_select_using_value
|
53
|
+
assert_raises(UnknownObjectException) { $ff.select_list(:name, "NoName").getSelectedItems }
|
54
|
+
assert_raises(NoValueFoundException) { $ff.select_list(:name, "sel1").select_value("missing item") }
|
55
|
+
assert_raises(NoValueFoundException) { $ff.select_list(:name, "sel1").select_value(/missing/) }
|
56
|
+
|
57
|
+
# the select method keeps any currently selected items - use the clear selectcion method first
|
58
|
+
$ff.select_list( :name , "sel1").clearSelection
|
59
|
+
$ff.select_list( :name , "sel1").select_value("o1")
|
60
|
+
assert_equal( ["Option 1" ] , $ff.select_list(:name, "sel1").getSelectedItems)
|
61
|
+
|
62
|
+
$ff.select_list( :name , "sel1").clearSelection
|
63
|
+
$ff.select_list( :name , "sel1").select_value(/2/)
|
64
|
+
assert_equal( ["Option 2" ] , $ff.select_list(:name, "sel1").getSelectedItems)
|
65
|
+
|
66
|
+
$ff.select_list( :name , "sel2").clearSelection
|
67
|
+
$ff.select_list( :name , "sel2").select_value(/4/)
|
68
|
+
$ff.select_list( :name , "sel2").select_value(/2/)
|
69
|
+
assert_equal( ["Option 2" , "Option 4" ] ,
|
70
|
+
$ff.select_list(:name, "sel2").getSelectedItems)
|
71
|
+
|
72
|
+
# these are to test the onchange event
|
73
|
+
# the event shouldnt get fired, as this is the selected item
|
74
|
+
$ff.select_list( :name , "sel3").select_value( /3/ )
|
75
|
+
assert_false($ff.text.include?("Pass") )
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_select_list_select_using_value2
|
79
|
+
# the event should get fired
|
80
|
+
$ff.select_list( :name , "sel3").select_value( /2/ )
|
81
|
+
assert($ff.text.include?("PASS") )
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_select_list_properties
|
85
|
+
assert_raises(UnknownObjectException) { $ff.select_list(:index, 199).value }
|
86
|
+
assert_raises(UnknownObjectException) { $ff.select_list(:index, 199).name }
|
87
|
+
assert_raises(UnknownObjectException) { $ff.select_list(:index, 199).id }
|
88
|
+
assert_raises(UnknownObjectException) { $ff.select_list(:index, 199).disabled }
|
89
|
+
assert_raises(UnknownObjectException) { $ff.select_list(:index, 199).type }
|
90
|
+
|
91
|
+
assert_equal("o3" , $ff.select_list(:index, 1).value)
|
92
|
+
assert_equal("sel1" , $ff.select_list(:index, 1).name )
|
93
|
+
assert_equal("" , $ff.select_list(:index, 1).id )
|
94
|
+
assert_equal("select-one", $ff.select_list(:index, 1).type )
|
95
|
+
assert_equal("select-multiple", $ff.select_list(:index, 2).type )
|
96
|
+
|
97
|
+
$ff.select_list(:index,1).select(/1/)
|
98
|
+
assert_equal("o1" , $ff.select_list(:index, 1).value)
|
99
|
+
|
100
|
+
assert_false( $ff.select_list(:index, 1).disabled )
|
101
|
+
assert( $ff.select_list(:index, 4).disabled )
|
102
|
+
assert( $ff.select_list(:id, 'selectbox_4').disabled )
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_select_list_iterator
|
106
|
+
assert_equal(5, $ff.select_lists.length)
|
107
|
+
assert_equal("o3" , $ff.select_lists[1].value)
|
108
|
+
assert_equal("sel1" , $ff.select_lists[1].name )
|
109
|
+
assert_equal("select-one", $ff.select_lists[1].type )
|
110
|
+
assert_equal("select-multiple" , $ff.select_lists[2].type )
|
111
|
+
|
112
|
+
index=1
|
113
|
+
$ff.select_lists.each do |l|
|
114
|
+
assert_equal( $ff.select_list(:index, index).name , l.name )
|
115
|
+
assert_equal( $ff.select_list(:index, index).id , l.id )
|
116
|
+
assert_equal( $ff.select_list(:index, index).type , l.type )
|
117
|
+
assert_equal( $ff.select_list(:index, index).value , l.value )
|
118
|
+
index+=1
|
119
|
+
end
|
120
|
+
assert_equal( index-1, $ff.select_lists.length)
|
121
|
+
# Bug Fix 25
|
122
|
+
$ff.select_lists.each { |list| puts list.getAllContents() }
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
class TC_Select_Options < Test::Unit::TestCase
|
127
|
+
include FireWatir
|
128
|
+
|
129
|
+
def setup()
|
130
|
+
$ff.goto($htmlRoot + "select_tealeaf.html")
|
131
|
+
end
|
132
|
+
|
133
|
+
def test_options_text
|
134
|
+
$ff.select_list(:name, 'op_numhits').option(:text, '>=').select
|
135
|
+
assert($ff.select_list(:name, 'op_numhits').option(:text, '>=').selected)
|
136
|
+
assert_equal( [">=" ] , $ff.select_list(:name, "op_numhits").getSelectedItems)
|
137
|
+
assert_equal( "=" , $ff.select_list(:name, "op_numhits")[1].text)
|
138
|
+
assert_equal( "0" , $ff.select_list(:name, "op_numhits")[1].value)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
@@ -0,0 +1,127 @@
|
|
1
|
+
# feature tests for Select Boxes
|
2
|
+
# revision: $Revision: 1.0 $
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
5
|
+
require 'unittests/setup'
|
6
|
+
|
7
|
+
class TC_Selectbox_XPath < Test::Unit::TestCase
|
8
|
+
include FireWatir
|
9
|
+
|
10
|
+
def setup()
|
11
|
+
$ff.goto($htmlRoot + "selectboxes1.html")
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_textBox_Exists
|
15
|
+
assert($ff.select_list(:xpath, "//select[@name='sel1']").exists?)
|
16
|
+
assert_false($ff.select_list(:xpath, "//select[@name='missing']").exists?)
|
17
|
+
assert_false($ff.select_list(:xpath, "//select[@id='missing']").exists?)
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_element_by_xpath_class
|
21
|
+
element = $ff.element_by_xpath("//select[@name='sel1']")
|
22
|
+
assert(element.instance_of?(SelectList),"element class should be #{SelectList}; got #{element.class}")
|
23
|
+
# FIXME got HTMLAnchorElement, should've gotten HTMLSelectElement
|
24
|
+
# TODO: If element is not present, this should return null
|
25
|
+
#element = $ff.element_by_xpath("//select[@name='missing']")
|
26
|
+
#assert(element.instance_of?(SelectList),"element class should be #{SelectList}; got #{element.class}")
|
27
|
+
# FIXME got HTMLAnchorElement, should've gotten HTMLSelectElement
|
28
|
+
# TODO: If element is not present, this should return null
|
29
|
+
#element = $ff.element_by_xpath("//select[@id='missing']")
|
30
|
+
#assert(element.instance_of?(SelectList),"element class should be #{SelectList}; got #{element.class}")
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_select_list_enabled
|
34
|
+
assert($ff.select_list(:xpath, "//select[@name='sel1']").enabled?)
|
35
|
+
assert_raises(UnknownObjectException) { $ff.select_list(:xpath, "//select[@name='NoName']").enabled? }
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_select_list_getAllContents
|
39
|
+
assert_raises(UnknownObjectException) { $ff.select_list(:xpath, "//select[@name='NoName']").getAllContents }
|
40
|
+
assert_equal( ["Option 1" ,"Option 2" , "Option 3" , "Option 4"] ,
|
41
|
+
$ff.select_list(:xpath, "//select[@name='sel1']").getAllContents)
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_select_list_getSelectedItems
|
45
|
+
assert_raises(UnknownObjectException) { $ff.select_list(:xpath, "//select[@name='NoName']").getSelectedItems }
|
46
|
+
assert_equal( ["Option 3" ] ,
|
47
|
+
$ff.select_list(:xpath, "//select[@name='sel1']").getSelectedItems)
|
48
|
+
assert_equal( ["Option 3" , "Option 6" ] ,
|
49
|
+
$ff.select_list(:xpath, "//select[@name='sel2']").getSelectedItems)
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_clearSelection
|
53
|
+
assert_raises(UnknownObjectException) { $ff.select_list(:xpath, "//select[@name='NoName']").clearSelection }
|
54
|
+
$ff.select_list(:xpath, "//select[@name='sel1']").clearSelection
|
55
|
+
|
56
|
+
# the box sel1 has no ability to have a de-selected item
|
57
|
+
# By default Option 1 will be selected
|
58
|
+
assert_equal( ["Option 1" ] , $ff.select_list(:xpath, "//select[@name='sel1']").getSelectedItems)
|
59
|
+
|
60
|
+
$ff.select_list(:xpath, "//select[@name='sel2']").clearSelection
|
61
|
+
assert_equal( [ ] , $ff.select_list(:xpath, "//select[@name='sel2']").getSelectedItems)
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_select_list_select
|
65
|
+
assert_raises(UnknownObjectException) { $ff.select_list(:xpath, "//select[@name='NoName']").getSelectedItems }
|
66
|
+
assert_raises(NoValueFoundException) { $ff.select_list(:xpath, "//select[@name='sel1']").select("missing item") }
|
67
|
+
assert_raises(NoValueFoundException) { $ff.select_list(:xpath, "//select[@name='sel1']").select(/missing/) }
|
68
|
+
|
69
|
+
# the select method keeps any currently selected items - use the clear selectcion method first
|
70
|
+
$ff.select_list(:xpath, "//select[@name='sel1']").clearSelection
|
71
|
+
$ff.select_list(:xpath, "//select[@name='sel1']").select("Option 1")
|
72
|
+
assert_equal( ["Option 1" ] , $ff.select_list(:xpath, "//select[@name='sel1']").getSelectedItems)
|
73
|
+
|
74
|
+
$ff.select_list(:xpath, "//select[@name='sel1']").clearSelection
|
75
|
+
$ff.select_list(:xpath, "//select[@name='sel1']").select(/2/)
|
76
|
+
assert_equal( ["Option 2" ] , $ff.select_list(:xpath, "//select[@name='sel1']").getSelectedItems)
|
77
|
+
|
78
|
+
$ff.select_list(:xpath, "//select[@name='sel2']").clearSelection
|
79
|
+
$ff.select_list(:xpath, "//select[@name='sel2']").select( /2/ )
|
80
|
+
$ff.select_list(:xpath, "//select[@name='sel2']").select( /4/ )
|
81
|
+
assert_equal( ["Option 2" , "Option 4" ] ,
|
82
|
+
$ff.select_list(:xpath, "//select[@name='sel2']").getSelectedItems)
|
83
|
+
|
84
|
+
# these are to test the onchange event
|
85
|
+
# the event shouldnt get fired, as this is the selected item
|
86
|
+
$ff.select_list(:xpath, "//select[@name='sel3']").select( /3/ )
|
87
|
+
assert_false($ff.text.include?("Pass") )
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_select_list_select2
|
91
|
+
# the event should get fired
|
92
|
+
$ff.select_list(:xpath, "//select[@name='sel3']").select( /2/ )
|
93
|
+
assert($ff.text.include?("PASS") )
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_select_list_select_using_value
|
97
|
+
assert_raises(UnknownObjectException) { $ff.select_list(:xpath, "//select[@name='NoName']").getSelectedItems }
|
98
|
+
assert_raises(NoValueFoundException) { $ff.select_list(:xpath, "//select[@name='sel1']").select_value("missing item") }
|
99
|
+
assert_raises(NoValueFoundException) { $ff.select_list(:xpath, "//select[@name='sel1']").select_value(/missing/) }
|
100
|
+
|
101
|
+
# the select method keeps any currently selected items - use the clear selectcion method first
|
102
|
+
$ff.select_list(:xpath, "//select[@name='sel1']").clearSelection
|
103
|
+
$ff.select_list(:xpath, "//select[@name='sel1']").select_value("o1")
|
104
|
+
assert_equal( ["Option 1" ] , $ff.select_list(:xpath, "//select[@name='sel1']").getSelectedItems)
|
105
|
+
|
106
|
+
$ff.select_list(:xpath, "//select[@name='sel1']").clearSelection
|
107
|
+
$ff.select_list(:xpath, "//select[@name='sel1']").select_value(/2/)
|
108
|
+
assert_equal( ["Option 2" ] , $ff.select_list(:xpath, "//select[@name='sel1']").getSelectedItems)
|
109
|
+
|
110
|
+
$ff.select_list(:xpath, "//select[@name='sel2']").clearSelection
|
111
|
+
$ff.select_list(:xpath, "//select[@name='sel2']").select( /2/ )
|
112
|
+
$ff.select_list(:xpath, "//select[@name='sel2']").select( /4/ )
|
113
|
+
assert_equal( ["Option 2" , "Option 4" ] , $ff.select_list(:xpath, "//select[@name='sel2']").getSelectedItems)
|
114
|
+
|
115
|
+
# these are to test the onchange event
|
116
|
+
# the event shouldnt get fired, as this is the selected item
|
117
|
+
$ff.select_list(:xpath, "//select[@name='sel3']").select_value( /3/ )
|
118
|
+
assert_false($ff.text.include?("Pass") )
|
119
|
+
end
|
120
|
+
|
121
|
+
def test_select_list_select_using_value2
|
122
|
+
# the event should get fired
|
123
|
+
$ff.select_list(:xpath, "//select[@name='sel3']").select_value( /2/ )
|
124
|
+
assert($ff.text.include?("PASS") )
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
data/unittests/setup.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
END {$ff.close if $ff} # close ff at completion of the tests
|
2
|
+
|
3
|
+
# libraries used by feature tests
|
4
|
+
require 'firewatir'
|
5
|
+
require 'test/unit'
|
6
|
+
require 'test/unit/ui/console/testrunner'
|
7
|
+
require 'firewatir/testUnitAddons'
|
8
|
+
require 'iostring'
|
9
|
+
|
10
|
+
topdir = File.join(File.dirname(__FILE__), '..')
|
11
|
+
Dir.chdir topdir do
|
12
|
+
$all_tests = Dir["unittests/*_test.rb"]
|
13
|
+
end
|
14
|
+
$non_core_tests = [ ].collect {|x| "unittests/#{x}_test.rb"}
|
15
|
+
|
16
|
+
$core_tests = $all_tests - $non_core_tests
|
17
|
+
|
18
|
+
def start_ff_with_logger
|
19
|
+
$ff = FireWatir::Firefox.new()
|
20
|
+
# $ff.logger = Watir::WatirLogger.new( 'debug.txt', 4, 10000 )
|
21
|
+
#$ff.set_fast_speed
|
22
|
+
end
|
23
|
+
|
24
|
+
def set_local_dir
|
25
|
+
$myDir = File.expand_path(File.dirname(__FILE__))
|
26
|
+
$myDir.sub!( %r{/cygdrive/(\w)/}, '\1:/' ) # convert from cygwin to dos
|
27
|
+
# if you run the unit tests form a local file system use this line
|
28
|
+
$htmlRoot = "file://#{$myDir}/html/"
|
29
|
+
# if you run the unit tests from a web server use this line
|
30
|
+
# $htmlRoot = "http://localhost:8080/watir/html/"
|
31
|
+
end
|
32
|
+
|
33
|
+
start_ff_with_logger
|
34
|
+
set_local_dir
|
35
|
+
|