watir-webdriver 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. data/Rakefile +53 -31
  2. data/VERSION +1 -1
  3. data/lib/watir-webdriver.rb +6 -8
  4. data/lib/watir-webdriver/attribute_helper.rb +121 -0
  5. data/lib/watir-webdriver/browser.rb +13 -6
  6. data/lib/watir-webdriver/collections/element_collection.rb +21 -15
  7. data/lib/watir-webdriver/collections/table_row_collection.rb +11 -0
  8. data/lib/watir-webdriver/container.rb +17 -11
  9. data/lib/watir-webdriver/element.rb +201 -0
  10. data/lib/watir-webdriver/elements/button.rb +19 -2
  11. data/lib/watir-webdriver/elements/checkbox.rb +24 -4
  12. data/lib/watir-webdriver/elements/file_field.rb +24 -4
  13. data/lib/watir-webdriver/elements/font.rb +10 -11
  14. data/lib/watir-webdriver/elements/frame.rb +11 -3
  15. data/lib/watir-webdriver/elements/generated.rb +2491 -1313
  16. data/lib/watir-webdriver/elements/hidden.rb +16 -5
  17. data/lib/watir-webdriver/elements/input.rb +44 -5
  18. data/lib/watir-webdriver/elements/link.rb +6 -8
  19. data/lib/watir-webdriver/elements/radio.rb +25 -6
  20. data/lib/watir-webdriver/elements/{select_list.rb → select.rb} +8 -9
  21. data/lib/watir-webdriver/elements/text_field.rb +32 -3
  22. data/lib/watir-webdriver/html.rb +18 -0
  23. data/lib/watir-webdriver/html/generator.rb +112 -0
  24. data/lib/watir-webdriver/html/idl_sorter.rb +49 -0
  25. data/lib/watir-webdriver/html/spec_extractor.rb +111 -0
  26. data/lib/watir-webdriver/html/util.rb +31 -0
  27. data/lib/watir-webdriver/html/visitor.rb +186 -0
  28. data/lib/watir-webdriver/locators/element_locator.rb +4 -0
  29. data/lib/watir-webdriver/locators/text_field_locator.rb +2 -2
  30. data/lib/watir-webdriver/xpath_support.rb +3 -5
  31. data/lib/yard/handlers/watir.rb +57 -0
  32. data/spec/{base_element_spec.rb → element_spec.rb} +3 -2
  33. data/spec/input_spec.rb +65 -0
  34. data/spec/spec_helper.rb +9 -2
  35. data/spec/watirspec/area_spec.rb +9 -13
  36. data/spec/watirspec/areas_spec.rb +7 -1
  37. data/spec/watirspec/browser_spec.rb +68 -72
  38. data/spec/watirspec/button_spec.rb +16 -9
  39. data/spec/watirspec/buttons_spec.rb +11 -9
  40. data/spec/watirspec/checkbox_spec.rb +1 -1
  41. data/spec/watirspec/checkboxes_spec.rb +7 -1
  42. data/spec/watirspec/collections_spec.rb +18 -0
  43. data/spec/watirspec/dd_spec.rb +1 -1
  44. data/spec/watirspec/dds_spec.rb +7 -1
  45. data/spec/watirspec/del_spec.rb +141 -0
  46. data/spec/watirspec/dels_spec.rb +37 -0
  47. data/spec/watirspec/div_spec.rb +6 -22
  48. data/spec/watirspec/divs_spec.rb +8 -2
  49. data/spec/watirspec/dl_spec.rb +1 -1
  50. data/spec/watirspec/dls_spec.rb +7 -1
  51. data/spec/watirspec/dt_spec.rb +1 -1
  52. data/spec/watirspec/dts_spec.rb +7 -1
  53. data/spec/watirspec/element_spec.rb +11 -20
  54. data/spec/watirspec/em_spec.rb +1 -1
  55. data/spec/watirspec/ems_spec.rb +7 -1
  56. data/spec/watirspec/filefield_spec.rb +8 -11
  57. data/spec/watirspec/filefields_spec.rb +7 -1
  58. data/spec/watirspec/font_spec.rb +2 -2
  59. data/spec/watirspec/form_spec.rb +10 -18
  60. data/spec/watirspec/forms_spec.rb +7 -1
  61. data/spec/watirspec/frame_spec.rb +69 -73
  62. data/spec/watirspec/frames_spec.rb +15 -2
  63. data/spec/watirspec/hidden_spec.rb +1 -1
  64. data/spec/watirspec/hiddens_spec.rb +7 -1
  65. data/spec/watirspec/hn_spec.rb +1 -1
  66. data/spec/watirspec/hns_spec.rb +23 -27
  67. data/spec/watirspec/image_spec.rb +9 -15
  68. data/spec/watirspec/images_spec.rb +7 -1
  69. data/spec/watirspec/ins_spec.rb +142 -0
  70. data/spec/watirspec/inses_spec.rb +37 -0
  71. data/spec/watirspec/label_spec.rb +1 -1
  72. data/spec/watirspec/labels_spec.rb +7 -1
  73. data/spec/watirspec/li_spec.rb +1 -1
  74. data/spec/watirspec/lib/guards.rb +12 -12
  75. data/spec/watirspec/lib/implementation.rb +48 -0
  76. data/spec/watirspec/lib/watirspec.rb +17 -12
  77. data/spec/watirspec/link_spec.rb +6 -11
  78. data/spec/watirspec/links_spec.rb +1 -1
  79. data/spec/watirspec/lis_spec.rb +7 -1
  80. data/spec/watirspec/map_spec.rb +1 -1
  81. data/spec/watirspec/maps_spec.rb +7 -1
  82. data/spec/watirspec/meta_spec.rb +13 -15
  83. data/spec/watirspec/metas_spec.rb +6 -1
  84. data/spec/watirspec/ol_spec.rb +57 -59
  85. data/spec/watirspec/ols_spec.rb +10 -4
  86. data/spec/watirspec/option_spec.rb +50 -83
  87. data/spec/watirspec/p_spec.rb +1 -1
  88. data/spec/watirspec/pre_spec.rb +1 -1
  89. data/spec/watirspec/pres_spec.rb +7 -1
  90. data/spec/watirspec/ps_spec.rb +7 -1
  91. data/spec/watirspec/radio_spec.rb +9 -11
  92. data/spec/watirspec/radios_spec.rb +1 -1
  93. data/spec/watirspec/select_list_spec.rb +27 -40
  94. data/spec/watirspec/select_lists_spec.rb +1 -1
  95. data/spec/watirspec/span_spec.rb +1 -1
  96. data/spec/watirspec/spans_spec.rb +7 -1
  97. data/spec/watirspec/spec_helper.rb +1 -0
  98. data/spec/watirspec/strong_spec.rb +1 -1
  99. data/spec/watirspec/strongs_spec.rb +7 -1
  100. data/spec/watirspec/table_bodies_spec.rb +22 -10
  101. data/spec/watirspec/table_body_spec.rb +33 -40
  102. data/spec/watirspec/table_cell_spec.rb +1 -1
  103. data/spec/watirspec/table_cells_spec.rb +36 -15
  104. data/spec/watirspec/table_footer_spec.rb +43 -40
  105. data/spec/watirspec/table_footers_spec.rb +35 -19
  106. data/spec/watirspec/table_header_spec.rb +44 -39
  107. data/spec/watirspec/table_headers_spec.rb +37 -19
  108. data/spec/watirspec/table_row_spec.rb +13 -9
  109. data/spec/watirspec/table_rows_spec.rb +16 -6
  110. data/spec/watirspec/table_spec.rb +83 -62
  111. data/spec/watirspec/tables_spec.rb +7 -1
  112. data/spec/watirspec/text_field_spec.rb +4 -6
  113. data/spec/watirspec/text_fields_spec.rb +1 -1
  114. data/spec/watirspec/ul_spec.rb +1 -1
  115. data/spec/watirspec/uls_spec.rb +25 -22
  116. data/support/html5.html +89235 -0
  117. data/watir-webdriver.gemspec +31 -21
  118. metadata +52 -23
  119. data/TODO +0 -15
  120. data/lib/watir-webdriver/base_element.rb +0 -361
  121. data/lib/watir-webdriver/collections/buttons_collection.rb +0 -15
  122. data/lib/watir-webdriver/collections/table_rows_collection.rb +0 -16
  123. data/lib/watir-webdriver/collections/text_fields_collection.rb +0 -15
  124. data/lib/watir-webdriver/elements/headings.rb +0 -48
  125. data/support/html5/html5.idl +0 -1274
  126. data/support/html5/old/html5.idl +0 -962
  127. data/support/html5/old/html5_extras.idl +0 -145
  128. data/support/html5/watir_visitor.rb +0 -173
  129. data/support/yard_handlers.rb +0 -87
@@ -0,0 +1,65 @@
1
+ require File.expand_path 'watirspec/spec_helper', File.dirname(__FILE__)
2
+
3
+ describe Watir::Input do
4
+
5
+ before do
6
+ browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
7
+ end
8
+
9
+ describe "#to_checkbox" do
10
+ it "returns a CheckBox instance" do
11
+ e = browser.input(:xpath => "//input[@type='checkbox']").to_checkbox
12
+ e.should be_kind_of(Watir::CheckBox)
13
+ end
14
+
15
+ it "raises an error if the element is not a checkbox" do
16
+ lambda {
17
+ browser.input(:xpath => "//input[@type='text']").to_checkbox
18
+ }.should raise_error(TypeError)
19
+ end
20
+ end
21
+
22
+ describe "#to_radio" do
23
+ it "returns a Radio instance" do
24
+ e = browser.input(:xpath => "//input[@type='radio']").to_radio
25
+ e.should be_kind_of(Watir::Radio)
26
+ end
27
+
28
+ it "raises an error if the element is not a radio button" do
29
+ lambda {
30
+ browser.input(:xpath => "//input[@type='text']").to_checkbox
31
+ }.should raise_error(TypeError)
32
+ end
33
+ end
34
+
35
+ describe "#to_button" do
36
+ it "returns a Button instance" do
37
+ es = [
38
+ browser.input(:xpath => "//input[@type='button']").to_button,
39
+ browser.input(:xpath => "//input[@type='submit']").to_button
40
+ ]
41
+
42
+ es.each { |e| e.should be_kind_of(Watir::Button) }
43
+ end
44
+
45
+ it "raises an error if the element is not a button" do
46
+ lambda {
47
+ browser.input(:xpath => "//input[@type='text']").to_button
48
+ }.should raise_error(TypeError)
49
+ end
50
+ end
51
+
52
+ describe "#to_text_field" do
53
+ it "returns a TextField instance" do
54
+ e = browser.input(:xpath => "//input[@type='text']").to_text_field
55
+ e.should be_kind_of(Watir::TextField)
56
+ end
57
+
58
+ it "raises an error if the element is not a text field" do
59
+ lambda {
60
+ browser.input(:xpath => "//input[@type='radio']").to_text_field
61
+ }.should raise_error(TypeError)
62
+ end
63
+ end
64
+
65
+ end
@@ -14,6 +14,13 @@ include Watir::Exception
14
14
  if defined?(WatirSpec)
15
15
  browser = (ENV['WATIR_WEBDRIVER_BROWSER'] || :firefox).to_sym
16
16
 
17
- WatirSpec.browser_args = [browser]
18
- WatirSpec.implementation = :webdriver
17
+ WatirSpec.implementation do |imp|
18
+ imp.name = :webdriver
19
+ imp.browser_class = Watir::Browser
20
+ imp.browser_args = [browser]
21
+
22
+ imp.guard_proc = lambda { |args|
23
+ args.any? { |arg| arg == :webdriver || arg == [:webdriver, browser] }
24
+ }
25
+ end
19
26
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
2
+ require File.expand_path('spec_helper', File.dirname(__FILE__))
3
3
 
4
4
  describe "Area" do
5
5
 
@@ -15,12 +15,10 @@ describe "Area" do
15
15
  browser.area(:title, "Tables").should exist
16
16
  browser.area(:title, /Tables/).should exist
17
17
 
18
- bug "WTR-342", :watir do
19
- browser.area(:url, "tables.html").should exist
20
- browser.area(:url, /tables/).should exist
21
- browser.area(:href, "tables.html").should exist
22
- browser.area(:href, /tables/).should exist
23
- end
18
+ browser.area(:url, "tables.html").should exist
19
+ browser.area(:url, /tables/).should exist
20
+ browser.area(:href, "tables.html").should exist
21
+ browser.area(:href, /tables/).should exist
24
22
 
25
23
  browser.area(:index, 0).should exist
26
24
  browser.area(:xpath, "//area[@id='NCE']").should exist
@@ -32,12 +30,10 @@ describe "Area" do
32
30
  browser.area(:title, "no_such_title").should_not exist
33
31
  browser.area(:title, /no_such_title/).should_not exist
34
32
 
35
- bug "WTR-342", :watir do
36
- browser.area(:url, "no_such_href").should_not exist
37
- browser.area(:url, /no_such_href/).should_not exist
38
- browser.area(:href, "tables.html").should exist
39
- browser.area(:href, /tables/).should exist
40
- end
33
+ browser.area(:url, "no_such_href").should_not exist
34
+ browser.area(:url, /no_such_href/).should_not exist
35
+ browser.area(:href, "no-tables.html").should_not exist
36
+ browser.area(:href, /no-tables/).should_not exist
41
37
 
42
38
  browser.area(:index, 1337).should_not exist
43
39
  browser.area(:xpath, "//area[@id='no_such_id']").should_not exist
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
2
+ require File.expand_path('spec_helper', File.dirname(__FILE__))
3
3
 
4
4
  describe "Areas" do
5
5
 
@@ -21,10 +21,16 @@ describe "Areas" do
21
21
 
22
22
  describe "#each" do
23
23
  it "iterates through areas correctly" do
24
+ count = 0
25
+
24
26
  browser.areas.each_with_index do |a, index|
25
27
  a.id.should == browser.area(:index, index).id
26
28
  a.title.should == browser.area(:index, index).title
29
+
30
+ count += 1
27
31
  end
32
+
33
+ count.should > 0
28
34
  end
29
35
  end
30
36
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
2
+ require File.expand_path('spec_helper', File.dirname(__FILE__))
3
3
 
4
4
  describe "Browser" do
5
5
 
@@ -9,38 +9,32 @@ describe "Browser" do
9
9
  browser.should exist
10
10
  end
11
11
 
12
- not_compliant_on :webdriver do
13
- it "returns false after IE#close" do
14
- b = WatirSpec.new_browser
15
- b.close
16
- b.should_not exist
17
- end
12
+ it "returns false after Browser#close" do
13
+ b = WatirSpec.new_browser
14
+ b.close
15
+ b.should_not exist
18
16
  end
19
17
  end
20
18
 
21
19
  # this should be rewritten - the actual string returned varies alot between implementations
22
20
  describe "#html" do
23
- deviates_on :celerity do
24
- it "returns the downloaded HTML of the page" do
25
- browser.goto(WatirSpec.files + "/non_control_elements.html")
26
- browser.html.should == File.read(File.dirname(__FILE__) + "/html/non_control_elements.html")
27
- end
28
- end
29
-
30
- deviates_on :watir do
21
+ not_compliant_on [:webdriver, :ie] do
31
22
  it "returns the DOM of the page as an HTML string" do
32
23
  browser.goto(WatirSpec.files + "/right_click.html")
33
- browser.html.should == "<HTML><HEAD><TITLE>Right Click Test</TITLE>\r\n<META http-equiv=Content-type content=\"text/html; charset=utf-8\">\r\n<SCRIPT src=\"javascript/helpers.js\" type=text/javascript charset=utf-8></SCRIPT>\r\n</HEAD>\r\n<BODY>\r\n<DIV id=messages></DIV>\r\n<DIV oncontextmenu='WatirSpec.addMessage(\"right-clicked\")' id=click>Right click!</DIV></BODY></HTML>"
24
+ html = browser.html.downcase # varies between browsers
25
+
26
+ html.should =~ /^<html/
27
+ html.should include('<meta http-equiv="content-type" content="text/html; charset=utf-8">')
34
28
  end
35
29
  end
36
30
 
37
- deviates_on :webdriver do
31
+ deviates_on [:webdriver, :ie] do
38
32
  it "returns the DOM of the page as an HTML string" do
39
33
  browser.goto(WatirSpec.files + "/right_click.html")
40
34
  html = browser.html.downcase # varies between browsers
41
35
 
42
36
  html.should =~ /^<html/
43
- html.should include("<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">")
37
+ html.should include('<meta content="text/html; charset=utf-8" http-equiv=content-type>')
44
38
  end
45
39
  end
46
40
  end
@@ -54,15 +48,13 @@ describe "Browser" do
54
48
 
55
49
  describe "#status" do
56
50
  not_compliant_on :webdriver do # need to set Firefox preference, might do this when selenium-webdriver exposes the profile used
57
- bug "WTR-348", :watir do
58
- it "returns the current value of window.status" do
59
- browser.goto(WatirSpec.files + "/non_control_elements.html")
60
-
61
- # for firefox, this needs to be enabled in
62
- # Preferences -> Content -> Advanced -> Change status bar text
63
- browser.execute_script "window.status = 'All done!';"
64
- browser.status.should == "All done!"
65
- end
51
+ it "returns the current value of window.status" do
52
+ browser.goto(WatirSpec.files + "/non_control_elements.html")
53
+
54
+ # for firefox, this needs to be enabled in
55
+ # Preferences -> Content -> Advanced -> Change status bar text
56
+ browser.execute_script "window.status = 'All done!';"
57
+ browser.status.should == "All done!"
66
58
  end
67
59
  end
68
60
  end
@@ -87,12 +79,11 @@ describe "Browser" do
87
79
  end
88
80
  end
89
81
 
90
- not_compliant_on :webdriver do
91
- # just hangs with watir-webdriver + IE
82
+ not_compliant_on [:webdriver, :ie] do # hang?
92
83
  describe ".start" do
93
84
  it "goes to the given URL and return an instance of itself" do
94
- browser = Browser.start("#{WatirSpec.files}/non_control_elements.html")
95
- browser.should be_instance_of(Browser)
85
+ browser = WatirSpec.implementation.browser_class.start("#{WatirSpec.files}/non_control_elements.html")
86
+ browser.should be_instance_of(WatirSpec.implementation.browser_class)
96
87
  browser.title.should == "Non-control elements"
97
88
  browser.quit
98
89
  end
@@ -179,57 +170,61 @@ describe "Browser" do
179
170
  end
180
171
 
181
172
  describe "#element_by_xpath" do
182
- before :each do
183
- browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
184
- end
185
-
186
- bug "WTR-343", :watir do
187
- it "finds submit buttons matching the given xpath" do
188
- browser.element_by_xpath("//input[@type='submit']").should exist
189
- end
190
-
191
- it "finds reset buttons matching the given xpath" do
192
- browser.element_by_xpath("//input[@type='reset']").should exist
193
- end
194
-
195
- it "finds image buttons matching the given xpath" do
196
- browser.element_by_xpath("//input[@type='image']").should exist
197
- end
198
-
199
- it "finds the element matching the given xpath" do
200
- browser.element_by_xpath("//input[@type='password']").should exist
201
- end
202
- end
203
-
204
- bug "WTR-327", :watir do
205
- it "will not find elements that doesn't exist" do
206
- e = browser.element_by_xpath("//input[@type='foobar']")
207
- e.should_not exist
208
- lambda { e.text }.should raise_error(UnknownObjectException)
209
- end
210
- end
211
- end
212
-
173
+ before :each do
174
+ browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
175
+ end
176
+
177
+ it "finds submit buttons matching the given xpath" do
178
+ browser.element_by_xpath("//input[@type='submit']").should exist
179
+ end
180
+
181
+ it "finds reset buttons matching the given xpath" do
182
+ browser.element_by_xpath("//input[@type='reset']").should exist
183
+ end
184
+
185
+ it "finds image buttons matching the given xpath" do
186
+ browser.element_by_xpath("//input[@type='image']").should exist
187
+ end
188
+
189
+ it "finds the element matching the given xpath" do
190
+ browser.element_by_xpath("//input[@type='password']").should exist
191
+ end
192
+
193
+ it "will not find elements that doesn't exist" do
194
+ e = browser.element_by_xpath("//input[@type='foobar']")
195
+ e.should_not exist
196
+ lambda { e.text }.should raise_error(UnknownObjectException)
197
+ end
198
+ end
199
+
213
200
  describe "#elements_by_xpath" do
214
201
  before :each do
215
202
  browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
216
203
  end
217
204
 
218
- bug "WTR-344", :watir do
205
+ not_compliant_on [:webdriver, :ie] do
219
206
  it "returns an Array of matching elements" do
220
207
  objects = browser.elements_by_xpath("//*[@type='text']")
221
208
  objects.should be_kind_of(Array)
209
+
222
210
  objects.size.should == 5
223
211
  end
224
212
  end
225
213
 
226
- bug "WTR-328", :watir do
227
- it "returns an empty Array if there are no matching elements" do
228
- objects = browser.elements_by_xpath("//*[@type='foobar']")
214
+ deviates_on [:webdriver, :ie] do
215
+ it "returns an Array of matching elements" do
216
+ objects = browser.elements_by_xpath("//*[@type='text']")
229
217
  objects.should be_kind_of(Array)
230
- objects.size.should == 0
218
+
219
+ objects.size.should == 6
231
220
  end
232
221
  end
222
+
223
+ it "returns an empty Array if there are no matching elements" do
224
+ objects = browser.elements_by_xpath("//*[@type='foobar']")
225
+ objects.should be_kind_of(Array)
226
+ objects.size.should == 0
227
+ end
233
228
  end
234
229
 
235
230
  describe "#add_checker" do
@@ -237,16 +232,17 @@ describe "Browser" do
237
232
  lambda { browser.add_checker }.should raise_error(ArgumentError)
238
233
  end
239
234
 
240
- not_compliant_on :webdriver do
241
- # if on IE, this slows the rest of the suite way down for some reason
242
- it "runs the given proc on each page load" do
243
- output = ''
244
- proc = Proc.new { |browser| output << browser.text }
235
+ it "runs the given proc on each page load" do
236
+ output = ''
237
+ proc = Proc.new { |browser| output << browser.text }
245
238
 
239
+ begin
246
240
  browser.add_checker(proc)
247
241
  browser.goto(WatirSpec.files + "/non_control_elements.html")
248
242
 
249
243
  output.should include('Dubito, ergo cogito, ergo sum')
244
+ ensure
245
+ browser.disable_checker(proc)
250
246
  end
251
247
  end
252
248
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
2
+ require File.expand_path('spec_helper', File.dirname(__FILE__))
3
3
 
4
4
  describe "Button" do
5
5
 
@@ -50,6 +50,13 @@ describe "Button" do
50
50
  browser.button(:xpath, "//input[@id='no_such_id']").should_not exist
51
51
  end
52
52
 
53
+ bug "http://github.com/jarib/watir-webdriver/issues#issue/6", :webdriver do
54
+ it "checks the tag name and type attribute when locating by xpath" do
55
+ browser.button(:xpath, "//input[@type='text']").should_not exist
56
+ browser.button(:xpath, "//input[@type='button']").should exist
57
+ end
58
+ end
59
+
53
60
  it "raises TypeError when 'what' argument is invalid" do
54
61
  lambda { browser.button(:id, 3.14).exists? }.should raise_error(TypeError)
55
62
  end
@@ -100,15 +107,15 @@ describe "Button" do
100
107
  end
101
108
 
102
109
  describe "#src" do
103
- not_compliant_on :watir do
110
+ not_compliant_on [:webdriver, :ie], [:webdriver, :firefox] do
104
111
  it "returns the src attribute for the button image" do
105
112
  browser.button(:name, "new_user_image").src.should == "images/button.jpg"
106
113
  end
107
114
  end
108
115
 
109
- deviates_on :watir do
110
- it "returns the full url for the button image" do
111
- browser.button(:name, "new_user_image").src.should == "file:///#{File.dirname(__FILE__)}/images/button.jpg"
116
+ deviates_on [:webdriver, :ie], [:webdriver, :firefox] do
117
+ it "returns the src attribute for the button image" do
118
+ browser.button(:name, "new_user_image").src.should == "file:///#{File.expand_path(File.dirname(__FILE__))}/html/images/button.jpg"
112
119
  end
113
120
  end
114
121
 
@@ -118,15 +125,15 @@ describe "Button" do
118
125
  end
119
126
 
120
127
  describe "#style" do
121
- deviates_on :watir do
128
+ not_compliant_on [:webdriver, :ie] do
122
129
  it "returns the style attribute if the button exists" do
123
- browser.button(:id, 'delete_user_submit').style.should == "border-right: red 4px solid; border-top: red 4px solid; border-left: red 4px solid; border-bottom: red 4px solid"
130
+ browser.button(:id, 'delete_user_submit').style.should == "border: 4px solid red;"
124
131
  end
125
132
  end
126
133
 
127
- not_compliant_on :watir do
134
+ deviates_on [:webdriver, :ie] do
128
135
  it "returns the style attribute if the button exists" do
129
- browser.button(:id, 'delete_user_submit').style.should == "border: 4px solid red;"
136
+ browser.button(:id, 'delete_user_submit').style.should == "BORDER-BOTTOM: red 4px solid; BORDER-LEFT: red 4px solid; BORDER-TOP: red 4px solid; BORDER-RIGHT: red 4px solid"
130
137
  end
131
138
  end
132
139
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
2
+ require File.expand_path('spec_helper', File.dirname(__FILE__))
3
3
 
4
4
  describe "Buttons" do
5
5
 
@@ -8,10 +8,8 @@ describe "Buttons" do
8
8
  end
9
9
 
10
10
  describe "#length" do
11
- bug "WTR-349", :watir do
12
- it "returns the number of buttons" do
13
- browser.buttons.length.should == 8
14
- end
11
+ it "returns the number of buttons" do
12
+ browser.buttons.length.should == 8
15
13
  end
16
14
  end
17
15
 
@@ -28,20 +26,24 @@ describe "Buttons" do
28
26
  end
29
27
 
30
28
  describe "#last" do
31
- bug "WTR-349", :watir do
32
- it "returns the last element in the collection" do
33
- browser.buttons.last.value.should == browser.buttons[-1].value
34
- end
29
+ it "returns the last element in the collection" do
30
+ browser.buttons.last.value.should == browser.buttons[-1].value
35
31
  end
36
32
  end
37
33
 
38
34
  describe "#each" do
39
35
  it "iterates through buttons correctly" do
36
+ count = 0
37
+
40
38
  browser.buttons.each_with_index do |b, index|
41
39
  b.name.should == browser.button(:index, index).name
42
40
  b.id.should == browser.button(:index, index).id
43
41
  b.value.should == browser.button(:index, index).value
42
+
43
+ count += 1
44
44
  end
45
+
46
+ count.should > 0
45
47
  end
46
48
  end
47
49