page-object 2.1.1 → 2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/ChangeLog +14 -2
- data/Gemfile +0 -5
- data/lib/page-object.rb +6 -11
- data/lib/page-object/elements/button.rb +0 -11
- data/lib/page-object/elements/check_box.rb +0 -6
- data/lib/page-object/elements/div.rb +0 -7
- data/lib/page-object/elements/element.rb +13 -119
- data/lib/page-object/elements/file_field.rb +0 -6
- data/lib/page-object/elements/form.rb +0 -6
- data/lib/page-object/elements/hidden_field.rb +0 -6
- data/lib/page-object/elements/image.rb +0 -6
- data/lib/page-object/elements/label.rb +0 -6
- data/lib/page-object/elements/link.rb +0 -10
- data/lib/page-object/elements/list_item.rb +0 -6
- data/lib/page-object/elements/ordered_list.rb +2 -6
- data/lib/page-object/elements/radio_button.rb +0 -6
- data/lib/page-object/elements/select_list.rb +1 -5
- data/lib/page-object/elements/span.rb +0 -6
- data/lib/page-object/elements/table.rb +3 -3
- data/lib/page-object/elements/table_cell.rb +0 -6
- data/lib/page-object/elements/table_row.rb +3 -3
- data/lib/page-object/elements/text_area.rb +0 -6
- data/lib/page-object/elements/text_field.rb +0 -6
- data/lib/page-object/elements/unordered_list.rb +2 -6
- data/lib/page-object/indexed_properties.rb +2 -2
- data/lib/page-object/javascript_framework_facade.rb +1 -1
- data/lib/page-object/locator_generator.rb +152 -148
- data/lib/page-object/page_populator.rb +15 -0
- data/lib/page-object/platforms/watir.rb +3 -5
- data/lib/page-object/platforms/watir/page_object.rb +12 -20
- data/lib/page-object/version.rb +1 -1
- data/lib/page-object/widgets.rb +1 -13
- data/page-object.gemspec +6 -6
- metadata +27 -29
- data/lib/page-object/loads_platform.rb +0 -45
- data/lib/page-object/platforms.rb +0 -17
@@ -22,7 +22,7 @@ module PageObject
|
|
22
22
|
# @return [PageObject::Elements::ListItem]
|
23
23
|
#
|
24
24
|
def [](idx)
|
25
|
-
Object::PageObject::Elements::ListItem.new(children[idx]
|
25
|
+
Object::PageObject::Elements::ListItem.new(children[idx])
|
26
26
|
end
|
27
27
|
|
28
28
|
#
|
@@ -37,7 +37,7 @@ module PageObject
|
|
37
37
|
#
|
38
38
|
def list_items
|
39
39
|
children.collect do |obj|
|
40
|
-
Object::PageObject::Elements::ListItem.new(obj
|
40
|
+
Object::PageObject::Elements::ListItem.new(obj)
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -51,10 +51,6 @@ module PageObject
|
|
51
51
|
"./child::li"
|
52
52
|
end
|
53
53
|
|
54
|
-
def self.watir_finders
|
55
|
-
[:class, :id, :index, :xpath]
|
56
|
-
end
|
57
|
-
|
58
54
|
end
|
59
55
|
|
60
56
|
::PageObject::Elements.tag_to_class[:ol] = ::PageObject::Elements::OrderedList
|
@@ -18,7 +18,7 @@ module PageObject
|
|
18
18
|
# @return [array of PageObject::Elements::Option]
|
19
19
|
#
|
20
20
|
def options
|
21
|
-
element.options.map { |e|
|
21
|
+
element.options.map { |e| PageObject::Elements::Option.new(e) }
|
22
22
|
end
|
23
23
|
|
24
24
|
#
|
@@ -50,10 +50,6 @@ module PageObject
|
|
50
50
|
".//child::option"
|
51
51
|
end
|
52
52
|
|
53
|
-
def self.watir_finders
|
54
|
-
super + [:text, :value, :label]
|
55
|
-
end
|
56
|
-
|
57
53
|
end
|
58
54
|
|
59
55
|
::PageObject::Elements.tag_to_class[:select] = ::PageObject::Elements::SelectList
|
@@ -54,7 +54,7 @@ module PageObject
|
|
54
54
|
def [](idx)
|
55
55
|
idx = find_index_by_title(idx) if idx.kind_of?(String)
|
56
56
|
return nil unless idx
|
57
|
-
initialize_row(element[idx]
|
57
|
+
initialize_row(element[idx])
|
58
58
|
end
|
59
59
|
|
60
60
|
#
|
@@ -70,8 +70,8 @@ module PageObject
|
|
70
70
|
".//child::tr"
|
71
71
|
end
|
72
72
|
|
73
|
-
def initialize_row(row_element
|
74
|
-
::PageObject::Elements::TableRow.new(row_element
|
73
|
+
def initialize_row(row_element)
|
74
|
+
::PageObject::Elements::TableRow.new(row_element)
|
75
75
|
end
|
76
76
|
|
77
77
|
def find_index_by_title(row_title)
|
@@ -25,7 +25,7 @@ module PageObject
|
|
25
25
|
def [](idx)
|
26
26
|
idx = find_index_by_title(idx) if idx.kind_of?(String)
|
27
27
|
return nil unless idx && columns >= idx + 1
|
28
|
-
initialize_cell(element[idx]
|
28
|
+
initialize_cell(element[idx])
|
29
29
|
end
|
30
30
|
|
31
31
|
#
|
@@ -41,8 +41,8 @@ module PageObject
|
|
41
41
|
".//child::td|th"
|
42
42
|
end
|
43
43
|
|
44
|
-
def initialize_cell(row_element
|
45
|
-
::PageObject::Elements::TableCell.new(row_element
|
44
|
+
def initialize_cell(row_element)
|
45
|
+
::PageObject::Elements::TableCell.new(row_element)
|
46
46
|
end
|
47
47
|
|
48
48
|
def find_index_by_title(title)
|
@@ -22,7 +22,7 @@ module PageObject
|
|
22
22
|
# @return [PageObject::Elements::ListItem]
|
23
23
|
#
|
24
24
|
def [](idx)
|
25
|
-
Object::PageObject::Elements::ListItem.new(children[idx]
|
25
|
+
Object::PageObject::Elements::ListItem.new(children[idx])
|
26
26
|
end
|
27
27
|
|
28
28
|
#
|
@@ -38,7 +38,7 @@ module PageObject
|
|
38
38
|
#
|
39
39
|
def list_items
|
40
40
|
children.collect do |obj|
|
41
|
-
Object::PageObject::Elements::ListItem.new(obj
|
41
|
+
Object::PageObject::Elements::ListItem.new(obj)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
@@ -48,10 +48,6 @@ module PageObject
|
|
48
48
|
"./child::li"
|
49
49
|
end
|
50
50
|
|
51
|
-
def self.watir_finders
|
52
|
-
[:class, :id, :index, :xpath]
|
53
|
-
end
|
54
|
-
|
55
51
|
def children
|
56
52
|
element.uls(:xpath => child_xpath)
|
57
53
|
end
|
@@ -2,14 +2,12 @@ module PageObject
|
|
2
2
|
module IndexedProperties
|
3
3
|
class TableOfElements
|
4
4
|
include PageObject
|
5
|
-
include LoadsPlatform
|
6
5
|
|
7
6
|
def initialize (browser, identifier_list)
|
8
7
|
initialize_browser(browser)
|
9
8
|
@identifier_list = identifier_list
|
10
9
|
@indexed_property_class = Class.new {
|
11
10
|
include PageObject
|
12
|
-
include LoadsPlatform
|
13
11
|
extend Accessors
|
14
12
|
|
15
13
|
def initialize (browser, index, identifier_list)
|
@@ -23,6 +21,8 @@ module PageObject
|
|
23
21
|
next if value.is_a? Regexp # Cannot format Regexp with %
|
24
22
|
if key == :index
|
25
23
|
how_and_what[key] = (value % index).to_i
|
24
|
+
elsif key == :frame
|
25
|
+
how_and_what[key] = value #passthrough frame without modification
|
26
26
|
else
|
27
27
|
how_and_what[key] = value % index
|
28
28
|
end
|
@@ -69,7 +69,7 @@ module PageObject
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def unknown_framework(framework)
|
72
|
-
"You specified the Javascript framework #{framework} and it is
|
72
|
+
"You specified the Javascript framework #{framework} and it is unknown to the system"
|
73
73
|
end
|
74
74
|
|
75
75
|
def invalid_framework
|
@@ -1,156 +1,160 @@
|
|
1
1
|
module PageObject
|
2
2
|
module LocatorGenerator
|
3
3
|
|
4
|
-
BASIC_ELEMENTS =
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
4
|
+
BASIC_ELEMENTS = %i(
|
5
|
+
abbr
|
6
|
+
address
|
7
|
+
animate
|
8
|
+
animate_motion
|
9
|
+
animate_transform
|
10
|
+
article
|
11
|
+
as
|
12
|
+
aside
|
13
|
+
base
|
14
|
+
bdi
|
15
|
+
bdo
|
16
|
+
blockquote
|
17
|
+
body
|
18
|
+
br
|
19
|
+
caption
|
20
|
+
circle
|
21
|
+
cite
|
22
|
+
code
|
23
|
+
col
|
24
|
+
colgroup
|
25
|
+
command
|
26
|
+
cursor
|
27
|
+
data
|
28
|
+
datalist
|
29
|
+
dd
|
30
|
+
defs
|
31
|
+
del
|
32
|
+
desc
|
33
|
+
details
|
34
|
+
dfn
|
35
|
+
dialog
|
36
|
+
discard
|
37
|
+
dl
|
38
|
+
dt
|
39
|
+
ellipse
|
40
|
+
em
|
41
|
+
embed
|
42
|
+
fieldset
|
43
|
+
figcaption
|
44
|
+
figure
|
45
|
+
font
|
46
|
+
footer
|
47
|
+
foreign_object
|
48
|
+
g
|
49
|
+
head
|
50
|
+
header
|
51
|
+
hgroup
|
52
|
+
hr
|
53
|
+
html
|
54
|
+
ins
|
55
|
+
kbd
|
56
|
+
keygen
|
57
|
+
legend
|
58
|
+
line
|
59
|
+
linear_gradient
|
60
|
+
main
|
61
|
+
map
|
62
|
+
mark
|
63
|
+
marker
|
64
|
+
menu
|
65
|
+
menuitem
|
66
|
+
mesh_gradient
|
67
|
+
mesh_patch
|
68
|
+
mesh_row
|
69
|
+
meta
|
70
|
+
metadata
|
71
|
+
meter
|
72
|
+
mpath
|
73
|
+
nav
|
74
|
+
noscript
|
75
|
+
object
|
76
|
+
optgroup
|
77
|
+
output
|
78
|
+
p
|
79
|
+
param
|
80
|
+
path
|
81
|
+
pattern
|
82
|
+
polygon
|
83
|
+
polyline
|
84
|
+
pre
|
85
|
+
progress
|
86
|
+
q
|
87
|
+
radial_gradient
|
88
|
+
rect
|
89
|
+
rp
|
90
|
+
rt
|
91
|
+
ruby
|
92
|
+
s
|
93
|
+
samp
|
94
|
+
script
|
95
|
+
section
|
96
|
+
set
|
97
|
+
small
|
98
|
+
source
|
99
|
+
stop
|
100
|
+
strong
|
101
|
+
style
|
102
|
+
sub
|
103
|
+
summary
|
104
|
+
sup
|
105
|
+
switch
|
106
|
+
symbol
|
107
|
+
template
|
108
|
+
text_path
|
109
|
+
thread
|
110
|
+
time
|
111
|
+
title
|
112
|
+
track
|
113
|
+
tspan
|
114
|
+
u
|
115
|
+
use
|
116
|
+
var
|
117
|
+
view
|
118
|
+
wbr
|
119
|
+
)
|
118
120
|
|
119
121
|
|
120
|
-
ADVANCED_ELEMENTS =
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
122
|
+
ADVANCED_ELEMENTS = %i(
|
123
|
+
text_field
|
124
|
+
hidden_field
|
125
|
+
text_area
|
126
|
+
select_list
|
127
|
+
link
|
128
|
+
checkbox
|
129
|
+
radio_button
|
130
|
+
button
|
131
|
+
div
|
132
|
+
span
|
133
|
+
table
|
134
|
+
cell
|
135
|
+
row
|
136
|
+
image
|
137
|
+
form
|
138
|
+
list_item
|
139
|
+
ordered_list
|
140
|
+
unordered_list
|
141
|
+
h1
|
142
|
+
h2
|
143
|
+
h3
|
144
|
+
h4
|
145
|
+
h5
|
146
|
+
h6
|
147
|
+
paragraph
|
148
|
+
label
|
149
|
+
file_field
|
150
|
+
area
|
151
|
+
canvas
|
152
|
+
audio
|
153
|
+
video
|
154
|
+
b
|
155
|
+
i
|
156
|
+
svg
|
157
|
+
)
|
154
158
|
|
155
159
|
def self.generate_locators(target)
|
156
160
|
ADVANCED_ELEMENTS.each do |tag|
|