page-object 2.1.1 → 2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/ChangeLog +14 -2
  4. data/Gemfile +0 -5
  5. data/lib/page-object.rb +6 -11
  6. data/lib/page-object/elements/button.rb +0 -11
  7. data/lib/page-object/elements/check_box.rb +0 -6
  8. data/lib/page-object/elements/div.rb +0 -7
  9. data/lib/page-object/elements/element.rb +13 -119
  10. data/lib/page-object/elements/file_field.rb +0 -6
  11. data/lib/page-object/elements/form.rb +0 -6
  12. data/lib/page-object/elements/hidden_field.rb +0 -6
  13. data/lib/page-object/elements/image.rb +0 -6
  14. data/lib/page-object/elements/label.rb +0 -6
  15. data/lib/page-object/elements/link.rb +0 -10
  16. data/lib/page-object/elements/list_item.rb +0 -6
  17. data/lib/page-object/elements/ordered_list.rb +2 -6
  18. data/lib/page-object/elements/radio_button.rb +0 -6
  19. data/lib/page-object/elements/select_list.rb +1 -5
  20. data/lib/page-object/elements/span.rb +0 -6
  21. data/lib/page-object/elements/table.rb +3 -3
  22. data/lib/page-object/elements/table_cell.rb +0 -6
  23. data/lib/page-object/elements/table_row.rb +3 -3
  24. data/lib/page-object/elements/text_area.rb +0 -6
  25. data/lib/page-object/elements/text_field.rb +0 -6
  26. data/lib/page-object/elements/unordered_list.rb +2 -6
  27. data/lib/page-object/indexed_properties.rb +2 -2
  28. data/lib/page-object/javascript_framework_facade.rb +1 -1
  29. data/lib/page-object/locator_generator.rb +152 -148
  30. data/lib/page-object/page_populator.rb +15 -0
  31. data/lib/page-object/platforms/watir.rb +3 -5
  32. data/lib/page-object/platforms/watir/page_object.rb +12 -20
  33. data/lib/page-object/version.rb +1 -1
  34. data/lib/page-object/widgets.rb +1 -13
  35. data/page-object.gemspec +6 -6
  36. metadata +27 -29
  37. data/lib/page-object/loads_platform.rb +0 -45
  38. data/lib/page-object/platforms.rb +0 -17
@@ -2,12 +2,6 @@ module PageObject
2
2
  module Elements
3
3
  class ListItem < Element
4
4
 
5
- protected
6
-
7
- def self.watir_finders
8
- super + [:text]
9
- end
10
-
11
5
  end
12
6
 
13
7
  ::PageObject::Elements.tag_to_class[:li] = ::PageObject::Elements::ListItem
@@ -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], :platform => :watir)
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, :platform => :watir)
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
@@ -17,12 +17,6 @@ module PageObject
17
17
  element.set?
18
18
  end
19
19
 
20
- protected
21
-
22
- def self.watir_finders
23
- super + [:value, :label]
24
- end
25
-
26
20
  end
27
21
 
28
22
  ::PageObject::Elements.type_to_class[:radio] = ::PageObject::Elements::RadioButton
@@ -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| ::PageObject::Elements::Option.new(e, :platform => :watir) }
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
@@ -2,12 +2,6 @@ module PageObject
2
2
  module Elements
3
3
  class Span < Element
4
4
 
5
- protected
6
-
7
- def self.watir_finders
8
- [:class, :id, :index, :text, :title, :xpath]
9
- end
10
-
11
5
  end
12
6
 
13
7
  ::PageObject::Elements.tag_to_class[:span] = ::PageObject::Elements::Span
@@ -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], :platform => :watir)
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, platform)
74
- ::PageObject::Elements::TableRow.new(row_element, platform)
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)
@@ -9,12 +9,6 @@ module PageObject
9
9
  true
10
10
  end
11
11
 
12
- protected
13
-
14
- def self.watir_finders
15
- super + [:text]
16
- end
17
-
18
12
  end
19
13
 
20
14
  ::PageObject::Elements.tag_to_class[:td] = ::PageObject::Elements::TableCell
@@ -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], :platform => :watir)
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, platform)
45
- ::PageObject::Elements::TableCell.new(row_element, platform)
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)
@@ -10,12 +10,6 @@ module PageObject
10
10
  element.set(new_value)
11
11
  end
12
12
 
13
- protected
14
-
15
- def self.watir_finders
16
- super + [:label]
17
- end
18
-
19
13
  end
20
14
 
21
15
  ::PageObject::Elements.tag_to_class[:textarea] = ::PageObject::Elements::TextArea
@@ -10,12 +10,6 @@ module PageObject
10
10
  element.set(new_value)
11
11
  end
12
12
 
13
- protected
14
-
15
- def self.watir_finders
16
- super + [:title, :value, :text, :label]
17
- end
18
-
19
13
  end
20
14
 
21
15
  ::PageObject::Elements.type_to_class[:text] = ::PageObject::Elements::TextField
@@ -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], :platform => :watir)
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, :platform => :watir)
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 unknow to the system"
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 = [:abbr,
5
- :address,
6
- :animate,
7
- :animate_motion,
8
- :animate_transform,
9
- :article,
10
- :as,
11
- :aside,
12
- :base,
13
- :bdi,
14
- :bdo,
15
- :blockquote,
16
- :body,
17
- :br,
18
- :caption,
19
- :circle,
20
- :cite,
21
- :code,
22
- :col,
23
- :colgroup,
24
- :command,
25
- :cursor,
26
- :data,
27
- :datalist,
28
- :dd,
29
- :defs,
30
- :del,
31
- :desc,
32
- :details,
33
- :dfn,
34
- :dialog,
35
- :discard,
36
- :dl,
37
- :dt,
38
- :ellipse,
39
- :em,
40
- :embed,
41
- :fieldset,
42
- :figcaption,
43
- :figure,
44
- :font,
45
- :footer,
46
- :foreign_object,
47
- :g,
48
- :head,
49
- :header,
50
- :hgroup,
51
- :hr,
52
- :html,
53
- :ins,
54
- :kbd,
55
- :keygen,
56
- :legend,
57
- :line,
58
- :linear_gradient,
59
- :main,
60
- :map,
61
- :mark,
62
- :marker,
63
- :menu,
64
- :menuitem,
65
- :mesh_gradient,
66
- :mesh_patch,
67
- :mesh_row,
68
- :meta,
69
- :metadata,
70
- :meter,
71
- :mpath,
72
- :nav,
73
- :noscript,
74
- :object,
75
- :optgroup,
76
- :output,
77
- :p,
78
- :param,
79
- :path,
80
- :pattern,
81
- :polygon,
82
- :polyline,
83
- :pre,
84
- :progress,
85
- :q,
86
- :radial_gradient,
87
- :rect,
88
- :rp,
89
- :rt,
90
- :ruby,
91
- :s,
92
- :samp,
93
- :script,
94
- :section,
95
- :set,
96
- :small,
97
- :source,
98
- :stop,
99
- :strong,
100
- :style,
101
- :sub,
102
- :summary,
103
- :sup,
104
- :switch,
105
- :symbol,
106
- :template,
107
- :text_path,
108
- :thread,
109
- :time,
110
- :title,
111
- :track,
112
- :tspan,
113
- :u,
114
- :use,
115
- :var,
116
- :view,
117
- :wbr]
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 = [:text_field,
121
- :hidden_field,
122
- :text_area,
123
- :select_list,
124
- :link,
125
- :checkbox,
126
- :radio_button,
127
- :button,
128
- :div,
129
- :span,
130
- :table,
131
- :cell,
132
- :row,
133
- :image,
134
- :form,
135
- :list_item,
136
- :ordered_list,
137
- :unordered_list,
138
- :h1,
139
- :h2,
140
- :h3,
141
- :h4,
142
- :h5,
143
- :h6,
144
- :paragraph,
145
- :label,
146
- :file_field,
147
- :area,
148
- :canvas,
149
- :audio,
150
- :video,
151
- :b,
152
- :i,
153
- :svg]
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|