page-object 0.8.6 → 0.8.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +6 -0
- data/features/check_box.feature +2 -1
- data/features/file_field.feature +1 -0
- data/features/html/static_elements.html +8 -3
- data/features/radio_button.feature +1 -0
- data/features/select_list.feature +2 -1
- data/features/support/page.rb +9 -4
- data/features/text_area.feature +2 -1
- data/lib/page-object/accessors.rb +8 -3
- data/lib/page-object/elements/check_box.rb +4 -4
- data/lib/page-object/elements/file_field.rb +3 -3
- data/lib/page-object/elements/radio_button.rb +3 -3
- data/lib/page-object/elements/select_list.rb +5 -1
- data/lib/page-object/elements/text_area.rb +9 -1
- data/lib/page-object/version.rb +1 -1
- data/page-object.gemspec +2 -2
- metadata +8 -8
data/ChangeLog
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
=== Version 0.8.6.1 / 2013-3-4
|
2
|
+
* Enhancements
|
3
|
+
* Added lable locators for checkbox, text area, select list, radio button and file field (Thanks Alex Rodionov)
|
4
|
+
* Updated to use the latest selenium-webdriver 2.31.0
|
5
|
+
* Updated to use the latest page_navigation 0.7
|
6
|
+
|
1
7
|
=== Version 0.8.6 / 2013-2-27
|
2
8
|
* Enhancements
|
3
9
|
* Added support for the svg element
|
data/features/check_box.feature
CHANGED
@@ -24,6 +24,7 @@ Feature: Check Box
|
|
24
24
|
| xpath |
|
25
25
|
| index |
|
26
26
|
| value |
|
27
|
+
| label |
|
27
28
|
|
28
29
|
@selenium_only
|
29
30
|
Scenario Outline: Locating check boxes on the page
|
@@ -47,7 +48,7 @@ Feature: Check Box
|
|
47
48
|
When I retrieve a check box element
|
48
49
|
Then I should know it exists
|
49
50
|
And I should know it is visible
|
50
|
-
|
51
|
+
|
51
52
|
Scenario: Finding a check box dynamically
|
52
53
|
When I select the first check box while the script is executing
|
53
54
|
Then I should see that the checkbox exists
|
data/features/file_field.feature
CHANGED
@@ -12,8 +12,10 @@
|
|
12
12
|
<input id="hidden_field_id" name="hidden_field_name" class="hidden_field_class"
|
13
13
|
size="40" type="hidden" value="12345"/>
|
14
14
|
|
15
|
+
<label for="text_area_id">Text Area</label>
|
15
16
|
<textarea rows="2" cols="20" id="text_area_id" class="text_area_class" name="text_area_name"></textarea>
|
16
17
|
|
18
|
+
<label for="sel_list_id">Select List</label>
|
17
19
|
<select name="sel_list_name" id="sel_list_id" class="sel_list_class">
|
18
20
|
<option value="option1">Test 1</option>
|
19
21
|
<option value="option2">Test 2</option>
|
@@ -31,7 +33,7 @@
|
|
31
33
|
<area shape="circle" coords="90,58,3" href="mercur.html"/>
|
32
34
|
<area shape="circle" coords="124,58,8" href="venus.html"/>
|
33
35
|
</map>
|
34
|
-
|
36
|
+
|
35
37
|
<canvas id="canvas" name="canvas" class="canvas" width="200" height="100"></canvas>
|
36
38
|
<script type="text/javascript">
|
37
39
|
var c=document.getElementById("myCanvas");
|
@@ -53,15 +55,17 @@
|
|
53
55
|
<source src="movie.ogg" type="video/ogg" />
|
54
56
|
Your browser does not support the video tag.
|
55
57
|
</video>
|
56
|
-
|
58
|
+
|
57
59
|
<svg width="100" height="100" id="the_svg">
|
58
60
|
<circle cx="50" cy="50" r="40" fill="red" stroke="blue" stroke-width="5" />
|
59
|
-
</svg>
|
61
|
+
</svg>
|
60
62
|
|
61
63
|
<a href="success.html" id="link_id" name="link_name" class="link_class" title="link_title">Google Search</a>
|
62
64
|
|
65
|
+
<label for="cb_id">Checkbox</label>
|
63
66
|
<input id="cb_id" name="cb_name" class="cb_class" type="checkbox" value="1"/>
|
64
67
|
|
68
|
+
<label for="milk_id">Radio</label>
|
65
69
|
<input type="radio" id="milk_id" name="milk_name" class="milk_class" value="Milk"> Milk <br/>
|
66
70
|
<input type="radio" id="butter_id" name="butter_name" class="butter_class" value="Butter">Butter
|
67
71
|
|
@@ -122,6 +126,7 @@
|
|
122
126
|
<form id="form_id" class="form_class" name="form_name" action="/">
|
123
127
|
</form>
|
124
128
|
|
129
|
+
<label for="file_field_id">File Field</label>
|
125
130
|
<input type="file" name="file_field_name" id="file_field_id" class="file_field_class" title="file_field_title" />
|
126
131
|
|
127
132
|
<ul id="ul_id" name="ul_name" class="ul_class">
|
@@ -23,6 +23,7 @@ Feature: Select List
|
|
23
23
|
| name |
|
24
24
|
| xpath |
|
25
25
|
| index |
|
26
|
+
| label |
|
26
27
|
|
27
28
|
@selenium_only
|
28
29
|
Scenario Outline: Locating select lists on the Page using Selenium
|
@@ -75,7 +76,7 @@ Feature: Select List
|
|
75
76
|
Scenario: Selecting an option by its value
|
76
77
|
When I select an option using the value "option2"
|
77
78
|
Then the selected option should be "Test 2"
|
78
|
-
|
79
|
+
|
79
80
|
Scenario: Getting the value from a selected option
|
80
81
|
When I select an option using the value "option2"
|
81
82
|
Then the selected option should have a value of "option2"
|
data/features/support/page.rb
CHANGED
@@ -34,6 +34,7 @@ class Page
|
|
34
34
|
text_area(:text_area_value, :value => "")
|
35
35
|
text_area(:text_area_class_index, :class => "text_area_class", :index => 0)
|
36
36
|
text_area(:text_area_name_index, :name => "text_area_name", :index => 0)
|
37
|
+
text_area(:text_area_label, :label => "Text Area")
|
37
38
|
|
38
39
|
hidden_field(:hidden_field_id, :id => "hidden_field_id")
|
39
40
|
hidden_field(:hidden_field_class, :class => "hidden_field_class")
|
@@ -72,6 +73,7 @@ class Page
|
|
72
73
|
select_list(:sel_list_class_index, :class => "sel_list_class", :index => 0)
|
73
74
|
select_list(:sel_list_name_index, :name => "sel_list_name", :index => 0)
|
74
75
|
select_list(:sel_list_multiple, :id => "sel_list_multiple")
|
76
|
+
select_list(:sel_list_label, :label => "Select List")
|
75
77
|
|
76
78
|
checkbox(:cb_id, :id => 'cb_id')
|
77
79
|
checkbox(:cb_name, :name => 'cb_name')
|
@@ -82,6 +84,7 @@ class Page
|
|
82
84
|
checkbox(:cb_value, :value => '1')
|
83
85
|
checkbox(:cb_class_index, :class => "cb_class", :index => 0)
|
84
86
|
checkbox(:cb_name_index, :name => "cb_name", :index => 0)
|
87
|
+
checkbox(:cb_label, :label => 'Checkbox')
|
85
88
|
|
86
89
|
radio_button(:milk_id, :id => 'milk_id')
|
87
90
|
radio_button(:milk_name, :name => 'milk_name')
|
@@ -92,6 +95,7 @@ class Page
|
|
92
95
|
radio_button(:milk_xpath, :xpath => "//input[@type='radio']")
|
93
96
|
radio_button(:milk_class_index, :class => "milk_class", :index => 0)
|
94
97
|
radio_button(:milk_name_index, :name => "milk_name", :index => 0)
|
98
|
+
radio_button(:milk_label, :label => "Radio")
|
95
99
|
|
96
100
|
radio_button(:butter_id, :id => 'butter_id')
|
97
101
|
|
@@ -164,7 +168,7 @@ class Page
|
|
164
168
|
button(:btn_class_index, :class => "btn_class", :index => 0)
|
165
169
|
button(:btn_name_index, :name => "btn_name", :index => 0)
|
166
170
|
|
167
|
-
|
171
|
+
|
168
172
|
button(:disabled_button, :value => 'Disabled')
|
169
173
|
|
170
174
|
image(:image_id, :id => 'image_id')
|
@@ -294,14 +298,15 @@ class Page
|
|
294
298
|
file_field(:file_field_class_index, :class => 'file_field_class', :index => 0)
|
295
299
|
file_field(:file_field_name_index, :name => 'file_field_name', :index => 0)
|
296
300
|
file_field(:file_field_xpath, :xpath => "//input[@type='file']")
|
301
|
+
file_field(:file_field_label, :label => "File Field")
|
297
302
|
|
298
303
|
label(:label_id, :id => 'label_id')
|
299
304
|
label(:label_name, :name => 'label_name')
|
300
305
|
label(:label_class, :class => 'label_class')
|
301
306
|
label(:label_css, :css => '.label_class')
|
302
307
|
label(:label_text, :text => 'page-object is the best!')
|
303
|
-
label(:label_index, :index =>
|
304
|
-
label(:label_xpath, :xpath => '//label[
|
308
|
+
label(:label_index, :index => 5)
|
309
|
+
label(:label_xpath, :xpath => '//label[6]')
|
305
310
|
label(:label_class_index, :class => "label_class", :index => 0)
|
306
311
|
label(:label_name_index, :name => "label_name", :index => 0)
|
307
312
|
|
@@ -344,7 +349,7 @@ class Page
|
|
344
349
|
video(:video_xpath, :xpath => '//video')
|
345
350
|
video(:video_class_index, :class => 'video', :index => 0)
|
346
351
|
video(:video_name_index, :name => 'video', :index => 0)
|
347
|
-
|
352
|
+
|
348
353
|
element(:article_id, :article, :id => 'article_id')
|
349
354
|
element(:header_id, :header, :id => 'header_id')
|
350
355
|
element(:footer_id, :footer, :id => 'footer_id')
|
data/features/text_area.feature
CHANGED
@@ -19,6 +19,7 @@ Feature: Text Area
|
|
19
19
|
| name |
|
20
20
|
| xpath |
|
21
21
|
| index |
|
22
|
+
| label |
|
22
23
|
|
23
24
|
@selenium_only
|
24
25
|
Scenario Outline: Locating text area on the Page
|
@@ -42,7 +43,7 @@ Feature: Text Area
|
|
42
43
|
When I find a text area while the script is executing
|
43
44
|
Then I should see that the text area exists
|
44
45
|
And I should be able to type "I found it" into the area element
|
45
|
-
|
46
|
+
|
46
47
|
Scenario: Clearing the text area
|
47
48
|
When I type "abcdefghijklmnop" into the text area
|
48
49
|
Then the text area should contain "abcdefghijklmnop"
|
@@ -194,6 +194,7 @@ module PageObject
|
|
194
194
|
# * :index => Watir and Selenium
|
195
195
|
# * :name => Watir and Selenium
|
196
196
|
# * :xpath => Watir and Selenium
|
197
|
+
# * :label => Watir and Selenium
|
197
198
|
# @param optional block to be invoked when element method is called
|
198
199
|
#
|
199
200
|
def text_area(name, identifier={:index => 0}, &block)
|
@@ -231,6 +232,7 @@ module PageObject
|
|
231
232
|
# * :text => Watir only
|
232
233
|
# * :value => Watir only
|
233
234
|
# * :xpath => Watir and Selenium
|
235
|
+
# * :label => Watir and Selenium
|
234
236
|
# @param optional block to be invoked when element method is called
|
235
237
|
#
|
236
238
|
def select_list(name, identifier={:index => 0}, &block)
|
@@ -242,12 +244,12 @@ module PageObject
|
|
242
244
|
return platform.select_list_value_set(identifier.clone, value) unless block_given?
|
243
245
|
self.send("#{name}_element").select(value)
|
244
246
|
end
|
245
|
-
|
247
|
+
|
246
248
|
define_method("#{name}_options") do
|
247
249
|
element = self.send("#{name}_element")
|
248
250
|
(element && element.options) ? element.options.collect(&:text) : []
|
249
251
|
end
|
250
|
-
|
252
|
+
|
251
253
|
standard_methods(name, identifier, 'select_list_for', &block)
|
252
254
|
end
|
253
255
|
alias_method :select, :select_list
|
@@ -307,6 +309,7 @@ module PageObject
|
|
307
309
|
# * :name => Watir and Selenium
|
308
310
|
# * :value => Watir and Selenium
|
309
311
|
# * :xpath => Watir and Selenium
|
312
|
+
# * :label => Watir and Selenium
|
310
313
|
# @param optional block to be invoked when element method is called
|
311
314
|
#
|
312
315
|
def checkbox(name, identifier={:index => 0}, &block)
|
@@ -347,6 +350,7 @@ module PageObject
|
|
347
350
|
# * :name => Watir and Selenium
|
348
351
|
# * :value => Watir and Selenium
|
349
352
|
# * :xpath => Watir and Selenium
|
353
|
+
# * :label => Watir and Selenium
|
350
354
|
# @param optional block to be invoked when element method is called
|
351
355
|
#
|
352
356
|
def radio_button(name, identifier={:index => 0}, &block)
|
@@ -859,6 +863,7 @@ module PageObject
|
|
859
863
|
# * :name => Watir and Selenium
|
860
864
|
# * :title => Watir and Selenium
|
861
865
|
# * :xpath => Watir and Selenium
|
866
|
+
# * :label => Watir and Selenium
|
862
867
|
# @param optional block to be invoked when element method is called
|
863
868
|
#
|
864
869
|
def file_field(name, identifier={:index => 0}, &block)
|
@@ -1118,7 +1123,7 @@ module PageObject
|
|
1118
1123
|
platform.send(method, identifier.clone).exists?
|
1119
1124
|
end
|
1120
1125
|
end
|
1121
|
-
|
1126
|
+
|
1122
1127
|
#
|
1123
1128
|
# adds a method that will return an indexed property. The property will respond to
|
1124
1129
|
# the [] method with an object that has a set of normal page_object properties that
|
@@ -11,13 +11,13 @@ module PageObject
|
|
11
11
|
protected
|
12
12
|
|
13
13
|
def self.watir_finders
|
14
|
-
super + [:value]
|
14
|
+
super + [:value, :label]
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.selenium_finders
|
18
|
-
super + [:value]
|
18
|
+
super + [:value, :label]
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
def include_platform_for platform
|
22
22
|
super
|
23
23
|
if platform[:platform] == :watir_webdriver
|
@@ -33,6 +33,6 @@ module PageObject
|
|
33
33
|
end
|
34
34
|
|
35
35
|
::PageObject::Elements.type_to_class[:checkbox] = ::PageObject::Elements::CheckBox
|
36
|
-
|
36
|
+
|
37
37
|
end
|
38
38
|
end
|
@@ -11,11 +11,11 @@ module PageObject
|
|
11
11
|
protected
|
12
12
|
|
13
13
|
def self.watir_finders
|
14
|
-
super + [:title]
|
14
|
+
super + [:title, :label]
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.selenium_finders
|
18
|
-
super + [:title]
|
18
|
+
super + [:title, :label]
|
19
19
|
end
|
20
20
|
|
21
21
|
def include_platform_for platform
|
@@ -33,6 +33,6 @@ module PageObject
|
|
33
33
|
end
|
34
34
|
|
35
35
|
::PageObject::Elements.type_to_class[:file] = ::PageObject::Elements::FileField
|
36
|
-
|
36
|
+
|
37
37
|
end
|
38
38
|
end
|
@@ -9,13 +9,13 @@ module PageObject
|
|
9
9
|
end
|
10
10
|
|
11
11
|
protected
|
12
|
-
|
12
|
+
|
13
13
|
def self.watir_finders
|
14
|
-
super + [:value]
|
14
|
+
super + [:value, :label]
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.selenium_finders
|
18
|
-
super + [:value]
|
18
|
+
super + [:value, :label]
|
19
19
|
end
|
20
20
|
|
21
21
|
def include_platform_for platform
|
@@ -8,6 +8,14 @@ module PageObject
|
|
8
8
|
include_platform_for platform
|
9
9
|
end
|
10
10
|
|
11
|
+
def self.watir_finders
|
12
|
+
super + [:label]
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.selenium_finders
|
16
|
+
super + [:label]
|
17
|
+
end
|
18
|
+
|
11
19
|
protected
|
12
20
|
|
13
21
|
def include_platform_for platform
|
@@ -25,6 +33,6 @@ module PageObject
|
|
25
33
|
end
|
26
34
|
|
27
35
|
::PageObject::Elements.tag_to_class[:textarea] = ::PageObject::Elements::TextArea
|
28
|
-
|
36
|
+
|
29
37
|
end
|
30
38
|
end
|
data/lib/page-object/version.rb
CHANGED
data/page-object.gemspec
CHANGED
@@ -20,8 +20,8 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.require_paths = ["lib"]
|
21
21
|
|
22
22
|
s.add_dependency 'watir-webdriver', '>= 0.6.2'
|
23
|
-
s.add_dependency 'selenium-webdriver', '>= 2.
|
24
|
-
s.add_dependency 'page_navigation', '>= 0.
|
23
|
+
s.add_dependency 'selenium-webdriver', '>= 2.31.0'
|
24
|
+
s.add_dependency 'page_navigation', '>= 0.7'
|
25
25
|
|
26
26
|
s.add_development_dependency 'rspec', '>= 2.12.0'
|
27
27
|
s.add_development_dependency 'cucumber', '>= 1.2.0'
|
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: 0.8.6
|
4
|
+
version: 0.8.6.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-03-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: watir-webdriver
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - ! '>='
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: 2.
|
37
|
+
version: 2.31.0
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 2.
|
45
|
+
version: 2.31.0
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: page_navigation
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ! '>='
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '0.
|
53
|
+
version: '0.7'
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -58,7 +58,7 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0.
|
61
|
+
version: '0.7'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: rspec
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -397,7 +397,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
397
397
|
version: '0'
|
398
398
|
segments:
|
399
399
|
- 0
|
400
|
-
hash: -
|
400
|
+
hash: -3618405462475899923
|
401
401
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
402
402
|
none: false
|
403
403
|
requirements:
|
@@ -406,7 +406,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
406
406
|
version: '0'
|
407
407
|
segments:
|
408
408
|
- 0
|
409
|
-
hash: -
|
409
|
+
hash: -3618405462475899923
|
410
410
|
requirements: []
|
411
411
|
rubyforge_project: page-object
|
412
412
|
rubygems_version: 1.8.25
|