page-object 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -35,7 +35,8 @@ class WatirAccessorsTestPageObject
|
|
35
35
|
canvas(:my_canvas, :id => 'canvas_id')
|
36
36
|
audio(:acdc, :id => 'audio_id')
|
37
37
|
video(:movie, :id => 'video_id')
|
38
|
-
b(:bold
|
38
|
+
b(:bold, :id => 'bold')
|
39
|
+
i(:italic, :id => 'italic')
|
39
40
|
end
|
40
41
|
|
41
42
|
class WatirBlockPageObject
|
@@ -133,6 +134,9 @@ class WatirBlockPageObject
|
|
133
134
|
b :bold do |element|
|
134
135
|
"b"
|
135
136
|
end
|
137
|
+
i :italic do |element|
|
138
|
+
"i"
|
139
|
+
end
|
136
140
|
end
|
137
141
|
|
138
142
|
describe PageObject::Accessors do
|
@@ -217,6 +221,33 @@ describe PageObject::Accessors do
|
|
217
221
|
end
|
218
222
|
end
|
219
223
|
|
224
|
+
context "using element accessor" do
|
225
|
+
class WatirDefaultElementTagToElement
|
226
|
+
include PageObject
|
227
|
+
# verify that the explicit :element tag can be omitted
|
228
|
+
# element('button', :element, {:css => 'some css'})
|
229
|
+
element('button', { :css => 'some css' })
|
230
|
+
elements('button2', { :css => 'some css' })
|
231
|
+
end
|
232
|
+
|
233
|
+
let (:page) { WatirDefaultElementTagToElement.new(watir_browser) }
|
234
|
+
|
235
|
+
def mock_driver_for(tag)
|
236
|
+
expect(watir_browser).to receive(tag).with(:css => 'some css').and_return(watir_browser)
|
237
|
+
end
|
238
|
+
|
239
|
+
it "should default element tag to element" do
|
240
|
+
mock_driver_for :element
|
241
|
+
page.button_element
|
242
|
+
end
|
243
|
+
|
244
|
+
it "should default elements tag to element" do
|
245
|
+
mock_driver_for :elements
|
246
|
+
expect(watir_browser).to receive(:map).and_return([])
|
247
|
+
page.button2_elements.to_a
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
220
251
|
context "using default identifiers" do
|
221
252
|
class WatirDefaultIdentifier
|
222
253
|
include PageObject
|
@@ -1131,4 +1162,29 @@ describe PageObject::Accessors do
|
|
1131
1162
|
end
|
1132
1163
|
end
|
1133
1164
|
|
1165
|
+
describe "i accessors" do
|
1166
|
+
context "when called on a page object" do
|
1167
|
+
it "should generate accessor methods" do
|
1168
|
+
expect(watir_page_object).to respond_to(:italic)
|
1169
|
+
expect(watir_page_object).to respond_to(:italic_element)
|
1170
|
+
end
|
1171
|
+
|
1172
|
+
it "should call a block on the element method when present" do
|
1173
|
+
expect(block_page_object.italic_element).to eql "i"
|
1174
|
+
end
|
1175
|
+
end
|
1176
|
+
|
1177
|
+
it "should retrieve the text from the i" do
|
1178
|
+
expect(watir_browser).to receive(:i).and_return(watir_browser)
|
1179
|
+
expect(watir_browser).to receive(:text).and_return("value")
|
1180
|
+
expect(watir_page_object.italic).to eql "value"
|
1181
|
+
end
|
1182
|
+
|
1183
|
+
it "should retrieve the element from the page" do
|
1184
|
+
expect(watir_browser).to receive(:i).and_return(watir_browser)
|
1185
|
+
element = watir_page_object.italic_element
|
1186
|
+
expect(element).to be_instance_of PageObject::Elements::Italic
|
1187
|
+
end
|
1188
|
+
end
|
1189
|
+
|
1134
1190
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -2,12 +2,9 @@
|
|
2
2
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
3
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
require 'simplecov'
|
9
|
-
SimpleCov.start { add_filter "spec/" }
|
10
|
-
end
|
5
|
+
require 'simplecov'
|
6
|
+
require 'coveralls'
|
7
|
+
SimpleCov.start { add_filter 'spec/' }
|
11
8
|
|
12
9
|
require 'rspec'
|
13
10
|
require 'watir-webdriver'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: page-object
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Morgan
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-01-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: watir-webdriver
|
@@ -109,6 +109,20 @@ dependencies:
|
|
109
109
|
- - ">="
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '1.0'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: coveralls
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - "~>"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: 0.8.1
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - "~>"
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 0.8.1
|
112
126
|
description: Page Object DSL that works with both Watir and Selenium
|
113
127
|
email:
|
114
128
|
- jeff.morgan@leandog.com
|
@@ -117,6 +131,7 @@ executables: []
|
|
117
131
|
extensions: []
|
118
132
|
extra_rdoc_files: []
|
119
133
|
files:
|
134
|
+
- ".coveralls.yml"
|
120
135
|
- ".gitignore"
|
121
136
|
- ".rspec"
|
122
137
|
- ".ruby-gemset"
|
@@ -176,8 +191,10 @@ files:
|
|
176
191
|
- features/html/success.html
|
177
192
|
- features/html/sun.gif
|
178
193
|
- features/html/sun.html
|
194
|
+
- features/html/widgets.html
|
179
195
|
- features/image.feature
|
180
196
|
- features/indexed_property.feature
|
197
|
+
- features/italic.feature
|
181
198
|
- features/javascript.feature
|
182
199
|
- features/label.feature
|
183
200
|
- features/link.feature
|
@@ -190,6 +207,7 @@ files:
|
|
190
207
|
- features/paragraph.feature
|
191
208
|
- features/radio_button.feature
|
192
209
|
- features/radio_button_group.feature
|
210
|
+
- features/sample-app/public/audio_video.html
|
193
211
|
- features/sample-app/public/jquery-1.3.2.js
|
194
212
|
- features/sample-app/public/jquery.html
|
195
213
|
- features/sample-app/public/prototype-1.6.0.3.js
|
@@ -217,6 +235,7 @@ files:
|
|
217
235
|
- features/step_definitions/hidden_field_steps.rb
|
218
236
|
- features/step_definitions/image_steps.rb
|
219
237
|
- features/step_definitions/indexed_property_steps.rb
|
238
|
+
- features/step_definitions/italic_steps.rb
|
220
239
|
- features/step_definitions/javascript_steps.rb
|
221
240
|
- features/step_definitions/label_steps.rb
|
222
241
|
- features/step_definitions/link_steps.rb
|
@@ -234,12 +253,14 @@ files:
|
|
234
253
|
- features/step_definitions/select_list_steps.rb
|
235
254
|
- features/step_definitions/span_steps.rb
|
236
255
|
- features/step_definitions/table_cell_steps.rb
|
256
|
+
- features/step_definitions/table_row_steps.rb
|
237
257
|
- features/step_definitions/table_steps.rb
|
238
258
|
- features/step_definitions/text_area_steps.rb
|
239
259
|
- features/step_definitions/text_field_steps.rb
|
240
260
|
- features/step_definitions/unordered_list_steps.rb
|
241
261
|
- features/step_definitions/video_steps.rb
|
242
262
|
- features/support/ajax_text_environment.rb
|
263
|
+
- features/support/audio_video_page.rb
|
243
264
|
- features/support/env.rb
|
244
265
|
- features/support/hooks.rb
|
245
266
|
- features/support/page.rb
|
@@ -249,6 +270,7 @@ files:
|
|
249
270
|
- features/support/url_helper.rb
|
250
271
|
- features/table.feature
|
251
272
|
- features/table_cell.feature
|
273
|
+
- features/table_row.feature
|
252
274
|
- features/text_area.feature
|
253
275
|
- features/text_field.feature
|
254
276
|
- features/unordered_list.feature
|
@@ -271,6 +293,7 @@ files:
|
|
271
293
|
- lib/page-object/elements/heading.rb
|
272
294
|
- lib/page-object/elements/hidden_field.rb
|
273
295
|
- lib/page-object/elements/image.rb
|
296
|
+
- lib/page-object/elements/italic.rb
|
274
297
|
- lib/page-object/elements/label.rb
|
275
298
|
- lib/page-object/elements/link.rb
|
276
299
|
- lib/page-object/elements/list_item.rb
|
@@ -353,9 +376,11 @@ files:
|
|
353
376
|
- spec/page-object/elements/heading_spec.rb
|
354
377
|
- spec/page-object/elements/hidden_field_spec.rb
|
355
378
|
- spec/page-object/elements/image_spec.rb
|
379
|
+
- spec/page-object/elements/italic_spec.rb
|
356
380
|
- spec/page-object/elements/label_spec.rb
|
357
381
|
- spec/page-object/elements/link_spec.rb
|
358
382
|
- spec/page-object/elements/list_item_spec.rb
|
383
|
+
- spec/page-object/elements/media_spec.rb
|
359
384
|
- spec/page-object/elements/nested_element_spec.rb
|
360
385
|
- spec/page-object/elements/option_spec.rb
|
361
386
|
- spec/page-object/elements/ordered_list_spec.rb
|
@@ -370,6 +395,7 @@ files:
|
|
370
395
|
- spec/page-object/elements/table_spec.rb
|
371
396
|
- spec/page-object/elements/text_area_spec.rb
|
372
397
|
- spec/page-object/elements/unordered_list_spec.rb
|
398
|
+
- spec/page-object/elements/video_spec.rb
|
373
399
|
- spec/page-object/elements/watir_element_spec.rb
|
374
400
|
- spec/page-object/javascript_framework_facade_spec.rb
|
375
401
|
- spec/page-object/loads_platform_spec.rb
|
@@ -405,7 +431,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
405
431
|
version: '0'
|
406
432
|
requirements: []
|
407
433
|
rubyforge_project: page-object
|
408
|
-
rubygems_version: 2.
|
434
|
+
rubygems_version: 2.4.3
|
409
435
|
signing_key:
|
410
436
|
specification_version: 4
|
411
437
|
summary: Page Object DSL for browser testing
|
@@ -457,8 +483,10 @@ test_files:
|
|
457
483
|
- features/html/success.html
|
458
484
|
- features/html/sun.gif
|
459
485
|
- features/html/sun.html
|
486
|
+
- features/html/widgets.html
|
460
487
|
- features/image.feature
|
461
488
|
- features/indexed_property.feature
|
489
|
+
- features/italic.feature
|
462
490
|
- features/javascript.feature
|
463
491
|
- features/label.feature
|
464
492
|
- features/link.feature
|
@@ -471,6 +499,7 @@ test_files:
|
|
471
499
|
- features/paragraph.feature
|
472
500
|
- features/radio_button.feature
|
473
501
|
- features/radio_button_group.feature
|
502
|
+
- features/sample-app/public/audio_video.html
|
474
503
|
- features/sample-app/public/jquery-1.3.2.js
|
475
504
|
- features/sample-app/public/jquery.html
|
476
505
|
- features/sample-app/public/prototype-1.6.0.3.js
|
@@ -498,6 +527,7 @@ test_files:
|
|
498
527
|
- features/step_definitions/hidden_field_steps.rb
|
499
528
|
- features/step_definitions/image_steps.rb
|
500
529
|
- features/step_definitions/indexed_property_steps.rb
|
530
|
+
- features/step_definitions/italic_steps.rb
|
501
531
|
- features/step_definitions/javascript_steps.rb
|
502
532
|
- features/step_definitions/label_steps.rb
|
503
533
|
- features/step_definitions/link_steps.rb
|
@@ -515,12 +545,14 @@ test_files:
|
|
515
545
|
- features/step_definitions/select_list_steps.rb
|
516
546
|
- features/step_definitions/span_steps.rb
|
517
547
|
- features/step_definitions/table_cell_steps.rb
|
548
|
+
- features/step_definitions/table_row_steps.rb
|
518
549
|
- features/step_definitions/table_steps.rb
|
519
550
|
- features/step_definitions/text_area_steps.rb
|
520
551
|
- features/step_definitions/text_field_steps.rb
|
521
552
|
- features/step_definitions/unordered_list_steps.rb
|
522
553
|
- features/step_definitions/video_steps.rb
|
523
554
|
- features/support/ajax_text_environment.rb
|
555
|
+
- features/support/audio_video_page.rb
|
524
556
|
- features/support/env.rb
|
525
557
|
- features/support/hooks.rb
|
526
558
|
- features/support/page.rb
|
@@ -530,6 +562,7 @@ test_files:
|
|
530
562
|
- features/support/url_helper.rb
|
531
563
|
- features/table.feature
|
532
564
|
- features/table_cell.feature
|
565
|
+
- features/table_row.feature
|
533
566
|
- features/text_area.feature
|
534
567
|
- features/text_field.feature
|
535
568
|
- features/unordered_list.feature
|
@@ -548,9 +581,11 @@ test_files:
|
|
548
581
|
- spec/page-object/elements/heading_spec.rb
|
549
582
|
- spec/page-object/elements/hidden_field_spec.rb
|
550
583
|
- spec/page-object/elements/image_spec.rb
|
584
|
+
- spec/page-object/elements/italic_spec.rb
|
551
585
|
- spec/page-object/elements/label_spec.rb
|
552
586
|
- spec/page-object/elements/link_spec.rb
|
553
587
|
- spec/page-object/elements/list_item_spec.rb
|
588
|
+
- spec/page-object/elements/media_spec.rb
|
554
589
|
- spec/page-object/elements/nested_element_spec.rb
|
555
590
|
- spec/page-object/elements/option_spec.rb
|
556
591
|
- spec/page-object/elements/ordered_list_spec.rb
|
@@ -565,6 +600,7 @@ test_files:
|
|
565
600
|
- spec/page-object/elements/table_spec.rb
|
566
601
|
- spec/page-object/elements/text_area_spec.rb
|
567
602
|
- spec/page-object/elements/unordered_list_spec.rb
|
603
|
+
- spec/page-object/elements/video_spec.rb
|
568
604
|
- spec/page-object/elements/watir_element_spec.rb
|
569
605
|
- spec/page-object/javascript_framework_facade_spec.rb
|
570
606
|
- spec/page-object/loads_platform_spec.rb
|