druid-s 1.0.0

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 (219) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +7 -0
  3. data/.rspec +1 -0
  4. data/.rvmrc +1 -0
  5. data/.travis.yml +27 -0
  6. data/ChangeLog +541 -0
  7. data/Gemfile +8 -0
  8. data/README.md +78 -0
  9. data/Rakefile +33 -0
  10. data/cucumber.yml +6 -0
  11. data/druid.gemspec +30 -0
  12. data/features/area.feature +33 -0
  13. data/features/async.feature +16 -0
  14. data/features/audio.feature +61 -0
  15. data/features/bold.feature +20 -0
  16. data/features/button.feature +81 -0
  17. data/features/canvas.feature +34 -0
  18. data/features/checkbox.feature +48 -0
  19. data/features/div.feature +45 -0
  20. data/features/element.feature +281 -0
  21. data/features/file_field.feature +38 -0
  22. data/features/form.feature +37 -0
  23. data/features/frames.feature +76 -0
  24. data/features/generic_elements.feature +29 -0
  25. data/features/heading.feature +160 -0
  26. data/features/hidden_field.feature +39 -0
  27. data/features/html/async.html +31 -0
  28. data/features/html/frame_1.html +18 -0
  29. data/features/html/frame_2.html +16 -0
  30. data/features/html/frame_3.html +14 -0
  31. data/features/html/frames.html +12 -0
  32. data/features/html/hover.html +11 -0
  33. data/features/html/iframes.html +12 -0
  34. data/features/html/images/circle.png +0 -0
  35. data/features/html/images/img_pulpit.jpg +0 -0
  36. data/features/html/modal.html +17 -0
  37. data/features/html/modal_1.html +38 -0
  38. data/features/html/modal_2.html +27 -0
  39. data/features/html/multi_elements.html +145 -0
  40. data/features/html/nested_elements.html +75 -0
  41. data/features/html/nested_frame_1.html +1 -0
  42. data/features/html/nested_frame_2.html +11 -0
  43. data/features/html/nested_frame_3.html +14 -0
  44. data/features/html/nested_frames.html +10 -0
  45. data/features/html/planets.gif +0 -0
  46. data/features/html/static_elements.html +203 -0
  47. data/features/html/success.html +8 -0
  48. data/features/html/sun.gif +0 -0
  49. data/features/html/sun.html +7 -0
  50. data/features/image.feature +47 -0
  51. data/features/italic.feature +20 -0
  52. data/features/javascript.feature +28 -0
  53. data/features/label.feature +43 -0
  54. data/features/link.feature +56 -0
  55. data/features/list_item.feature +37 -0
  56. data/features/modal_dialog.feature +9 -0
  57. data/features/multi_elements.feature +498 -0
  58. data/features/nested_elements.feature +121 -0
  59. data/features/ordered_list.feature +46 -0
  60. data/features/page_level_actions.feature +116 -0
  61. data/features/paragraph.feature +33 -0
  62. data/features/populate_page_with.feature +25 -0
  63. data/features/radio_button.feature +51 -0
  64. data/features/radio_button_group.feature +28 -0
  65. data/features/sample-app/public/04-Death_Becomes_Fur.mp4 +0 -0
  66. data/features/sample-app/public/04-Death_Becomes_Fur.oga +0 -0
  67. data/features/sample-app/public/audio_video.html +19 -0
  68. data/features/sample-app/public/jquery-1.3.2.js +4376 -0
  69. data/features/sample-app/public/jquery.html +28 -0
  70. data/features/sample-app/public/movie.mp4 +0 -0
  71. data/features/sample-app/public/movie.ogg +0 -0
  72. data/features/sample-app/public/prototype-1.6.0.3.js +4320 -0
  73. data/features/sample-app/public/prototype.html +32 -0
  74. data/features/sample-app/sample_app.rb +35 -0
  75. data/features/section.feature +132 -0
  76. data/features/select_list.feature +84 -0
  77. data/features/span.feature +43 -0
  78. data/features/step_definations/area_steps.rb +23 -0
  79. data/features/step_definations/async_steps.rb +80 -0
  80. data/features/step_definations/audio_steps.rb +47 -0
  81. data/features/step_definations/bold_steps.rb +11 -0
  82. data/features/step_definations/button_steps.rb +52 -0
  83. data/features/step_definations/canvas_steps.rb +19 -0
  84. data/features/step_definations/checkbox_steps.rb +39 -0
  85. data/features/step_definations/div_steps.rb +28 -0
  86. data/features/step_definations/element_steps.rb +217 -0
  87. data/features/step_definations/file_field_steps.rb +31 -0
  88. data/features/step_definations/form_steps.rb +23 -0
  89. data/features/step_definations/frame_steps.rb +189 -0
  90. data/features/step_definations/generic_element_steps.rb +31 -0
  91. data/features/step_definations/heading_steps.rb +39 -0
  92. data/features/step_definations/hidden_field_steps.rb +27 -0
  93. data/features/step_definations/image_steps.rb +35 -0
  94. data/features/step_definations/italic_steps.rb +11 -0
  95. data/features/step_definations/javasript_steps.rb +52 -0
  96. data/features/step_definations/label_steps.rb +19 -0
  97. data/features/step_definations/link_steps.rb +42 -0
  98. data/features/step_definations/list_item_steps.rb +24 -0
  99. data/features/step_definations/modal_dialog_steps.rb +38 -0
  100. data/features/step_definations/multi_elements_steps.rb +557 -0
  101. data/features/step_definations/nested_elements_steps.rb +219 -0
  102. data/features/step_definations/ordered_list_steps.rb +49 -0
  103. data/features/step_definations/page_level_actions_steps.rb +172 -0
  104. data/features/step_definations/page_traversal_steps.rb +4 -0
  105. data/features/step_definations/paragraph_steps.rb +19 -0
  106. data/features/step_definations/populate_page_with_steps.rb +3 -0
  107. data/features/step_definations/radio_button_group_steps.rb +32 -0
  108. data/features/step_definations/radio_button_steps.rb +31 -0
  109. data/features/step_definations/section_steps.rb +271 -0
  110. data/features/step_definations/select_list_steps.rb +91 -0
  111. data/features/step_definations/span_steps.rb +23 -0
  112. data/features/step_definations/table_cell_steps.rb +27 -0
  113. data/features/step_definations/table_row_steps.rb +23 -0
  114. data/features/step_definations/table_steps.rb +109 -0
  115. data/features/step_definations/text_area_steps.rb +39 -0
  116. data/features/step_definations/text_field_steps.rb +39 -0
  117. data/features/step_definations/unordered_list_steps.rb +27 -0
  118. data/features/step_definations/video_steps.rb +27 -0
  119. data/features/support/ajax_test_environment.rb +26 -0
  120. data/features/support/audio_video_page.rb +23 -0
  121. data/features/support/env.rb +5 -0
  122. data/features/support/hooks.rb +3 -0
  123. data/features/support/page.rb +372 -0
  124. data/features/support/persistent_browser.rb +58 -0
  125. data/features/support/targets/firefox14_osx.rb +5 -0
  126. data/features/support/targets/firefox14_windows7.rb +5 -0
  127. data/features/support/url_helper.rb +50 -0
  128. data/features/table.feature +127 -0
  129. data/features/table_cell.feature +42 -0
  130. data/features/table_row.feature +30 -0
  131. data/features/text_area.feature +44 -0
  132. data/features/text_field.feature +53 -0
  133. data/features/unordered_list.feature +46 -0
  134. data/features/video.feature +66 -0
  135. data/lib/druid/accessors.rb +1082 -0
  136. data/lib/druid/assist.rb +653 -0
  137. data/lib/druid/element_locators.rb +21 -0
  138. data/lib/druid/elements/area.rb +9 -0
  139. data/lib/druid/elements/audio.rb +9 -0
  140. data/lib/druid/elements/bold.rb +8 -0
  141. data/lib/druid/elements/button.rb +12 -0
  142. data/lib/druid/elements/canvas.rb +9 -0
  143. data/lib/druid/elements/check_box.rb +9 -0
  144. data/lib/druid/elements/div.rb +9 -0
  145. data/lib/druid/elements/element.rb +187 -0
  146. data/lib/druid/elements/file_field.rb +9 -0
  147. data/lib/druid/elements/form.rb +9 -0
  148. data/lib/druid/elements/heading.rb +14 -0
  149. data/lib/druid/elements/hidden_field.rb +9 -0
  150. data/lib/druid/elements/image.rb +9 -0
  151. data/lib/druid/elements/italic.rb +9 -0
  152. data/lib/druid/elements/label.rb +8 -0
  153. data/lib/druid/elements/link.rb +9 -0
  154. data/lib/druid/elements/list_item.rb +9 -0
  155. data/lib/druid/elements/media.rb +11 -0
  156. data/lib/druid/elements/option.rb +9 -0
  157. data/lib/druid/elements/ordered_list.rb +29 -0
  158. data/lib/druid/elements/paragraph.rb +9 -0
  159. data/lib/druid/elements/radio_button.rb +9 -0
  160. data/lib/druid/elements/select_list.rb +30 -0
  161. data/lib/druid/elements/span.rb +9 -0
  162. data/lib/druid/elements/table.rb +92 -0
  163. data/lib/druid/elements/table_cell.rb +11 -0
  164. data/lib/druid/elements/table_row.rb +50 -0
  165. data/lib/druid/elements/text_area.rb +10 -0
  166. data/lib/druid/elements/text_field.rb +11 -0
  167. data/lib/druid/elements/unordered_list.rb +32 -0
  168. data/lib/druid/elements/video.rb +8 -0
  169. data/lib/druid/elements.rb +55 -0
  170. data/lib/druid/javascript/angularjs.rb +12 -0
  171. data/lib/druid/javascript/jquery.rb +12 -0
  172. data/lib/druid/javascript/prototype.rb +12 -0
  173. data/lib/druid/javascript/yui.rb +19 -0
  174. data/lib/druid/javascript_framework_facade.rb +76 -0
  175. data/lib/druid/locator_generator.rb +181 -0
  176. data/lib/druid/nested_elements.rb +56 -0
  177. data/lib/druid/page_factory.rb +115 -0
  178. data/lib/druid/page_populator.rb +104 -0
  179. data/lib/druid/section_collection.rb +17 -0
  180. data/lib/druid/version.rb +3 -0
  181. data/lib/druid.rb +452 -0
  182. data/spec/druid/accessors_spec.rb +1209 -0
  183. data/spec/druid/druid_spec.rb +295 -0
  184. data/spec/druid/element_locators_spec.rb +750 -0
  185. data/spec/druid/elements/bold_spec.rb +12 -0
  186. data/spec/druid/elements/button_spec.rb +23 -0
  187. data/spec/druid/elements/check_box_spec.rb +14 -0
  188. data/spec/druid/elements/div_spec.rb +10 -0
  189. data/spec/druid/elements/element_spec.rb +250 -0
  190. data/spec/druid/elements/file_field_spec.rb +13 -0
  191. data/spec/druid/elements/form_spec.rb +18 -0
  192. data/spec/druid/elements/heading_spec.rb +30 -0
  193. data/spec/druid/elements/hidden_field_spec.rb +10 -0
  194. data/spec/druid/elements/image_spec.rb +23 -0
  195. data/spec/druid/elements/itatic_spec.rb +11 -0
  196. data/spec/druid/elements/label_spec.rb +10 -0
  197. data/spec/druid/elements/link_spec.rb +10 -0
  198. data/spec/druid/elements/list_item_spec.rb +10 -0
  199. data/spec/druid/elements/media_spec.rb +12 -0
  200. data/spec/druid/elements/option_spec.rb +21 -0
  201. data/spec/druid/elements/ordered_list_spec.rb +38 -0
  202. data/spec/druid/elements/page_factory_spec.rb +40 -0
  203. data/spec/druid/elements/paragraph_spec.rb +12 -0
  204. data/spec/druid/elements/radio_button_spec.rb +14 -0
  205. data/spec/druid/elements/select_list_spec.rb +51 -0
  206. data/spec/druid/elements/span_spec.rb +10 -0
  207. data/spec/druid/elements/table_cell_spec.rb +14 -0
  208. data/spec/druid/elements/table_row_spec.rb +34 -0
  209. data/spec/druid/elements/table_spec.rb +47 -0
  210. data/spec/druid/elements/text_area_spec.rb +13 -0
  211. data/spec/druid/elements/text_field_spec.rb +22 -0
  212. data/spec/druid/elements/unordered_list_spec.rb +39 -0
  213. data/spec/druid/javascript_framework_facade_spec.rb +59 -0
  214. data/spec/druid/nested_element_spec.rb +128 -0
  215. data/spec/druid/page_factory_spec.rb +235 -0
  216. data/spec/druid/page_populator_spec.rb +173 -0
  217. data/spec/druid/page_section_spec.rb +70 -0
  218. data/spec/spec_helper.rb +9 -0
  219. metadata +517 -0
@@ -0,0 +1,750 @@
1
+ require 'spec_helper'
2
+
3
+ class ElementLocatorsTestDruid
4
+ include Druid
5
+ end
6
+
7
+ describe Druid::ElementLocators do
8
+ let(:driver) { mock_driver }
9
+ let(:page) { ElementLocatorsTestDruid.new(driver) }
10
+
11
+ it "should find a button element" do
12
+ expect(driver).to receive(:button).with(:id => 'blah').and_return(driver)
13
+ element = page.button_element(:id => 'blah')
14
+ expect(element).to be_instance_of Druid::Elements::Button
15
+ end
16
+
17
+ it "should find a button element using a default identifier" do
18
+ expect(driver).to receive(:button).with(:index => 0).and_return(driver)
19
+ page.button_element
20
+ end
21
+
22
+ it "should find all button elements" do
23
+ expect(driver).to receive(:buttons).with(:id => 'blah').and_return([driver])
24
+ elements = page.button_elements(:id => 'blah')
25
+ expect(elements[0]).to be_instance_of Druid::Elements::Button
26
+ end
27
+
28
+ it "should find all buttons with no identifier" do
29
+ expect(driver).to receive(:buttons).with({}).and_return([driver])
30
+ page.button_elements
31
+ end
32
+
33
+ it "should find a text field element" do
34
+ expect(driver).to receive(:text_field).with(:id => 'blah').and_return(driver)
35
+ element = page.text_field_element(:id => 'blah')
36
+ expect(element).to be_instance_of Druid::Elements::TextField
37
+ end
38
+
39
+ it "should find a text field element using a default identifier" do
40
+ expect(driver).to receive(:text_field).with(:index => 0).and_return(driver)
41
+ page.text_field_element
42
+ end
43
+
44
+ it "should find all text field elemnts" do
45
+ expect(driver).to receive(:text_fields).with(:id => 'blah').and_return([driver])
46
+ expect(driver).to receive(:tag_name).and_return('input')
47
+ elements = page.text_field_elements(:id => 'blah')
48
+ expect(elements[0]).to be_instance_of Druid::Elements::TextField
49
+ end
50
+
51
+ it "should find all text fields with no identifier" do
52
+ expect(driver).to receive(:text_fields).with({}).and_return([driver])
53
+ expect(driver).to receive(:tag_name).and_return('input')
54
+ page.text_field_elements
55
+ end
56
+
57
+ it "should find a hidden field element" do
58
+ expect(driver).to receive(:hidden).with(:id => 'blah').and_return(driver)
59
+ element = page.hidden_field_element(:id => 'blah')
60
+ expect(element).to be_instance_of Druid::Elements::HiddenField
61
+ end
62
+
63
+ it "should find a hidden field element using a default identifier" do
64
+ expect(driver).to receive(:hidden).with(:index => 0).and_return(driver)
65
+ page.hidden_field_element
66
+ end
67
+
68
+ it "should find all hidden field elements" do
69
+ expect(driver).to receive(:hiddens).with(:id => 'blah').and_return([driver])
70
+ elements = page.hidden_field_elements(:id => 'blah')
71
+ expect(elements[0]).to be_instance_of Druid::Elements::HiddenField
72
+ end
73
+
74
+ it "should find all hidden fields using no identifier" do
75
+ expect(driver).to receive(:hiddens).with({}).and_return([driver])
76
+ page.hidden_field_elements
77
+ end
78
+
79
+ it "should find a text area element" do
80
+ expect(driver).to receive(:textarea).with(:id => 'blah').and_return(driver)
81
+ element = page.text_area_element(:id => "blah")
82
+ expect(element).to be_instance_of Druid::Elements::TextArea
83
+ end
84
+
85
+ it "should find a text area element using a default identifier" do
86
+ expect(driver).to receive(:textarea).with(:index => 0).and_return(driver)
87
+ page.text_area_element
88
+ end
89
+
90
+ it "should find all text area elements" do
91
+ expect(driver).to receive(:textareas).with(:id => 'blah').and_return([driver])
92
+ elements = page.text_area_elements(:id => 'blah')
93
+ expect(elements[0]).to be_instance_of Druid::Elements::TextArea
94
+ end
95
+
96
+ it "should find all text areas using no identifier" do
97
+ expect(driver).to receive(:textareas).with({}).and_return([driver])
98
+ page.text_area_elements
99
+ end
100
+
101
+ it "should find a select list element" do
102
+ expect(driver).to receive(:select_list).with(:id => 'blah').and_return(driver)
103
+ element = page.select_list_element(:id => "blah")
104
+ expect(element).to be_instance_of Druid::Elements::SelectList
105
+ end
106
+
107
+ it "should find a select list element using a default identifier" do
108
+ expect(driver).to receive(:select_list).with(:index => 0).and_return(driver)
109
+ page.select_list_element
110
+ end
111
+
112
+ it "should find all select list elements" do
113
+ expect(driver).to receive(:select_lists).with(:id => 'blah').and_return([driver])
114
+ elements = page.select_list_elements(:id => 'blah')
115
+ expect(elements[0]).to be_instance_of Druid::Elements::SelectList
116
+ end
117
+
118
+ it "should find all select lists using no identifier" do
119
+ expect(driver).to receive(:select_lists).with({}).and_return([driver])
120
+ page.select_list_elements
121
+ end
122
+
123
+ it "should find a link element" do
124
+ expect(driver).to receive(:link).with(:id => 'blah').and_return(driver)
125
+ element = page.link_element(:id => 'blah')
126
+ expect(element).to be_instance_of Druid::Elements::Link
127
+ end
128
+
129
+ it "should find a link element using a default identifier" do
130
+ expect(driver).to receive(:link).with(:index => 0).and_return(driver)
131
+ page.link_element
132
+ end
133
+
134
+ it "should find all link elements" do
135
+ expect(driver).to receive(:links).with(:id => 'blah').and_return([driver])
136
+ elements = page.link_elements(:id => 'blah')
137
+ expect(elements[0]).to be_instance_of Druid::Elements::Link
138
+ end
139
+
140
+ it "should find all links using no identifier" do
141
+ expect(driver).to receive(:links).with({}).and_return([driver])
142
+ page.link_elements
143
+ end
144
+
145
+ it "should find a check box element" do
146
+ expect(driver).to receive(:checkbox).with(:id => 'blah').and_return(driver)
147
+ element = page.checkbox_element(:id => 'blah')
148
+ expect(element).to be_instance_of Druid::Elements::CheckBox
149
+ end
150
+
151
+ it "should find a check box element using a default identifier" do
152
+ expect(driver).to receive(:checkbox).with(:index => 0).and_return(driver)
153
+ page.checkbox_element
154
+ end
155
+
156
+ it "should find all check box elements" do
157
+ expect(driver).to receive(:checkboxes).with(:id => 'blah').and_return([driver])
158
+ elements = page.checkbox_elements(:id => 'blah')
159
+ expect(elements[0]).to be_instance_of Druid::Elements::CheckBox
160
+ end
161
+
162
+ it "should find all checkboxes using no identifier" do
163
+ expect(driver).to receive(:checkboxes).with({}).and_return([driver])
164
+ page.checkbox_elements
165
+ end
166
+
167
+ it "should find a radio button element" do
168
+ expect(driver).to receive(:radio).with(:id => 'blah').and_return(driver)
169
+ element = page.radio_button_element(:id => 'blah')
170
+ expect(element).to be_instance_of Druid::Elements::RadioButton
171
+ end
172
+
173
+ it "should find a radio button element using a default identifier" do
174
+ expect(driver).to receive(:radio).with(:index => 0).and_return(driver)
175
+ page.radio_button_element
176
+ end
177
+
178
+ it "should find all radio button elements" do
179
+ expect(driver).to receive(:radios).with(:id => 'blah').and_return([driver])
180
+ elements = page.radio_button_elements(:id => 'blah')
181
+ expect(elements[0]).to be_instance_of Druid::Elements::RadioButton
182
+ end
183
+
184
+ it "should find all radio buttons using no identifier" do
185
+ expect(driver).to receive(:radios).with({}).and_return([driver])
186
+ page.radio_button_elements
187
+ end
188
+
189
+ it "should find a div element" do
190
+ expect(driver).to receive(:div).with(:id => 'blah').and_return(driver)
191
+ element = page.div_element(:id => 'blah')
192
+ expect(element).to be_instance_of Druid::Elements::Div
193
+ end
194
+
195
+ it "should find a div element using a default identifier" do
196
+ expect(driver).to receive(:div).with(:index => 0).and_return(driver)
197
+ page.div_element
198
+ end
199
+
200
+ it "should find all div elements" do
201
+ expect(driver).to receive(:divs).with(:id => 'blah').and_return([driver])
202
+ elements = page.div_elements(:id => 'blah')
203
+ expect(elements[0]).to be_instance_of Druid::Elements::Div
204
+ end
205
+
206
+ it "should find all divs using no identifier" do
207
+ expect(driver).to receive(:divs).with({}).and_return([driver])
208
+ page.div_elements
209
+ end
210
+
211
+ it "should find a span element" do
212
+ expect(driver).to receive(:span).with(:id => 'blah').and_return(driver)
213
+ element = page.span_element(:id => 'blah')
214
+ expect(element).to be_instance_of Druid::Elements::Span
215
+ end
216
+
217
+ it "should find a span element using a default identifier" do
218
+ expect(driver).to receive(:span).with(:index => 0).and_return(driver)
219
+ page.span_element
220
+ end
221
+
222
+ it "should find all span elements" do
223
+ expect(driver).to receive(:spans).with(:id => 'blah').and_return([driver])
224
+ elements = page.span_elements(:id => 'blah')
225
+ expect(elements[0]).to be_instance_of Druid::Elements::Span
226
+ end
227
+
228
+ it "should find all spans using no identifier" do
229
+ expect(driver).to receive(:spans).with({}).and_return([driver])
230
+ page.span_elements
231
+ end
232
+
233
+ it "should find a table element" do
234
+ expect(driver).to receive(:table).with(:id => 'blah').and_return(driver)
235
+ element = page.table_element(:id => 'blah')
236
+ expect(element).to be_instance_of Druid::Elements::Table
237
+ end
238
+
239
+ it "should find a table element using a default identifier" do
240
+ expect(driver).to receive(:table).with(:index => 0).and_return(driver)
241
+ page.table_element
242
+ end
243
+
244
+ it "should find all table elements" do
245
+ expect(driver).to receive(:tables).with(:id => 'blah').and_return([driver])
246
+ elements = page.table_elements(:id => 'blah')
247
+ expect(elements[0]).to be_instance_of Druid::Elements::Table
248
+ end
249
+
250
+ it "should find all tables using no identifier" do
251
+ expect(driver).to receive(:tables).with({}).and_return([driver])
252
+ page.table_elements
253
+ end
254
+
255
+ it "should find a table cell element" do
256
+ expect(driver).to receive(:td).with(:id => 'blah').and_return(driver)
257
+ element = page.cell_element(:id => 'blah')
258
+ expect(element).to be_instance_of Druid::Elements::TableCell
259
+ end
260
+
261
+ it "should find a table cell element using a default identifier" do
262
+ expect(driver).to receive(:td).with(:index => 0).and_return(driver)
263
+ page.cell_element
264
+ end
265
+
266
+ it "should find all table cells" do
267
+ expect(driver).to receive(:tds).with(:id => 'blah').and_return([driver])
268
+ elements = page.cell_elements(:id => 'blah')
269
+ expect(elements[0]).to be_instance_of Druid::Elements::TableCell
270
+ end
271
+
272
+ it "should find all table cells using no identifier" do
273
+ expect(driver).to receive(:tds).with({}).and_return([driver])
274
+ page.cell_elements
275
+ end
276
+
277
+ it "should find a table row" do
278
+ expect(driver).to receive(:tr).with(:id => 'blah').and_return(driver)
279
+ element = page.row_element(:id => 'blah')
280
+ expect(element).to be_instance_of Druid::Elements::TableRow
281
+ end
282
+
283
+ it "should find a table row using a default identifier" do
284
+ expect(driver).to receive(:tr).with(:index => 0).and_return(driver)
285
+ page.row_element
286
+ end
287
+
288
+ it "should find all table row" do
289
+ expect(driver).to receive(:trs).with(:id => 'blah').and_return([driver])
290
+ elements = page.row_elements(:id => 'blah')
291
+ expect(elements[0]).to be_instance_of Druid::Elements::TableRow
292
+ end
293
+
294
+ it "should find all table rows using no identifier" do
295
+ expect(driver).to receive(:trs).with({}).and_return([driver])
296
+ page.row_elements
297
+ end
298
+
299
+ it "should find an image element" do
300
+ expect(driver).to receive(:image).with(:id => 'blah').and_return(driver)
301
+ element = page.image_element(:id => 'blah')
302
+ expect(element).to be_instance_of Druid::Elements::Image
303
+ end
304
+
305
+ it "should find a image element using a default identifier" do
306
+ expect(driver).to receive(:image).with(:index => 0).and_return(driver)
307
+ page.image_element
308
+ end
309
+
310
+ it "should find all image elements" do
311
+ expect(driver).to receive(:images).with(:id => 'blah').and_return([driver])
312
+ elements = page.image_elements(:id => 'blah')
313
+ expect(elements[0]).to be_instance_of Druid::Elements::Image
314
+ end
315
+
316
+ it "should find all images using no identifier" do
317
+ expect(driver).to receive(:images).with({}).and_return([driver])
318
+ page.image_elements
319
+ end
320
+
321
+ it "should find a form element" do
322
+ expect(driver).to receive(:form).with(:id => 'blah').and_return(driver)
323
+ element = page.form_element(:id => 'blah')
324
+ expect(element).to be_instance_of Druid::Elements::Form
325
+ end
326
+
327
+ it "should find a form element using a default identifier" do
328
+ expect(driver).to receive(:form).with(:index => 0).and_return(driver)
329
+ page.form_element
330
+ end
331
+
332
+ it "should find all form elements" do
333
+ expect(driver).to receive(:forms).with(:id => 'blah').and_return([driver])
334
+ elements = page.form_elements(:id => 'blah')
335
+ expect(elements[0]).to be_instance_of Druid::Elements::Form
336
+ end
337
+
338
+ it "should find all forms using no identifier" do
339
+ expect(driver).to receive(:forms).with({}).and_return([driver])
340
+ page.form_elements
341
+ end
342
+
343
+ it "should find a list item element" do
344
+ expect(driver).to receive(:li).with(:id => 'blah').and_return(driver)
345
+ element = page.list_item_element(:id => 'blah')
346
+ expect(element).to be_instance_of Druid::Elements::ListItem
347
+ end
348
+
349
+ it "should find a list item element using a default identifier" do
350
+ expect(driver).to receive(:li).with(:index => 0).and_return(driver)
351
+ page.list_item_element
352
+ end
353
+
354
+ it "should find all list item elements" do
355
+ expect(driver).to receive(:lis).with(:id => 'blah').and_return([driver])
356
+ elements = page.list_item_elements(:id => 'blah')
357
+ expect(elements[0]).to be_instance_of Druid::Elements::ListItem
358
+ end
359
+
360
+ it "should find all list items using no identifier" do
361
+ expect(driver).to receive(:lis).with({}).and_return([driver])
362
+ page.list_item_elements
363
+ end
364
+
365
+ it "should find an ordered list element" do
366
+ expect(driver).to receive(:ol).with(:id => 'blah').and_return(driver)
367
+ element = page.ordered_list_element(:id => 'blah')
368
+ expect(element).to be_instance_of Druid::Elements::OrderedList
369
+ end
370
+
371
+ it "should find an ordered list element using a default identifier" do
372
+ expect(driver).to receive(:ol).with(:index => 0).and_return(driver)
373
+ page.ordered_list_element
374
+ end
375
+
376
+ it "should find all ordered list elements" do
377
+ expect(driver).to receive(:ols).with(:id => 'blah').and_return([driver])
378
+ elements = page.ordered_list_elements(:id => 'blah')
379
+ expect(elements[0]).to be_instance_of Druid::Elements::OrderedList
380
+ end
381
+
382
+ it "should find all ordered lists using no identifier" do
383
+ expect(driver).to receive(:ols).with({}).and_return([driver])
384
+ page.ordered_list_elements
385
+ end
386
+
387
+ it "should find an unordered list element" do
388
+ expect(driver).to receive(:ul).with(:id => 'blah').and_return(driver)
389
+ element = page.unordered_list_element(:id => 'blah')
390
+ expect(element).to be_instance_of Druid::Elements::UnOrderedList
391
+ end
392
+
393
+ it "should find an unordered list element using a default identifier" do
394
+ expect(driver).to receive(:ul).with(:index => 0).and_return(driver)
395
+ page.unordered_list_element
396
+ end
397
+
398
+ it "should find all unordered list elements" do
399
+ expect(driver).to receive(:uls).with(:id => 'blah').and_return([driver])
400
+ elements = page.unordered_list_elements(:id => 'blah')
401
+ expect(elements[0]).to be_instance_of Druid::Elements::UnOrderedList
402
+ end
403
+
404
+ it "should find all unordered lists using no identifier" do
405
+ expect(driver).to receive(:uls).with({}).and_return([driver])
406
+ page.unordered_list_elements
407
+ end
408
+
409
+ it "should find a h1 element" do
410
+ expect(driver).to receive(:h1).with(:id => 'blah').and_return(driver)
411
+ element = page.h1_element(:id => 'blah')
412
+ expect(element).to be_instance_of Druid::Elements::Heading
413
+ end
414
+
415
+ it "should find a h1 element using a default identifier" do
416
+ expect(driver).to receive(:h1).with(:index => 0).and_return(driver)
417
+ page.h1_element
418
+ end
419
+
420
+ it "should find all h1 elements" do
421
+ expect(driver).to receive(:h1s).with(:id => 'blah').and_return([driver])
422
+ elements = page.h1_elements(:id => 'blah')
423
+ expect(elements[0]).to be_instance_of Druid::Elements::Heading
424
+ end
425
+
426
+ it "should find all h1s using no identifier" do
427
+ expect(driver).to receive(:h1s).with({}).and_return([driver])
428
+ page.h1_elements
429
+ end
430
+
431
+ it "should find a h2 element" do
432
+ expect(driver).to receive(:h2).with(:id => 'blah').and_return(driver)
433
+ element = page.h2_element(:id => 'blah')
434
+ expect(element).to be_instance_of Druid::Elements::Heading
435
+ end
436
+
437
+ it "should find a h2 element using a default identifier" do
438
+ expect(driver).to receive(:h2).with(:index => 0).and_return(driver)
439
+ page.h2_element
440
+ end
441
+
442
+ it "should find all h2 elements" do
443
+ expect(driver).to receive(:h2s).with(:id => 'blah').and_return([driver])
444
+ elements = page.h2_elements(:id => 'blah')
445
+ expect(elements[0]).to be_instance_of Druid::Elements::Heading
446
+ end
447
+
448
+ it "should find all h2s using no identifier" do
449
+ expect(driver).to receive(:h2s).with({}).and_return([driver])
450
+ page.h2_elements
451
+ end
452
+
453
+ it "should find a h3 element" do
454
+ expect(driver).to receive(:h3).with(:id => 'blah').and_return(driver)
455
+ element = page.h3_element(:id => 'blah')
456
+ expect(element).to be_instance_of Druid::Elements::Heading
457
+ end
458
+
459
+ it "should find a h3 element using a default identifier" do
460
+ expect(driver).to receive(:h3).with(:index => 0).and_return(driver)
461
+ page.h3_element
462
+ end
463
+
464
+ it "should find all h3 elements" do
465
+ expect(driver).to receive(:h3s).with(:id => 'blah').and_return([driver])
466
+ elements = page.h3_elements(:id => 'blah')
467
+ expect(elements[0]).to be_instance_of Druid::Elements::Heading
468
+ end
469
+
470
+ it "should find all h3s using no identifier" do
471
+ expect(driver).to receive(:h3s).with({}).and_return([driver])
472
+ page.h3_elements
473
+ end
474
+
475
+ it "should find a h4 element" do
476
+ expect(driver).to receive(:h4).with(:id => 'blah').and_return(driver)
477
+ element = page.h4_element(:id => 'blah')
478
+ expect(element).to be_instance_of Druid::Elements::Heading
479
+ end
480
+
481
+ it "should find a h4 element using a default identifier" do
482
+ expect(driver).to receive(:h4).with(:index => 0).and_return(driver)
483
+ page.h4_element
484
+ end
485
+
486
+ it "should find all h4 elements" do
487
+ expect(driver).to receive(:h4s).with(:id => 'blah').and_return([driver])
488
+ elements = page.h4_elements(:id => 'blah')
489
+ expect(elements[0]).to be_instance_of Druid::Elements::Heading
490
+ end
491
+
492
+ it "should find all h4s using no identifier" do
493
+ expect(driver).to receive(:h4s).with({}).and_return([driver])
494
+ page.h4_elements
495
+ end
496
+
497
+ it "should find a h5 element" do
498
+ expect(driver).to receive(:h5).with(:id => 'blah').and_return(driver)
499
+ element = page.h5_element(:id => 'blah')
500
+ expect(element).to be_instance_of Druid::Elements::Heading
501
+ end
502
+
503
+ it "should find a h5 element using a default identifier" do
504
+ expect(driver).to receive(:h5).with(:index => 0).and_return(driver)
505
+ page.h5_element
506
+ end
507
+
508
+ it "should find all h5 elements" do
509
+ expect(driver).to receive(:h5s).with(:id => 'blah').and_return([driver])
510
+ elements = page.h5_elements(:id => 'blah')
511
+ expect(elements[0]).to be_instance_of Druid::Elements::Heading
512
+ end
513
+
514
+ it "should find all h5s using no identifier" do
515
+ expect(driver).to receive(:h5s).with({}).and_return([driver])
516
+ page.h5_elements
517
+ end
518
+
519
+ it "should find a h6 element" do
520
+ expect(driver).to receive(:h6).with(:id => 'blah').and_return(driver)
521
+ element = page.h6_element(:id => 'blah')
522
+ expect(element).to be_instance_of Druid::Elements::Heading
523
+ end
524
+
525
+ it "should find a h6 element using a default identifier" do
526
+ expect(driver).to receive(:h6).with(:index => 0).and_return(driver)
527
+ page.h6_element
528
+ end
529
+
530
+ it "should find all h6 elements" do
531
+ expect(driver).to receive(:h6s).with(:id => 'blah').and_return([driver])
532
+ elements = page.h6_elements(:id => 'blah')
533
+ expect(elements[0]).to be_instance_of Druid::Elements::Heading
534
+ end
535
+
536
+ it "should find all h6s using no identifier" do
537
+ expect(driver).to receive(:h6s).with({}).and_return([driver])
538
+ page.h6_elements
539
+ end
540
+
541
+ it "should find a paragraph element" do
542
+ expect(driver).to receive(:p).with(:id => 'blah').and_return(driver)
543
+ element = page.paragraph_element(:id => 'blah')
544
+ expect(element).to be_instance_of Druid::Elements::Paragraph
545
+ end
546
+
547
+ it "should find all paragraph elements" do
548
+ expect(driver).to receive(:ps).with(:id => 'blah').and_return([driver])
549
+ elements = page.paragraph_elements(:id => 'blah')
550
+ expect(elements[0]).to be_instance_of Druid::Elements::Paragraph
551
+ end
552
+
553
+ it "should find a paragraph element using a default identifier" do
554
+ expect(driver).to receive(:p).with(:index => 0).and_return(driver)
555
+ page.paragraph_element
556
+ end
557
+
558
+ it "should find all paragraphs using no identifier" do
559
+ expect(driver).to receive(:ps).with({}).and_return([driver])
560
+ page.paragraph_elements
561
+ end
562
+
563
+ it "should find a file field element" do
564
+ expect(driver).to receive(:file_field).with(:id => 'blah').and_return(driver)
565
+ element = page.file_field_element(:id => 'blah')
566
+ expect(element).to be_instance_of Druid::Elements::FileField
567
+ end
568
+
569
+ it "should find a file field element using a default identifier" do
570
+ expect(driver).to receive(:file_field).with(:index => 0).and_return(driver)
571
+ page.file_field_element
572
+ end
573
+
574
+ it "should find all file field elements" do
575
+ expect(driver).to receive(:file_fields).with(:id => 'blah').and_return([driver])
576
+ element = page.file_field_elements(:id => 'blah')
577
+ expect(element[0]).to be_instance_of Druid::Elements::FileField
578
+ end
579
+
580
+ it "should find all file fields using no identifier" do
581
+ expect(driver).to receive(:file_fields).with({}).and_return([driver])
582
+ page.file_field_elements
583
+ end
584
+
585
+ it "should find a label" do
586
+ expect(driver).to receive(:label).with(:id => 'blah').and_return(driver)
587
+ element = page.label_element(:id => 'blah')
588
+ expect(element).to be_instance_of Druid::Elements::Label
589
+ end
590
+
591
+ it "should find a label element using a default identifier" do
592
+ expect(driver).to receive(:label).with(:index => 0).and_return(driver)
593
+ page.label_element
594
+ end
595
+
596
+ it "should find all label elements" do
597
+ expect(driver).to receive(:labels).with(:id => 'blah').and_return([driver])
598
+ elements = page.label_elements(:id => 'blah')
599
+ expect(elements[0]).to be_instance_of Druid::Elements::Label
600
+ end
601
+
602
+ it "should find all labels using no identifier" do
603
+ expect(driver).to receive(:labels).with({}).and_return([driver])
604
+ page.label_elements
605
+ end
606
+
607
+ it "should find an audio element" do
608
+ expect(driver).to receive(:audio).with(:id => 'blah').and_return(driver)
609
+ element = page.audio_element(:id => 'blah')
610
+ expect(element).to be_instance_of Druid::Elements::Audio
611
+ end
612
+
613
+ it "should find an audio element using a default identifier" do
614
+ expect(driver).to receive(:audio).with(:index => 0).and_return(driver)
615
+ page.audio_element
616
+ end
617
+
618
+ it "should find an area element" do
619
+ expect(driver).to receive(:area).with(:id => 'blah').and_return(driver)
620
+ element = page.area_element(:id => 'blah')
621
+ expect(element).to be_instance_of Druid::Elements::Area
622
+ end
623
+
624
+ it "should find an area element using a default identifier" do
625
+ expect(driver).to receive(:area).with(:index => 0).and_return(driver)
626
+ page.area_element
627
+ end
628
+
629
+ it "should find all area elements" do
630
+ expect(driver).to receive(:areas).with(:id => 'blah').and_return([driver])
631
+ elements = page.area_elements(:id => 'blah')
632
+ expect(elements[0]).to be_instance_of Druid::Elements::Area
633
+ end
634
+
635
+ it "should find all areas with no identifier" do
636
+ expect(driver).to receive(:areas).with({}).and_return([driver])
637
+ page.area_elements
638
+ end
639
+
640
+ it "should find a canvas element" do
641
+ expect(driver).to receive(:canvas).with(:id => 'blah').and_return(driver)
642
+ element = page.canvas_element(:id => 'blah')
643
+ expect(element).to be_instance_of Druid::Elements::Canvas
644
+ end
645
+
646
+ it "should find a canvas element using a default identifier" do
647
+ expect(driver).to receive(:canvas).with(:index => 0).and_return(driver)
648
+ page.canvas_element
649
+ end
650
+
651
+ it "should find all canvas elements" do
652
+ expect(driver).to receive(:canvases).with(:id => 'blah').and_return([driver])
653
+ elements = page.canvas_elements(:id => 'blah')
654
+ expect(elements[0]).to be_instance_of Druid::Elements::Canvas
655
+ end
656
+
657
+ it "should find all canvas elements with no identifier" do
658
+ expect(driver).to receive(:canvases).with({}).and_return([driver])
659
+ page.canvas_elements
660
+ end
661
+
662
+ it "should find an audio element" do
663
+ expect(driver).to receive(:audio).with(:id => 'blah').and_return(driver)
664
+ element = page.audio_element(:id => 'blah')
665
+ expect(element).to be_instance_of Druid::Elements::Audio
666
+ end
667
+
668
+ it "should find an audio element using a default identifier" do
669
+ expect(driver).to receive(:audio).with(:index => 0).and_return(driver)
670
+ page.audio_element
671
+ end
672
+
673
+ it "should find all audios elements" do
674
+ expect(driver).to receive(:audios).with(:id => 'blah').and_return([driver])
675
+ elements = page.audio_elements(:id => 'blah')
676
+ expect(elements[0]).to be_instance_of Druid::Elements::Audio
677
+ end
678
+
679
+ it "should find all audios elements with no identifier" do
680
+ expect(driver).to receive(:audios).with({}).and_return([driver])
681
+ page.audio_elements
682
+ end
683
+
684
+ it "should find an video element" do
685
+ expect(driver).to receive(:video).with(:id => 'blah').and_return(driver)
686
+ element = page.video_element(:id => 'blah')
687
+ expect(element).to be_instance_of Druid::Elements::Video
688
+ end
689
+
690
+ it "should find an video element using a default identifier" do
691
+ expect(driver).to receive(:video).with(:index => 0).and_return(driver)
692
+ page.video_element
693
+ end
694
+
695
+ it "should find all videos elements" do
696
+ expect(driver).to receive(:videos).with(:id => 'blah').and_return([driver])
697
+ elements = page.video_elements(:id => 'blah')
698
+ expect(elements[0]).to be_instance_of Druid::Elements::Video
699
+ end
700
+
701
+ it "should find all videos elements with no identifier" do
702
+ expect(driver).to receive(:videos).with({}).and_return([driver])
703
+ page.video_elements
704
+ end
705
+
706
+ it "should find a b element" do
707
+ expect(driver).to receive(:b).with(:id => 'blah').and_return(driver)
708
+ element = page.b_element(:id => 'blah')
709
+ expect(element).to be_instance_of Druid::Elements::Bold
710
+ end
711
+
712
+ it "should find a b element using a default identifier" do
713
+ expect(driver).to receive(:b).with(:index => 0).and_return(driver)
714
+ page.b_element
715
+ end
716
+
717
+ it "should find all b elements" do
718
+ expect(driver).to receive(:bs).with(:id => 'blah').and_return([driver])
719
+ elements = page.b_elements(:id => 'blah')
720
+ expect(elements[0]).to be_instance_of Druid::Elements::Bold
721
+ end
722
+
723
+ it "should find all b elements using no parameters" do
724
+ expect(driver).to receive(:bs).with({}).and_return([driver])
725
+ page.b_elements
726
+ end
727
+
728
+ it "should find a i element" do
729
+ expect(driver).to receive(:i).with(:id => 'blah').and_return(driver)
730
+ element = page.i_element(:id => 'blah')
731
+ expect(element).to be_instance_of Druid::Elements::Italic
732
+ end
733
+
734
+ it "should find a i element using a default identifier" do
735
+ expect(driver).to receive(:i).with(:index => 0).and_return(driver)
736
+ page.i_element
737
+ end
738
+
739
+ it "should find all i elements" do
740
+ expect(driver).to receive(:is).with(:id => 'blah').and_return([driver])
741
+ elements = page.i_elements(:id => 'blah')
742
+ expect(elements[0]).to be_instance_of Druid::Elements::Italic
743
+ end
744
+
745
+ it "should find all b elements using no parameters" do
746
+ expect(driver).to receive(:is).with({}).and_return([driver])
747
+ page.i_elements
748
+ end
749
+
750
+ end