page-object 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +10 -0
- data/features/html/static_elements.html +1 -2
- data/features/step_definitions/accessor_steps.rb +16 -16
- data/features/step_definitions/element_steps.rb +15 -16
- data/features/support/page.rb +1 -0
- data/features/table_cell.feature +1 -0
- data/lib/page-object.rb +15 -3
- data/lib/page-object/accessors.rb +87 -52
- data/lib/page-object/elements/element.rb +11 -0
- data/lib/page-object/elements/table_cell.rb +10 -0
- data/lib/page-object/platforms/selenium/page_object.rb +44 -108
- data/lib/page-object/platforms/watir/page_object.rb +43 -83
- data/lib/page-object/version.rb +1 -1
- data/page-object.gemspec +1 -1
- data/spec/page-object/accessors_spec.rb +91 -68
- data/spec/page-object/elements/element_spec.rb +7 -0
- data/spec/page-object/page-object_spec.rb +26 -0
- metadata +3 -3
data/lib/page-object/version.rb
CHANGED
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.2.8'
|
23
|
-
s.add_dependency 'selenium-webdriver', '>= 2.2
|
23
|
+
s.add_dependency 'selenium-webdriver', '>= 2.3.2'
|
24
24
|
|
25
25
|
s.add_development_dependency 'rspec', '>= 2.6.0'
|
26
26
|
s.add_development_dependency 'cucumber', '>= 1.0.0'
|
@@ -28,55 +28,55 @@ class BlockPageObject
|
|
28
28
|
|
29
29
|
attr_reader :value
|
30
30
|
|
31
|
-
text_field :first_name do |
|
31
|
+
text_field :first_name do |element|
|
32
32
|
"text_field"
|
33
33
|
end
|
34
|
-
hidden_field :secret do |
|
34
|
+
hidden_field :secret do |element|
|
35
35
|
"hidden_field"
|
36
36
|
end
|
37
|
-
text_area :address do |
|
37
|
+
text_area :address do |element|
|
38
38
|
"text_area"
|
39
39
|
end
|
40
|
-
select_list :state do |
|
40
|
+
select_list :state do |element|
|
41
41
|
"select_list"
|
42
42
|
end
|
43
|
-
link :continue do |
|
43
|
+
link :continue do |element|
|
44
44
|
"link"
|
45
45
|
end
|
46
|
-
checkbox :active do |
|
46
|
+
checkbox :active do |element|
|
47
47
|
"checkbox"
|
48
48
|
end
|
49
|
-
radio_button :first do |
|
49
|
+
radio_button :first do |element|
|
50
50
|
"radio_button"
|
51
51
|
end
|
52
|
-
button :click_me do |
|
52
|
+
button :click_me do |element|
|
53
53
|
"button"
|
54
54
|
end
|
55
|
-
div :footer do |
|
55
|
+
div :footer do |element|
|
56
56
|
"div"
|
57
57
|
end
|
58
|
-
span :alert do |
|
58
|
+
span :alert do |element|
|
59
59
|
"span"
|
60
60
|
end
|
61
|
-
table :cart do |
|
61
|
+
table :cart do |element|
|
62
62
|
"table"
|
63
63
|
end
|
64
|
-
cell :total do |
|
64
|
+
cell :total do |element|
|
65
65
|
"cell"
|
66
66
|
end
|
67
|
-
image :logo do |
|
67
|
+
image :logo do |element|
|
68
68
|
"image"
|
69
69
|
end
|
70
|
-
form :login do |
|
70
|
+
form :login do |element|
|
71
71
|
"form"
|
72
72
|
end
|
73
|
-
list_item :item_one do |
|
73
|
+
list_item :item_one do |element|
|
74
74
|
"list_item"
|
75
75
|
end
|
76
|
-
unordered_list :menu do |
|
76
|
+
unordered_list :menu do |element|
|
77
77
|
"unordered_list"
|
78
78
|
end
|
79
|
-
ordered_list :top_five do |
|
79
|
+
ordered_list :top_five do |element|
|
80
80
|
"ordered_list"
|
81
81
|
end
|
82
82
|
end
|
@@ -114,11 +114,12 @@ describe PageObject::Accessors do
|
|
114
114
|
context "when called on a page object" do
|
115
115
|
it "should generate accessor methods" do
|
116
116
|
watir_page_object.should respond_to(:google_search)
|
117
|
+
watir_page_object.should respond_to(:google_search_element)
|
117
118
|
watir_page_object.should respond_to(:google_search_link)
|
118
119
|
end
|
119
120
|
|
120
121
|
it "should call a block on the element method when present" do
|
121
|
-
block_page_object.
|
122
|
+
block_page_object.continue_element.should == "link"
|
122
123
|
end
|
123
124
|
end
|
124
125
|
|
@@ -130,7 +131,7 @@ describe PageObject::Accessors do
|
|
130
131
|
|
131
132
|
it "should return a link element" do
|
132
133
|
watir_browser.should_receive(:link).and_return(watir_browser)
|
133
|
-
element = watir_page_object.
|
134
|
+
element = watir_page_object.google_search_element
|
134
135
|
element.should be_instance_of PageObject::Elements::Link
|
135
136
|
end
|
136
137
|
end
|
@@ -143,7 +144,7 @@ describe PageObject::Accessors do
|
|
143
144
|
|
144
145
|
it "should return a link element" do
|
145
146
|
selenium_browser.should_receive(:find_element).and_return(selenium_browser)
|
146
|
-
element = selenium_page_object.
|
147
|
+
element = selenium_page_object.google_search_element
|
147
148
|
element.should be_instance_of PageObject::Elements::Link
|
148
149
|
end
|
149
150
|
end
|
@@ -155,11 +156,12 @@ describe PageObject::Accessors do
|
|
155
156
|
it "should generate accessor methods" do
|
156
157
|
watir_page_object.should respond_to(:first_name)
|
157
158
|
watir_page_object.should respond_to(:first_name=)
|
159
|
+
watir_page_object.should respond_to(:first_name_element)
|
158
160
|
watir_page_object.should respond_to(:first_name_text_field)
|
159
161
|
end
|
160
162
|
|
161
163
|
it "should call a block on the element method when present" do
|
162
|
-
block_page_object.
|
164
|
+
block_page_object.first_name_element.should == "text_field"
|
163
165
|
end
|
164
166
|
end
|
165
167
|
|
@@ -178,7 +180,7 @@ describe PageObject::Accessors do
|
|
178
180
|
|
179
181
|
it "should retrieve a text field element" do
|
180
182
|
watir_browser.should_receive(:text_field).and_return(watir_browser)
|
181
|
-
element = watir_page_object.
|
183
|
+
element = watir_page_object.first_name_element
|
182
184
|
element.should be_instance_of PageObject::Elements::TextField
|
183
185
|
end
|
184
186
|
end
|
@@ -199,7 +201,7 @@ describe PageObject::Accessors do
|
|
199
201
|
|
200
202
|
it "should retrieve a text field element" do
|
201
203
|
selenium_browser.should_receive(:find_element).and_return(selenium_browser)
|
202
|
-
element = selenium_page_object.
|
204
|
+
element = selenium_page_object.first_name_element
|
203
205
|
element.should be_instance_of PageObject::Elements::TextField
|
204
206
|
end
|
205
207
|
end
|
@@ -210,11 +212,12 @@ describe PageObject::Accessors do
|
|
210
212
|
context "when called on a page object" do
|
211
213
|
it "should generate accessor methods" do
|
212
214
|
watir_page_object.should respond_to(:social_security_number)
|
215
|
+
watir_page_object.should respond_to(:social_security_number_element)
|
213
216
|
watir_page_object.should respond_to(:social_security_number_hidden_field)
|
214
217
|
end
|
215
218
|
|
216
219
|
it "should call a block on the element method when present" do
|
217
|
-
block_page_object.
|
220
|
+
block_page_object.secret_element.should == "hidden_field"
|
218
221
|
end
|
219
222
|
end
|
220
223
|
|
@@ -227,7 +230,7 @@ describe PageObject::Accessors do
|
|
227
230
|
|
228
231
|
it "should retrieve a hidden field element" do
|
229
232
|
watir_browser.should_receive(:hidden).and_return(watir_browser)
|
230
|
-
element = watir_page_object.
|
233
|
+
element = watir_page_object.social_security_number_element
|
231
234
|
element.should be_instance_of(PageObject::Elements::HiddenField)
|
232
235
|
end
|
233
236
|
end
|
@@ -241,7 +244,7 @@ describe PageObject::Accessors do
|
|
241
244
|
|
242
245
|
it "should retrieve a hidden field element" do
|
243
246
|
selenium_browser.should_receive(:find_element).and_return(selenium_browser)
|
244
|
-
element = selenium_page_object.
|
247
|
+
element = selenium_page_object.social_security_number_element
|
245
248
|
element.should be_instance_of PageObject::Elements::HiddenField
|
246
249
|
end
|
247
250
|
end
|
@@ -252,11 +255,12 @@ describe PageObject::Accessors do
|
|
252
255
|
it "should generate accessor methods" do
|
253
256
|
watir_page_object.should respond_to(:address)
|
254
257
|
watir_page_object.should respond_to(:address=)
|
258
|
+
watir_page_object.should respond_to(:address_element)
|
255
259
|
watir_page_object.should respond_to(:address_text_area)
|
256
260
|
end
|
257
261
|
|
258
262
|
it "should call a block on the element method when present" do
|
259
|
-
block_page_object.
|
263
|
+
block_page_object.address_element.should == "text_area"
|
260
264
|
end
|
261
265
|
end
|
262
266
|
|
@@ -275,7 +279,7 @@ describe PageObject::Accessors do
|
|
275
279
|
|
276
280
|
it "should retrieve a text area element" do
|
277
281
|
watir_browser.should_receive(:textarea).and_return(watir_browser)
|
278
|
-
element = watir_page_object.
|
282
|
+
element = watir_page_object.address_element
|
279
283
|
element.should be_instance_of PageObject::Elements::TextArea
|
280
284
|
end
|
281
285
|
end
|
@@ -295,7 +299,7 @@ describe PageObject::Accessors do
|
|
295
299
|
|
296
300
|
it "should retrieve a text area element" do
|
297
301
|
selenium_browser.should_receive(:find_element).and_return(selenium_browser)
|
298
|
-
element = selenium_page_object.
|
302
|
+
element = selenium_page_object.address_element
|
299
303
|
element.should be_instance_of PageObject::Elements::TextArea
|
300
304
|
end
|
301
305
|
end
|
@@ -306,11 +310,12 @@ describe PageObject::Accessors do
|
|
306
310
|
it "should generate accessor methods" do
|
307
311
|
watir_page_object.should respond_to :state
|
308
312
|
watir_page_object.should respond_to :state=
|
313
|
+
watir_page_object.should respond_to(:state_element)
|
309
314
|
watir_page_object.should respond_to(:state_select_list)
|
310
315
|
end
|
311
316
|
|
312
317
|
it "should call a block on the element method when present" do
|
313
|
-
block_page_object.
|
318
|
+
block_page_object.state_element.should == "select_list"
|
314
319
|
end
|
315
320
|
end
|
316
321
|
|
@@ -329,7 +334,7 @@ describe PageObject::Accessors do
|
|
329
334
|
|
330
335
|
it "should retreive the select list element" do
|
331
336
|
watir_browser.should_receive(:select_list).and_return(watir_browser)
|
332
|
-
element = watir_page_object.
|
337
|
+
element = watir_page_object.state_element
|
333
338
|
element.should be_instance_of PageObject::Elements::SelectList
|
334
339
|
end
|
335
340
|
end
|
@@ -349,7 +354,7 @@ describe PageObject::Accessors do
|
|
349
354
|
|
350
355
|
it "should retrieve the select list element" do
|
351
356
|
selenium_browser.should_receive(:find_element).and_return(selenium_browser)
|
352
|
-
element = selenium_page_object.
|
357
|
+
element = selenium_page_object.state_element
|
353
358
|
element.should be_instance_of PageObject::Elements::SelectList
|
354
359
|
end
|
355
360
|
end
|
@@ -362,11 +367,12 @@ describe PageObject::Accessors do
|
|
362
367
|
watir_page_object.should respond_to :check_active
|
363
368
|
watir_page_object.should respond_to :uncheck_active
|
364
369
|
watir_page_object.should respond_to :active_checked?
|
365
|
-
watir_page_object.should respond_to
|
370
|
+
watir_page_object.should respond_to :active_element
|
371
|
+
watir_page_object.should respond_to :active_checkbox
|
366
372
|
end
|
367
373
|
|
368
374
|
it "should call a block on the element method when present" do
|
369
|
-
block_page_object.
|
375
|
+
block_page_object.active_element.should == "checkbox"
|
370
376
|
end
|
371
377
|
end
|
372
378
|
|
@@ -391,7 +397,7 @@ describe PageObject::Accessors do
|
|
391
397
|
|
392
398
|
it "should retrieve a checkbox element" do
|
393
399
|
watir_browser.should_receive(:checkbox).and_return(watir_browser)
|
394
|
-
element = watir_page_object.
|
400
|
+
element = watir_page_object.active_element
|
395
401
|
element.should be_instance_of PageObject::Elements::CheckBox
|
396
402
|
end
|
397
403
|
end
|
@@ -419,7 +425,7 @@ describe PageObject::Accessors do
|
|
419
425
|
|
420
426
|
it "should retrieve a checkbox element" do
|
421
427
|
selenium_browser.should_receive(:find_element).and_return(selenium_browser)
|
422
|
-
element = selenium_page_object.
|
428
|
+
element = selenium_page_object.active_element
|
423
429
|
element.should be_instance_of PageObject::Elements::CheckBox
|
424
430
|
end
|
425
431
|
end
|
@@ -432,11 +438,12 @@ describe PageObject::Accessors do
|
|
432
438
|
watir_page_object.should respond_to :select_first
|
433
439
|
watir_page_object.should respond_to :clear_first
|
434
440
|
watir_page_object.should respond_to :first_selected?
|
441
|
+
watir_page_object.should respond_to(:first_element)
|
435
442
|
watir_page_object.should respond_to(:first_radio_button)
|
436
443
|
end
|
437
444
|
|
438
445
|
it "should call a block on the element method when present" do
|
439
|
-
block_page_object.
|
446
|
+
block_page_object.first_element.should == "radio_button"
|
440
447
|
end
|
441
448
|
end
|
442
449
|
|
@@ -461,7 +468,7 @@ describe PageObject::Accessors do
|
|
461
468
|
|
462
469
|
it "should retrieve a radio button element" do
|
463
470
|
watir_browser.should_receive(:radio).and_return(watir_browser)
|
464
|
-
element = watir_page_object.
|
471
|
+
element = watir_page_object.first_element
|
465
472
|
element.should be_instance_of PageObject::Elements::RadioButton
|
466
473
|
end
|
467
474
|
end
|
@@ -489,7 +496,7 @@ describe PageObject::Accessors do
|
|
489
496
|
|
490
497
|
it "should retrieve a radio button element" do
|
491
498
|
selenium_browser.should_receive(:find_element).and_return(selenium_browser)
|
492
|
-
element = selenium_page_object.
|
499
|
+
element = selenium_page_object.first_element
|
493
500
|
element.should be_instance_of PageObject::Elements::RadioButton
|
494
501
|
end
|
495
502
|
end
|
@@ -499,11 +506,12 @@ describe PageObject::Accessors do
|
|
499
506
|
context "when called on a page object" do
|
500
507
|
it "should generate accessor methods" do
|
501
508
|
watir_page_object.should respond_to :click_me
|
509
|
+
watir_page_object.should respond_to :click_me_element
|
502
510
|
watir_page_object.should respond_to :click_me_button
|
503
511
|
end
|
504
512
|
|
505
513
|
it "should call a block on the element method when present" do
|
506
|
-
block_page_object.
|
514
|
+
block_page_object.click_me_element.should == "button"
|
507
515
|
end
|
508
516
|
end
|
509
517
|
|
@@ -516,7 +524,7 @@ describe PageObject::Accessors do
|
|
516
524
|
|
517
525
|
it "should retrieve a button element" do
|
518
526
|
watir_browser.should_receive(:button).and_return(watir_browser)
|
519
|
-
element = watir_page_object.
|
527
|
+
element = watir_page_object.click_me_element
|
520
528
|
element.should be_instance_of PageObject::Elements::Button
|
521
529
|
end
|
522
530
|
end
|
@@ -530,7 +538,7 @@ describe PageObject::Accessors do
|
|
530
538
|
|
531
539
|
it "should retrieve a button element" do
|
532
540
|
selenium_browser.should_receive(:find_element).and_return(selenium_browser)
|
533
|
-
element = selenium_page_object.
|
541
|
+
element = selenium_page_object.click_me_element
|
534
542
|
element.should be_instance_of PageObject::Elements::Button
|
535
543
|
|
536
544
|
end
|
@@ -541,11 +549,12 @@ describe PageObject::Accessors do
|
|
541
549
|
context "when called on a page object" do
|
542
550
|
it "should generate accessor methods" do
|
543
551
|
watir_page_object.should respond_to(:message)
|
552
|
+
watir_page_object.should respond_to(:message_element)
|
544
553
|
watir_page_object.should respond_to(:message_div)
|
545
554
|
end
|
546
555
|
|
547
556
|
it "should call a block on the element method when present" do
|
548
|
-
block_page_object.
|
557
|
+
block_page_object.footer_element.should == "div"
|
549
558
|
end
|
550
559
|
end
|
551
560
|
|
@@ -558,7 +567,7 @@ describe PageObject::Accessors do
|
|
558
567
|
|
559
568
|
it "should retrieve the div element from the page" do
|
560
569
|
watir_browser.should_receive(:div).and_return(watir_browser)
|
561
|
-
element = watir_page_object.
|
570
|
+
element = watir_page_object.message_element
|
562
571
|
element.should be_instance_of PageObject::Elements::Div
|
563
572
|
end
|
564
573
|
end
|
@@ -573,7 +582,7 @@ describe PageObject::Accessors do
|
|
573
582
|
|
574
583
|
it "should retrieve the div element from the page" do
|
575
584
|
selenium_browser.should_receive(:find_element).and_return(selenium_browser)
|
576
|
-
element = selenium_page_object.
|
585
|
+
element = selenium_page_object.message_element
|
577
586
|
element.should be_instance_of PageObject::Elements::Div
|
578
587
|
|
579
588
|
end
|
@@ -584,11 +593,12 @@ describe PageObject::Accessors do
|
|
584
593
|
context "when called on a page object" do
|
585
594
|
it "should generate accessor methods" do
|
586
595
|
watir_page_object.should respond_to(:alert)
|
596
|
+
watir_page_object.should respond_to(:alert_element)
|
587
597
|
watir_page_object.should respond_to(:alert_span)
|
588
598
|
end
|
589
599
|
|
590
600
|
it "should call a block on the element method when present" do
|
591
|
-
block_page_object.
|
601
|
+
block_page_object.alert_element.should == "span"
|
592
602
|
end
|
593
603
|
end
|
594
604
|
|
@@ -601,7 +611,7 @@ describe PageObject::Accessors do
|
|
601
611
|
|
602
612
|
it "should retrieve the span element from the page" do
|
603
613
|
watir_browser.should_receive(:span).and_return(watir_browser)
|
604
|
-
element = watir_page_object.
|
614
|
+
element = watir_page_object.alert_element
|
605
615
|
element.should be_instance_of PageObject::Elements::Span
|
606
616
|
end
|
607
617
|
end
|
@@ -615,7 +625,7 @@ describe PageObject::Accessors do
|
|
615
625
|
|
616
626
|
it "should retrieve the span element from the page" do
|
617
627
|
selenium_browser.should_receive(:find_element).and_return(selenium_browser)
|
618
|
-
element = selenium_page_object.
|
628
|
+
element = selenium_page_object.alert_element
|
619
629
|
element.should be_instance_of PageObject::Elements::Span
|
620
630
|
|
621
631
|
end
|
@@ -625,18 +635,19 @@ describe PageObject::Accessors do
|
|
625
635
|
describe "table accessors" do
|
626
636
|
context "when called on a page object" do
|
627
637
|
it "should generate accessor methods" do
|
638
|
+
watir_page_object.should respond_to(:cart_element)
|
628
639
|
watir_page_object.should respond_to(:cart_table)
|
629
640
|
end
|
630
641
|
|
631
642
|
it "should call a block on the element method when present" do
|
632
|
-
block_page_object.
|
643
|
+
block_page_object.cart_element.should == "table"
|
633
644
|
end
|
634
645
|
end
|
635
646
|
|
636
647
|
context "watir implementation" do
|
637
648
|
it "should retrieve the table element from the page" do
|
638
649
|
watir_browser.should_receive(:table).and_return(watir_browser)
|
639
|
-
element = watir_page_object.
|
650
|
+
element = watir_page_object.cart_element
|
640
651
|
element.should be_instance_of PageObject::Elements::Table
|
641
652
|
end
|
642
653
|
end
|
@@ -644,7 +655,7 @@ describe PageObject::Accessors do
|
|
644
655
|
context "selenium implementation" do
|
645
656
|
it "should retrieve the table element from the page" do
|
646
657
|
selenium_browser.should_receive(:find_element).and_return(selenium_browser)
|
647
|
-
element = selenium_page_object.
|
658
|
+
element = selenium_page_object.cart_element
|
648
659
|
element.should be_instance_of(PageObject::Elements::Table)
|
649
660
|
end
|
650
661
|
end
|
@@ -654,11 +665,12 @@ describe PageObject::Accessors do
|
|
654
665
|
context "when called on a page object" do
|
655
666
|
it "should generate accessor methods" do
|
656
667
|
watir_page_object.should respond_to(:total)
|
668
|
+
watir_page_object.should respond_to(:total_element)
|
657
669
|
watir_page_object.should respond_to(:total_cell)
|
658
670
|
end
|
659
671
|
|
660
672
|
it "should call a block on the element method when present" do
|
661
|
-
block_page_object.
|
673
|
+
block_page_object.total_element.should == "cell"
|
662
674
|
end
|
663
675
|
end
|
664
676
|
|
@@ -671,7 +683,7 @@ describe PageObject::Accessors do
|
|
671
683
|
|
672
684
|
it "should retrieve the cell element from the page" do
|
673
685
|
watir_browser.should_receive(:td).and_return(watir_browser)
|
674
|
-
element = watir_page_object.
|
686
|
+
element = watir_page_object.total_element
|
675
687
|
element.should be_instance_of PageObject::Elements::TableCell
|
676
688
|
end
|
677
689
|
end
|
@@ -682,24 +694,31 @@ describe PageObject::Accessors do
|
|
682
694
|
selenium_browser.should_receive(:text).and_return('celldata')
|
683
695
|
selenium_page_object.total.should == 'celldata'
|
684
696
|
end
|
697
|
+
|
698
|
+
it "should retrieve the cell element from the page" do
|
699
|
+
selenium_browser.should_receive(:find_element).and_return(selenium_browser)
|
700
|
+
element = selenium_page_object.total_element
|
701
|
+
element.should be_instance_of PageObject::Elements::TableCell
|
702
|
+
end
|
685
703
|
end
|
686
704
|
end
|
687
705
|
|
688
706
|
describe "image accessors" do
|
689
707
|
context "when called on a page object" do
|
690
708
|
it "should generate accessor methods" do
|
709
|
+
watir_page_object.should respond_to(:logo_element)
|
691
710
|
watir_page_object.should respond_to(:logo_image)
|
692
711
|
end
|
693
712
|
|
694
713
|
it "should call a block on the element method when present" do
|
695
|
-
block_page_object.
|
714
|
+
block_page_object.logo_element.should == "image"
|
696
715
|
end
|
697
716
|
end
|
698
717
|
|
699
718
|
context "watir implementation" do
|
700
719
|
it "should retrieve the image element from the page" do
|
701
720
|
watir_browser.should_receive(:image).and_return(watir_browser)
|
702
|
-
element = watir_page_object.
|
721
|
+
element = watir_page_object.logo_element
|
703
722
|
element.should be_instance_of PageObject::Elements::Image
|
704
723
|
end
|
705
724
|
end
|
@@ -707,7 +726,7 @@ describe PageObject::Accessors do
|
|
707
726
|
context "selenium implementation" do
|
708
727
|
it "should retrieve the image element from the page" do
|
709
728
|
selenium_browser.should_receive(:find_element).and_return(selenium_browser)
|
710
|
-
element = selenium_page_object.
|
729
|
+
element = selenium_page_object.logo_element
|
711
730
|
element.should be_instance_of PageObject::Elements::Image
|
712
731
|
end
|
713
732
|
end
|
@@ -716,18 +735,19 @@ describe PageObject::Accessors do
|
|
716
735
|
describe "form accessors" do
|
717
736
|
context "when called on a page object" do
|
718
737
|
it "should generate accessor methods" do
|
738
|
+
watir_page_object.should respond_to(:login_element)
|
719
739
|
watir_page_object.should respond_to(:login_form)
|
720
740
|
end
|
721
741
|
|
722
742
|
it "should call a block on the element method when present" do
|
723
|
-
block_page_object.
|
743
|
+
block_page_object.login_element.should == "form"
|
724
744
|
end
|
725
745
|
end
|
726
746
|
|
727
747
|
context "watir implementation" do
|
728
748
|
it "should retrieve the form element from the page" do
|
729
749
|
watir_browser.should_receive(:form).and_return(watir_browser)
|
730
|
-
element = watir_page_object.
|
750
|
+
element = watir_page_object.login_element
|
731
751
|
element.should be_instance_of PageObject::Elements::Form
|
732
752
|
end
|
733
753
|
end
|
@@ -735,7 +755,7 @@ describe PageObject::Accessors do
|
|
735
755
|
context "selenium implementation" do
|
736
756
|
it "should retrieve the form element from the page" do
|
737
757
|
selenium_browser.should_receive(:find_element).and_return(selenium_browser)
|
738
|
-
element = selenium_page_object.
|
758
|
+
element = selenium_page_object.login_element
|
739
759
|
element.should be_instance_of PageObject::Elements::Form
|
740
760
|
end
|
741
761
|
end
|
@@ -745,11 +765,12 @@ describe PageObject::Accessors do
|
|
745
765
|
context "when called on a page object" do
|
746
766
|
it "should generate accessor methods" do
|
747
767
|
watir_page_object.should respond_to(:item_one)
|
768
|
+
watir_page_object.should respond_to(:item_one_element)
|
748
769
|
watir_page_object.should respond_to(:item_one_list_item)
|
749
770
|
end
|
750
771
|
|
751
772
|
it "should call a block on the element method when present" do
|
752
|
-
block_page_object.
|
773
|
+
block_page_object.item_one_element.should == "list_item"
|
753
774
|
end
|
754
775
|
end
|
755
776
|
|
@@ -762,7 +783,7 @@ describe PageObject::Accessors do
|
|
762
783
|
|
763
784
|
it "should retrieve the list item element from the page" do
|
764
785
|
watir_browser.should_receive(:li).and_return(watir_browser)
|
765
|
-
element = watir_page_object.
|
786
|
+
element = watir_page_object.item_one_element
|
766
787
|
element.should be_instance_of PageObject::Elements::ListItem
|
767
788
|
end
|
768
789
|
end
|
@@ -776,7 +797,7 @@ describe PageObject::Accessors do
|
|
776
797
|
|
777
798
|
it "should retrieve the list item from the page" do
|
778
799
|
selenium_browser.should_receive(:find_element).and_return(selenium_browser)
|
779
|
-
element = selenium_page_object.
|
800
|
+
element = selenium_page_object.item_one_element
|
780
801
|
element.should be_instance_of PageObject::Elements::ListItem
|
781
802
|
end
|
782
803
|
end
|
@@ -785,18 +806,19 @@ describe PageObject::Accessors do
|
|
785
806
|
describe "unordered list accessors" do
|
786
807
|
context "when called on a page object" do
|
787
808
|
it "should generate accessor methods" do
|
809
|
+
watir_page_object.should respond_to(:menu_element)
|
788
810
|
watir_page_object.should respond_to(:menu_unordered_list)
|
789
811
|
end
|
790
812
|
|
791
813
|
it "should call a block on the element method when present" do
|
792
|
-
block_page_object.
|
814
|
+
block_page_object.menu_element.should == "unordered_list"
|
793
815
|
end
|
794
816
|
end
|
795
817
|
|
796
818
|
context "watir implementation" do
|
797
819
|
it "should retrieve the element from the page" do
|
798
820
|
watir_browser.should_receive(:ul).and_return(watir_browser)
|
799
|
-
element = watir_page_object.
|
821
|
+
element = watir_page_object.menu_element
|
800
822
|
element.should be_instance_of PageObject::Elements::UnorderedList
|
801
823
|
end
|
802
824
|
end
|
@@ -804,7 +826,7 @@ describe PageObject::Accessors do
|
|
804
826
|
context "selenium implementation" do
|
805
827
|
it "should retrieve the element from the page" do
|
806
828
|
selenium_browser.should_receive(:find_element).and_return(selenium_browser)
|
807
|
-
element = selenium_page_object.
|
829
|
+
element = selenium_page_object.menu_element
|
808
830
|
element.should be_instance_of PageObject::Elements::UnorderedList
|
809
831
|
end
|
810
832
|
end
|
@@ -813,18 +835,19 @@ describe PageObject::Accessors do
|
|
813
835
|
describe "ordered list accessors" do
|
814
836
|
context "when called on a page object" do
|
815
837
|
it "should generate accessor methods" do
|
838
|
+
watir_page_object.should respond_to(:top_five_element)
|
816
839
|
watir_page_object.should respond_to(:top_five_ordered_list)
|
817
840
|
end
|
818
841
|
|
819
842
|
it "should call a block on the element method when present" do
|
820
|
-
block_page_object.
|
843
|
+
block_page_object.top_five_element.should == "ordered_list"
|
821
844
|
end
|
822
845
|
end
|
823
846
|
|
824
847
|
context "watir implementation" do
|
825
848
|
it "should retrieve the element from the page" do
|
826
849
|
watir_browser.should_receive(:ol).and_return(watir_browser)
|
827
|
-
element = watir_page_object.
|
850
|
+
element = watir_page_object.top_five_element
|
828
851
|
element.should be_instance_of PageObject::Elements::OrderedList
|
829
852
|
end
|
830
853
|
end
|
@@ -832,7 +855,7 @@ describe PageObject::Accessors do
|
|
832
855
|
context "selenium implementation" do
|
833
856
|
it "should retrieve the element from the page" do
|
834
857
|
selenium_browser.should_receive(:find_element).and_return(selenium_browser)
|
835
|
-
element = selenium_page_object.
|
858
|
+
element = selenium_page_object.top_five_element
|
836
859
|
element.should be_instance_of PageObject::Elements::OrderedList
|
837
860
|
end
|
838
861
|
end
|