operawatir 0.4-jruby → 0.4.1-jruby

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.
Files changed (222) hide show
  1. data/.gitmodules +3 -3
  2. data/AUTHORS +1 -0
  3. data/CHANGES +454 -0
  4. data/README.md +67 -50
  5. data/Rakefile +6 -10
  6. data/VERSION +1 -1
  7. data/bin/desktopwatir +52 -29
  8. data/bin/operawatir +50 -18
  9. data/lib/operadriver/client-combined-nodeps.jar +0 -0
  10. data/lib/operadriver/webdriver-opera.jar +0 -0
  11. data/lib/operawatir.rb +8 -1
  12. data/lib/operawatir/browser.rb +35 -15
  13. data/lib/operawatir/collection.rb +2 -2
  14. data/lib/operawatir/compat.rb +3 -2
  15. data/lib/operawatir/compat/browser.rb +0 -5
  16. data/lib/operawatir/compat/collection.rb +15 -0
  17. data/lib/operawatir/compat/element.rb +72 -21
  18. data/lib/operawatir/compat/element_finders.rb +6 -0
  19. data/lib/operawatir/compat/selector.rb +7 -0
  20. data/lib/operawatir/compat/window.rb +49 -0
  21. data/lib/operawatir/desktop_browser.rb +88 -14
  22. data/lib/operawatir/desktop_common.rb +0 -2
  23. data/lib/operawatir/desktop_container.rb +82 -29
  24. data/lib/operawatir/desktop_helper.rb +2 -0
  25. data/lib/operawatir/element.rb +49 -25
  26. data/lib/operawatir/helper.rb +5 -3
  27. data/lib/operawatir/keys.rb +19 -6
  28. data/lib/operawatir/preferences.rb +315 -78
  29. data/lib/operawatir/quickwidgets.rb +2 -1
  30. data/lib/operawatir/quickwidgets/quick_addressfield.rb +12 -0
  31. data/lib/operawatir/quickwidgets/quick_button.rb +8 -2
  32. data/lib/operawatir/quickwidgets/quick_checkbox.rb +5 -5
  33. data/lib/operawatir/quickwidgets/quick_editfield.rb +8 -5
  34. data/lib/operawatir/quickwidgets/quick_find.rb +11 -0
  35. data/lib/operawatir/quickwidgets/quick_griditem.rb +11 -0
  36. data/lib/operawatir/quickwidgets/quick_gridlayout.rb +11 -0
  37. data/lib/operawatir/quickwidgets/quick_searchfield.rb +7 -1
  38. data/lib/operawatir/quickwidgets/quick_tab.rb +0 -1
  39. data/lib/operawatir/quickwidgets/quick_treeitem.rb +22 -1
  40. data/lib/operawatir/quickwidgets/quick_widget.rb +62 -23
  41. data/lib/operawatir/quickwidgets/quick_window.rb +32 -2
  42. data/lib/operawatir/screenshot.rb +46 -0
  43. data/lib/operawatir/version.rb +6 -4
  44. data/lib/operawatir/window.rb +53 -67
  45. data/operawatir.gemspec +310 -245
  46. data/spec/operawatir/README.md +4 -0
  47. data/spec/operawatir/core/browser_spec.rb +82 -0
  48. data/spec/operawatir/core/element_spec.rb +88 -0
  49. data/spec/operawatir/core/preferences_spec.rb +438 -0
  50. data/spec/operawatir/core/screenshot_spec.rb +76 -0
  51. data/spec/{new_watirspec → operawatir/core}/spatnav_spec.rb +3 -3
  52. data/spec/operawatir/core/window_spec.rb +76 -0
  53. data/spec/operawatir/desktop/desktopbrowser_spec.rb +316 -0
  54. data/spec/operawatir/desktop/quickaddressfield_spec.rb +59 -0
  55. data/spec/operawatir/desktop/quickbutton_spec.rb +248 -0
  56. data/spec/operawatir/desktop/quickcheckbox_spec.rb +36 -0
  57. data/spec/operawatir/desktop/quickdialogtab_spec.rb +30 -0
  58. data/spec/operawatir/desktop/quickdropdown_spec.rb +39 -0
  59. data/spec/operawatir/desktop/quickeditfield_spec.rb +51 -0
  60. data/spec/operawatir/desktop/quickfind_spec.rb +30 -0
  61. data/spec/operawatir/desktop/quickgriditem_spec.rb +16 -0
  62. data/spec/operawatir/desktop/quickgridlayout_spec.rb +15 -0
  63. data/spec/operawatir/desktop/quicklabel_spec.rb +28 -0
  64. data/spec/operawatir/desktop/quickradiobutton_spec.rb +24 -0
  65. data/spec/operawatir/desktop/quicksearchfield_spec.rb +26 -0
  66. data/spec/operawatir/desktop/quicktab_spec.rb +86 -0
  67. data/spec/operawatir/desktop/quickthumbnail_spec.rb +37 -0
  68. data/spec/operawatir/desktop/quicktreeitem_spec.rb +135 -0
  69. data/spec/operawatir/desktop/quicktreeview_spec.rb +30 -0
  70. data/spec/operawatir/desktop/quickwidget_spec.rb +101 -0
  71. data/spec/operawatir/desktop/quickwindow_spec.rb +108 -0
  72. data/spec/operawatir/desktop/shared/shared.rb +138 -0
  73. data/spec/operawatir/fixtures/boxes.html +22 -0
  74. data/spec/operawatir/fixtures/browsers.svg +367 -0
  75. data/spec/operawatir/fixtures/frames.html +13 -0
  76. data/spec/operawatir/fixtures/grid.html +29 -0
  77. data/spec/operawatir/fixtures/input_fields_value.html +6 -0
  78. data/spec/operawatir/fixtures/onclick.html +20 -0
  79. data/spec/operawatir/fixtures/paragraphs.html +15 -0
  80. data/spec/operawatir/fixtures/two_input_fields.html +6 -0
  81. data/spec/{new_watirspec → operawatir}/guards.rb +0 -0
  82. data/spec/operawatir/matchers.rb +68 -0
  83. data/spec/{legacy_watirspec → operawatir}/server.rb +0 -0
  84. data/spec/operawatir/watirspec.rake +43 -0
  85. data/spec/operawatir/watirspec_desktophelper.rb +14 -0
  86. data/spec/operawatir/watirspec_helper.rb +62 -0
  87. data/spec/{legacy_watirspec → watir2}/area_spec.rb +0 -0
  88. data/spec/{legacy_watirspec → watir2}/areas_spec.rb +0 -0
  89. data/spec/{legacy_watirspec → watir2}/browser_spec.rb +2 -0
  90. data/spec/{legacy_watirspec → watir2}/button_spec.rb +0 -0
  91. data/spec/{legacy_watirspec → watir2}/buttons_spec.rb +0 -0
  92. data/spec/{legacy_watirspec → watir2}/checkbox_spec.rb +0 -0
  93. data/spec/{legacy_watirspec → watir2}/checkboxes_spec.rb +0 -0
  94. data/spec/{legacy_watirspec → watir2}/collections_spec.rb +0 -0
  95. data/spec/{legacy_watirspec → watir2}/dd_spec.rb +0 -0
  96. data/spec/{legacy_watirspec → watir2}/dds_spec.rb +0 -0
  97. data/spec/{legacy_watirspec → watir2}/del_spec.rb +0 -0
  98. data/spec/{legacy_watirspec → watir2}/dels_spec.rb +0 -0
  99. data/spec/{legacy_watirspec → watir2}/div_spec.rb +0 -0
  100. data/spec/{legacy_watirspec → watir2}/divs_spec.rb +0 -0
  101. data/spec/{legacy_watirspec → watir2}/dl_spec.rb +0 -0
  102. data/spec/{legacy_watirspec → watir2}/dls_spec.rb +0 -0
  103. data/spec/{legacy_watirspec → watir2}/dt_spec.rb +0 -0
  104. data/spec/{legacy_watirspec → watir2}/dts_spec.rb +0 -0
  105. data/spec/watir2/element_spec.rb +155 -0
  106. data/spec/{legacy_watirspec → watir2}/em_spec.rb +0 -0
  107. data/spec/{legacy_watirspec → watir2}/ems_spec.rb +0 -0
  108. data/spec/{legacy_watirspec → watir2}/filefield_spec.rb +0 -0
  109. data/spec/{legacy_watirspec → watir2}/filefields_spec.rb +0 -0
  110. data/spec/{legacy_watirspec → watir2}/fixtures/2000_spans.html +0 -0
  111. data/spec/{legacy_watirspec → watir2}/fixtures/bug_duplicate_attributes.html +0 -0
  112. data/spec/{legacy_watirspec → watir2}/fixtures/bug_javascript_001.html +0 -0
  113. data/spec/{legacy_watirspec → watir2}/fixtures/buttons_with_duplicate_ids.html +0 -0
  114. data/spec/{legacy_watirspec → watir2}/fixtures/collections.html +0 -0
  115. data/spec/{legacy_watirspec → watir2}/fixtures/definition_lists.html +0 -0
  116. data/spec/{legacy_watirspec → watir2}/fixtures/euc-jp_text.html +0 -0
  117. data/spec/{legacy_watirspec → watir2}/fixtures/forms_with_input_elements.html +0 -0
  118. data/spec/{legacy_watirspec → watir2}/fixtures/frame_1.html +0 -0
  119. data/spec/{legacy_watirspec → watir2}/fixtures/frame_2.html +0 -0
  120. data/spec/{legacy_watirspec → watir2}/fixtures/frames.html +0 -0
  121. data/spec/{legacy_watirspec → watir2}/fixtures/iframes.html +0 -0
  122. data/spec/{legacy_watirspec → watir2}/fixtures/images.html +0 -0
  123. data/spec/{legacy_watirspec → watir2}/fixtures/images/1.gif +0 -0
  124. data/spec/{legacy_watirspec → watir2}/fixtures/images/2.gif +0 -0
  125. data/spec/{legacy_watirspec → watir2}/fixtures/images/3.gif +0 -0
  126. data/spec/{legacy_watirspec → watir2}/fixtures/images/button.jpg +0 -0
  127. data/spec/{legacy_watirspec → watir2}/fixtures/images/circle.jpg +0 -0
  128. data/spec/{legacy_watirspec → watir2}/fixtures/images/map.gif +0 -0
  129. data/spec/{legacy_watirspec → watir2}/fixtures/images/map2.gif +0 -0
  130. data/spec/{legacy_watirspec → watir2}/fixtures/images/minus.gif +0 -0
  131. data/spec/{legacy_watirspec → watir2}/fixtures/images/originaltriangle.jpg +0 -0
  132. data/spec/{legacy_watirspec → watir2}/fixtures/images/plus.gif +0 -0
  133. data/spec/{legacy_watirspec → watir2}/fixtures/images/square.jpg +0 -0
  134. data/spec/{legacy_watirspec → watir2}/fixtures/images/triangle.jpg +0 -0
  135. data/spec/{legacy_watirspec → watir2}/fixtures/iso-2022-jp_text.html +0 -0
  136. data/spec/{legacy_watirspec → watir2}/fixtures/javascript/helpers.js +0 -0
  137. data/spec/{legacy_watirspec → watir2}/fixtures/jquery.html +0 -0
  138. data/spec/{legacy_watirspec → watir2}/fixtures/latin1_text.html +0 -0
  139. data/spec/{legacy_watirspec → watir2}/fixtures/multiple_ids.html +0 -0
  140. data/spec/{legacy_watirspec → watir2}/fixtures/non_control_elements.html +0 -0
  141. data/spec/{legacy_watirspec → watir2}/fixtures/parser_bug_001.html +0 -0
  142. data/spec/{legacy_watirspec → watir2}/fixtures/prevent_form_submit.html +0 -0
  143. data/spec/{legacy_watirspec → watir2}/fixtures/right_click.html +0 -0
  144. data/spec/{legacy_watirspec → watir2}/fixtures/shift_jis_text.html +0 -0
  145. data/spec/{legacy_watirspec → watir2}/fixtures/tables.html +0 -0
  146. data/spec/{legacy_watirspec → watir2}/fixtures/timeout.html +0 -0
  147. data/spec/{legacy_watirspec → watir2}/fixtures/timeout_window_location.html +0 -0
  148. data/spec/{legacy_watirspec → watir2}/fixtures/tiny_mce.html +0 -0
  149. data/spec/{legacy_watirspec → watir2}/fixtures/utf8_text.html +0 -0
  150. data/spec/{legacy_watirspec → watir2}/fixtures/watirspec.css +0 -0
  151. data/spec/{legacy_watirspec → watir2}/form_spec.rb +0 -0
  152. data/spec/{legacy_watirspec → watir2}/forms_spec.rb +0 -0
  153. data/spec/{legacy_watirspec → watir2}/frame_spec.rb +0 -0
  154. data/spec/{legacy_watirspec → watir2}/frames_spec.rb +0 -0
  155. data/spec/{legacy_watirspec → watir2}/guards.rb +0 -0
  156. data/spec/{legacy_watirspec → watir2}/hidden_spec.rb +0 -0
  157. data/spec/{legacy_watirspec → watir2}/hiddens_spec.rb +0 -0
  158. data/spec/{legacy_watirspec → watir2}/hn_spec.rb +0 -0
  159. data/spec/{legacy_watirspec → watir2}/hns_spec.rb +0 -0
  160. data/spec/{legacy_watirspec → watir2}/image_spec.rb +0 -0
  161. data/spec/{legacy_watirspec → watir2}/images_spec.rb +0 -0
  162. data/spec/{legacy_watirspec → watir2}/ins_spec.rb +0 -0
  163. data/spec/{legacy_watirspec → watir2}/inses_spec.rb +0 -0
  164. data/spec/{legacy_watirspec → watir2}/label_spec.rb +0 -0
  165. data/spec/{legacy_watirspec → watir2}/labels_spec.rb +0 -0
  166. data/spec/{legacy_watirspec → watir2}/li_spec.rb +0 -0
  167. data/spec/{legacy_watirspec → watir2}/link_spec.rb +0 -0
  168. data/spec/{legacy_watirspec → watir2}/links_spec.rb +0 -0
  169. data/spec/{legacy_watirspec → watir2}/lis_spec.rb +0 -0
  170. data/spec/{legacy_watirspec → watir2}/map_spec.rb +0 -0
  171. data/spec/{legacy_watirspec → watir2}/maps_spec.rb +0 -0
  172. data/spec/{legacy_watirspec → watir2}/meta_spec.rb +0 -0
  173. data/spec/{legacy_watirspec → watir2}/metas_spec.rb +0 -0
  174. data/spec/{legacy_watirspec → watir2}/ol_spec.rb +0 -0
  175. data/spec/{legacy_watirspec → watir2}/ols_spec.rb +0 -0
  176. data/spec/{legacy_watirspec → watir2}/option_spec.rb +0 -0
  177. data/spec/{legacy_watirspec → watir2}/p_spec.rb +0 -0
  178. data/spec/{legacy_watirspec → watir2}/pre_spec.rb +0 -0
  179. data/spec/{legacy_watirspec → watir2}/pres_spec.rb +0 -0
  180. data/spec/{legacy_watirspec → watir2}/ps_spec.rb +0 -0
  181. data/spec/{legacy_watirspec → watir2}/radio_spec.rb +0 -0
  182. data/spec/{legacy_watirspec → watir2}/radios_spec.rb +0 -0
  183. data/spec/{legacy_watirspec → watir2}/select_list_spec.rb +84 -71
  184. data/spec/{legacy_watirspec → watir2}/select_lists_spec.rb +0 -0
  185. data/spec/{new_watirspec → watir2}/server.rb +0 -0
  186. data/spec/{legacy_watirspec → watir2}/span_spec.rb +0 -0
  187. data/spec/{legacy_watirspec → watir2}/spans_spec.rb +0 -0
  188. data/spec/{legacy_watirspec → watir2}/spec_helper.rb +0 -0
  189. data/spec/{legacy_watirspec → watir2}/strong_spec.rb +0 -0
  190. data/spec/{legacy_watirspec → watir2}/strongs_spec.rb +0 -0
  191. data/spec/{legacy_watirspec → watir2}/table_bodies_spec.rb +0 -0
  192. data/spec/{legacy_watirspec → watir2}/table_body_spec.rb +0 -0
  193. data/spec/{legacy_watirspec → watir2}/table_cell_spec.rb +0 -0
  194. data/spec/{legacy_watirspec → watir2}/table_cells_spec.rb +0 -0
  195. data/spec/{legacy_watirspec → watir2}/table_footer_spec.rb +0 -0
  196. data/spec/{legacy_watirspec → watir2}/table_footers_spec.rb +0 -0
  197. data/spec/{legacy_watirspec → watir2}/table_header_spec.rb +0 -0
  198. data/spec/{legacy_watirspec → watir2}/table_headers_spec.rb +0 -0
  199. data/spec/{legacy_watirspec → watir2}/table_row_spec.rb +0 -0
  200. data/spec/{legacy_watirspec → watir2}/table_rows_spec.rb +0 -0
  201. data/spec/{legacy_watirspec → watir2}/table_spec.rb +0 -0
  202. data/spec/{legacy_watirspec → watir2}/tables_spec.rb +0 -0
  203. data/spec/{legacy_watirspec → watir2}/text_field_spec.rb +0 -0
  204. data/spec/{legacy_watirspec → watir2}/text_fields_spec.rb +0 -0
  205. data/spec/{legacy_watirspec → watir2}/ul_spec.rb +0 -0
  206. data/spec/{legacy_watirspec → watir2}/uls_spec.rb +0 -0
  207. data/spec/{legacy_watirspec → watir2}/watir_compatibility_spec.rb +0 -0
  208. data/spec/{legacy_watirspec → watir2}/watirspec_helper.rb +0 -0
  209. data/spec/{new_watirspec → watir3}/browser_spec.rb +11 -21
  210. data/spec/{new_watirspec → watir3}/clipboard_spec.rb +2 -2
  211. data/spec/{new_watirspec → watir3}/collection_spec.rb +0 -0
  212. data/spec/{new_watirspec → watir3}/element_spec.rb +30 -12
  213. data/spec/watir3/guards.rb +39 -0
  214. data/spec/{new_watirspec → watir3}/keys_spec.rb +0 -0
  215. data/spec/watir3/server.rb +91 -0
  216. data/spec/{new_watirspec → watir3}/watirspec_helper.rb +0 -0
  217. data/spec/{new_watirspec → watir3}/window_spec.rb +8 -83
  218. metadata +315 -280
  219. data/lib/operadriver/selenium-common.jar +0 -0
  220. data/spec/legacy_watirspec/element_spec.rb +0 -86
  221. data/spec/new_watirspec/preferences_spec.rb +0 -144
  222. data/spec/new_watirspec/screenshot_spec.rb +0 -34
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -14,21 +14,18 @@ describe "SelectList" do
14
14
  browser.select_list(:id, /new_user_country/).should exist
15
15
  browser.select_list(:name, 'new_user_country').should exist
16
16
  browser.select_list(:name, /new_user_country/).should exist
17
- # TODO: check behaviour in Watir
18
- # browser.select_list(:value, 'Norway').should exist
19
- # browser.select_list(:value, /Norway/).should exist
20
- browser.select_list(:text, 'Norway').should exist
21
- browser.select_list(:text, /Norway/).should exist
17
+
18
+ not_compliant_on :webdriver do
19
+ browser.select_list(:text, 'Norway').should exist
20
+ browser.select_list(:text, /Norway/).should exist
21
+ end
22
+
22
23
  browser.select_list(:class, 'country').should exist
23
24
  browser.select_list(:class, /country/).should exist
24
- browser.select_list(:index, 1).should exist
25
+ browser.select_list(:index, 0).should exist
25
26
  browser.select_list(:xpath, "//select[@id='new_user_country']").should exist
26
27
  end
27
28
 
28
- it "returns true if the element exists (default how = :name)" do
29
- browser.select_list("new_user_country").should exist
30
- end
31
-
32
29
  it "returns the first select if given no args" do
33
30
  browser.select_list.should exist
34
31
  end
@@ -70,7 +67,7 @@ describe "SelectList" do
70
67
 
71
68
  describe "#id" do
72
69
  it "returns the id of the element" do
73
- browser.select_list(:index, 1).id.should == "new_user_country"
70
+ browser.select_list(:index, 0).id.should == "new_user_country"
74
71
  end
75
72
 
76
73
  it "raises UnknownObjectException if the select list doesn't exist" do
@@ -80,7 +77,7 @@ describe "SelectList" do
80
77
 
81
78
  describe "#name" do
82
79
  it "returns the name of the element" do
83
- browser.select_list(:index, 1).name.should == "new_user_country"
80
+ browser.select_list(:index, 0).name.should == "new_user_country"
84
81
  end
85
82
 
86
83
  it "raises UnknownObjectException if the select list doesn't exist" do
@@ -88,22 +85,22 @@ describe "SelectList" do
88
85
  end
89
86
  end
90
87
 
91
- describe "#type" do
92
- it "returns the type of the element" do
93
- browser.select_list(:index, 1).type.should == "select-one"
94
- browser.select_list(:index, 2).type.should == "select-multiple"
88
+ describe "#multiple?" do
89
+ it "knows whether the select list allows multiple slections" do
90
+ browser.select_list(:index, 0).should_not be_multiple
91
+ browser.select_list(:index, 1).should be_multiple
95
92
  end
96
93
 
97
94
  it "raises UnknownObjectException if the select list doesn't exist" do
98
- lambda { browser.select_list(:index, 1337).type }.should raise_error(UnknownObjectException)
95
+ lambda { browser.select_list(:index, 1337).multiple? }.should raise_error(UnknownObjectException)
99
96
  end
100
97
  end
101
98
 
102
99
  describe "#value" do
103
100
  it "returns the value of the selected option" do
104
- browser.select_list(:index, 1).value.should == "2"
105
- browser.select_list(:index, 1).select(/Sweden/)
106
- browser.select_list(:index, 1).value.should == "3"
101
+ browser.select_list(:index, 0).value.should == "2"
102
+ browser.select_list(:index, 0).select(/Sweden/)
103
+ browser.select_list(:index, 0).value.should == "3"
107
104
  end
108
105
 
109
106
  it "raises UnknownObjectException if the select list doesn't exist" do
@@ -113,11 +110,10 @@ describe "SelectList" do
113
110
 
114
111
  describe "#respond_to?" do
115
112
  it "returns true for all attribute methods" do
116
- browser.select_list(:index, 1).should respond_to(:class_name)
117
- browser.select_list(:index, 1).should respond_to(:id)
118
- browser.select_list(:index, 1).should respond_to(:name)
119
- browser.select_list(:index, 1).should respond_to(:type)
120
- browser.select_list(:index, 1).should respond_to(:value)
113
+ browser.select_list(:index, 0).should respond_to(:class_name)
114
+ browser.select_list(:index, 0).should respond_to(:id)
115
+ browser.select_list(:index, 0).should respond_to(:name)
116
+ browser.select_list(:index, 0).should respond_to(:value)
121
117
  end
122
118
  end
123
119
 
@@ -138,14 +134,14 @@ describe "SelectList" do
138
134
 
139
135
  describe "#disabled?" do
140
136
  it "returns true if the select list is disabled" do
141
- browser.select_list(:index, 3).should be_disabled
137
+ browser.select_list(:index, 2).should be_disabled
142
138
  end
143
139
 
144
140
  it "returns false if the select list is enabled" do
145
- browser.select_list(:index, 1).should_not be_disabled
141
+ browser.select_list(:index, 0).should_not be_disabled
146
142
  end
147
143
 
148
- it "shoulds raise UnknownObjectException when the select list does not exist" do
144
+ it "should raise UnknownObjectException when the select list does not exist" do
149
145
  lambda { browser.select_list(:index, 1337).disabled? }.should raise_error(UnknownObjectException)
150
146
  end
151
147
  end
@@ -160,19 +156,31 @@ describe "SelectList" do
160
156
  end
161
157
 
162
158
  describe "#options" do
163
- it "shoulds raise UnknownObjectException if the select list doesn't exist" do
159
+ it "should raise UnknownObjectException if the select list doesn't exist" do
164
160
  lambda { browser.select_list(:name, 'no_such_name').options }.should raise_error(UnknownObjectException)
165
161
  end
166
162
 
167
- bug "WTR-339", :watir do
163
+ #
164
+ # The correct behaviour here needs to be discussed.
165
+ #
166
+
167
+ not_compliant_on :webdriver do
168
168
  it "returns all the options as an Array" do
169
- browser.select_list(:name, "new_user_country").options.should == ["Denmark" ,"Norway" , "Sweden" , "United Kingdom", "USA", "Germany"]
169
+ browser.select_list(:name, "new_user_country").options.should == ["Denmark", "Norway", "Sweden", "United Kingdom", "USA", "Germany"]
170
+ end
171
+ end
172
+
173
+ deviates_on :webdriver do
174
+ it "returns all the options as a collection of Options" do
175
+ options = browser.select_list(:name, "new_user_country").options
176
+ options.should be_kind_of(OptionCollection)
177
+ options.map { |opt| opt.text }.should == ["Denmark", "Norway", "Sweden", "United Kingdom", "USA", "Germany"]
170
178
  end
171
179
  end
172
180
  end
173
181
 
174
182
  describe "#selected_options" do
175
- it "shoulds raise UnknownObjectException if the select list doesn't exist" do
183
+ it "should raise UnknownObjectException if the select list doesn't exist" do
176
184
  lambda { browser.select_list(:name, 'no_such_name').selected_options }.should raise_error(UnknownObjectException)
177
185
  end
178
186
 
@@ -189,7 +197,7 @@ describe "SelectList" do
189
197
  end
190
198
 
191
199
  it "does not clear selections when not possible" do
192
- browser.select_list(:name , "new_user_country").clear
200
+ lambda { browser.select_list(:name, "new_user_country").clear }.should raise_error
193
201
  browser.select_list(:name, "new_user_country").selected_options.should == ["Norway"]
194
202
  end
195
203
 
@@ -198,24 +206,24 @@ describe "SelectList" do
198
206
  end
199
207
  end
200
208
 
201
- describe "#includes?" do
209
+ describe "#include?" do
202
210
  it "returns true if the given option exists" do
203
- browser.select_list(:name, 'new_user_country').includes?('Denmark').should be_true
211
+ browser.select_list(:name, 'new_user_country').should include('Denmark')
204
212
  end
205
213
 
206
214
  it "returns false if the given option doesn't exist" do
207
- browser.select_list(:name, 'new_user_country').includes?('Ireland').should be_false
215
+ browser.select_list(:name, 'new_user_country').should_not include('Ireland')
208
216
  end
209
217
  end
210
218
 
211
219
  describe "#selected?" do
212
220
  it "returns true if the given option is selected" do
213
221
  browser.select_list(:name, 'new_user_country').select('Denmark')
214
- browser.select_list(:name, 'new_user_country').selected?('Denmark').should be_true
222
+ browser.select_list(:name, 'new_user_country').should be_selected('Denmark')
215
223
  end
216
224
 
217
225
  it "returns false if the given option is not selected" do
218
- browser.select_list(:name, 'new_user_country').selected?('Sweden').should be_false
226
+ browser.select_list(:name, 'new_user_country').should_not be_selected('Sweden')
219
227
  end
220
228
 
221
229
  it "raises UnknonwObjectException if the option doesn't exist" do
@@ -251,18 +259,16 @@ describe "SelectList" do
251
259
  browser.select_list(:name, "new_user_languages").selected_options.should == ["Danish", "Swedish"]
252
260
  end
253
261
 
254
- bug "WTR-362", :watir do
255
- it "selects multiple items using :name and a Regexp" do
256
- browser.select_list(:name, "new_user_languages").clear
257
- browser.select_list(:name, "new_user_languages").select(/ish/)
258
- browser.select_list(:name, "new_user_languages").selected_options.should == ["Danish", "English", "Swedish"]
259
- end
262
+ it "selects multiple items using :name and a Regexp" do
263
+ browser.select_list(:name, "new_user_languages").clear
264
+ browser.select_list(:name, "new_user_languages").select(/ish/)
265
+ browser.select_list(:name, "new_user_languages").selected_options.should == ["Danish", "English", "Swedish"]
266
+ end
260
267
 
261
- it "selects multiple items using :xpath" do
262
- browser.select_list(:xpath, "//select[@name='new_user_languages']").clear
263
- browser.select_list(:xpath, "//select[@name='new_user_languages']").select(/ish/)
264
- browser.select_list(:xpath, "//select[@name='new_user_languages']").selected_options.should == ["Danish", "English", "Swedish"]
265
- end
268
+ it "selects multiple items using :xpath" do
269
+ browser.select_list(:xpath, "//select[@name='new_user_languages']").clear
270
+ browser.select_list(:xpath, "//select[@name='new_user_languages']").select(/ish/)
271
+ browser.select_list(:xpath, "//select[@name='new_user_languages']").selected_options.should == ["Danish", "English", "Swedish"]
266
272
  end
267
273
 
268
274
  it "selects empty options" do
@@ -270,14 +276,12 @@ describe "SelectList" do
270
276
  browser.select_list(:id, "delete_user_username").selected_options.should == [""]
271
277
  end
272
278
 
273
- bug "WTR-363", :watir do
274
- it "returns the value selected" do
275
- browser.select_list(:name, "new_user_languages").select("Danish").should == "Danish"
276
- end
279
+ it "returns the value selected" do
280
+ browser.select_list(:name, "new_user_languages").select("Danish").should == "Danish"
281
+ end
277
282
 
278
- it "returns the first matching value if there are multiple matches" do
279
- browser.select_list(:name, "new_user_languages").select(/ish/).should == "Danish"
280
- end
283
+ it "returns the first matching value if there are multiple matches" do
284
+ browser.select_list(:name, "new_user_languages").select(/ish/).should == "Danish"
281
285
  end
282
286
 
283
287
  it "fires onchange event when selecting an item" do
@@ -285,23 +289,34 @@ describe "SelectList" do
285
289
  messages.should == ['changed language']
286
290
  end
287
291
 
288
- bug "WTR-364", :watir do
289
- it "doesn't fire onchange event when selecting an already selected item" do
290
- browser.select_list(:id, "new_user_languages").clear # removes the two pre-selected options
291
- browser.select_list(:id, "new_user_languages").select("English")
292
- messages.size.should == 3
292
+ it "doesn't fire onchange event when selecting an already selected item" do
293
+ browser.select_list(:id, "new_user_languages").clear # removes the two pre-selected options
294
+ browser.select_list(:id, "new_user_languages").select("English")
295
+ messages.size.should == 3
293
296
 
294
- browser.select_list(:id, "new_user_languages").select("English")
295
- messages.size.should == 3
296
- end
297
+ browser.select_list(:id, "new_user_languages").select("English")
298
+ messages.size.should == 3
299
+ end
300
+
301
+ it "returns the text of the selected option" do
302
+ browser.select_list(:id, "new_user_languages").select("English").should == "English"
303
+ end
304
+
305
+ it "returns an empty string when selecting an option that disappears when selected" do
306
+ browser.select_list(:id, 'obsolete').select('sweden').should == ''
297
307
  end
298
308
 
299
309
  it "raises NoValueFoundException if the option doesn't exist" do
300
310
  lambda { browser.select_list(:name, "new_user_country").select("missing_option") }.should raise_error(NoValueFoundException)
301
311
  lambda { browser.select_list(:name, "new_user_country").select(/missing_option/) }.should raise_error(NoValueFoundException)
302
312
  end
303
- end
304
313
 
314
+ it "raises a TypeError if argument is not a String, Regexp or Numeric" do
315
+ lambda { browser.select_list(:id, "new_user_languages").select([]) }.should raise_error(TypeError)
316
+ end
317
+ end
318
+
319
+ # deprecate?
305
320
  describe "#select_value" do
306
321
  it "selects the item by value string" do
307
322
  browser.select_list(:name, "new_user_languages").clear
@@ -309,12 +324,10 @@ describe "SelectList" do
309
324
  browser.select_list(:name, "new_user_languages").selected_options.should == %w[English]
310
325
  end
311
326
 
312
- bug "WTR-362", :watir do
313
- it "selects the items by value regexp" do
314
- browser.select_list(:name, "new_user_languages").clear
315
- browser.select_list(:name, "new_user_languages").select_value(/1|3/)
316
- browser.select_list(:name, "new_user_languages").selected_options.should == %w[Danish Norwegian]
317
- end
327
+ it "selects the items by value regexp" do
328
+ browser.select_list(:name, "new_user_languages").clear
329
+ browser.select_list(:name, "new_user_languages").select_value(/1|3/)
330
+ browser.select_list(:name, "new_user_languages").selected_options.should == %w[Danish Norwegian]
318
331
  end
319
332
 
320
333
  it "raises NoValueFoundException if the option doesn't exist" do