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.
Files changed (112) hide show
  1. data/CHANGES +461 -0
  2. data/LICENSE +31 -31
  3. data/README.rdoc +112 -0
  4. data/VERSION +1 -0
  5. data/lib/firewatir.rb +41 -40
  6. data/lib/firewatir/container.rb +491 -491
  7. data/lib/firewatir/document.rb +239 -239
  8. data/lib/firewatir/element.rb +1364 -1364
  9. data/lib/firewatir/element_collections.rb +314 -314
  10. data/lib/firewatir/elements/button.rb +15 -15
  11. data/lib/firewatir/elements/file_field.rb +29 -29
  12. data/lib/firewatir/elements/form.rb +40 -40
  13. data/lib/firewatir/elements/frame.rb +55 -55
  14. data/lib/firewatir/elements/hidden.rb +56 -56
  15. data/lib/firewatir/elements/image.rb +139 -139
  16. data/lib/firewatir/elements/input_element.rb +44 -44
  17. data/lib/firewatir/elements/link.rb +76 -76
  18. data/lib/firewatir/elements/non_control_element.rb +53 -53
  19. data/lib/firewatir/elements/non_control_elements.rb +108 -108
  20. data/lib/firewatir/elements/not_used.rb +278 -278
  21. data/lib/firewatir/elements/option.rb +130 -130
  22. data/lib/firewatir/elements/radio_check_common.rb +163 -163
  23. data/lib/firewatir/elements/select_list.rb +188 -188
  24. data/lib/firewatir/elements/table.rb +218 -218
  25. data/lib/firewatir/elements/table_cell.rb +54 -54
  26. data/lib/firewatir/elements/table_row.rb +100 -100
  27. data/lib/firewatir/elements/text_field.rb +218 -218
  28. data/lib/firewatir/exceptions.rb +10 -10
  29. data/lib/firewatir/firefox.rb +984 -1040
  30. data/lib/firewatir/jssh_socket.rb +100 -100
  31. data/lib/firewatir/winClicker.rb +122 -122
  32. data/lib/firewatir/x11.rb +192 -192
  33. data/rakefile.rb +15 -0
  34. data/unittests/attach_to_new_window_test.rb +49 -49
  35. data/unittests/bug_fixes_test.rb +195 -195
  36. data/unittests/buttons_xpath_test.rb +88 -88
  37. data/unittests/checkbox_test.rb +158 -158
  38. data/unittests/checkbox_xpath_test.rb +107 -107
  39. data/unittests/div_test.rb +275 -275
  40. data/unittests/ff_test.rb +47 -0
  41. data/unittests/filefield_test.rb +49 -49
  42. data/unittests/filefield_xpath_test.rb +35 -35
  43. data/unittests/form_test.rb +296 -296
  44. data/unittests/frame_test.rb +159 -159
  45. data/unittests/hidden_test.rb +85 -85
  46. data/unittests/hidden_xpath_test.rb +72 -72
  47. data/unittests/html/JavascriptClick.html +42 -42
  48. data/unittests/html/blankpage.html +11 -11
  49. data/unittests/html/buttons1.html +61 -61
  50. data/unittests/html/checkboxes1.html +70 -70
  51. data/unittests/html/complex_table.html +36 -36
  52. data/unittests/html/cssTest.html +42 -42
  53. data/unittests/html/div.html +72 -72
  54. data/unittests/html/div_xml.html +20 -20
  55. data/unittests/html/fileupload.html +45 -45
  56. data/unittests/html/formTest1.html +38 -38
  57. data/unittests/html/forms2.html +45 -45
  58. data/unittests/html/forms3.html +132 -132
  59. data/unittests/html/forms4.html +27 -27
  60. data/unittests/html/frame_buttons.html +3 -3
  61. data/unittests/html/frame_links.html +3 -3
  62. data/unittests/html/frame_multi.html +4 -4
  63. data/unittests/html/iframeTest.html +14 -14
  64. data/unittests/html/iframeTest1.html +13 -13
  65. data/unittests/html/iframeTest2.html +5 -5
  66. data/unittests/html/images1.html +66 -66
  67. data/unittests/html/javascriptevents.html +35 -35
  68. data/unittests/html/link_pass.html +10 -10
  69. data/unittests/html/links1.html +42 -42
  70. data/unittests/html/links2.html +10 -10
  71. data/unittests/html/modal_dialog.html +8 -8
  72. data/unittests/html/modal_dialog_launcher.html +11 -11
  73. data/unittests/html/nestedFrames.html +6 -6
  74. data/unittests/html/new_browser.html +17 -17
  75. data/unittests/html/new_browser_popup.html +7 -7
  76. data/unittests/html/pass.html +9 -9
  77. data/unittests/html/popups1.html +60 -60
  78. data/unittests/html/pre.html +27 -27
  79. data/unittests/html/radioButtons1.html +70 -70
  80. data/unittests/html/redirect.html +10 -10
  81. data/unittests/html/redirect1.html +8 -8
  82. data/unittests/html/redirect2.html +8 -8
  83. data/unittests/html/redirect3.html +8 -8
  84. data/unittests/html/select_tealeaf.html +54 -54
  85. data/unittests/html/selectboxes1.html +55 -55
  86. data/unittests/html/simple_table.html +26 -26
  87. data/unittests/html/simple_table_buttons.html +104 -104
  88. data/unittests/html/simple_table_columns.html +74 -74
  89. data/unittests/html/table1.html +165 -165
  90. data/unittests/html/tableCell_using_xpath.html +19 -19
  91. data/unittests/html/textarea.html +30 -30
  92. data/unittests/html/textfields1.html +62 -62
  93. data/unittests/html/textsearch.html +44 -44
  94. data/unittests/images_test.rb +198 -198
  95. data/unittests/images_xpath_test.rb +118 -118
  96. data/unittests/javascript_test.rb +75 -75
  97. data/unittests/links_test.rb +231 -231
  98. data/unittests/links_xpath_test.rb +79 -79
  99. data/unittests/mozilla_all_tests.rb +7 -7
  100. data/unittests/pre_test.rb +75 -75
  101. data/unittests/radios_test.rb +166 -166
  102. data/unittests/radios_xpath_test.rb +101 -101
  103. data/unittests/redirect_test.rb +41 -41
  104. data/unittests/selectbox_test.rb +142 -142
  105. data/unittests/selectbox_xpath_test.rb +129 -129
  106. data/unittests/setup.rb +29 -29
  107. data/unittests/table_test.rb +385 -385
  108. data/unittests/table_xpath_test.rb +185 -185
  109. data/unittests/textfields_test.rb +234 -234
  110. data/unittests/textfields_xpath_test.rb +113 -113
  111. metadata +51 -19
  112. 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
@@ -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