page-object 0.8.10 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de3884dc88299dede9806d452ed929d3e2ba5fde
4
- data.tar.gz: c4e6a39d2f9f0a9da473fc546c6f044ccd503763
3
+ metadata.gz: e620fc1f0961903a190021d0d48cb0534a1c2542
4
+ data.tar.gz: 9246d412ee8c1b8e80742c7e9fb565b895a36cc1
5
5
  SHA512:
6
- metadata.gz: 1c725dfe10c6760ea599efff3c99792732f7d49bcaab49f280eab18904e979cfdbe141fcb7f8afd810e285f927857b7fad3337f0ec87a6f0b18205f94d66cca9
7
- data.tar.gz: 56db7861055dbb2a52d5d33fcc3b9ec9bd4b4a3ff6aa0d642ae1db11029453efe2f6d35f903d1866bd6a60ceff995ca6138d15b99485c1243c159b140ef8db9e
6
+ metadata.gz: 5a47a924c8726590868fcd55f0773fe13d7ea861b4713ad97bde67cbe58db43172082ba1b4b3298d340ac3f95c1e60dec49a66cb608ae01ce935b230abd55bbf
7
+ data.tar.gz: f1766a0c593a6106e93a9de36b1c676ad916d34ef281fb30a6555ce57c8336926cce311353af6b75bd410579e000fee8cfdfd7036da7eb57824932faf40aaa3a
data/ChangeLog CHANGED
@@ -1,3 +1,53 @@
1
+ === Version 0.9.0 / 2013-6-11
2
+ * Enhancements
3
+ * Added plural _elements methods for the following types:
4
+ * area
5
+ * canvas
6
+ * audio
7
+ * video
8
+ * svg
9
+ * Added basic element support for the following types:
10
+ * as
11
+ * blockquote
12
+ * body
13
+ * br
14
+ * caption
15
+ * col
16
+ * colgroup
17
+ * command
18
+ * data
19
+ * datalist
20
+ * del
21
+ * details
22
+ * dialog
23
+ * dl
24
+ * embed
25
+ * fieldset
26
+ * head
27
+ * hr
28
+ * ins
29
+ * keygen
30
+ * legend
31
+ * map
32
+ * menu
33
+ * meta
34
+ * meter
35
+ * object
36
+ * optgroup
37
+ * output
38
+ * param
39
+ * pre
40
+ * progress
41
+ * small
42
+ * strong
43
+ * style
44
+ * time
45
+ * title
46
+ * track
47
+ * Updated to use the latest selenium-webdriver 2.33.0
48
+ * Fixes
49
+ * Fixed issue when using the page and element accessors for html 5 elements.
50
+
1
51
  === Version 0.8.10 / 2013-5-3
2
52
  * Enhancements
3
53
  * Updated populate_page_with to also check if the element is visible prior to setting value
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # page-object
2
2
 
3
- [![Build Status](http://travis-ci.org/cheezy/page-object.png)](http://travis-ci.org/cheezy/page-object)
3
+ [![Build Status](https://travis-ci.org/cheezy/page-object.png)](https://travis-ci.org/cheezy/page-object)
4
4
 
5
5
 
6
6
  A simple gem that assists in creating flexible page objects for testing browser based applications. The goal is to facilitate creating abstraction layers in your tests to decouple the tests from the item they are testing and to provide a simple interface to the elements on a page. It works with both watir-webdriver and selenium-webdriver.
@@ -304,3 +304,11 @@ Feature: Elements
304
304
  And I should know it is visible
305
305
  And I should know the text is "found using data-entity"
306
306
 
307
+
308
+ Scenario: Accessing an HTML 5 element using the declaration
309
+ When I retrieve the figure using the declaration
310
+ Then I should see the figure contains an image
311
+
312
+ Scenario: Accessing an HTML 5 element using the element method
313
+ When I retrieve the figure using the element
314
+ Then I should see the figure contains an image
Binary file
@@ -7,7 +7,7 @@
7
7
 
8
8
  <label for="text_field_id">Text Field</label>
9
9
  <input id="text_field_id" name="text_field_name" class="text_field_class"
10
- title="text_field_title" size="40" type="text"/>
10
+ title="text_field_title" data-field="title" size="40" type="text"/>
11
11
 
12
12
  <input id="hidden_field_id" name="hidden_field_name" class="hidden_field_class"
13
13
  size="40" type="hidden" value="12345"/>
@@ -179,6 +179,10 @@
179
179
  <summary id='summary_id'>The summary</summary>
180
180
  The details
181
181
  </details>
182
+
183
+ <figure id='figure_id'>
184
+ <img src="images/img_pulpit.jpg" alt="The Pulpit Rock" width="304" height="228">
185
+ </figure>
182
186
 
183
187
  </body>
184
188
  </html>
@@ -247,3 +247,15 @@ end
247
247
  When /^I retrieve a div using data\-entity$/ do
248
248
  @element = @page.div_data_entity_element
249
249
  end
250
+
251
+ When(/^I retrieve the figure using the declaration$/) do
252
+ @element = @page.figure_id_element
253
+ end
254
+
255
+ When(/^I retrieve the figure using the element$/) do
256
+ @element = @page.figure_element(:id => 'figure_id')
257
+ end
258
+
259
+ Then(/^I should see the figure contains an image$/) do
260
+ @element.image_element.should_not be_nil
261
+ end
@@ -19,6 +19,7 @@ class Page
19
19
  text_field(:text_field_value, :value => "")
20
20
  text_field(:text_field_label, :label => "Text Field")
21
21
  text_field(:text_field_title, :title => 'text_field_title')
22
+ text_field(:text_field_data_field, :data_field => 'title')
22
23
  text_field(:text_field_class_index, :class => "text_field_class", :index => 0)
23
24
  text_field(:text_field_name_index, :name => "text_field_name", :index => 0)
24
25
 
@@ -358,6 +359,8 @@ class Page
358
359
  element(:summary_id, :summary, :id => 'summary_id')
359
360
  element(:details_id, :details, :id => 'details_id')
360
361
 
362
+ figure(:figure_id, :id => 'figure_id')
363
+
361
364
  svg(:svg_id, :id => 'the_svg')
362
365
  end
363
366
 
@@ -15,15 +15,24 @@ Feature: Text Fields
15
15
  Then I should be able to type "I found it" into the field
16
16
 
17
17
  Examples:
18
- | search_by |
19
- | id |
20
- | class |
21
- | name |
22
- | xpath |
23
- | index |
24
- | title |
25
- | text |
26
- | label |
18
+ | search_by |
19
+ | id |
20
+ | class |
21
+ | name |
22
+ | xpath |
23
+ | index |
24
+ | title |
25
+ | text |
26
+ | label |
27
+
28
+
29
+ @watir_only
30
+ Scenario Outline: Locating text fields on the Page using Watir
31
+ When I search for the text field by "<search_by>"
32
+ Then I should be able to type "I found it" into the field
33
+ Examples:
34
+ | search_by |
35
+ | data_field |
27
36
 
28
37
  @selenium_only
29
38
  Scenario Outline: Locating text fields on the Page using Selenium
@@ -1,4 +1,5 @@
1
1
  require 'erb'
2
+ require 'page-object/locator_generator'
2
3
 
3
4
  module PageObject
4
5
  #
@@ -1076,37 +1077,7 @@ module PageObject
1076
1077
  # * :xpath => Watir and Selenium
1077
1078
  # @param optional block to be invoked when element method is called
1078
1079
  #
1079
- [:abbr,
1080
- :address,
1081
- :article,
1082
- :aside,
1083
- :bdi,
1084
- :bdo,
1085
- :cite,
1086
- :code,
1087
- :dd,
1088
- :dfn,
1089
- :dt,
1090
- :em,
1091
- :figcaption,
1092
- :figure,
1093
- :footer,
1094
- :header,
1095
- :hgroup,
1096
- :kbd,
1097
- :mark,
1098
- :nav,
1099
- :noscript,
1100
- :rp,
1101
- :rt,
1102
- :ruby,
1103
- :samp,
1104
- :section,
1105
- :sub,
1106
- :summary,
1107
- :sup,
1108
- :var,
1109
- :wbr].each do |type|
1080
+ LocatorGenerator::BASIC_ELEMENTS.each do |type|
1110
1081
  define_method(type) do |name, *identifier, &block|
1111
1082
  identifier = identifier[0] ? identifier[0] : {:index => 0}
1112
1083
  element(name, type, identifier, &block)
@@ -1169,36 +1140,14 @@ module PageObject
1169
1140
  # keys are the same ones supported by the standard methods.
1170
1141
  # @param optional block to be invoked when element method is called
1171
1142
  #
1172
- [:text_fields,
1173
- :hidden_fields,
1174
- :text_areas,
1175
- :select_lists,
1176
- :links,
1177
- :checkboxes,
1178
- :radio_buttons,
1179
- :buttons,
1180
- :divs,
1181
- :spans,
1182
- :tables,
1183
- :cells,
1184
- :images,
1185
- :forms,
1186
- :list_items,
1187
- :unordered_lists,
1188
- :ordered_lists,
1189
- :h1s,
1190
- :h2s,
1191
- :h3s,
1192
- :h4s,
1193
- :h5s,
1194
- :h6s,
1195
- :paragraphs,
1196
- :labels,
1197
- :file_fields].each do |method_name|
1198
- define_method(method_name) do |name, *identifier, &block|
1143
+ idx = LocatorGenerator::ADVANCED_ELEMENTS.find_index { |type| type == :checkbox }
1144
+ elements = LocatorGenerator::ADVANCED_ELEMENTS.clone
1145
+ elements[idx] = :checkboxe
1146
+ elements.each do |method_name|
1147
+ define_method("#{method_name}s") do |name, *identifier, &block|
1199
1148
  define_method("#{name}_elements") do
1200
1149
  return call_block(&block) unless block.nil?
1201
- platform_method = (method_name == :checkboxes) ? 'checkboxs_for' : "#{method_name.to_s}_for"
1150
+ platform_method = (method_name == :checkboxe) ? 'checkboxs_for' : "#{method_name.to_s}s_for"
1202
1151
  platform.send platform_method, (identifier.first ? identifier.first.clone : {})
1203
1152
  end
1204
1153
  end
@@ -1,38 +1,110 @@
1
1
  module PageObject
2
2
  module LocatorGenerator
3
3
 
4
+ BASIC_ELEMENTS = [:abbr,
5
+ :address,
6
+ :article,
7
+ :as,
8
+ :aside,
9
+ :bdi,
10
+ :bdo,
11
+ :blockquote,
12
+ :body,
13
+ :br,
14
+ :caption,
15
+ :cite,
16
+ :code,
17
+ :col,
18
+ :colgroup,
19
+ :command,
20
+ :data,
21
+ :datalist,
22
+ :dd,
23
+ :del,
24
+ :details,
25
+ :dfn,
26
+ :dialog,
27
+ :dl,
28
+ :dt,
29
+ :em,
30
+ :embed,
31
+ :fieldset,
32
+ :figcaption,
33
+ :figure,
34
+ :footer,
35
+ :head,
36
+ :header,
37
+ :hgroup,
38
+ :hr,
39
+ :ins,
40
+ :kbd,
41
+ :keygen,
42
+ :legend,
43
+ :map,
44
+ :mark,
45
+ :menu,
46
+ :meta,
47
+ :meter,
48
+ :nav,
49
+ :noscript,
50
+ :object,
51
+ :optgroup,
52
+ :output,
53
+ :param,
54
+ :pre,
55
+ :progress,
56
+ :rp,
57
+ :rt,
58
+ :ruby,
59
+ :samp,
60
+ :section,
61
+ :small,
62
+ :strong,
63
+ :style,
64
+ :sub,
65
+ :summary,
66
+ :sup,
67
+ :time,
68
+ :title,
69
+ :track,
70
+ :var,
71
+ :wbr]
72
+
73
+
74
+ ADVANCED_ELEMENTS = [:text_field,
75
+ :hidden_field,
76
+ :text_area,
77
+ :select_list,
78
+ :link,
79
+ :checkbox,
80
+ :radio_button,
81
+ :button,
82
+ :div,
83
+ :span,
84
+ :table,
85
+ :cell,
86
+ :image,
87
+ :form,
88
+ :list_item,
89
+ :ordered_list,
90
+ :unordered_list,
91
+ :h1,
92
+ :h2,
93
+ :h3,
94
+ :h4,
95
+ :h5,
96
+ :h6,
97
+ :paragraph,
98
+ :label,
99
+ :file_field,
100
+ :area,
101
+ :canvas,
102
+ :audio,
103
+ :video,
104
+ :svg]
105
+
4
106
  def self.generate_locators(target)
5
- [:text_field,
6
- :hidden_field,
7
- :text_area,
8
- :select_list,
9
- :link,
10
- :checkbox,
11
- :radio_button,
12
- :button,
13
- :div,
14
- :span,
15
- :table,
16
- :cell,
17
- :image,
18
- :form,
19
- :list_item,
20
- :ordered_list,
21
- :unordered_list,
22
- :h1,
23
- :h2,
24
- :h3,
25
- :h4,
26
- :h5,
27
- :h6,
28
- :paragraph,
29
- :label,
30
- :file_field,
31
- :area,
32
- :canvas,
33
- :audio,
34
- :video,
35
- :svg].each do |tag|
107
+ ADVANCED_ELEMENTS.each do |tag|
36
108
  target.send(:define_method, "#{tag.to_s}_element") do |*identifier|
37
109
  @platform.send "#{tag.to_s}_for", locator(identifier)
38
110
  end
@@ -42,43 +114,13 @@ module PageObject
42
114
  end
43
115
  end
44
116
 
45
- [:abbr,
46
- :address,
47
- :article,
48
- :aside,
49
- :bdi,
50
- :bdo,
51
- :cite,
52
- :code,
53
- :dd,
54
- :dfn,
55
- :dt,
56
- :em,
57
- :figcaption,
58
- :figure,
59
- :footer,
60
- :header,
61
- :hgroup,
62
- :kbd,
63
- :mark,
64
- :nav,
65
- :noscript,
66
- :rp,
67
- :rt,
68
- :ruby,
69
- :samp,
70
- :section,
71
- :sub,
72
- :summary,
73
- :sup,
74
- :var,
75
- :wbr].each do |tag|
117
+ BASIC_ELEMENTS.each do |tag|
76
118
  target.send(:define_method, "#{tag.to_s}_element") do |*identifier|
77
- @platform.send :element_for, locator(identifier)
119
+ @platform.send :element_for, tag, locator(identifier)
78
120
  end
79
121
 
80
122
  target.send(:define_method, "#{tag.to_s}_elements") do |*identifier|
81
- @platform.send(:elements_for, identifier[0] ? identifier[0] : {})
123
+ @platform.send(:elements_for, tag, identifier[0] ? identifier[0] : {})
82
124
  end
83
125
  end
84
126
  end
@@ -1,4 +1,4 @@
1
1
  module PageObject
2
2
  # @private
3
- VERSION = "0.8.10"
3
+ VERSION = "0.9.0"
4
4
  end
data/page-object.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.require_paths = ["lib"]
21
21
 
22
22
  s.add_dependency 'watir-webdriver', '>= 0.6.4'
23
- s.add_dependency 'selenium-webdriver', '>= 2.32.1'
23
+ s.add_dependency 'selenium-webdriver', '>= 2.33.0'
24
24
  s.add_dependency 'page_navigation', '>= 0.8'
25
25
 
26
26
  s.add_development_dependency 'rspec', '>= 2.12.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: page-object
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.10
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Morgan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-03 00:00:00.000000000 Z
11
+ date: 2013-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: watir-webdriver
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - '>='
32
32
  - !ruby/object:Gem::Version
33
- version: 2.32.1
33
+ version: 2.33.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '>='
39
39
  - !ruby/object:Gem::Version
40
- version: 2.32.1
40
+ version: 2.33.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: page_navigation
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -154,6 +154,7 @@ files:
154
154
  - features/html/hover.html
155
155
  - features/html/iframes.html
156
156
  - features/html/images/circle.png
157
+ - features/html/images/img_pulpit.jpg
157
158
  - features/html/images/submit.gif
158
159
  - features/html/indexed_property.html
159
160
  - features/html/modal.html
@@ -420,6 +421,7 @@ test_files:
420
421
  - features/html/hover.html
421
422
  - features/html/iframes.html
422
423
  - features/html/images/circle.png
424
+ - features/html/images/img_pulpit.jpg
423
425
  - features/html/images/submit.gif
424
426
  - features/html/indexed_property.html
425
427
  - features/html/modal.html