page-object 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +10 -1
- data/Gemfile +3 -0
- data/README.md +2 -2
- data/cucumber.yml +2 -0
- data/features/element.feature +81 -8
- data/features/form.feature +28 -0
- data/features/hidden_field.feature +32 -0
- data/features/html/static_elements.html +26 -0
- data/features/list_item.feature +36 -0
- data/features/ordered_list.feature +39 -0
- data/features/step_definitions/accessor_steps.rb +71 -0
- data/features/step_definitions/element_steps.rb +23 -0
- data/features/support/page.rb +43 -0
- data/features/text_area.feature +32 -0
- data/features/text_field.feature +1 -2
- data/features/unordered_list.feature +39 -0
- data/lib/page-object.rb +48 -3
- data/lib/page-object/accessors.rb +282 -111
- data/lib/page-object/elements.rb +6 -0
- data/lib/page-object/elements/element.rb +5 -1
- data/lib/page-object/elements/form.rb +25 -0
- data/lib/page-object/elements/hidden_field.rb +28 -0
- data/lib/page-object/elements/list_item.rb +7 -0
- data/lib/page-object/elements/ordered_list.rb +31 -0
- data/lib/page-object/elements/text_area.rb +24 -0
- data/lib/page-object/elements/text_field.rb +1 -1
- data/lib/page-object/elements/unordered_list.rb +31 -0
- data/lib/page-object/platforms/selenium_button.rb +1 -1
- data/lib/page-object/platforms/selenium_element.rb +3 -0
- data/lib/page-object/platforms/selenium_form.rb +14 -0
- data/lib/page-object/platforms/selenium_image.rb +6 -2
- data/lib/page-object/platforms/selenium_ordered_list.rb +18 -0
- data/lib/page-object/platforms/selenium_unordered_list.rb +18 -0
- data/lib/page-object/platforms/watir_element.rb +3 -0
- data/lib/page-object/platforms/watir_form.rb +14 -0
- data/lib/page-object/platforms/watir_ordered_list.rb +18 -0
- data/lib/page-object/platforms/watir_unordered_list.rb +18 -0
- data/lib/page-object/selenium_page_object.rb +101 -0
- data/lib/page-object/version.rb +2 -1
- data/lib/page-object/watir_page_object.rb +103 -2
- data/spec/page-object/accessors_spec.rb +203 -2
- data/spec/page-object/elements/form_spec.rb +24 -0
- data/spec/page-object/elements/hidden_field_spec.rb +32 -0
- data/spec/page-object/elements/list_item_spec.rb +22 -0
- data/spec/page-object/elements/ordered_list_spec.rb +43 -0
- data/spec/page-object/elements/text_area_spec.rb +32 -0
- data/spec/page-object/elements/text_field_spec.rb +1 -1
- data/spec/page-object/elements/unordered_list_spec.rb +43 -0
- metadata +39 -5
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'page-object/elements'
|
3
|
+
|
4
|
+
describe PageObject::Elements::OrderedList do
|
5
|
+
let(:ol) { PageObject::Elements::OrderedList }
|
6
|
+
|
7
|
+
describe "when mapping how to find an element" do
|
8
|
+
it "should map watir types to same" do
|
9
|
+
[:class, :id, :index, :xpath].each do |t|
|
10
|
+
identifier = ol.watir_identifier_for t => 'value'
|
11
|
+
identifier.keys.first.should == t
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should map selenium types to same" do
|
16
|
+
[:class, :id, :name, :xpath].each do |t|
|
17
|
+
key, value = ol.selenium_identifier_for t => 'value'
|
18
|
+
key.should == t
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "interface" do
|
24
|
+
let(:ol_element) { double('ol_element') }
|
25
|
+
|
26
|
+
context "for watir" do
|
27
|
+
it "should return a list item when indexed" do
|
28
|
+
ol = PageObject::Elements::OrderedList.new(ol_element, :platform => :watir)
|
29
|
+
ol_element.stub(:wd).and_return(ol_element)
|
30
|
+
ol_element.stub(:find_element)
|
31
|
+
ol[1].should be_instance_of PageObject::Elements::ListItem
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context "for selenium" do
|
36
|
+
it "should return a list item when indexed" do
|
37
|
+
ol = PageObject::Elements::OrderedList.new(ol_element, :platform => :selenium)
|
38
|
+
ol_element.should_receive(:find_element).and_return(ol_element)
|
39
|
+
ol[1].should be_instance_of PageObject::Elements::ListItem
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'page-object/elements'
|
3
|
+
|
4
|
+
describe PageObject::Elements::TextArea do
|
5
|
+
let(:textarea) { PageObject::Elements::TextArea }
|
6
|
+
|
7
|
+
describe "when mapping how to find an element" do
|
8
|
+
it "should map watir types to same" do
|
9
|
+
[:class, :id, :index, :name, :tag_name, :xpath].each do |t|
|
10
|
+
identifier = textarea.watir_identifier_for t => 'value'
|
11
|
+
identifier.keys.first.should == t
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should map selenium types to watir" do
|
16
|
+
identifier = textarea.watir_identifier_for :css => 'value'
|
17
|
+
identifier.keys.first.should == :tag_name
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should map selenium types to same" do
|
21
|
+
[:class, :css, :id, :name, :xpath].each do |t|
|
22
|
+
key, value = textarea.selenium_identifier_for t => 'value'
|
23
|
+
key.should == t
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should map watir types to selenium" do
|
28
|
+
key, value = textarea.selenium_identifier_for :tag_name => 'value'
|
29
|
+
key.should == :css
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -6,7 +6,7 @@ describe PageObject::Elements::TextField do
|
|
6
6
|
|
7
7
|
describe "when mapping how to find an element" do
|
8
8
|
it "should map watir types to same" do
|
9
|
-
[:class, :id, :index, :name, :tag_name, :
|
9
|
+
[:class, :id, :index, :name, :tag_name, :xpath].each do |t|
|
10
10
|
identifier = textfield.watir_identifier_for t => 'value'
|
11
11
|
identifier.keys.first.should == t
|
12
12
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'page-object/elements'
|
3
|
+
|
4
|
+
describe PageObject::Elements::UnorderedList do
|
5
|
+
let(:ul) { PageObject::Elements::UnorderedList }
|
6
|
+
|
7
|
+
describe "when mapping how to find an element" do
|
8
|
+
it "should map watir types to same" do
|
9
|
+
[:class, :id, :index, :xpath].each do |t|
|
10
|
+
identifier = ul.watir_identifier_for t => 'value'
|
11
|
+
identifier.keys.first.should == t
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should map selenium types to same" do
|
16
|
+
[:class, :id, :name, :xpath].each do |t|
|
17
|
+
key, value = ul.selenium_identifier_for t => 'value'
|
18
|
+
key.should == t
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "interface" do
|
24
|
+
let(:ul_element) { double('ul_element') }
|
25
|
+
|
26
|
+
context "for watir" do
|
27
|
+
it "should return a list item when indexed" do
|
28
|
+
ul = PageObject::Elements::UnorderedList.new(ul_element, :platform => :watir)
|
29
|
+
ul_element.stub(:wd).and_return(ul_element)
|
30
|
+
ul_element.stub(:find_element)
|
31
|
+
ul[1].should be_instance_of PageObject::Elements::ListItem
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context "for selenium" do
|
36
|
+
it "should return a list item when indexed" do
|
37
|
+
ul = PageObject::Elements::UnorderedList.new(ul_element, :platform => :selenium)
|
38
|
+
ul_element.should_receive(:find_element).and_return(ul_element)
|
39
|
+
ul[1].should be_instance_of PageObject::Elements::ListItem
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: page-object
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jeff Morgan
|
@@ -10,8 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-06-
|
14
|
-
default_executable:
|
13
|
+
date: 2011-06-13 00:00:00 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: watir-webdriver
|
@@ -91,11 +90,15 @@ files:
|
|
91
90
|
- features/check_box.feature
|
92
91
|
- features/div.feature
|
93
92
|
- features/element.feature
|
93
|
+
- features/form.feature
|
94
|
+
- features/hidden_field.feature
|
94
95
|
- features/html/images/circle.png
|
95
96
|
- features/html/static_elements.html
|
96
97
|
- features/html/success.html
|
97
98
|
- features/image.feature
|
98
99
|
- features/link.feature
|
100
|
+
- features/list_item.feature
|
101
|
+
- features/ordered_list.feature
|
99
102
|
- features/page_level_actions.feature
|
100
103
|
- features/radio_button.feature
|
101
104
|
- features/select_list.feature
|
@@ -110,7 +113,9 @@ files:
|
|
110
113
|
- features/support/url_helper.rb
|
111
114
|
- features/table.feature
|
112
115
|
- features/table_cell.feature
|
116
|
+
- features/text_area.feature
|
113
117
|
- features/text_field.feature
|
118
|
+
- features/unordered_list.feature
|
114
119
|
- lib/page-object.rb
|
115
120
|
- lib/page-object/accessors.rb
|
116
121
|
- lib/page-object/elements.rb
|
@@ -118,25 +123,37 @@ files:
|
|
118
123
|
- lib/page-object/elements/check_box.rb
|
119
124
|
- lib/page-object/elements/div.rb
|
120
125
|
- lib/page-object/elements/element.rb
|
126
|
+
- lib/page-object/elements/form.rb
|
127
|
+
- lib/page-object/elements/hidden_field.rb
|
121
128
|
- lib/page-object/elements/image.rb
|
122
129
|
- lib/page-object/elements/link.rb
|
130
|
+
- lib/page-object/elements/list_item.rb
|
131
|
+
- lib/page-object/elements/ordered_list.rb
|
123
132
|
- lib/page-object/elements/radio_button.rb
|
124
133
|
- lib/page-object/elements/select_list.rb
|
125
134
|
- lib/page-object/elements/span.rb
|
126
135
|
- lib/page-object/elements/table.rb
|
127
136
|
- lib/page-object/elements/table_cell.rb
|
128
137
|
- lib/page-object/elements/table_row.rb
|
138
|
+
- lib/page-object/elements/text_area.rb
|
129
139
|
- lib/page-object/elements/text_field.rb
|
140
|
+
- lib/page-object/elements/unordered_list.rb
|
130
141
|
- lib/page-object/platforms/selenium_button.rb
|
131
142
|
- lib/page-object/platforms/selenium_element.rb
|
143
|
+
- lib/page-object/platforms/selenium_form.rb
|
132
144
|
- lib/page-object/platforms/selenium_image.rb
|
133
145
|
- lib/page-object/platforms/selenium_link.rb
|
146
|
+
- lib/page-object/platforms/selenium_ordered_list.rb
|
134
147
|
- lib/page-object/platforms/selenium_table.rb
|
135
148
|
- lib/page-object/platforms/selenium_table_row.rb
|
149
|
+
- lib/page-object/platforms/selenium_unordered_list.rb
|
136
150
|
- lib/page-object/platforms/watir_element.rb
|
151
|
+
- lib/page-object/platforms/watir_form.rb
|
137
152
|
- lib/page-object/platforms/watir_image.rb
|
153
|
+
- lib/page-object/platforms/watir_ordered_list.rb
|
138
154
|
- lib/page-object/platforms/watir_table.rb
|
139
155
|
- lib/page-object/platforms/watir_table_row.rb
|
156
|
+
- lib/page-object/platforms/watir_unordered_list.rb
|
140
157
|
- lib/page-object/selenium_page_object.rb
|
141
158
|
- lib/page-object/version.rb
|
142
159
|
- lib/page-object/watir_page_object.rb
|
@@ -146,17 +163,22 @@ files:
|
|
146
163
|
- spec/page-object/elements/check_box_spec.rb
|
147
164
|
- spec/page-object/elements/div_spec.rb
|
148
165
|
- spec/page-object/elements/element_spec.rb
|
166
|
+
- spec/page-object/elements/form_spec.rb
|
167
|
+
- spec/page-object/elements/hidden_field_spec.rb
|
149
168
|
- spec/page-object/elements/image_spec.rb
|
150
169
|
- spec/page-object/elements/link_spec.rb
|
170
|
+
- spec/page-object/elements/list_item_spec.rb
|
171
|
+
- spec/page-object/elements/ordered_list_spec.rb
|
151
172
|
- spec/page-object/elements/radio_button_spec.rb
|
152
173
|
- spec/page-object/elements/select_list_spec.rb
|
153
174
|
- spec/page-object/elements/span_spec.rb
|
154
175
|
- spec/page-object/elements/table_row_spec.rb
|
155
176
|
- spec/page-object/elements/table_spec.rb
|
177
|
+
- spec/page-object/elements/text_area_spec.rb
|
156
178
|
- spec/page-object/elements/text_field_spec.rb
|
179
|
+
- spec/page-object/elements/unordered_list_spec.rb
|
157
180
|
- spec/page-object/page-object_spec.rb
|
158
181
|
- spec/spec_helper.rb
|
159
|
-
has_rdoc: true
|
160
182
|
homepage: http://github.com/cheezy/page-object
|
161
183
|
licenses: []
|
162
184
|
|
@@ -180,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
202
|
requirements: []
|
181
203
|
|
182
204
|
rubyforge_project: page-object
|
183
|
-
rubygems_version: 1.
|
205
|
+
rubygems_version: 1.8.5
|
184
206
|
signing_key:
|
185
207
|
specification_version: 3
|
186
208
|
summary: Page Object DSL for browser testing
|
@@ -189,11 +211,15 @@ test_files:
|
|
189
211
|
- features/check_box.feature
|
190
212
|
- features/div.feature
|
191
213
|
- features/element.feature
|
214
|
+
- features/form.feature
|
215
|
+
- features/hidden_field.feature
|
192
216
|
- features/html/images/circle.png
|
193
217
|
- features/html/static_elements.html
|
194
218
|
- features/html/success.html
|
195
219
|
- features/image.feature
|
196
220
|
- features/link.feature
|
221
|
+
- features/list_item.feature
|
222
|
+
- features/ordered_list.feature
|
197
223
|
- features/page_level_actions.feature
|
198
224
|
- features/radio_button.feature
|
199
225
|
- features/select_list.feature
|
@@ -208,19 +234,27 @@ test_files:
|
|
208
234
|
- features/support/url_helper.rb
|
209
235
|
- features/table.feature
|
210
236
|
- features/table_cell.feature
|
237
|
+
- features/text_area.feature
|
211
238
|
- features/text_field.feature
|
239
|
+
- features/unordered_list.feature
|
212
240
|
- spec/page-object/accessors_spec.rb
|
213
241
|
- spec/page-object/elements/button_spec.rb
|
214
242
|
- spec/page-object/elements/check_box_spec.rb
|
215
243
|
- spec/page-object/elements/div_spec.rb
|
216
244
|
- spec/page-object/elements/element_spec.rb
|
245
|
+
- spec/page-object/elements/form_spec.rb
|
246
|
+
- spec/page-object/elements/hidden_field_spec.rb
|
217
247
|
- spec/page-object/elements/image_spec.rb
|
218
248
|
- spec/page-object/elements/link_spec.rb
|
249
|
+
- spec/page-object/elements/list_item_spec.rb
|
250
|
+
- spec/page-object/elements/ordered_list_spec.rb
|
219
251
|
- spec/page-object/elements/radio_button_spec.rb
|
220
252
|
- spec/page-object/elements/select_list_spec.rb
|
221
253
|
- spec/page-object/elements/span_spec.rb
|
222
254
|
- spec/page-object/elements/table_row_spec.rb
|
223
255
|
- spec/page-object/elements/table_spec.rb
|
256
|
+
- spec/page-object/elements/text_area_spec.rb
|
224
257
|
- spec/page-object/elements/text_field_spec.rb
|
258
|
+
- spec/page-object/elements/unordered_list_spec.rb
|
225
259
|
- spec/page-object/page-object_spec.rb
|
226
260
|
- spec/spec_helper.rb
|