page-object 0.8.5 → 0.8.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +1 -1
- data/ChangeLog +6 -0
- data/features/generic_elements.feature +6 -1
- data/features/html/static_elements.html +4 -0
- data/features/step_definitions/generic_element_steps.rb +12 -0
- data/features/support/page.rb +1 -0
- data/lib/page-object/accessors.rb +24 -0
- data/lib/page-object/locator_generator.rb +13 -3
- data/lib/page-object/platforms/selenium_webdriver/page_object.rb +14 -0
- data/lib/page-object/platforms/watir_webdriver/page_object.rb +20 -2
- data/lib/page-object/version.rb +1 -1
- metadata +5 -5
data/.rvmrc
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
rvm --create use 1.9.3-
|
1
|
+
rvm --create use 1.9.3-p392@page-object
|
2
2
|
|
data/ChangeLog
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
=== Version 0.8.6 / 2013-2-27
|
2
|
+
* Enhancements
|
3
|
+
* Added support for the svg element
|
4
|
+
* Fixes
|
5
|
+
* Fixed issue with nested generic element calls
|
6
|
+
|
1
7
|
=== Version 0.8.5 / 2013-2-21
|
2
8
|
* Enhancements
|
3
9
|
* Updated to use the latest selenium-webdriver 2.30 - support for Firefox 19
|
@@ -21,4 +21,9 @@ Feature: Generic Elements
|
|
21
21
|
|
22
22
|
Scenario: Getting the text from the details element
|
23
23
|
When I get the text from the details
|
24
|
-
Then the text should be "The summary The details"
|
24
|
+
Then the text should be "The summary The details"
|
25
|
+
|
26
|
+
Scenario: getting properties from a svg element
|
27
|
+
When I get the svg element
|
28
|
+
Then the svg width should be "100"
|
29
|
+
And the svg height should be "100"
|
@@ -54,6 +54,10 @@
|
|
54
54
|
Your browser does not support the video tag.
|
55
55
|
</video>
|
56
56
|
|
57
|
+
<svg width="100" height="100" id="the_svg">
|
58
|
+
<circle cx="50" cy="50" r="40" fill="red" stroke="blue" stroke-width="5" />
|
59
|
+
</svg>
|
60
|
+
|
57
61
|
<a href="success.html" id="link_id" name="link_name" class="link_class" title="link_title">Google Search</a>
|
58
62
|
|
59
63
|
<input id="cb_id" name="cb_name" class="cb_class" type="checkbox" value="1"/>
|
@@ -17,3 +17,15 @@ end
|
|
17
17
|
When /^I get the text from the details$/ do
|
18
18
|
@text = @page.details_id
|
19
19
|
end
|
20
|
+
|
21
|
+
When /^I get the svg element$/ do
|
22
|
+
@svg = @page.svg_id_element
|
23
|
+
end
|
24
|
+
|
25
|
+
Then /^the svg width should be "(.*?)"$/ do |width|
|
26
|
+
@svg.attribute('width').should == width
|
27
|
+
end
|
28
|
+
|
29
|
+
Then /^the svg height should be "(.*?)"$/ do |height|
|
30
|
+
@svg.attribute('height').should == height
|
31
|
+
end
|
data/features/support/page.rb
CHANGED
@@ -1027,6 +1027,30 @@ module PageObject
|
|
1027
1027
|
end
|
1028
1028
|
end
|
1029
1029
|
|
1030
|
+
#
|
1031
|
+
# adds two methods - one to retrieve a svg, and another to check
|
1032
|
+
# the svg's existence.
|
1033
|
+
#
|
1034
|
+
# @example
|
1035
|
+
# svg(:circle, :id => 'circle')
|
1036
|
+
# # will generate 'circle_element', and 'circle?' methods
|
1037
|
+
#
|
1038
|
+
# @param [Symbol] the name used for the generated methods
|
1039
|
+
# @param [Hash] identifier how we find a svg. You can use a multiple paramaters
|
1040
|
+
# by combining of any of the following except xpath. The valid keys are:
|
1041
|
+
# * :class => Watir and Selenium
|
1042
|
+
# * :css => Selenium only
|
1043
|
+
# * :id => Watir and Selenium
|
1044
|
+
# * :index => Watir and Selenium
|
1045
|
+
# * :name => Watir and Selenium
|
1046
|
+
# * :xpath => Watir and Selenium
|
1047
|
+
# @param optional block to be invoked when element method is called
|
1048
|
+
#
|
1049
|
+
def svg(name, identifier={:index => 0}, &block)
|
1050
|
+
standard_methods(name, identifier, 'svg_for', &block)
|
1051
|
+
end
|
1052
|
+
|
1053
|
+
|
1030
1054
|
#
|
1031
1055
|
# methods to generate accessors for types that follow the same
|
1032
1056
|
# pattern as element
|
@@ -32,7 +32,17 @@ module PageObject
|
|
32
32
|
:canvas,
|
33
33
|
:audio,
|
34
34
|
:video,
|
35
|
-
:
|
35
|
+
:svg].each do |tag|
|
36
|
+
target.send(:define_method, "#{tag.to_s}_element") do |*identifier|
|
37
|
+
@platform.send "#{tag.to_s}_for", locator(identifier)
|
38
|
+
end
|
39
|
+
|
40
|
+
target.send(:define_method, "#{tag.to_s}_elements") do |*identifier|
|
41
|
+
@platform.send("#{tag.to_s}s_for", identifier[0] ? identifier[0] : {})
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
[:abbr,
|
36
46
|
:address,
|
37
47
|
:article,
|
38
48
|
:aside,
|
@@ -64,11 +74,11 @@ module PageObject
|
|
64
74
|
:var,
|
65
75
|
:wbr].each do |tag|
|
66
76
|
target.send(:define_method, "#{tag.to_s}_element") do |*identifier|
|
67
|
-
@platform.send
|
77
|
+
@platform.send :element_for, locator(identifier)
|
68
78
|
end
|
69
79
|
|
70
80
|
target.send(:define_method, "#{tag.to_s}_elements") do |*identifier|
|
71
|
-
@platform.send(
|
81
|
+
@platform.send(:elements_for, identifier[0] ? identifier[0] : {})
|
72
82
|
end
|
73
83
|
end
|
74
84
|
end
|
@@ -988,6 +988,20 @@ module PageObject
|
|
988
988
|
find_selenium_elements(identifier, Elements::Element, tag.to_s)
|
989
989
|
end
|
990
990
|
|
991
|
+
#
|
992
|
+
# platform method to return a svg element
|
993
|
+
#
|
994
|
+
def svg_for(identifier)
|
995
|
+
find_selenium_element(identifier, Elements::Element, 'svg')
|
996
|
+
end
|
997
|
+
|
998
|
+
#
|
999
|
+
# platform method to return an array of svg elements
|
1000
|
+
#
|
1001
|
+
def svgs_for(identifier)
|
1002
|
+
find_selenium_elements(identifier, Elements::Element, 'svg')
|
1003
|
+
end
|
1004
|
+
|
991
1005
|
private
|
992
1006
|
|
993
1007
|
def process_selenium_call(identifier, type, tag, other=nil)
|
@@ -277,7 +277,7 @@ module PageObject
|
|
277
277
|
# See PageObject::Accessors#select_list
|
278
278
|
#
|
279
279
|
def select_list_value_for(identifier)
|
280
|
-
process_watir_call("select_list(identifier).options.
|
280
|
+
process_watir_call("select_list(identifier).options.find {|o| o.selected?}.text",
|
281
281
|
Elements::SelectList, identifier)
|
282
282
|
end
|
283
283
|
|
@@ -901,16 +901,34 @@ module PageObject
|
|
901
901
|
|
902
902
|
#
|
903
903
|
# platform method to return a PageObject::Elements::Element element
|
904
|
-
# See PageObject::Accessors#
|
904
|
+
# See PageObject::Accessors#element
|
905
905
|
#
|
906
906
|
def element_for(tag, identifier)
|
907
907
|
find_watir_element("#{tag.to_s}(identifier)", Elements::Element, identifier, tag.to_s)
|
908
908
|
end
|
909
909
|
|
910
|
+
#
|
911
|
+
# platform method to return an array of PageObject::Elements::Element elements
|
912
|
+
# See PageObject::Accessors#element
|
913
|
+
#
|
910
914
|
def elements_for(tag, identifier)
|
911
915
|
find_watir_elements("#{tag.to_s}s(identifier)", Elements::Element, identifier, tag.to_s)
|
912
916
|
end
|
913
917
|
|
918
|
+
#
|
919
|
+
# platform method to return a svg element
|
920
|
+
#
|
921
|
+
def svg_for(identifier)
|
922
|
+
find_watir_element("element(identifier)", Elements::Element, identifier)
|
923
|
+
end
|
924
|
+
|
925
|
+
#
|
926
|
+
# platform method to return an array of svg elements
|
927
|
+
#
|
928
|
+
def svgs_for(identifier)
|
929
|
+
find_watir_elements("element(identifier)", Elements::Element, identifier)
|
930
|
+
end
|
931
|
+
|
914
932
|
private
|
915
933
|
|
916
934
|
def find_watir_elements(the_call, type, identifier, tag_name=nil)
|
data/lib/page-object/version.rb
CHANGED
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.
|
4
|
+
version: 0.8.6
|
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-02-
|
12
|
+
date: 2013-02-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: watir-webdriver
|
@@ -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: -3437791365044287985
|
401
401
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
402
402
|
none: false
|
403
403
|
requirements:
|
@@ -406,10 +406,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
406
406
|
version: '0'
|
407
407
|
segments:
|
408
408
|
- 0
|
409
|
-
hash:
|
409
|
+
hash: -3437791365044287985
|
410
410
|
requirements: []
|
411
411
|
rubyforge_project: page-object
|
412
|
-
rubygems_version: 1.8.
|
412
|
+
rubygems_version: 1.8.25
|
413
413
|
signing_key:
|
414
414
|
specification_version: 3
|
415
415
|
summary: Page Object DSL for browser testing
|