firewatir 1.6.5 → 1.6.6.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +461 -0
- data/LICENSE +31 -31
- data/README.rdoc +112 -0
- data/VERSION +1 -0
- data/lib/firewatir.rb +41 -40
- data/lib/firewatir/container.rb +491 -491
- data/lib/firewatir/document.rb +239 -239
- data/lib/firewatir/element.rb +1364 -1364
- data/lib/firewatir/element_collections.rb +314 -314
- data/lib/firewatir/elements/button.rb +15 -15
- data/lib/firewatir/elements/file_field.rb +29 -29
- data/lib/firewatir/elements/form.rb +40 -40
- data/lib/firewatir/elements/frame.rb +55 -55
- data/lib/firewatir/elements/hidden.rb +56 -56
- data/lib/firewatir/elements/image.rb +139 -139
- data/lib/firewatir/elements/input_element.rb +44 -44
- data/lib/firewatir/elements/link.rb +76 -76
- data/lib/firewatir/elements/non_control_element.rb +53 -53
- data/lib/firewatir/elements/non_control_elements.rb +108 -108
- data/lib/firewatir/elements/not_used.rb +278 -278
- data/lib/firewatir/elements/option.rb +130 -130
- data/lib/firewatir/elements/radio_check_common.rb +163 -163
- data/lib/firewatir/elements/select_list.rb +188 -188
- data/lib/firewatir/elements/table.rb +218 -218
- data/lib/firewatir/elements/table_cell.rb +54 -54
- data/lib/firewatir/elements/table_row.rb +100 -100
- data/lib/firewatir/elements/text_field.rb +218 -218
- data/lib/firewatir/exceptions.rb +10 -10
- data/lib/firewatir/firefox.rb +984 -1040
- data/lib/firewatir/jssh_socket.rb +100 -100
- data/lib/firewatir/winClicker.rb +122 -122
- data/lib/firewatir/x11.rb +192 -192
- data/rakefile.rb +15 -0
- data/unittests/attach_to_new_window_test.rb +49 -49
- data/unittests/bug_fixes_test.rb +195 -195
- data/unittests/buttons_xpath_test.rb +88 -88
- data/unittests/checkbox_test.rb +158 -158
- data/unittests/checkbox_xpath_test.rb +107 -107
- data/unittests/div_test.rb +275 -275
- data/unittests/ff_test.rb +47 -0
- data/unittests/filefield_test.rb +49 -49
- data/unittests/filefield_xpath_test.rb +35 -35
- data/unittests/form_test.rb +296 -296
- data/unittests/frame_test.rb +159 -159
- data/unittests/hidden_test.rb +85 -85
- data/unittests/hidden_xpath_test.rb +72 -72
- data/unittests/html/JavascriptClick.html +42 -42
- data/unittests/html/blankpage.html +11 -11
- data/unittests/html/buttons1.html +61 -61
- data/unittests/html/checkboxes1.html +70 -70
- data/unittests/html/complex_table.html +36 -36
- data/unittests/html/cssTest.html +42 -42
- data/unittests/html/div.html +72 -72
- data/unittests/html/div_xml.html +20 -20
- data/unittests/html/fileupload.html +45 -45
- data/unittests/html/formTest1.html +38 -38
- data/unittests/html/forms2.html +45 -45
- data/unittests/html/forms3.html +132 -132
- data/unittests/html/forms4.html +27 -27
- data/unittests/html/frame_buttons.html +3 -3
- data/unittests/html/frame_links.html +3 -3
- data/unittests/html/frame_multi.html +4 -4
- data/unittests/html/iframeTest.html +14 -14
- data/unittests/html/iframeTest1.html +13 -13
- data/unittests/html/iframeTest2.html +5 -5
- data/unittests/html/images1.html +66 -66
- data/unittests/html/javascriptevents.html +35 -35
- data/unittests/html/link_pass.html +10 -10
- data/unittests/html/links1.html +42 -42
- data/unittests/html/links2.html +10 -10
- data/unittests/html/modal_dialog.html +8 -8
- data/unittests/html/modal_dialog_launcher.html +11 -11
- data/unittests/html/nestedFrames.html +6 -6
- data/unittests/html/new_browser.html +17 -17
- data/unittests/html/new_browser_popup.html +7 -7
- data/unittests/html/pass.html +9 -9
- data/unittests/html/popups1.html +60 -60
- data/unittests/html/pre.html +27 -27
- data/unittests/html/radioButtons1.html +70 -70
- data/unittests/html/redirect.html +10 -10
- data/unittests/html/redirect1.html +8 -8
- data/unittests/html/redirect2.html +8 -8
- data/unittests/html/redirect3.html +8 -8
- data/unittests/html/select_tealeaf.html +54 -54
- data/unittests/html/selectboxes1.html +55 -55
- data/unittests/html/simple_table.html +26 -26
- data/unittests/html/simple_table_buttons.html +104 -104
- data/unittests/html/simple_table_columns.html +74 -74
- data/unittests/html/table1.html +165 -165
- data/unittests/html/tableCell_using_xpath.html +19 -19
- data/unittests/html/textarea.html +30 -30
- data/unittests/html/textfields1.html +62 -62
- data/unittests/html/textsearch.html +44 -44
- data/unittests/images_test.rb +198 -198
- data/unittests/images_xpath_test.rb +118 -118
- data/unittests/javascript_test.rb +75 -75
- data/unittests/links_test.rb +231 -231
- data/unittests/links_xpath_test.rb +79 -79
- data/unittests/mozilla_all_tests.rb +7 -7
- data/unittests/pre_test.rb +75 -75
- data/unittests/radios_test.rb +166 -166
- data/unittests/radios_xpath_test.rb +101 -101
- data/unittests/redirect_test.rb +41 -41
- data/unittests/selectbox_test.rb +142 -142
- data/unittests/selectbox_xpath_test.rb +129 -129
- data/unittests/setup.rb +29 -29
- data/unittests/table_test.rb +385 -385
- data/unittests/table_xpath_test.rb +185 -185
- data/unittests/textfields_test.rb +234 -234
- data/unittests/textfields_xpath_test.rb +113 -113
- metadata +51 -19
- data/lib/firewatir/version.rb +0 -5
data/rakefile.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/clean'
|
4
|
+
require 'rake/gempackagetask'
|
5
|
+
|
6
|
+
task :default => :package
|
7
|
+
|
8
|
+
CLEAN << 'pkg' << 'rdoc'
|
9
|
+
|
10
|
+
gemspec = eval(File.read('firewatir.gemspec'))
|
11
|
+
Rake::GemPackageTask.new(gemspec) do |p|
|
12
|
+
p.gem_spec = gemspec
|
13
|
+
p.need_tar = false
|
14
|
+
p.need_zip = false
|
15
|
+
end
|
@@ -1,49 +1,49 @@
|
|
1
|
-
# feature tests for attaching to new Firefox windows
|
2
|
-
# revision: $Revision: 1.0 $
|
3
|
-
|
4
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
5
|
-
require 'unittests/setup'
|
6
|
-
|
7
|
-
class TC_NewWindow < Test::Unit::TestCase
|
8
|
-
tags :fails_on_ie
|
9
|
-
|
10
|
-
def setup
|
11
|
-
goto_page("new_browser.html")
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_simply_attach_to_new_window_using_title
|
15
|
-
browser.link(:text, 'New Window').click
|
16
|
-
begin
|
17
|
-
ff_new = browser.attach(:title, 'Pass Page')
|
18
|
-
rescue Watir::Exception::NoMatchingWindowFoundException
|
19
|
-
raise $!, "Attach failed, check your Firefox settings: http://wiki.openqa.org/display/WTR/FireWatir+Installation#FireWatirInstallation-ffsettings"
|
20
|
-
end
|
21
|
-
assert(ff_new.text.include?('PASS'))
|
22
|
-
ff_new.close
|
23
|
-
#browser.link(:text, 'New Window').click
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_simply_attach_to_new_window_using_url
|
27
|
-
browser.link(:text, 'New Window').click
|
28
|
-
begin
|
29
|
-
ff_new = browser.attach(:url, /pass\.html/)
|
30
|
-
rescue Watir::Exception::NoMatchingWindowFoundException
|
31
|
-
raise $!, "Attach failed, check your Firefox settings: http://wiki.openqa.org/display/WTR/FireWatir+Installation#FireWatirInstallation-ffsettings"
|
32
|
-
end
|
33
|
-
assert(ff_new.text.include?('PASS'))
|
34
|
-
ff_new.close
|
35
|
-
#browser.link(:text, 'New Window').click
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_attach_to_new_window_with_same_title_as_parent
|
39
|
-
browser.link(:text, 'New Browser Window').click
|
40
|
-
ff_new = browser.attach(:title, 'New Browser Launcher')
|
41
|
-
assert(ff_new.text.include?('PASS'))
|
42
|
-
ff_new.close
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_new_window_exists
|
46
|
-
assert_raises(NoMatchingWindowFoundException , "NoMatchingWindowFoundException was supposed to be thrown" ) { browser.attach(:title, "missing_title") }
|
47
|
-
assert_raises(NoMatchingWindowFoundException , "NoMatchingWindowFoundException was supposed to be thrown" ) { browser.attach(:url, "missing_url") }
|
48
|
-
end
|
49
|
-
end
|
1
|
+
# feature tests for attaching to new Firefox windows
|
2
|
+
# revision: $Revision: 1.0 $
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
5
|
+
require 'unittests/setup'
|
6
|
+
|
7
|
+
class TC_NewWindow < Test::Unit::TestCase
|
8
|
+
tags :fails_on_ie
|
9
|
+
|
10
|
+
def setup
|
11
|
+
goto_page("new_browser.html")
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_simply_attach_to_new_window_using_title
|
15
|
+
browser.link(:text, 'New Window').click
|
16
|
+
begin
|
17
|
+
ff_new = browser.attach(:title, 'Pass Page')
|
18
|
+
rescue Watir::Exception::NoMatchingWindowFoundException
|
19
|
+
raise $!, "Attach failed, check your Firefox settings: http://wiki.openqa.org/display/WTR/FireWatir+Installation#FireWatirInstallation-ffsettings"
|
20
|
+
end
|
21
|
+
assert(ff_new.text.include?('PASS'))
|
22
|
+
ff_new.close
|
23
|
+
#browser.link(:text, 'New Window').click
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_simply_attach_to_new_window_using_url
|
27
|
+
browser.link(:text, 'New Window').click
|
28
|
+
begin
|
29
|
+
ff_new = browser.attach(:url, /pass\.html/)
|
30
|
+
rescue Watir::Exception::NoMatchingWindowFoundException
|
31
|
+
raise $!, "Attach failed, check your Firefox settings: http://wiki.openqa.org/display/WTR/FireWatir+Installation#FireWatirInstallation-ffsettings"
|
32
|
+
end
|
33
|
+
assert(ff_new.text.include?('PASS'))
|
34
|
+
ff_new.close
|
35
|
+
#browser.link(:text, 'New Window').click
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_attach_to_new_window_with_same_title_as_parent
|
39
|
+
browser.link(:text, 'New Browser Window').click
|
40
|
+
ff_new = browser.attach(:title, 'New Browser Launcher')
|
41
|
+
assert(ff_new.text.include?('PASS'))
|
42
|
+
ff_new.close
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_new_window_exists
|
46
|
+
assert_raises(NoMatchingWindowFoundException , "NoMatchingWindowFoundException was supposed to be thrown" ) { browser.attach(:title, "missing_title") }
|
47
|
+
assert_raises(NoMatchingWindowFoundException , "NoMatchingWindowFoundException was supposed to be thrown" ) { browser.attach(:url, "missing_url") }
|
48
|
+
end
|
49
|
+
end
|
data/unittests/bug_fixes_test.rb
CHANGED
@@ -1,195 +1,195 @@
|
|
1
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
2
|
-
require 'unittests/setup'
|
3
|
-
|
4
|
-
class TC_Bugs< Test::Unit::TestCase
|
5
|
-
|
6
|
-
|
7
|
-
def setup
|
8
|
-
goto_page("frame_buttons.html")
|
9
|
-
end
|
10
|
-
|
11
|
-
tag_method :test_frame_objects_bug3, :fails_on_ie
|
12
|
-
def test_frame_objects_bug3
|
13
|
-
frame = browser.frame("buttonFrame")
|
14
|
-
button = frame.button(:name, "b1")
|
15
|
-
assert_equal("buttonFrame", frame.name)
|
16
|
-
assert_equal("b2", button.id)
|
17
|
-
text1 = frame.text_field(:id, "text_id")
|
18
|
-
text1.set("NewValue")
|
19
|
-
assert("NewValue",frame.text_field(:id, "text_id").value)
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_link_object_bug9
|
23
|
-
goto_page("links1.html")
|
24
|
-
link = browser.link(:text, "nameDelet")
|
25
|
-
assert_equal("test_link", link.name)
|
26
|
-
end
|
27
|
-
|
28
|
-
|
29
|
-
# element_by_xpath should return an element that's instance of the
|
30
|
-
# appropriate class, not the generic Element class. So if it's a div,
|
31
|
-
# it should return an instance of Div, if it's a checkbox, CheckBox,
|
32
|
-
# and so on. TODO write tests for all classes
|
33
|
-
tag_method :test_element_by_xpath_bug01, :fails_on_ie
|
34
|
-
def test_element_by_xpath_bug01
|
35
|
-
goto_page("div.html")
|
36
|
-
element = browser.element_by_xpath("//div[@id='div1']")
|
37
|
-
assert_not_nil(element) # helder
|
38
|
-
# next assert always breaks, dunno why (error, not failure)
|
39
|
-
#assert_instance_of(Div, element, "wrong constructor was used")
|
40
|
-
# using this hack instead
|
41
|
-
assert_class element, 'Div'
|
42
|
-
end
|
43
|
-
|
44
|
-
tag_method :test_elements_by_xpath_bug10, :fails_on_ie
|
45
|
-
def test_elements_by_xpath_bug10
|
46
|
-
goto_page("links1.html")
|
47
|
-
elements = browser.elements_by_xpath("//a")
|
48
|
-
assert_equal(11, elements.length)
|
49
|
-
assert_equal("links2.html", elements[0].href)
|
50
|
-
assert_equal("link_class_1", elements[1].className)
|
51
|
-
assert_equal("link_id", elements[5].id)
|
52
|
-
assert_equal("Link Using an ID", elements[5].text)
|
53
|
-
end
|
54
|
-
|
55
|
-
def test_button_by_value_bug8
|
56
|
-
goto_page("buttons1.html")
|
57
|
-
assert_equal("Sign In", browser.button(:value,"Sign In").value)
|
58
|
-
end
|
59
|
-
|
60
|
-
tag_method :test_html_bug7, :fails_on_ie
|
61
|
-
def test_html_bug7
|
62
|
-
goto_page("links1.html")
|
63
|
-
html = browser.html
|
64
|
-
assert_match(/.*<a id="linktos" *>*/,html)
|
65
|
-
end
|
66
|
-
|
67
|
-
def test_span_onclick_bug14
|
68
|
-
goto_page("div.html")
|
69
|
-
browser.span(:id, "span1").fireEvent("onclick")
|
70
|
-
assert(browser.text.include?("PASS") )
|
71
|
-
end
|
72
|
-
|
73
|
-
tag_method :test_file_field_value_bug20, :fails_on_ie # hangs, actually
|
74
|
-
def test_file_field_value_bug20
|
75
|
-
actual_file_name = "c:\\Program Files\\TestFile.html"
|
76
|
-
goto_page("fileupload.html")
|
77
|
-
browser.file_field(:name, "file3").set(actual_file_name)
|
78
|
-
set_file_name = browser.file_field(:name, "file3").value
|
79
|
-
# make sure correct value for upload file is posted.
|
80
|
-
assert(actual_file_name, set_file_name)
|
81
|
-
end
|
82
|
-
|
83
|
-
tag_method :test_attribute_value_bug22, :fails_on_ie
|
84
|
-
def test_attribute_value_bug22
|
85
|
-
goto_page("div.html")
|
86
|
-
assert("Test1", browser.element_by_xpath("//div[@id='div1']").attribute_value("title"))
|
87
|
-
end
|
88
|
-
|
89
|
-
def test_url_value_bug23
|
90
|
-
goto_page("buttons1.html")
|
91
|
-
browser.button(:id, "b2").click
|
92
|
-
assert($htmlRoot + "pass.html", browser.url)
|
93
|
-
end
|
94
|
-
|
95
|
-
def test_contains_text_bug28
|
96
|
-
goto_page("buttons1.html")
|
97
|
-
browser.button(:id, "b2").click
|
98
|
-
assert_false(browser.contains_text("passed"))
|
99
|
-
assert(browser.contains_text("PASS"))
|
100
|
-
assert(browser.contains_text("PAS"))
|
101
|
-
assert(browser.contains_text(/PAS/))
|
102
|
-
assert(browser.contains_text(/pass/i))
|
103
|
-
assert_false(browser.contains_text(/pass/))
|
104
|
-
end
|
105
|
-
|
106
|
-
tag_method :test_frame_bug_21, :fails_on_ie
|
107
|
-
def test_frame_bug_21
|
108
|
-
goto_page("frame_buttons.html")
|
109
|
-
frame1 = browser.frame(:name, "buttonFrame")
|
110
|
-
frame2 = browser.frame(:name, "buttonFrame2")
|
111
|
-
assert_equal("buttons1.html", frame1.src)
|
112
|
-
assert_equal("blankpage.html", frame2.src)
|
113
|
-
end
|
114
|
-
|
115
|
-
def test_quotes_bug_11
|
116
|
-
goto_page("textfields1.html")
|
117
|
-
browser.text_field(:name, "text1").set("value with quote (\")")
|
118
|
-
assert_equal("value with quote (\")", browser.text_field(:name, "text1").value)
|
119
|
-
browser.text_field(:name, "text1").set("value with backslash (\\)")
|
120
|
-
assert_equal("value with backslash (\\)", browser.text_field(:name, "text1").value)
|
121
|
-
end
|
122
|
-
|
123
|
-
tag_method :test_close_bug_26, :fails_on_ie
|
124
|
-
def test_close_bug_26
|
125
|
-
browser.close()
|
126
|
-
browser = FireWatir::Firefox.new
|
127
|
-
end
|
128
|
-
|
129
|
-
def test_class_bug_29
|
130
|
-
goto_page("div.html")
|
131
|
-
div = browser.div(:class, "blueText")
|
132
|
-
assert_equal("div2", div.id)
|
133
|
-
end
|
134
|
-
|
135
|
-
def test_element_using_any_attribute
|
136
|
-
goto_page("div.html")
|
137
|
-
div = browser.div(:title, "Test1")
|
138
|
-
assert_equal("div1", div.id)
|
139
|
-
end
|
140
|
-
|
141
|
-
tag_method :test_element_using_any_attribute2, :fails_on_ie
|
142
|
-
def test_element_using_any_attribute2
|
143
|
-
goto_page("div.html")
|
144
|
-
div = browser.div(:attribute, "attribute")
|
145
|
-
assert_equal("div1", div.id)
|
146
|
-
end
|
147
|
-
|
148
|
-
tag_method :test_file_field_bug_20, :fails_on_ie
|
149
|
-
def test_file_field_bug_20
|
150
|
-
goto_page("fileupload.html")
|
151
|
-
# Enter dummy path.
|
152
|
-
if(RUBY_PLATFORM =~ /.*mswin.*/)
|
153
|
-
browser.file_field(:name, "file3").set("c:\\results.txt")
|
154
|
-
else
|
155
|
-
browser.file_field(:name, "file3").set("/user/lib/results.txt")
|
156
|
-
end
|
157
|
-
browser.button(:name, "upload").click()
|
158
|
-
url = browser.url
|
159
|
-
assert_match(/.*results.txt&upload=upload$/,url)
|
160
|
-
end
|
161
|
-
|
162
|
-
def test_button_bug2
|
163
|
-
goto_page("buttons1.html")
|
164
|
-
btn = browser.button(:id, "b7")
|
165
|
-
assert_equal("b7", btn.id)
|
166
|
-
end
|
167
|
-
|
168
|
-
def test_getAllContents_bug25
|
169
|
-
goto_page("select_tealeaf.html")
|
170
|
-
browser.select_lists.each do |select|
|
171
|
-
contents = select.getAllContents().join
|
172
|
-
assert_equal("=<>>=<=", contents)
|
173
|
-
break
|
174
|
-
end
|
175
|
-
end
|
176
|
-
|
177
|
-
tag_method :test_fire_event_bug31, :fails_on_ie
|
178
|
-
def test_fire_event_bug31
|
179
|
-
goto_page("div.html")
|
180
|
-
div = browser.div(:attribute, "attribute")
|
181
|
-
div.fire_event("ondblclick")
|
182
|
-
assert("PASS", browser.text)
|
183
|
-
goto_page("div.html")
|
184
|
-
div = browser.div(:id, "div1")
|
185
|
-
div.fireEvent("ondblclick")
|
186
|
-
assert("PASS", browser.text)
|
187
|
-
end
|
188
|
-
|
189
|
-
def test_contains_text_bug37
|
190
|
-
goto_page("frame_buttons.html")
|
191
|
-
frame = browser.frame(:name, "buttonFrame")
|
192
|
-
assert(frame.contains_text("second button"))
|
193
|
-
assert_false(frame.contains_text("second button second"))
|
194
|
-
end
|
195
|
-
end
|
1
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
2
|
+
require 'unittests/setup'
|
3
|
+
|
4
|
+
class TC_Bugs< Test::Unit::TestCase
|
5
|
+
|
6
|
+
|
7
|
+
def setup
|
8
|
+
goto_page("frame_buttons.html")
|
9
|
+
end
|
10
|
+
|
11
|
+
tag_method :test_frame_objects_bug3, :fails_on_ie
|
12
|
+
def test_frame_objects_bug3
|
13
|
+
frame = browser.frame("buttonFrame")
|
14
|
+
button = frame.button(:name, "b1")
|
15
|
+
assert_equal("buttonFrame", frame.name)
|
16
|
+
assert_equal("b2", button.id)
|
17
|
+
text1 = frame.text_field(:id, "text_id")
|
18
|
+
text1.set("NewValue")
|
19
|
+
assert("NewValue",frame.text_field(:id, "text_id").value)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_link_object_bug9
|
23
|
+
goto_page("links1.html")
|
24
|
+
link = browser.link(:text, "nameDelet")
|
25
|
+
assert_equal("test_link", link.name)
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
# element_by_xpath should return an element that's instance of the
|
30
|
+
# appropriate class, not the generic Element class. So if it's a div,
|
31
|
+
# it should return an instance of Div, if it's a checkbox, CheckBox,
|
32
|
+
# and so on. TODO write tests for all classes
|
33
|
+
tag_method :test_element_by_xpath_bug01, :fails_on_ie
|
34
|
+
def test_element_by_xpath_bug01
|
35
|
+
goto_page("div.html")
|
36
|
+
element = browser.element_by_xpath("//div[@id='div1']")
|
37
|
+
assert_not_nil(element) # helder
|
38
|
+
# next assert always breaks, dunno why (error, not failure)
|
39
|
+
#assert_instance_of(Div, element, "wrong constructor was used")
|
40
|
+
# using this hack instead
|
41
|
+
assert_class element, 'Div'
|
42
|
+
end
|
43
|
+
|
44
|
+
tag_method :test_elements_by_xpath_bug10, :fails_on_ie
|
45
|
+
def test_elements_by_xpath_bug10
|
46
|
+
goto_page("links1.html")
|
47
|
+
elements = browser.elements_by_xpath("//a")
|
48
|
+
assert_equal(11, elements.length)
|
49
|
+
assert_equal("links2.html", elements[0].href)
|
50
|
+
assert_equal("link_class_1", elements[1].className)
|
51
|
+
assert_equal("link_id", elements[5].id)
|
52
|
+
assert_equal("Link Using an ID", elements[5].text)
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_button_by_value_bug8
|
56
|
+
goto_page("buttons1.html")
|
57
|
+
assert_equal("Sign In", browser.button(:value,"Sign In").value)
|
58
|
+
end
|
59
|
+
|
60
|
+
tag_method :test_html_bug7, :fails_on_ie
|
61
|
+
def test_html_bug7
|
62
|
+
goto_page("links1.html")
|
63
|
+
html = browser.html
|
64
|
+
assert_match(/.*<a id="linktos" *>*/,html)
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_span_onclick_bug14
|
68
|
+
goto_page("div.html")
|
69
|
+
browser.span(:id, "span1").fireEvent("onclick")
|
70
|
+
assert(browser.text.include?("PASS") )
|
71
|
+
end
|
72
|
+
|
73
|
+
tag_method :test_file_field_value_bug20, :fails_on_ie # hangs, actually
|
74
|
+
def test_file_field_value_bug20
|
75
|
+
actual_file_name = "c:\\Program Files\\TestFile.html"
|
76
|
+
goto_page("fileupload.html")
|
77
|
+
browser.file_field(:name, "file3").set(actual_file_name)
|
78
|
+
set_file_name = browser.file_field(:name, "file3").value
|
79
|
+
# make sure correct value for upload file is posted.
|
80
|
+
assert(actual_file_name, set_file_name)
|
81
|
+
end
|
82
|
+
|
83
|
+
tag_method :test_attribute_value_bug22, :fails_on_ie
|
84
|
+
def test_attribute_value_bug22
|
85
|
+
goto_page("div.html")
|
86
|
+
assert("Test1", browser.element_by_xpath("//div[@id='div1']").attribute_value("title"))
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_url_value_bug23
|
90
|
+
goto_page("buttons1.html")
|
91
|
+
browser.button(:id, "b2").click
|
92
|
+
assert($htmlRoot + "pass.html", browser.url)
|
93
|
+
end
|
94
|
+
|
95
|
+
def test_contains_text_bug28
|
96
|
+
goto_page("buttons1.html")
|
97
|
+
browser.button(:id, "b2").click
|
98
|
+
assert_false(browser.contains_text("passed"))
|
99
|
+
assert(browser.contains_text("PASS"))
|
100
|
+
assert(browser.contains_text("PAS"))
|
101
|
+
assert(browser.contains_text(/PAS/))
|
102
|
+
assert(browser.contains_text(/pass/i))
|
103
|
+
assert_false(browser.contains_text(/pass/))
|
104
|
+
end
|
105
|
+
|
106
|
+
tag_method :test_frame_bug_21, :fails_on_ie
|
107
|
+
def test_frame_bug_21
|
108
|
+
goto_page("frame_buttons.html")
|
109
|
+
frame1 = browser.frame(:name, "buttonFrame")
|
110
|
+
frame2 = browser.frame(:name, "buttonFrame2")
|
111
|
+
assert_equal("buttons1.html", frame1.src)
|
112
|
+
assert_equal("blankpage.html", frame2.src)
|
113
|
+
end
|
114
|
+
|
115
|
+
def test_quotes_bug_11
|
116
|
+
goto_page("textfields1.html")
|
117
|
+
browser.text_field(:name, "text1").set("value with quote (\")")
|
118
|
+
assert_equal("value with quote (\")", browser.text_field(:name, "text1").value)
|
119
|
+
browser.text_field(:name, "text1").set("value with backslash (\\)")
|
120
|
+
assert_equal("value with backslash (\\)", browser.text_field(:name, "text1").value)
|
121
|
+
end
|
122
|
+
|
123
|
+
tag_method :test_close_bug_26, :fails_on_ie
|
124
|
+
def test_close_bug_26
|
125
|
+
browser.close()
|
126
|
+
browser = FireWatir::Firefox.new
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_class_bug_29
|
130
|
+
goto_page("div.html")
|
131
|
+
div = browser.div(:class, "blueText")
|
132
|
+
assert_equal("div2", div.id)
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_element_using_any_attribute
|
136
|
+
goto_page("div.html")
|
137
|
+
div = browser.div(:title, "Test1")
|
138
|
+
assert_equal("div1", div.id)
|
139
|
+
end
|
140
|
+
|
141
|
+
tag_method :test_element_using_any_attribute2, :fails_on_ie
|
142
|
+
def test_element_using_any_attribute2
|
143
|
+
goto_page("div.html")
|
144
|
+
div = browser.div(:attribute, "attribute")
|
145
|
+
assert_equal("div1", div.id)
|
146
|
+
end
|
147
|
+
|
148
|
+
tag_method :test_file_field_bug_20, :fails_on_ie
|
149
|
+
def test_file_field_bug_20
|
150
|
+
goto_page("fileupload.html")
|
151
|
+
# Enter dummy path.
|
152
|
+
if(RUBY_PLATFORM =~ /.*mswin.*/)
|
153
|
+
browser.file_field(:name, "file3").set("c:\\results.txt")
|
154
|
+
else
|
155
|
+
browser.file_field(:name, "file3").set("/user/lib/results.txt")
|
156
|
+
end
|
157
|
+
browser.button(:name, "upload").click()
|
158
|
+
url = browser.url
|
159
|
+
assert_match(/.*results.txt&upload=upload$/,url)
|
160
|
+
end
|
161
|
+
|
162
|
+
def test_button_bug2
|
163
|
+
goto_page("buttons1.html")
|
164
|
+
btn = browser.button(:id, "b7")
|
165
|
+
assert_equal("b7", btn.id)
|
166
|
+
end
|
167
|
+
|
168
|
+
def test_getAllContents_bug25
|
169
|
+
goto_page("select_tealeaf.html")
|
170
|
+
browser.select_lists.each do |select|
|
171
|
+
contents = select.getAllContents().join
|
172
|
+
assert_equal("=<>>=<=", contents)
|
173
|
+
break
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
tag_method :test_fire_event_bug31, :fails_on_ie
|
178
|
+
def test_fire_event_bug31
|
179
|
+
goto_page("div.html")
|
180
|
+
div = browser.div(:attribute, "attribute")
|
181
|
+
div.fire_event("ondblclick")
|
182
|
+
assert("PASS", browser.text)
|
183
|
+
goto_page("div.html")
|
184
|
+
div = browser.div(:id, "div1")
|
185
|
+
div.fireEvent("ondblclick")
|
186
|
+
assert("PASS", browser.text)
|
187
|
+
end
|
188
|
+
|
189
|
+
def test_contains_text_bug37
|
190
|
+
goto_page("frame_buttons.html")
|
191
|
+
frame = browser.frame(:name, "buttonFrame")
|
192
|
+
assert(frame.contains_text("second button"))
|
193
|
+
assert_false(frame.contains_text("second button second"))
|
194
|
+
end
|
195
|
+
end
|