page-object 1.1.0 → 1.1.1
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.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -0
- data/.gitignore +1 -0
- data/.travis.yml +7 -2
- data/ChangeLog +14 -1
- data/Gemfile +4 -2
- data/README.md +2 -0
- data/Rakefile +5 -1
- data/features/async.feature +3 -12
- data/features/audio.feature +10 -14
- data/features/element.feature +21 -0
- data/features/gxt_table_extension.feature +1 -2
- data/features/html/multi_elements.html +11 -10
- data/features/html/static_elements.html +3 -16
- data/features/html/widgets.html +20 -0
- data/features/italic.feature +21 -0
- data/features/multi_elements.feature +28 -22
- data/features/sample-app/public/audio_video.html +23 -0
- data/features/step_definitions/audio_steps.rb +6 -6
- data/features/step_definitions/element_steps.rb +28 -0
- data/features/step_definitions/gxt_table_steps.rb +1 -6
- data/features/step_definitions/italic_steps.rb +12 -0
- data/features/step_definitions/multi_elements_steps.rb +13 -0
- data/features/step_definitions/page_traversal_steps.rb +4 -0
- data/features/step_definitions/table_row_steps.rb +23 -0
- data/features/step_definitions/video_steps.rb +3 -3
- data/features/support/audio_video_page.rb +24 -0
- data/features/support/page.rb +20 -20
- data/features/support/url_helper.rb +4 -0
- data/features/table_row.feature +43 -0
- data/features/video.feature +1 -5
- data/lib/page-object.rb +4 -0
- data/lib/page-object/accessors.rb +88 -4
- data/lib/page-object/elements.rb +2 -1
- data/lib/page-object/elements/element.rb +5 -5
- data/lib/page-object/elements/italic.rb +11 -0
- data/lib/page-object/elements/ordered_list.rb +1 -1
- data/lib/page-object/elements/unordered_list.rb +1 -1
- data/lib/page-object/locator_generator.rb +2 -0
- data/lib/page-object/platforms/selenium_webdriver/element.rb +37 -0
- data/lib/page-object/platforms/selenium_webdriver/ordered_list.rb +10 -8
- data/lib/page-object/platforms/selenium_webdriver/page_object.rb +51 -1
- data/lib/page-object/platforms/selenium_webdriver/unordered_list.rb +7 -9
- data/lib/page-object/platforms/watir_webdriver/element.rb +45 -1
- data/lib/page-object/platforms/watir_webdriver/ordered_list.rb +9 -4
- data/lib/page-object/platforms/watir_webdriver/page_object.rb +81 -50
- data/lib/page-object/platforms/watir_webdriver/unordered_list.rb +11 -5
- data/lib/page-object/version.rb +1 -1
- data/lib/page-object/widgets.rb +1 -1
- data/page-object.gemspec +1 -0
- data/spec/page-object/element_locators_spec.rb +124 -80
- data/spec/page-object/elements/element_spec.rb +83 -1
- data/spec/page-object/elements/italic_spec.rb +29 -0
- data/spec/page-object/elements/media_spec.rb +63 -0
- data/spec/page-object/elements/ordered_list_spec.rb +6 -22
- data/spec/page-object/elements/selenium_element_spec.rb +41 -0
- data/spec/page-object/elements/unordered_list_spec.rb +4 -21
- data/spec/page-object/elements/video_spec.rb +27 -0
- data/spec/page-object/elements/watir_element_spec.rb +48 -0
- data/spec/page-object/selenium_accessors_spec.rb +28 -9
- data/spec/page-object/watir_accessors_spec.rb +57 -1
- data/spec/spec_helper.rb +3 -6
- metadata +39 -3
@@ -20,16 +20,22 @@ module PageObject
|
|
20
20
|
children.size
|
21
21
|
end
|
22
22
|
|
23
|
+
#
|
24
|
+
# Return the ListItem objects that are children of the
|
25
|
+
# UnorderedList
|
26
|
+
#
|
27
|
+
def list_items
|
28
|
+
children.collect do |obj|
|
29
|
+
Object::PageObject::Elements::ListItem.new(obj, :platform => :watir_webdriver)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
23
33
|
private
|
24
34
|
|
25
35
|
def children
|
26
|
-
list_items.find_all { |item| item.parent == element }
|
27
|
-
end
|
28
|
-
|
29
|
-
def list_items
|
30
36
|
element.uls(:xpath => child_xpath)
|
31
37
|
end
|
32
|
-
|
38
|
+
|
33
39
|
end
|
34
40
|
end
|
35
41
|
end
|
data/lib/page-object/version.rb
CHANGED
data/lib/page-object/widgets.rb
CHANGED
@@ -99,7 +99,7 @@ module PageObject
|
|
99
99
|
|
100
100
|
def self.define_multiple_nested_accessor(base, widget_tag)
|
101
101
|
base.send(:define_method, "#{widget_tag}_elements") do |*args|
|
102
|
-
identifier = args[0] ? args[0] : {
|
102
|
+
identifier = args[0] ? args[0] : {}
|
103
103
|
@platform.send("#{widget_tag}s_for", identifier.clone)
|
104
104
|
end
|
105
105
|
end
|
data/page-object.gemspec
CHANGED
@@ -10,7 +10,7 @@ describe PageObject::ElementLocators do
|
|
10
10
|
context "when using Watir" do
|
11
11
|
let(:watir_browser) { mock_watir_browser }
|
12
12
|
let(:watir_page_object) { ElementLocatorsTestPageObject.new(watir_browser) }
|
13
|
-
|
13
|
+
|
14
14
|
it "should find a button element" do
|
15
15
|
expect(watir_browser).to receive(:button).with(:id => 'blah').and_return(watir_browser)
|
16
16
|
element = watir_page_object.button_element(:id => 'blah')
|
@@ -32,7 +32,7 @@ describe PageObject::ElementLocators do
|
|
32
32
|
expect(watir_browser).to receive(:buttons).with({}).and_return([watir_browser])
|
33
33
|
watir_page_object.button_elements
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
it "should find a text field element" do
|
37
37
|
expect(watir_browser).to receive(:text_field).with(:id => 'blah').and_return(watir_browser)
|
38
38
|
element = watir_page_object.text_field_element(:id => 'blah')
|
@@ -56,7 +56,7 @@ describe PageObject::ElementLocators do
|
|
56
56
|
expect(watir_browser).to receive(:tag_name).and_return('input')
|
57
57
|
watir_page_object.text_field_elements
|
58
58
|
end
|
59
|
-
|
59
|
+
|
60
60
|
it "should find a hidden field element" do
|
61
61
|
expect(watir_browser).to receive(:hidden).with(:id => 'blah').and_return(watir_browser)
|
62
62
|
element = watir_page_object.hidden_field_element(:id => 'blah')
|
@@ -78,7 +78,7 @@ describe PageObject::ElementLocators do
|
|
78
78
|
expect(watir_browser).to receive(:hiddens).with({}).and_return([watir_browser])
|
79
79
|
watir_page_object.hidden_field_elements
|
80
80
|
end
|
81
|
-
|
81
|
+
|
82
82
|
it "should find a text area element" do
|
83
83
|
expect(watir_browser).to receive(:textarea).with(:id => 'blah').and_return(watir_browser)
|
84
84
|
element = watir_page_object.text_area_element(:id => 'blah')
|
@@ -93,14 +93,14 @@ describe PageObject::ElementLocators do
|
|
93
93
|
it "should find all text area elements" do
|
94
94
|
expect(watir_browser).to receive(:textareas).with(:id => 'blah').and_return([watir_browser])
|
95
95
|
elements = watir_page_object.text_area_elements(:id => 'blah')
|
96
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::TextArea
|
96
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::TextArea
|
97
97
|
end
|
98
98
|
|
99
99
|
it "should find all text area elements using no identifier" do
|
100
100
|
expect(watir_browser).to receive(:textareas).with({}).and_return([watir_browser])
|
101
101
|
watir_page_object.text_area_elements
|
102
102
|
end
|
103
|
-
|
103
|
+
|
104
104
|
it "should find a select list element" do
|
105
105
|
expect(watir_browser).to receive(:select_list).with(:id => 'blah').and_return(watir_browser)
|
106
106
|
element = watir_page_object.select_list_element(:id => 'blah')
|
@@ -115,14 +115,14 @@ describe PageObject::ElementLocators do
|
|
115
115
|
it "should find all select list elements" do
|
116
116
|
expect(watir_browser).to receive(:select_lists).with(:id => 'blah').and_return([watir_browser])
|
117
117
|
elements = watir_page_object.select_list_elements(:id => 'blah')
|
118
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::SelectList
|
118
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::SelectList
|
119
119
|
end
|
120
120
|
|
121
121
|
it "should find all select list elements using no identifier" do
|
122
122
|
expect(watir_browser).to receive(:select_lists).with({}).and_return([watir_browser])
|
123
123
|
watir_page_object.select_list_elements
|
124
124
|
end
|
125
|
-
|
125
|
+
|
126
126
|
it "should find a link element" do
|
127
127
|
expect(watir_browser).to receive(:link).with(:id => 'blah').and_return(watir_browser)
|
128
128
|
element = watir_page_object.link_element(:id => 'blah')
|
@@ -137,14 +137,14 @@ describe PageObject::ElementLocators do
|
|
137
137
|
it "should find all link elements" do
|
138
138
|
expect(watir_browser).to receive(:links).with(:id => 'blah').and_return([watir_browser])
|
139
139
|
elements = watir_page_object.link_elements(:id => 'blah')
|
140
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::Link
|
140
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Link
|
141
141
|
end
|
142
142
|
|
143
143
|
it "should find all links using no identifier" do
|
144
144
|
expect(watir_browser).to receive(:links).with({}).and_return([watir_browser])
|
145
145
|
watir_page_object.link_elements
|
146
146
|
end
|
147
|
-
|
147
|
+
|
148
148
|
it "should find a check box" do
|
149
149
|
expect(watir_browser).to receive(:checkbox).with(:id => 'blah').and_return(watir_browser)
|
150
150
|
element = watir_page_object.checkbox_element(:id => 'blah')
|
@@ -159,14 +159,14 @@ describe PageObject::ElementLocators do
|
|
159
159
|
it "should find all check box elements" do
|
160
160
|
expect(watir_browser).to receive(:checkboxes).with(:id => 'blah').and_return([watir_browser])
|
161
161
|
elements = watir_page_object.checkbox_elements(:id => 'blah')
|
162
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::CheckBox
|
162
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::CheckBox
|
163
163
|
end
|
164
164
|
|
165
165
|
it "should find all check box elements using no identifier" do
|
166
166
|
expect(watir_browser).to receive(:checkboxes).with({}).and_return([watir_browser])
|
167
167
|
watir_page_object.checkbox_elements
|
168
168
|
end
|
169
|
-
|
169
|
+
|
170
170
|
it "should find a radio button" do
|
171
171
|
expect(watir_browser).to receive(:radio).with(:id => 'blah').and_return(watir_browser)
|
172
172
|
element = watir_page_object.radio_button_element(:id => 'blah')
|
@@ -181,14 +181,14 @@ describe PageObject::ElementLocators do
|
|
181
181
|
it "should find all radio buttons" do
|
182
182
|
expect(watir_browser).to receive(:radios).with(:id => 'blah').and_return([watir_browser])
|
183
183
|
elements = watir_page_object.radio_button_elements(:id => 'blah')
|
184
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::RadioButton
|
184
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::RadioButton
|
185
185
|
end
|
186
186
|
|
187
187
|
it "should find all radio buttons using no identifier" do
|
188
188
|
expect(watir_browser).to receive(:radios).with({}).and_return([watir_browser])
|
189
189
|
watir_page_object.radio_button_elements
|
190
190
|
end
|
191
|
-
|
191
|
+
|
192
192
|
it "should find a div" do
|
193
193
|
expect(watir_browser).to receive(:div).with(:id => 'blah').and_return(watir_browser)
|
194
194
|
element = watir_page_object.div_element(:id => 'blah')
|
@@ -203,14 +203,14 @@ describe PageObject::ElementLocators do
|
|
203
203
|
it "should find all div elements" do
|
204
204
|
expect(watir_browser).to receive(:divs).with(:id => 'blah').and_return([watir_browser])
|
205
205
|
elements = watir_page_object.div_elements(:id => 'blah')
|
206
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::Div
|
206
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Div
|
207
207
|
end
|
208
208
|
|
209
209
|
it "should find all div elements using no identifier" do
|
210
210
|
expect(watir_browser).to receive(:divs).with({}).and_return([watir_browser])
|
211
211
|
watir_page_object.div_elements
|
212
212
|
end
|
213
|
-
|
213
|
+
|
214
214
|
it "should find a span" do
|
215
215
|
expect(watir_browser).to receive(:span).with(:id => 'blah').and_return(watir_browser)
|
216
216
|
element = watir_page_object.span_element(:id => 'blah')
|
@@ -225,14 +225,14 @@ describe PageObject::ElementLocators do
|
|
225
225
|
it "should find all span elements" do
|
226
226
|
expect(watir_browser).to receive(:spans).with(:id => 'blah').and_return([watir_browser])
|
227
227
|
elements = watir_page_object.span_elements(:id => 'blah')
|
228
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::Span
|
228
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Span
|
229
229
|
end
|
230
230
|
|
231
231
|
it "should find all span elements using no identifier" do
|
232
232
|
expect(watir_browser).to receive(:spans).with({}).and_return([watir_browser])
|
233
233
|
watir_page_object.span_elements
|
234
234
|
end
|
235
|
-
|
235
|
+
|
236
236
|
it "should find a table" do
|
237
237
|
expect(watir_browser).to receive(:table).with(:id => 'blah').and_return(watir_browser)
|
238
238
|
element = watir_page_object.table_element(:id => 'blah')
|
@@ -247,14 +247,14 @@ describe PageObject::ElementLocators do
|
|
247
247
|
it "should find all table elements" do
|
248
248
|
expect(watir_browser).to receive(:tables).with(:id => 'blah').and_return([watir_browser])
|
249
249
|
elements = watir_page_object.table_elements(:id => 'blah')
|
250
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::Table
|
250
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Table
|
251
251
|
end
|
252
252
|
|
253
253
|
it "should find all table elements using no identifier" do
|
254
254
|
expect(watir_browser).to receive(:tables).with({}).and_return([watir_browser])
|
255
255
|
watir_page_object.table_elements
|
256
256
|
end
|
257
|
-
|
257
|
+
|
258
258
|
it "should find a table cell" do
|
259
259
|
expect(watir_browser).to receive(:td).with(:id => 'blah').and_return(watir_browser)
|
260
260
|
element = watir_page_object.cell_element(:id => 'blah')
|
@@ -269,14 +269,36 @@ describe PageObject::ElementLocators do
|
|
269
269
|
it "should find all table cells" do
|
270
270
|
expect(watir_browser).to receive(:tds).with(:id => 'blah').and_return([watir_browser])
|
271
271
|
elements = watir_page_object.cell_elements(:id => 'blah')
|
272
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::TableCell
|
272
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::TableCell
|
273
273
|
end
|
274
274
|
|
275
275
|
it "should find all table cells using no identifier" do
|
276
276
|
expect(watir_browser).to receive(:tds).with({}).and_return([watir_browser])
|
277
277
|
watir_page_object.cell_elements
|
278
278
|
end
|
279
|
-
|
279
|
+
|
280
|
+
it "should find a table row" do
|
281
|
+
expect(watir_browser).to receive(:tr).with(:id => 'blah').and_return(watir_browser)
|
282
|
+
element = watir_page_object.row_element(:id => 'blah')
|
283
|
+
expect(element).to be_instance_of PageObject::Elements::TableRow
|
284
|
+
end
|
285
|
+
|
286
|
+
it "should find a table row using a default identifier" do
|
287
|
+
expect(watir_browser).to receive(:tr).with(:index => 0).and_return(watir_browser)
|
288
|
+
watir_page_object.row_element
|
289
|
+
end
|
290
|
+
|
291
|
+
it "should find all table row" do
|
292
|
+
expect(watir_browser).to receive(:trs).with(:id => 'blah').and_return([watir_browser])
|
293
|
+
elements = watir_page_object.row_elements(:id => 'blah')
|
294
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::TableRow
|
295
|
+
end
|
296
|
+
|
297
|
+
it "should find all table rows using no identifier" do
|
298
|
+
expect(watir_browser).to receive(:trs).with({}).and_return([watir_browser])
|
299
|
+
watir_page_object.row_elements
|
300
|
+
end
|
301
|
+
|
280
302
|
it "should find an image" do
|
281
303
|
expect(watir_browser).to receive(:image).with(:id => 'blah').and_return(watir_browser)
|
282
304
|
element = watir_page_object.image_element(:id => 'blah')
|
@@ -298,7 +320,7 @@ describe PageObject::ElementLocators do
|
|
298
320
|
expect(watir_browser).to receive(:images).with({}).and_return([watir_browser])
|
299
321
|
watir_page_object.image_elements
|
300
322
|
end
|
301
|
-
|
323
|
+
|
302
324
|
it "should find a form" do
|
303
325
|
expect(watir_browser).to receive(:form).with(:id => 'blah').and_return(watir_browser)
|
304
326
|
element = watir_page_object.form_element(:id => 'blah')
|
@@ -320,7 +342,7 @@ describe PageObject::ElementLocators do
|
|
320
342
|
expect(watir_browser).to receive(:forms).with({}).and_return([watir_browser])
|
321
343
|
watir_page_object.form_elements
|
322
344
|
end
|
323
|
-
|
345
|
+
|
324
346
|
it "should find a list item" do
|
325
347
|
expect(watir_browser).to receive(:li).with(:id => 'blah').and_return(watir_browser)
|
326
348
|
element = watir_page_object.list_item_element(:id => 'blah')
|
@@ -335,14 +357,14 @@ describe PageObject::ElementLocators do
|
|
335
357
|
it "should find all list items" do
|
336
358
|
expect(watir_browser).to receive(:lis).with(:id => 'blah').and_return([watir_browser])
|
337
359
|
elements = watir_page_object.list_item_elements(:id => 'blah')
|
338
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::ListItem
|
360
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::ListItem
|
339
361
|
end
|
340
362
|
|
341
363
|
it "should find all list items using no parameter" do
|
342
364
|
expect(watir_browser).to receive(:lis).with({}).and_return([watir_browser])
|
343
365
|
watir_page_object.list_item_elements
|
344
366
|
end
|
345
|
-
|
367
|
+
|
346
368
|
it "should find an unordered list" do
|
347
369
|
expect(watir_browser).to receive(:ul).with(:id => 'blah').and_return(watir_browser)
|
348
370
|
element = watir_page_object.unordered_list_element(:id => 'blah')
|
@@ -357,14 +379,14 @@ describe PageObject::ElementLocators do
|
|
357
379
|
it "should find all unordered lists" do
|
358
380
|
expect(watir_browser).to receive(:uls).with(:id => 'blah').and_return([watir_browser])
|
359
381
|
elements = watir_page_object.unordered_list_elements(:id => 'blah')
|
360
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::UnorderedList
|
382
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::UnorderedList
|
361
383
|
end
|
362
384
|
|
363
385
|
it "should find all unordered lists using no parameters" do
|
364
386
|
expect(watir_browser).to receive(:uls).with({}).and_return([watir_browser])
|
365
387
|
watir_page_object.unordered_list_elements
|
366
388
|
end
|
367
|
-
|
389
|
+
|
368
390
|
it "should find an ordered list" do
|
369
391
|
expect(watir_browser).to receive(:ol).with(:id => 'blah').and_return(watir_browser)
|
370
392
|
element = watir_page_object.ordered_list_element(:id => 'blah')
|
@@ -379,14 +401,14 @@ describe PageObject::ElementLocators do
|
|
379
401
|
it "should find all ordered lists" do
|
380
402
|
expect(watir_browser).to receive(:ols).with(:id => 'blah').and_return([watir_browser])
|
381
403
|
elements = watir_page_object.ordered_list_elements(:id => 'blah')
|
382
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::OrderedList
|
404
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::OrderedList
|
383
405
|
end
|
384
406
|
|
385
407
|
it "should find all orderd lists using no parameters" do
|
386
408
|
expect(watir_browser).to receive(:ols).with({}).and_return([watir_browser])
|
387
409
|
watir_page_object.ordered_list_elements
|
388
410
|
end
|
389
|
-
|
411
|
+
|
390
412
|
it "should find a h1 element" do
|
391
413
|
expect(watir_browser).to receive(:h1).with(:id => 'blah').and_return(watir_browser)
|
392
414
|
element = watir_page_object.h1_element(:id => 'blah')
|
@@ -401,7 +423,7 @@ describe PageObject::ElementLocators do
|
|
401
423
|
it "should find all h1 elements" do
|
402
424
|
expect(watir_browser).to receive(:h1s).with(:id => 'blah').and_return([watir_browser])
|
403
425
|
elements = watir_page_object.h1_elements(:id => 'blah')
|
404
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::Heading
|
426
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Heading
|
405
427
|
end
|
406
428
|
|
407
429
|
it "should find all h1 elements using no parameters" do
|
@@ -423,7 +445,7 @@ describe PageObject::ElementLocators do
|
|
423
445
|
it "should find all h2 elements" do
|
424
446
|
expect(watir_browser).to receive(:h2s).with(:id => 'blah').and_return([watir_browser])
|
425
447
|
elements = watir_page_object.h2_elements(:id => 'blah')
|
426
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::Heading
|
448
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Heading
|
427
449
|
end
|
428
450
|
|
429
451
|
it "should find all h2 elements using no identifier" do
|
@@ -445,7 +467,7 @@ describe PageObject::ElementLocators do
|
|
445
467
|
it "should find all h3 elements" do
|
446
468
|
expect(watir_browser).to receive(:h3s).with(:id => 'blah').and_return([watir_browser])
|
447
469
|
elements = watir_page_object.h3_elements(:id => 'blah')
|
448
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::Heading
|
470
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Heading
|
449
471
|
end
|
450
472
|
|
451
473
|
it "should find all h3 elements using no identifiers" do
|
@@ -467,7 +489,7 @@ describe PageObject::ElementLocators do
|
|
467
489
|
it "should find all h4 elements" do
|
468
490
|
expect(watir_browser).to receive(:h4s).with(:id => 'blah').and_return([watir_browser])
|
469
491
|
elements = watir_page_object.h4_elements(:id => 'blah')
|
470
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::Heading
|
492
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Heading
|
471
493
|
end
|
472
494
|
|
473
495
|
it "should find all h4 elements using no identifier" do
|
@@ -489,7 +511,7 @@ describe PageObject::ElementLocators do
|
|
489
511
|
it "should find all h5 elements" do
|
490
512
|
expect(watir_browser).to receive(:h5s).with(:id => 'blah').and_return([watir_browser])
|
491
513
|
elements = watir_page_object.h5_elements(:id => 'blah')
|
492
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::Heading
|
514
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Heading
|
493
515
|
end
|
494
516
|
|
495
517
|
it "should find all h5 elements using no identifier" do
|
@@ -511,7 +533,7 @@ describe PageObject::ElementLocators do
|
|
511
533
|
it "should find all h6 elements" do
|
512
534
|
expect(watir_browser).to receive(:h6s).with(:id => 'blah').and_return([watir_browser])
|
513
535
|
elements = watir_page_object.h6_elements(:id => 'blah')
|
514
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::Heading
|
536
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Heading
|
515
537
|
end
|
516
538
|
|
517
539
|
it "should find all h6 elements using no identifier" do
|
@@ -533,7 +555,7 @@ describe PageObject::ElementLocators do
|
|
533
555
|
it "should find all paragraph elements" do
|
534
556
|
expect(watir_browser).to receive(:ps).with(:id => 'blah').and_return([watir_browser])
|
535
557
|
elements = watir_page_object.paragraph_elements(:id => 'blah')
|
536
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::Paragraph
|
558
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Paragraph
|
537
559
|
end
|
538
560
|
|
539
561
|
it "should find all paragraph elements using no identifier" do
|
@@ -606,7 +628,7 @@ describe PageObject::ElementLocators do
|
|
606
628
|
expect(watir_browser).to receive(:areas).with({}).and_return([watir_browser])
|
607
629
|
watir_page_object.area_elements
|
608
630
|
end
|
609
|
-
|
631
|
+
|
610
632
|
it "should find a canvas element" do
|
611
633
|
expect(watir_browser).to receive(:canvas).with(:id => 'blah').and_return(watir_browser)
|
612
634
|
element = watir_page_object.canvas_element(:id => 'blah')
|
@@ -705,12 +727,34 @@ describe PageObject::ElementLocators do
|
|
705
727
|
expect(watir_browser).to receive(:bs).with({}).and_return([watir_browser])
|
706
728
|
watir_page_object.b_elements
|
707
729
|
end
|
730
|
+
|
731
|
+
it "should find an i element" do
|
732
|
+
expect(watir_browser).to receive(:i).with(:id => 'blah').and_return(watir_browser)
|
733
|
+
element = watir_page_object.i_element(:id => 'blah')
|
734
|
+
expect(element).to be_instance_of PageObject::Elements::Italic
|
735
|
+
end
|
736
|
+
|
737
|
+
it "should find an i element using a default identifier" do
|
738
|
+
expect(watir_browser).to receive(:i).with(:index => 0).and_return(watir_browser)
|
739
|
+
watir_page_object.i_element
|
740
|
+
end
|
741
|
+
|
742
|
+
it "should find all i elements" do
|
743
|
+
expect(watir_browser).to receive(:is).with(:id => 'blah').and_return([watir_browser])
|
744
|
+
elements = watir_page_object.i_elements(:id => 'blah')
|
745
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Italic
|
746
|
+
end
|
747
|
+
|
748
|
+
it "should find all i elements using no parameters" do
|
749
|
+
expect(watir_browser).to receive(:is).with({}).and_return([watir_browser])
|
750
|
+
watir_page_object.i_elements
|
751
|
+
end
|
708
752
|
end
|
709
753
|
|
710
754
|
context "when using Selenium" do
|
711
755
|
let(:selenium_browser) { mock_selenium_browser }
|
712
756
|
let(:selenium_page_object) { ElementLocatorsTestPageObject.new(selenium_browser) }
|
713
|
-
|
757
|
+
|
714
758
|
it "should find a button element" do
|
715
759
|
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
716
760
|
element = selenium_page_object.button_element(:id => 'blah')
|
@@ -744,10 +788,10 @@ describe PageObject::ElementLocators do
|
|
744
788
|
it "should find all hidden field elements" do
|
745
789
|
expect(selenium_browser).to receive(:find_elements).with(:id, "blah").and_return([selenium_browser])
|
746
790
|
elements = selenium_page_object.hidden_field_elements(:id => 'blah')
|
747
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::HiddenField
|
791
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::HiddenField
|
748
792
|
|
749
793
|
end
|
750
|
-
|
794
|
+
|
751
795
|
it "should find a text area element" do
|
752
796
|
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
753
797
|
element = selenium_page_object.text_area_element(:id => 'blah')
|
@@ -757,9 +801,9 @@ describe PageObject::ElementLocators do
|
|
757
801
|
it "should find all text area elements" do
|
758
802
|
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
759
803
|
elements = selenium_page_object.text_area_elements(:id => 'blah')
|
760
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::TextArea
|
804
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::TextArea
|
761
805
|
end
|
762
|
-
|
806
|
+
|
763
807
|
it "should find a select list element" do
|
764
808
|
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
765
809
|
element = selenium_page_object.select_list_element(:id => 'blah')
|
@@ -769,9 +813,9 @@ describe PageObject::ElementLocators do
|
|
769
813
|
it "should find all select list elements" do
|
770
814
|
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
771
815
|
elements = selenium_page_object.select_list_elements(:id => 'blah')
|
772
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::SelectList
|
816
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::SelectList
|
773
817
|
end
|
774
|
-
|
818
|
+
|
775
819
|
it "should find a link element" do
|
776
820
|
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
777
821
|
element = selenium_page_object.link_element(:id => 'blah')
|
@@ -781,9 +825,9 @@ describe PageObject::ElementLocators do
|
|
781
825
|
it "should find all link elements" do
|
782
826
|
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
783
827
|
elements = selenium_page_object.link_elements(:id => 'blah')
|
784
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::Link
|
828
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Link
|
785
829
|
end
|
786
|
-
|
830
|
+
|
787
831
|
it "should find a check box" do
|
788
832
|
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
789
833
|
element = selenium_page_object.checkbox_element(:id => 'blah')
|
@@ -793,9 +837,9 @@ describe PageObject::ElementLocators do
|
|
793
837
|
it "should find all checkbox elements" do
|
794
838
|
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
795
839
|
elements = selenium_page_object.checkbox_elements(:id => 'blah')
|
796
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::CheckBox
|
840
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::CheckBox
|
797
841
|
end
|
798
|
-
|
842
|
+
|
799
843
|
it "should find a radio button" do
|
800
844
|
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
801
845
|
element = selenium_page_object.radio_button_element(:id => 'blah')
|
@@ -805,9 +849,9 @@ describe PageObject::ElementLocators do
|
|
805
849
|
it "should find all radio button elements" do
|
806
850
|
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
807
851
|
elements = selenium_page_object.radio_button_elements(:id => 'blah')
|
808
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::RadioButton
|
852
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::RadioButton
|
809
853
|
end
|
810
|
-
|
854
|
+
|
811
855
|
it "should find a div" do
|
812
856
|
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
813
857
|
element = selenium_page_object.div_element(:id => 'blah')
|
@@ -817,9 +861,9 @@ describe PageObject::ElementLocators do
|
|
817
861
|
it "should find all div elements" do
|
818
862
|
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
819
863
|
elements = selenium_page_object.div_elements(:id => 'blah')
|
820
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::Div
|
864
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Div
|
821
865
|
end
|
822
|
-
|
866
|
+
|
823
867
|
it "should find a span" do
|
824
868
|
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
825
869
|
element = selenium_page_object.span_element(:id => 'blah')
|
@@ -829,21 +873,21 @@ describe PageObject::ElementLocators do
|
|
829
873
|
it "should find all span elements" do
|
830
874
|
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
831
875
|
elements = selenium_page_object.span_elements(:id => 'blah')
|
832
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::Span
|
876
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Span
|
833
877
|
end
|
834
|
-
|
878
|
+
|
835
879
|
it "should find a table" do
|
836
880
|
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
837
881
|
element = selenium_page_object.table_element(:id => 'blah')
|
838
882
|
expect(element).to be_instance_of PageObject::Elements::Table
|
839
883
|
end
|
840
|
-
|
884
|
+
|
841
885
|
it "should find all table elements" do
|
842
886
|
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
843
887
|
elements = selenium_page_object.table_elements(:id => 'blah')
|
844
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::Table
|
888
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Table
|
845
889
|
end
|
846
|
-
|
890
|
+
|
847
891
|
it "should find a table cell" do
|
848
892
|
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
849
893
|
element = selenium_page_object.cell_element(:id => 'blah')
|
@@ -853,7 +897,7 @@ describe PageObject::ElementLocators do
|
|
853
897
|
it "should find all table cell elements" do
|
854
898
|
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
855
899
|
elements = selenium_page_object.cell_elements(:id => 'blah')
|
856
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::TableCell
|
900
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::TableCell
|
857
901
|
end
|
858
902
|
|
859
903
|
it "should find an image" do
|
@@ -867,13 +911,13 @@ describe PageObject::ElementLocators do
|
|
867
911
|
elements = selenium_page_object.image_elements(:id => 'blah')
|
868
912
|
expect(elements[0]).to be_instance_of PageObject::Elements::Image
|
869
913
|
end
|
870
|
-
|
914
|
+
|
871
915
|
it "should find a form" do
|
872
916
|
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
873
917
|
element = selenium_page_object.form_element(:id => 'blah')
|
874
918
|
expect(element).to be_instance_of PageObject::Elements::Form
|
875
919
|
end
|
876
|
-
|
920
|
+
|
877
921
|
it "should find all forms" do
|
878
922
|
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
879
923
|
elements = selenium_page_object.form_elements(:id => 'blah')
|
@@ -889,9 +933,9 @@ describe PageObject::ElementLocators do
|
|
889
933
|
it "should find all list items" do
|
890
934
|
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
891
935
|
element = selenium_page_object.list_item_elements(:id => 'blah')
|
892
|
-
expect(element[0]).to be_instance_of PageObject::Elements::ListItem
|
936
|
+
expect(element[0]).to be_instance_of PageObject::Elements::ListItem
|
893
937
|
end
|
894
|
-
|
938
|
+
|
895
939
|
it "should find an unordered list" do
|
896
940
|
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
897
941
|
element = selenium_page_object.unordered_list_element(:id => 'blah')
|
@@ -901,9 +945,9 @@ describe PageObject::ElementLocators do
|
|
901
945
|
it "should find all unordered lists" do
|
902
946
|
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
903
947
|
elements = selenium_page_object.unordered_list_elements(:id => 'blah')
|
904
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::UnorderedList
|
948
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::UnorderedList
|
905
949
|
end
|
906
|
-
|
950
|
+
|
907
951
|
it "should find an ordered list" do
|
908
952
|
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
909
953
|
element = selenium_page_object.ordered_list_element(:id => 'blah')
|
@@ -913,9 +957,9 @@ describe PageObject::ElementLocators do
|
|
913
957
|
it "should find all orderd list elements" do
|
914
958
|
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
915
959
|
elements = selenium_page_object.ordered_list_elements(:id => 'blah')
|
916
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::OrderedList
|
960
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::OrderedList
|
917
961
|
end
|
918
|
-
|
962
|
+
|
919
963
|
it "should find a h1 element" do
|
920
964
|
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
921
965
|
element = selenium_page_object.h1_element(:id => 'blah')
|
@@ -925,7 +969,7 @@ describe PageObject::ElementLocators do
|
|
925
969
|
it "should find all h1 elements" do
|
926
970
|
expect(selenium_browser).to receive(:find_elements).with(:id, "blah").and_return([selenium_browser])
|
927
971
|
elements = selenium_page_object.h1_elements(:id => 'blah')
|
928
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::Heading
|
972
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Heading
|
929
973
|
end
|
930
974
|
|
931
975
|
it "should find a h2 element" do
|
@@ -937,7 +981,7 @@ describe PageObject::ElementLocators do
|
|
937
981
|
it "should find all h2 elements" do
|
938
982
|
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
939
983
|
elements = selenium_page_object.h2_elements(:id => 'blah')
|
940
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::Heading
|
984
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Heading
|
941
985
|
end
|
942
986
|
|
943
987
|
it "should find a h3 element" do
|
@@ -949,7 +993,7 @@ describe PageObject::ElementLocators do
|
|
949
993
|
it "should find all h3 elements" do
|
950
994
|
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
951
995
|
elements = selenium_page_object.h3_elements(:id => 'blah')
|
952
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::Heading
|
996
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Heading
|
953
997
|
end
|
954
998
|
|
955
999
|
it "should find a h4 element" do
|
@@ -973,7 +1017,7 @@ describe PageObject::ElementLocators do
|
|
973
1017
|
it "should find all h5 elements" do
|
974
1018
|
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
975
1019
|
elements = selenium_page_object.h5_elements(:id => 'blah')
|
976
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::Heading
|
1020
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Heading
|
977
1021
|
end
|
978
1022
|
|
979
1023
|
it "should find a h6 element" do
|
@@ -985,7 +1029,7 @@ describe PageObject::ElementLocators do
|
|
985
1029
|
it "should find all h6 elements" do
|
986
1030
|
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
987
1031
|
elements = selenium_page_object.h6_elements(:id => 'blah')
|
988
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::Heading
|
1032
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Heading
|
989
1033
|
end
|
990
1034
|
|
991
1035
|
it "should find a paragraph element" do
|
@@ -997,7 +1041,7 @@ describe PageObject::ElementLocators do
|
|
997
1041
|
it "should find all paragraph elements" do
|
998
1042
|
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
999
1043
|
elements = selenium_page_object.paragraph_elements(:id => 'blah')
|
1000
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::Paragraph
|
1044
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Paragraph
|
1001
1045
|
end
|
1002
1046
|
|
1003
1047
|
it "should find a label" do
|
@@ -1010,7 +1054,7 @@ describe PageObject::ElementLocators do
|
|
1010
1054
|
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
1011
1055
|
elements = selenium_page_object.label_elements(:id => 'blah')
|
1012
1056
|
expect(elements[0]).to be_instance_of PageObject::Elements::Label
|
1013
|
-
end
|
1057
|
+
end
|
1014
1058
|
|
1015
1059
|
it "should find a file field element" do
|
1016
1060
|
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
@@ -1083,17 +1127,17 @@ describe PageObject::ElementLocators do
|
|
1083
1127
|
expect(selenium_browser).to receive(:find_elements).with(:tag_name, 'audio').and_return([selenium_browser])
|
1084
1128
|
selenium_page_object.audio_elements
|
1085
1129
|
end
|
1086
|
-
it "should find
|
1130
|
+
it "should find an i element" do
|
1087
1131
|
expect(selenium_browser).to receive(:find_element).with(:id,'blah').and_return(selenium_browser)
|
1088
|
-
element = selenium_page_object.
|
1089
|
-
expect(element).to be_instance_of PageObject::Elements::
|
1132
|
+
element = selenium_page_object.i_element(:id => 'blah')
|
1133
|
+
expect(element).to be_instance_of PageObject::Elements::Italic
|
1090
1134
|
end
|
1091
1135
|
|
1092
1136
|
|
1093
|
-
it "should find all
|
1137
|
+
it "should find all i elements" do
|
1094
1138
|
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
1095
|
-
elements = selenium_page_object.
|
1096
|
-
expect(elements[0]).to be_instance_of PageObject::Elements::
|
1139
|
+
elements = selenium_page_object.i_elements(:id => 'blah')
|
1140
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Italic
|
1097
1141
|
end
|
1098
1142
|
|
1099
1143
|
end
|