page-object 1.0.2 → 1.0.3
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/.travis.yml +1 -0
- data/ChangeLog +10 -0
- data/README.md +1 -1
- data/features/bold.feature +21 -0
- data/features/html/indexed_property.html +14 -0
- data/features/html/multi_elements.html +1 -1
- data/features/html/static_elements.html +1 -2
- data/features/indexed_property.feature +15 -0
- data/features/multi_elements.feature +6 -0
- data/features/step_definitions/async_steps.rb +1 -1
- data/features/step_definitions/bold_steps.rb +12 -0
- data/features/step_definitions/check_box_steps.rb +2 -2
- data/features/step_definitions/indexed_property_steps.rb +47 -1
- data/features/step_definitions/label_steps.rb +1 -1
- data/features/step_definitions/multi_elements_steps.rb +13 -0
- data/features/step_definitions/select_list_steps.rb +1 -1
- data/features/step_definitions/table_steps.rb +4 -0
- data/features/support/page.rb +9 -0
- data/features/table.feature +12 -4
- data/lib/page-object.rb +6 -5
- data/lib/page-object/accessors.rb +78 -58
- data/lib/page-object/elements.rb +1 -0
- data/lib/page-object/elements/bold.rb +11 -0
- data/lib/page-object/elements/element.rb +12 -1
- data/lib/page-object/elements/table.rb +12 -1
- data/lib/page-object/indexed_properties.rb +20 -21
- data/lib/page-object/javascript/angularjs.rb +14 -0
- data/lib/page-object/javascript_framework_facade.rb +4 -2
- data/lib/page-object/locator_generator.rb +1 -0
- data/lib/page-object/page_populator.rb +0 -1
- data/lib/page-object/platforms/selenium_webdriver/button.rb +1 -1
- data/lib/page-object/platforms/selenium_webdriver/element.rb +1 -1
- data/lib/page-object/platforms/selenium_webdriver/page_object.rb +26 -10
- data/lib/page-object/platforms/selenium_webdriver/radio_button.rb +0 -7
- data/lib/page-object/platforms/watir_webdriver/element.rb +1 -1
- data/lib/page-object/platforms/watir_webdriver/page_object.rb +23 -8
- data/lib/page-object/platforms/watir_webdriver/radio_button.rb +0 -7
- data/lib/page-object/version.rb +1 -1
- data/lib/page-object/widgets.rb +7 -0
- data/page-object.gemspec +3 -3
- data/spec/page-object/accessors_spec.rb +40 -0
- data/spec/page-object/element_locators_spec.rb +340 -305
- data/spec/page-object/elements/area_spec.rb +8 -8
- data/spec/page-object/elements/bold_spec.rb +29 -0
- data/spec/page-object/elements/button_spec.rb +7 -7
- data/spec/page-object/elements/canvas_spec.rb +6 -6
- data/spec/page-object/elements/check_box_spec.rb +9 -9
- data/spec/page-object/elements/div_spec.rb +3 -3
- data/spec/page-object/elements/element_spec.rb +21 -21
- data/spec/page-object/elements/file_field_spec.rb +4 -4
- data/spec/page-object/elements/form_spec.rb +3 -3
- data/spec/page-object/elements/heading_spec.rb +8 -8
- data/spec/page-object/elements/hidden_field_spec.rb +3 -3
- data/spec/page-object/elements/image_spec.rb +14 -14
- data/spec/page-object/elements/label_spec.rb +3 -3
- data/spec/page-object/elements/link_spec.rb +6 -6
- data/spec/page-object/elements/list_item_spec.rb +4 -3
- data/spec/page-object/elements/nested_element_spec.rb +47 -47
- data/spec/page-object/elements/option_spec.rb +1 -1
- data/spec/page-object/elements/ordered_list_spec.rb +33 -33
- data/spec/page-object/elements/paragraph_spec.rb +3 -4
- data/spec/page-object/elements/select_list_spec.rb +52 -52
- data/spec/page-object/elements/selenium/radio_button_spec.rb +7 -13
- data/spec/page-object/elements/selenium/text_field_spec.rb +7 -7
- data/spec/page-object/elements/selenium_element_spec.rb +53 -53
- data/spec/page-object/elements/span_spec.rb +3 -3
- data/spec/page-object/elements/table_cell_spec.rb +3 -3
- data/spec/page-object/elements/table_row_spec.rb +22 -22
- data/spec/page-object/elements/table_spec.rb +28 -28
- data/spec/page-object/elements/text_area_spec.rb +5 -5
- data/spec/page-object/elements/unordered_list_spec.rb +33 -34
- data/spec/page-object/elements/watir_element_spec.rb +47 -48
- data/spec/page-object/javascript_framework_facade_spec.rb +6 -6
- data/spec/page-object/loads_platform_spec.rb +4 -4
- data/spec/page-object/page-object_spec.rb +103 -102
- data/spec/page-object/page_factory_spec.rb +43 -61
- data/spec/page-object/page_populator_spec.rb +44 -50
- data/spec/page-object/platforms/selenium_webdriver/selenium_page_object_spec.rb +15 -15
- data/spec/page-object/platforms/selenium_webdriver_spec.rb +6 -6
- data/spec/page-object/platforms/watir_webdriver/watir_page_object_spec.rb +4 -4
- data/spec/page-object/platforms/watir_webdriver_spec.rb +1 -1
- data/spec/page-object/selenium_accessors_spec.rb +166 -153
- data/spec/page-object/watir_accessors_spec.rb +265 -245
- data/spec/page-object/widget_spec.rb +62 -30
- data/spec/spec_helper.rb +8 -8
- metadata +20 -10
@@ -4,26 +4,26 @@ require 'spec_helper'
|
|
4
4
|
describe PageObject::Platforms::SeleniumWebDriver do
|
5
5
|
|
6
6
|
it "should be registered as an adapter" do
|
7
|
-
PageObject::Platforms.get[:selenium_webdriver].
|
8
|
-
|
7
|
+
expect(PageObject::Platforms.get[:selenium_webdriver]).to be PageObject::Platforms::SeleniumWebDriver
|
9
8
|
end
|
9
|
+
|
10
10
|
describe 'create page object' do
|
11
11
|
let(:browser) { double('browser') }
|
12
12
|
let(:subject) { PageObject::Platforms::SeleniumWebDriver.create_page_object(browser) }
|
13
13
|
|
14
14
|
it "should create a SeleniumPageObject" do
|
15
|
-
subject.
|
15
|
+
expect(subject).to be_kind_of PageObject::Platforms::SeleniumWebDriver::PageObject
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
19
|
describe "is for?" do
|
20
20
|
it "should be true when the browser is a selenium driver" do
|
21
21
|
browser = mock_selenium_browser()
|
22
|
-
PageObject::Platforms::SeleniumWebDriver.is_for?(browser).
|
22
|
+
expect(PageObject::Platforms::SeleniumWebDriver.is_for?(browser)).to eql true
|
23
23
|
end
|
24
24
|
|
25
25
|
it "should be false when the browser is anything else" do
|
26
|
-
PageObject::Platforms::SeleniumWebDriver.is_for?("asdf").
|
26
|
+
expect(PageObject::Platforms::SeleniumWebDriver.is_for?("asdf")).to eql false
|
27
27
|
end
|
28
28
|
end
|
29
|
-
end
|
29
|
+
end
|
@@ -6,23 +6,23 @@ describe PageObject::Platforms::WatirWebDriver do
|
|
6
6
|
let(:subject) { PageObject::Platforms::WatirWebDriver.create_page_object(browser) }
|
7
7
|
|
8
8
|
it "should create a WatirPageObject" do
|
9
|
-
subject.
|
9
|
+
expect(subject).to be_kind_of PageObject::Platforms::WatirWebDriver::PageObject
|
10
10
|
end
|
11
11
|
|
12
12
|
it "should give the watir page object the browser" do
|
13
|
-
subject.browser.
|
13
|
+
expect(subject.browser).to be browser
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
describe "is for?" do
|
18
18
|
it "should be true when the browser is Watir::Browser" do
|
19
19
|
browser = mock_watir_browser()
|
20
|
-
PageObject::Platforms::WatirWebDriver.is_for?(browser).
|
20
|
+
expect(PageObject::Platforms::WatirWebDriver.is_for?(browser)).to be true
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should be false at any other point" do
|
24
24
|
browser = 'asdf'
|
25
|
-
PageObject::Platforms::WatirWebDriver.is_for?('asdf').
|
25
|
+
expect(PageObject::Platforms::WatirWebDriver.is_for?('asdf')).to be false
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe PageObject::Platforms::WatirWebDriver do
|
4
4
|
|
5
5
|
it "should be in the PageObjects Adapters list" do
|
6
|
-
PageObject::Platforms.get[:watir_webdriver].
|
6
|
+
expect(PageObject::Platforms.get[:watir_webdriver]).to be PageObject::Platforms::WatirWebDriver
|
7
7
|
end
|
8
8
|
|
9
9
|
end
|
@@ -35,6 +35,7 @@ class SeleniumAccessorsTestPageObject
|
|
35
35
|
canvas(:my_canvas, :id => 'canvas')
|
36
36
|
audio(:acdc, :id => 'audio_id')
|
37
37
|
video(:movie, :id => 'movie_id')
|
38
|
+
b(:bold, :id=>'bold')
|
38
39
|
end
|
39
40
|
|
40
41
|
class SeleniumBlockPageObject
|
@@ -129,6 +130,10 @@ class SeleniumBlockPageObject
|
|
129
130
|
video :movie do |element|
|
130
131
|
'video'
|
131
132
|
end
|
133
|
+
|
134
|
+
b :bold do |element|
|
135
|
+
'b'
|
136
|
+
end
|
132
137
|
end
|
133
138
|
|
134
139
|
describe PageObject::Accessors do
|
@@ -137,117 +142,117 @@ describe PageObject::Accessors do
|
|
137
142
|
let(:block_page_object) { SeleniumBlockPageObject.new(selenium_browser) }
|
138
143
|
|
139
144
|
before(:each) do
|
140
|
-
selenium_browser.
|
141
|
-
selenium_browser.
|
145
|
+
allow(selenium_browser).to receive(:switch_to).and_return(selenium_browser)
|
146
|
+
allow(selenium_browser).to receive(:default_content)
|
142
147
|
end
|
143
148
|
|
144
149
|
describe "link accessors" do
|
145
150
|
it "should select a link" do
|
146
|
-
selenium_browser.
|
151
|
+
allow(selenium_browser).to receive_messages(find_element: selenium_browser, click: selenium_browser)
|
147
152
|
selenium_page_object.google_search
|
148
153
|
end
|
149
154
|
|
150
155
|
it "should return a link element" do
|
151
|
-
selenium_browser.
|
156
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
152
157
|
element = selenium_page_object.google_search_element
|
153
|
-
element.
|
158
|
+
expect(element).to be_instance_of PageObject::Elements::Link
|
154
159
|
end
|
155
160
|
end
|
156
161
|
|
157
162
|
|
158
163
|
describe "text_field accessors" do
|
159
164
|
it "should get the text from the text field element" do
|
160
|
-
selenium_browser.
|
161
|
-
selenium_browser.
|
162
|
-
selenium_page_object.first_name.
|
165
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
166
|
+
expect(selenium_browser).to receive(:attribute).with('value').and_return('Katie')
|
167
|
+
expect(selenium_page_object.first_name).to eql 'Katie'
|
163
168
|
end
|
164
169
|
|
165
170
|
it "should set some text on a text field element" do
|
166
|
-
selenium_browser.
|
167
|
-
selenium_browser.
|
168
|
-
selenium_browser.
|
171
|
+
expect(selenium_browser).to receive(:find_element).twice.and_return(selenium_browser)
|
172
|
+
expect(selenium_browser).to receive(:clear)
|
173
|
+
expect(selenium_browser).to receive(:send_keys).with('Katie')
|
169
174
|
selenium_page_object.first_name = 'Katie'
|
170
175
|
end
|
171
176
|
|
172
177
|
it "should retrieve a text field element" do
|
173
|
-
selenium_browser.
|
178
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
174
179
|
element = selenium_page_object.first_name_element
|
175
|
-
element.
|
180
|
+
expect(element).to be_instance_of PageObject::Elements::TextField
|
176
181
|
end
|
177
182
|
end
|
178
183
|
|
179
184
|
|
180
185
|
describe "hidden field accessors" do
|
181
186
|
it "should get the text from a hidden field" do
|
182
|
-
selenium_browser.
|
183
|
-
selenium_browser.
|
184
|
-
selenium_page_object.social_security_number.
|
187
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
188
|
+
expect(selenium_browser).to receive(:attribute).with('value').and_return("12345")
|
189
|
+
expect(selenium_page_object.social_security_number).to eql "12345"
|
185
190
|
end
|
186
191
|
|
187
192
|
it "should retrieve a hidden field element" do
|
188
|
-
selenium_browser.
|
193
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
189
194
|
element = selenium_page_object.social_security_number_element
|
190
|
-
element.
|
195
|
+
expect(element).to be_instance_of PageObject::Elements::HiddenField
|
191
196
|
end
|
192
197
|
end
|
193
198
|
|
194
199
|
describe "text area accessors" do
|
195
200
|
it "should set some text on the text area" do
|
196
|
-
selenium_browser.
|
197
|
-
selenium_browser.
|
198
|
-
selenium_browser.
|
201
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
202
|
+
expect(selenium_browser).to receive(:clear)
|
203
|
+
expect(selenium_browser).to receive(:send_keys).with("123 main street")
|
199
204
|
selenium_page_object.address = "123 main street"
|
200
205
|
end
|
201
206
|
|
202
207
|
it "should get the text from the text area" do
|
203
|
-
selenium_browser.
|
204
|
-
selenium_browser.
|
205
|
-
selenium_page_object.address.
|
208
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
209
|
+
expect(selenium_browser).to receive(:attribute).with('value').and_return("123 main street")
|
210
|
+
expect(selenium_page_object.address).to eql "123 main street"
|
206
211
|
end
|
207
212
|
|
208
213
|
it "should retrieve a text area element" do
|
209
|
-
selenium_browser.
|
214
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
210
215
|
element = selenium_page_object.address_element
|
211
|
-
element.
|
216
|
+
expect(element).to be_instance_of PageObject::Elements::TextArea
|
212
217
|
end
|
213
218
|
end
|
214
219
|
|
215
220
|
describe "select_list accessors" do
|
216
221
|
it "should should get the current item from a select list" do
|
217
222
|
selected = "OH"
|
218
|
-
selected.
|
219
|
-
selected.
|
220
|
-
selenium_browser.
|
221
|
-
selenium_browser.
|
222
|
-
selenium_page_object.state.
|
223
|
+
expect(selected).to receive(:selected?).and_return(selected)
|
224
|
+
expect(selected).to receive(:text).and_return("OH")
|
225
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
226
|
+
expect(selenium_browser).to receive(:find_elements).and_return([selected])
|
227
|
+
expect(selenium_page_object.state).to eql "OH"
|
223
228
|
end
|
224
229
|
|
225
230
|
it "should set the current item of a select list" do
|
226
231
|
option = double('option')
|
227
|
-
selenium_browser.
|
228
|
-
selenium_browser.
|
229
|
-
option.
|
230
|
-
option.
|
232
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
233
|
+
expect(selenium_browser).to receive(:find_elements).and_return([option])
|
234
|
+
expect(option).to receive(:text).and_return('OH')
|
235
|
+
expect(option).to receive(:click)
|
231
236
|
selenium_page_object.state = "OH"
|
232
237
|
end
|
233
238
|
|
234
239
|
it "should retrieve the select list element" do
|
235
|
-
selenium_browser.
|
240
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
236
241
|
element = selenium_page_object.state_element
|
237
|
-
element.
|
242
|
+
expect(element).to be_instance_of PageObject::Elements::SelectList
|
238
243
|
end
|
239
244
|
|
240
245
|
it "should return list of selection options" do
|
241
246
|
option1 = double('option')
|
242
247
|
option2 = double('option')
|
243
|
-
option1.
|
244
|
-
option2.
|
248
|
+
expect(option1).to receive(:text).and_return("CA")
|
249
|
+
expect(option2).to receive(:text).and_return("OH")
|
245
250
|
|
246
251
|
select_element = double("select")
|
247
|
-
select_element.
|
248
|
-
selenium_page_object.
|
252
|
+
expect(select_element).to receive(:options).twice.and_return([option1, option2])
|
253
|
+
expect(selenium_page_object).to receive(:state_element).and_return(select_element)
|
249
254
|
|
250
|
-
selenium_page_object.state_options.
|
255
|
+
expect(selenium_page_object.state_options).to eql ["CA","OH"]
|
251
256
|
end
|
252
257
|
|
253
258
|
end
|
@@ -255,317 +260,310 @@ describe PageObject::Accessors do
|
|
255
260
|
|
256
261
|
describe "check_box accessors" do
|
257
262
|
it "should check a check box element" do
|
258
|
-
selenium_browser.
|
259
|
-
selenium_browser.
|
260
|
-
selenium_browser.
|
263
|
+
expect(selenium_browser).to receive(:find_element).twice.and_return(selenium_browser)
|
264
|
+
expect(selenium_browser).to receive(:selected?).and_return(false)
|
265
|
+
expect(selenium_browser).to receive(:click)
|
261
266
|
selenium_page_object.check_active
|
262
267
|
end
|
263
268
|
|
264
269
|
it "should clear a check box element" do
|
265
|
-
selenium_browser.
|
266
|
-
selenium_browser.
|
267
|
-
selenium_browser.
|
270
|
+
expect(selenium_browser).to receive(:find_element).twice.and_return(selenium_browser)
|
271
|
+
expect(selenium_browser).to receive(:selected?).and_return(true)
|
272
|
+
expect(selenium_browser).to receive(:click)
|
268
273
|
selenium_page_object.uncheck_active
|
269
274
|
end
|
270
275
|
|
271
276
|
it "should know if a check box element is selected" do
|
272
|
-
selenium_browser.
|
273
|
-
selenium_browser.
|
274
|
-
selenium_page_object.active_checked
|
277
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
278
|
+
expect(selenium_browser).to receive(:selected?).and_return(true)
|
279
|
+
expect(selenium_page_object.active_checked?).to be true
|
275
280
|
end
|
276
281
|
|
277
282
|
it "should retrieve a checkbox element" do
|
278
|
-
selenium_browser.
|
283
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
279
284
|
element = selenium_page_object.active_element
|
280
|
-
element.
|
285
|
+
expect(element).to be_instance_of PageObject::Elements::CheckBox
|
281
286
|
end
|
282
287
|
end
|
283
288
|
|
284
289
|
|
285
290
|
describe "radio accessors" do
|
286
291
|
it "should select a radio button" do
|
287
|
-
selenium_browser.
|
288
|
-
selenium_browser.
|
289
|
-
selenium_browser.
|
292
|
+
expect(selenium_browser).to receive(:find_element).twice.and_return(selenium_browser)
|
293
|
+
expect(selenium_browser).to receive(:selected?).and_return(false)
|
294
|
+
expect(selenium_browser).to receive(:click)
|
290
295
|
selenium_page_object.select_first
|
291
296
|
end
|
292
297
|
|
293
|
-
it "should clear a radio button" do
|
294
|
-
selenium_browser.should_receive(:find_element).twice.and_return(selenium_browser)
|
295
|
-
selenium_browser.should_receive(:selected?).and_return(true)
|
296
|
-
selenium_browser.should_receive(:click)
|
297
|
-
selenium_page_object.clear_first
|
298
|
-
end
|
299
|
-
|
300
298
|
it "should determine if a radio is selected" do
|
301
|
-
selenium_browser.
|
302
|
-
selenium_browser.
|
299
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
300
|
+
expect(selenium_browser).to receive(:selected?).and_return(true)
|
303
301
|
selenium_page_object.first_selected?
|
304
302
|
end
|
305
303
|
|
306
304
|
it "should retrieve a radio button element" do
|
307
|
-
selenium_browser.
|
305
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
308
306
|
element = selenium_page_object.first_element
|
309
|
-
element.
|
307
|
+
expect(element).to be_instance_of PageObject::Elements::RadioButton
|
310
308
|
end
|
311
309
|
end
|
312
310
|
|
313
311
|
describe "button accessors" do
|
314
312
|
it "should be able to click a button" do
|
315
|
-
selenium_browser.
|
316
|
-
selenium_browser.
|
313
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
314
|
+
expect(selenium_browser).to receive(:click)
|
317
315
|
selenium_page_object.click_me
|
318
316
|
end
|
319
317
|
|
320
318
|
it "should retrieve a button element" do
|
321
|
-
selenium_browser.
|
319
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
322
320
|
element = selenium_page_object.click_me_element
|
323
|
-
element.
|
321
|
+
expect(element).to be_instance_of PageObject::Elements::Button
|
324
322
|
end
|
325
323
|
end
|
326
324
|
|
327
325
|
describe "div accessors" do
|
328
326
|
it "should retrieve the text from a div" do
|
329
|
-
selenium_browser.
|
330
|
-
selenium_browser.
|
331
|
-
selenium_page_object.message.
|
327
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
328
|
+
expect(selenium_browser).to receive(:text).and_return("Message from div")
|
329
|
+
expect(selenium_page_object.message).to eql "Message from div"
|
332
330
|
end
|
333
331
|
|
334
332
|
it "should retrieve the div element from the page" do
|
335
|
-
selenium_browser.
|
333
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
336
334
|
element = selenium_page_object.message_element
|
337
|
-
element.
|
335
|
+
expect(element).to be_instance_of PageObject::Elements::Div
|
338
336
|
end
|
339
337
|
end
|
340
338
|
|
341
339
|
describe "span accessors" do
|
342
340
|
it "should retrieve the text from a span" do
|
343
|
-
selenium_browser.
|
344
|
-
selenium_browser.
|
345
|
-
selenium_page_object.alert_span.
|
341
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
342
|
+
expect(selenium_browser).to receive(:text).and_return("Alert")
|
343
|
+
expect(selenium_page_object.alert_span).to eql "Alert"
|
346
344
|
end
|
347
345
|
|
348
346
|
it "should retrieve the span element from the page" do
|
349
|
-
selenium_browser.
|
347
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
350
348
|
element = selenium_page_object.alert_span_element
|
351
|
-
element.
|
349
|
+
expect(element).to be_instance_of PageObject::Elements::Span
|
352
350
|
end
|
353
351
|
end
|
354
352
|
|
355
353
|
describe "table accessors" do
|
356
354
|
it "should retrieve the table element from the page" do
|
357
|
-
selenium_browser.
|
355
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
358
356
|
element = selenium_page_object.cart_element
|
359
|
-
element.
|
357
|
+
expect(element).to be_instance_of(PageObject::Elements::Table)
|
360
358
|
end
|
361
359
|
end
|
362
360
|
|
363
361
|
describe "table cell accessors" do
|
364
362
|
it "should retrieve the text from the cell" do
|
365
|
-
selenium_browser.
|
366
|
-
selenium_browser.
|
367
|
-
selenium_page_object.total.
|
363
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
364
|
+
expect(selenium_browser).to receive(:text).and_return('celldata')
|
365
|
+
expect(selenium_page_object.total).to eql 'celldata'
|
368
366
|
end
|
369
367
|
|
370
368
|
it "should retrieve the cell element from the page" do
|
371
|
-
selenium_browser.
|
369
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
372
370
|
element = selenium_page_object.total_element
|
373
|
-
element.
|
371
|
+
expect(element).to be_instance_of PageObject::Elements::TableCell
|
374
372
|
end
|
375
373
|
end
|
376
374
|
|
377
375
|
describe "image accessors" do
|
378
376
|
it "should retrieve the image element from the page" do
|
379
|
-
selenium_browser.
|
377
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
380
378
|
element = selenium_page_object.logo_element
|
381
|
-
element.
|
379
|
+
expect(element).to be_instance_of PageObject::Elements::Image
|
382
380
|
end
|
383
381
|
end
|
384
382
|
|
385
383
|
describe "form accessors" do
|
386
384
|
it "should retrieve the form element from the page" do
|
387
|
-
selenium_browser.
|
385
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
388
386
|
element = selenium_page_object.login_element
|
389
|
-
element.
|
387
|
+
expect(element).to be_instance_of PageObject::Elements::Form
|
390
388
|
end
|
391
389
|
end
|
392
390
|
|
393
391
|
describe "list item accessors" do
|
394
392
|
it "should retrieve the text from the list item" do
|
395
|
-
selenium_browser.
|
396
|
-
selenium_browser.
|
397
|
-
selenium_page_object.item_one.
|
393
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
394
|
+
expect(selenium_browser).to receive(:text).and_return("value")
|
395
|
+
expect(selenium_page_object.item_one).to eql "value"
|
398
396
|
end
|
399
397
|
|
400
398
|
it "should retrieve the list item from the page" do
|
401
|
-
selenium_browser.
|
399
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
402
400
|
element = selenium_page_object.item_one_element
|
403
|
-
element.
|
401
|
+
expect(element).to be_instance_of PageObject::Elements::ListItem
|
404
402
|
end
|
405
403
|
end
|
406
404
|
|
407
405
|
describe "unordered list accessors" do
|
408
406
|
it "should retrieve the element from the page" do
|
409
|
-
selenium_browser.
|
407
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
410
408
|
element = selenium_page_object.menu_element
|
411
|
-
element.
|
409
|
+
expect(element).to be_instance_of PageObject::Elements::UnorderedList
|
412
410
|
end
|
413
411
|
end
|
414
412
|
|
415
413
|
describe "ordered list accessors" do
|
416
414
|
it "should retrieve the element from the page" do
|
417
|
-
selenium_browser.
|
415
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
418
416
|
element = selenium_page_object.top_five_element
|
419
|
-
element.
|
417
|
+
expect(element).to be_instance_of PageObject::Elements::OrderedList
|
420
418
|
end
|
421
419
|
end
|
422
420
|
|
423
421
|
describe "h1 accessors" do
|
424
422
|
it "should retrieve the text from the h1" do
|
425
|
-
selenium_browser.
|
426
|
-
selenium_browser.
|
427
|
-
selenium_page_object.heading1.
|
423
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
424
|
+
expect(selenium_browser).to receive(:text).and_return("value")
|
425
|
+
expect(selenium_page_object.heading1).to eql "value"
|
428
426
|
end
|
429
427
|
|
430
428
|
it "should retrieve the element from the page" do
|
431
|
-
selenium_browser.
|
429
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
432
430
|
element = selenium_page_object.heading1_element
|
433
|
-
element.
|
431
|
+
expect(element).to be_instance_of PageObject::Elements::Heading
|
434
432
|
end
|
435
433
|
end
|
436
434
|
|
437
435
|
describe "h2 accessors" do
|
438
436
|
it "should retrieve the text from the h2" do
|
439
|
-
selenium_browser.
|
440
|
-
selenium_browser.
|
441
|
-
selenium_page_object.heading2.
|
437
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
438
|
+
expect(selenium_browser).to receive(:text).and_return("value")
|
439
|
+
expect(selenium_page_object.heading2).to eql "value"
|
442
440
|
end
|
443
441
|
|
444
442
|
it "should retrieve the element from the page" do
|
445
|
-
selenium_browser.
|
443
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
446
444
|
element = selenium_page_object.heading2_element
|
447
|
-
element.
|
445
|
+
expect(element).to be_instance_of PageObject::Elements::Heading
|
448
446
|
end
|
449
447
|
end
|
450
448
|
|
451
449
|
describe "h3 accessors" do
|
452
450
|
it "should retrieve the text from the h3" do
|
453
|
-
selenium_browser.
|
454
|
-
selenium_browser.
|
455
|
-
selenium_page_object.heading3.
|
451
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
452
|
+
expect(selenium_browser).to receive(:text).and_return("value")
|
453
|
+
expect(selenium_page_object.heading3).to eql "value"
|
456
454
|
end
|
457
455
|
|
458
456
|
it "should retrieve the element from the page" do
|
459
|
-
selenium_browser.
|
457
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
460
458
|
element = selenium_page_object.heading3_element
|
461
|
-
element.
|
459
|
+
expect(element).to be_instance_of PageObject::Elements::Heading
|
462
460
|
end
|
463
461
|
end
|
464
462
|
|
465
463
|
describe "h4 accessors" do
|
466
464
|
it "should retrieve the text from the h4" do
|
467
|
-
selenium_browser.
|
468
|
-
selenium_browser.
|
469
|
-
selenium_page_object.heading4.
|
465
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
466
|
+
expect(selenium_browser).to receive(:text).and_return("value")
|
467
|
+
expect(selenium_page_object.heading4).to eql "value"
|
470
468
|
end
|
471
469
|
|
472
470
|
it "should retrieve the element from the page" do
|
473
|
-
selenium_browser.
|
471
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
474
472
|
element = selenium_page_object.heading4_element
|
475
|
-
element.
|
473
|
+
expect(element).to be_instance_of PageObject::Elements::Heading
|
476
474
|
end
|
477
475
|
end
|
478
476
|
|
479
477
|
describe "h5 accessors" do
|
480
478
|
it "should retrieve the text from the h5" do
|
481
|
-
selenium_browser.
|
482
|
-
selenium_browser.
|
483
|
-
selenium_page_object.heading5.
|
479
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
480
|
+
expect(selenium_browser).to receive(:text).and_return("value")
|
481
|
+
expect(selenium_page_object.heading5).to eql "value"
|
484
482
|
end
|
485
483
|
|
486
484
|
it "should retrieve the element from the page" do
|
487
|
-
selenium_browser.
|
485
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
488
486
|
element = selenium_page_object.heading5_element
|
489
|
-
element.
|
487
|
+
expect(element).to be_instance_of PageObject::Elements::Heading
|
490
488
|
end
|
491
489
|
end
|
492
490
|
|
493
491
|
describe "h6 accessors" do
|
494
492
|
it "should retrieve the text from the h6" do
|
495
|
-
selenium_browser.
|
496
|
-
selenium_browser.
|
497
|
-
selenium_page_object.heading6.
|
493
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
494
|
+
expect(selenium_browser).to receive(:text).and_return("value")
|
495
|
+
expect(selenium_page_object.heading6).to eql "value"
|
498
496
|
end
|
499
497
|
|
500
498
|
it "should retrieve the element from the page" do
|
501
|
-
selenium_browser.
|
499
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
502
500
|
element = selenium_page_object.heading6_element
|
503
|
-
element.
|
501
|
+
expect(element).to be_instance_of PageObject::Elements::Heading
|
504
502
|
end
|
505
503
|
end
|
506
504
|
|
507
505
|
|
508
506
|
describe "p accessors" do
|
509
507
|
it "should retrieve the text from the p" do
|
510
|
-
selenium_browser.
|
511
|
-
selenium_browser.
|
512
|
-
selenium_page_object.first_para.
|
508
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
509
|
+
expect(selenium_browser).to receive(:text).and_return("value")
|
510
|
+
expect(selenium_page_object.first_para).to eql "value"
|
513
511
|
end
|
514
512
|
|
515
513
|
it "should retrieve the element from the page" do
|
516
|
-
selenium_browser.
|
514
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
517
515
|
element = selenium_page_object.first_para_element
|
518
|
-
element.
|
516
|
+
expect(element).to be_instance_of PageObject::Elements::Paragraph
|
519
517
|
end
|
520
518
|
end
|
521
519
|
|
522
520
|
describe "file_field accessors" do
|
523
521
|
it "should set the file name" do
|
524
|
-
selenium_browser.
|
525
|
-
selenium_browser.
|
522
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
523
|
+
expect(selenium_browser).to receive(:send_keys).with('some_file')
|
526
524
|
selenium_page_object.upload_me = 'some_file'
|
527
525
|
end
|
528
526
|
|
529
527
|
it "should retrieve a file_field element" do
|
530
|
-
selenium_browser.
|
528
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
531
529
|
element = selenium_page_object.upload_me_element
|
532
|
-
element.
|
530
|
+
expect(element).to be_instance_of PageObject::Elements::FileField
|
533
531
|
end
|
534
532
|
end
|
535
533
|
|
536
534
|
describe "area accessors" do
|
537
535
|
context "when called on a page object" do
|
538
536
|
it "should generate accessor methods" do
|
539
|
-
selenium_page_object.
|
540
|
-
selenium_page_object.
|
537
|
+
expect(selenium_page_object).to respond_to(:img_area)
|
538
|
+
expect(selenium_page_object).to respond_to(:img_area_element)
|
541
539
|
end
|
542
540
|
|
543
541
|
it "should call a block on the element method when present" do
|
544
|
-
block_page_object.img_area_element.
|
542
|
+
expect(block_page_object.img_area_element).to eql "area"
|
545
543
|
end
|
546
544
|
end
|
547
545
|
|
548
546
|
it "should click on the area" do
|
549
|
-
selenium_browser.
|
550
|
-
selenium_browser.
|
547
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
548
|
+
expect(selenium_browser).to receive(:click)
|
551
549
|
selenium_page_object.img_area
|
552
550
|
end
|
553
551
|
|
554
552
|
it "should retrieve the element from the page" do
|
555
|
-
selenium_browser.
|
553
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
556
554
|
element = selenium_page_object.img_area_element
|
557
|
-
element.
|
555
|
+
expect(element).to be_instance_of PageObject::Elements::Area
|
558
556
|
end
|
559
557
|
end
|
560
558
|
|
561
559
|
describe "canvas accessors" do
|
562
560
|
context "when called on a page object" do
|
563
561
|
it "should generate accessor methods" do
|
564
|
-
selenium_page_object.
|
562
|
+
expect(selenium_page_object).to respond_to(:my_canvas_element)
|
565
563
|
end
|
566
564
|
|
567
565
|
it "should call a block on the element method when present" do
|
568
|
-
block_page_object.my_canvas_element.
|
566
|
+
expect(block_page_object.my_canvas_element).to eql "canvas"
|
569
567
|
end
|
570
568
|
end
|
571
569
|
end
|
@@ -573,11 +571,11 @@ describe PageObject::Accessors do
|
|
573
571
|
describe "audio accessors" do
|
574
572
|
context "when called on a page object" do
|
575
573
|
it "should generate accessor methods" do
|
576
|
-
selenium_page_object.
|
574
|
+
expect(selenium_page_object).to respond_to(:acdc_element)
|
577
575
|
end
|
578
576
|
|
579
577
|
it "should call a block on the element method when present" do
|
580
|
-
block_page_object.acdc_element.
|
578
|
+
expect(block_page_object.acdc_element).to eql "audio"
|
581
579
|
end
|
582
580
|
end
|
583
581
|
end
|
@@ -585,12 +583,27 @@ describe PageObject::Accessors do
|
|
585
583
|
describe "video accessors" do
|
586
584
|
context "when called on a page object" do
|
587
585
|
it "should generate accessor methods" do
|
588
|
-
selenium_page_object.
|
586
|
+
expect(selenium_page_object).to respond_to(:movie_element)
|
589
587
|
end
|
590
588
|
|
591
589
|
it "should call a block on the elmenet method when present" do
|
592
|
-
block_page_object.movie_element.
|
590
|
+
expect(block_page_object.movie_element).to eql "video"
|
593
591
|
end
|
594
592
|
end
|
595
593
|
end
|
594
|
+
|
595
|
+
describe "b accessors" do
|
596
|
+
it "should retrieve the text from the b" do
|
597
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
598
|
+
expect(selenium_browser).to receive(:text).and_return("value")
|
599
|
+
expect(selenium_page_object.bold).to eql "value"
|
600
|
+
end
|
601
|
+
|
602
|
+
it "should retrieve the element from the page" do
|
603
|
+
expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
|
604
|
+
element = selenium_page_object.bold_element
|
605
|
+
expect(element).to be_instance_of PageObject::Elements::Bold
|
606
|
+
end
|
607
|
+
end
|
608
|
+
|
596
609
|
end
|