meeane-page-object 0.1.8
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.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +10 -0
- data/ChangeLog +790 -0
- data/Gemfile +13 -0
- data/Guardfile +20 -0
- data/LICENSE +20 -0
- data/README.md +141 -0
- data/Rakefile +35 -0
- data/cucumber.yml +10 -0
- data/features/area.feature +35 -0
- data/features/async.feature +30 -0
- data/features/audio.feature +68 -0
- data/features/button.feature +87 -0
- data/features/canvas.feature +37 -0
- data/features/check_box.feature +55 -0
- data/features/div.feature +45 -0
- data/features/element.feature +322 -0
- data/features/file_field.feature +40 -0
- data/features/form.feature +43 -0
- data/features/frames.feature +75 -0
- data/features/generic_elements.feature +29 -0
- data/features/gxt_table_extension.feature +24 -0
- data/features/headings.feature +97 -0
- data/features/hidden_field.feature +45 -0
- data/features/html/04-Death_Becomes_Fur.mp4 +0 -0
- data/features/html/04-Death_Becomes_Fur.oga +0 -0
- data/features/html/async.html +36 -0
- data/features/html/double_click.html +13 -0
- data/features/html/failure.html +8 -0
- data/features/html/frame_1.html +18 -0
- data/features/html/frame_2.html +16 -0
- data/features/html/frame_3.html +14 -0
- data/features/html/frames.html +12 -0
- data/features/html/hover.html +12 -0
- data/features/html/iframes.html +12 -0
- data/features/html/images/circle.png +0 -0
- data/features/html/images/img_pulpit.jpg +0 -0
- data/features/html/images/submit.gif +0 -0
- data/features/html/indexed_property.html +52 -0
- data/features/html/modal.html +17 -0
- data/features/html/modal_1.html +38 -0
- data/features/html/modal_2.html +27 -0
- data/features/html/movie.mp4 +0 -0
- data/features/html/movie.ogg +0 -0
- data/features/html/multi_elements.html +144 -0
- data/features/html/nested_elements.html +77 -0
- data/features/html/nested_frame_1.html +1 -0
- data/features/html/nested_frame_2.html +11 -0
- data/features/html/nested_frame_3.html +14 -0
- data/features/html/nested_frames.html +10 -0
- data/features/html/planets.gif +0 -0
- data/features/html/static_elements.html +206 -0
- data/features/html/success.html +8 -0
- data/features/html/sun.gif +0 -0
- data/features/html/sun.html +7 -0
- data/features/image.feature +50 -0
- data/features/indexed_property.feature +98 -0
- data/features/javascript.feature +28 -0
- data/features/label.feature +46 -0
- data/features/link.feature +52 -0
- data/features/list_item.feature +36 -0
- data/features/modal_dialog.feature +15 -0
- data/features/multi_elements.feature +486 -0
- data/features/nested_elements.feature +117 -0
- data/features/ordered_list.feature +56 -0
- data/features/page_level_actions.feature +90 -0
- data/features/paragraph.feature +35 -0
- data/features/radio_button.feature +58 -0
- data/features/radio_button_group.feature +29 -0
- data/features/sample-app/public/jquery-1.3.2.js +4376 -0
- data/features/sample-app/public/jquery.html +30 -0
- data/features/sample-app/public/prototype-1.6.0.3.js +4320 -0
- data/features/sample-app/public/prototype.html +35 -0
- data/features/sample-app/sample_app.rb +35 -0
- data/features/select_list.feature +86 -0
- data/features/span.feature +37 -0
- data/features/step_definitions/accessor_steps.rb +60 -0
- data/features/step_definitions/area_steps.rb +19 -0
- data/features/step_definitions/async_steps.rb +83 -0
- data/features/step_definitions/audio_steps.rb +27 -0
- data/features/step_definitions/button_steps.rb +43 -0
- data/features/step_definitions/canvas_steps.rb +15 -0
- data/features/step_definitions/check_box_steps.rb +35 -0
- data/features/step_definitions/div_steps.rb +19 -0
- data/features/step_definitions/element_steps.rb +266 -0
- data/features/step_definitions/file_field_steps.rb +19 -0
- data/features/step_definitions/form_steps.rb +19 -0
- data/features/step_definitions/frames_steps.rb +159 -0
- data/features/step_definitions/generic_element_steps.rb +31 -0
- data/features/step_definitions/gxt_table_steps.rb +58 -0
- data/features/step_definitions/headings_steps.rb +12 -0
- data/features/step_definitions/hidden_field_steps.rb +27 -0
- data/features/step_definitions/image_steps.rb +27 -0
- data/features/step_definitions/indexed_property_steps.rb +129 -0
- data/features/step_definitions/javascript_steps.rb +53 -0
- data/features/step_definitions/label_steps.rb +19 -0
- data/features/step_definitions/link_steps.rb +40 -0
- data/features/step_definitions/list_item_steps.rb +19 -0
- data/features/step_definitions/modal_dialog_steps.rb +62 -0
- data/features/step_definitions/multi_elements_steps.rb +528 -0
- data/features/step_definitions/nested_elements_steps.rb +212 -0
- data/features/step_definitions/ordered_list_steps.rb +23 -0
- data/features/step_definitions/page_level_actions_steps.rb +135 -0
- data/features/step_definitions/page_traversal_steps.rb +4 -0
- data/features/step_definitions/paragraph_steps.rb +28 -0
- data/features/step_definitions/radio_button_group_steps.rb +36 -0
- data/features/step_definitions/radio_button_steps.rb +27 -0
- data/features/step_definitions/select_list_steps.rb +65 -0
- data/features/step_definitions/span_steps.rb +19 -0
- data/features/step_definitions/table_cell_steps.rb +15 -0
- data/features/step_definitions/table_steps.rb +66 -0
- data/features/step_definitions/text_area_steps.rb +35 -0
- data/features/step_definitions/text_field_steps.rb +35 -0
- data/features/step_definitions/unordered_list_steps.rb +23 -0
- data/features/step_definitions/video_steps.rb +45 -0
- data/features/support/ajax_text_environment.rb +26 -0
- data/features/support/env.rb +8 -0
- data/features/support/hooks.rb +8 -0
- data/features/support/page.rb +364 -0
- data/features/support/persistent_browser.rb +70 -0
- data/features/support/targets/firefox14_osx.rb +6 -0
- data/features/support/targets/firefox14_windows7.rb +6 -0
- data/features/support/url_helper.rb +57 -0
- data/features/table.feature +114 -0
- data/features/table_cell.feature +45 -0
- data/features/text_area.feature +51 -0
- data/features/text_field.feature +70 -0
- data/features/unordered_list.feature +56 -0
- data/features/video.feature +73 -0
- data/lib/page-object/accessors.rb +1313 -0
- data/lib/page-object/core_ext/string.rb +5 -0
- data/lib/page-object/element_locators.rb +21 -0
- data/lib/page-object/elements/area.rb +31 -0
- data/lib/page-object/elements/audio.rb +9 -0
- data/lib/page-object/elements/button.rb +35 -0
- data/lib/page-object/elements/canvas.rb +23 -0
- data/lib/page-object/elements/check_box.rb +37 -0
- data/lib/page-object/elements/div.rb +19 -0
- data/lib/page-object/elements/element.rb +226 -0
- data/lib/page-object/elements/file_field.rb +38 -0
- data/lib/page-object/elements/form.rb +36 -0
- data/lib/page-object/elements/heading.rb +15 -0
- data/lib/page-object/elements/hidden_field.rb +22 -0
- data/lib/page-object/elements/image.rb +36 -0
- data/lib/page-object/elements/label.rb +36 -0
- data/lib/page-object/elements/link.rb +46 -0
- data/lib/page-object/elements/list_item.rb +19 -0
- data/lib/page-object/elements/media.rb +45 -0
- data/lib/page-object/elements/option.rb +10 -0
- data/lib/page-object/elements/ordered_list.rb +50 -0
- data/lib/page-object/elements/paragraph.rb +9 -0
- data/lib/page-object/elements/radio_button.rb +37 -0
- data/lib/page-object/elements/select_list.rb +42 -0
- data/lib/page-object/elements/span.rb +19 -0
- data/lib/page-object/elements/table.rb +68 -0
- data/lib/page-object/elements/table_cell.rb +28 -0
- data/lib/page-object/elements/table_row.rb +50 -0
- data/lib/page-object/elements/text_area.rb +38 -0
- data/lib/page-object/elements/text_field.rb +42 -0
- data/lib/page-object/elements/unordered_list.rb +51 -0
- data/lib/page-object/elements/video.rb +18 -0
- data/lib/page-object/elements.rb +59 -0
- data/lib/page-object/indexed_properties.rb +36 -0
- data/lib/page-object/javascript/jquery.rb +14 -0
- data/lib/page-object/javascript/prototype.rb +14 -0
- data/lib/page-object/javascript/yui.rb +19 -0
- data/lib/page-object/javascript_framework_facade.rb +78 -0
- data/lib/page-object/loads_platform.rb +26 -0
- data/lib/page-object/locator_generator.rb +129 -0
- data/lib/page-object/nested_elements.rb +17 -0
- data/lib/page-object/page_factory.rb +108 -0
- data/lib/page-object/page_populator.rb +92 -0
- data/lib/page-object/platforms/selenium_webdriver/button.rb +15 -0
- data/lib/page-object/platforms/selenium_webdriver/check_box.rb +29 -0
- data/lib/page-object/platforms/selenium_webdriver/element.rb +291 -0
- data/lib/page-object/platforms/selenium_webdriver/file_field.rb +16 -0
- data/lib/page-object/platforms/selenium_webdriver/form.rb +16 -0
- data/lib/page-object/platforms/selenium_webdriver/image.rb +28 -0
- data/lib/page-object/platforms/selenium_webdriver/label.rb +17 -0
- data/lib/page-object/platforms/selenium_webdriver/link.rb +23 -0
- data/lib/page-object/platforms/selenium_webdriver/ordered_list.rb +39 -0
- data/lib/page-object/platforms/selenium_webdriver/page_object.rb +1136 -0
- data/lib/page-object/platforms/selenium_webdriver/radio_button.rb +22 -0
- data/lib/page-object/platforms/selenium_webdriver/select_list.rb +93 -0
- data/lib/page-object/platforms/selenium_webdriver/surrogate_selenium_element.rb +42 -0
- data/lib/page-object/platforms/selenium_webdriver/table.rb +42 -0
- data/lib/page-object/platforms/selenium_webdriver/table_row.rb +43 -0
- data/lib/page-object/platforms/selenium_webdriver/text_area.rb +17 -0
- data/lib/page-object/platforms/selenium_webdriver/text_field.rb +17 -0
- data/lib/page-object/platforms/selenium_webdriver/unordered_list.rb +39 -0
- data/lib/page-object/platforms/selenium_webdriver.rb +18 -0
- data/lib/page-object/platforms/watir_webdriver/check_box.rb +29 -0
- data/lib/page-object/platforms/watir_webdriver/element.rb +249 -0
- data/lib/page-object/platforms/watir_webdriver/file_field.rb +16 -0
- data/lib/page-object/platforms/watir_webdriver/form.rb +16 -0
- data/lib/page-object/platforms/watir_webdriver/image.rb +22 -0
- data/lib/page-object/platforms/watir_webdriver/label.rb +17 -0
- data/lib/page-object/platforms/watir_webdriver/link.rb +15 -0
- data/lib/page-object/platforms/watir_webdriver/ordered_list.rb +35 -0
- data/lib/page-object/platforms/watir_webdriver/page_object.rb +1029 -0
- data/lib/page-object/platforms/watir_webdriver/radio_button.rb +22 -0
- data/lib/page-object/platforms/watir_webdriver/select_list.rb +74 -0
- data/lib/page-object/platforms/watir_webdriver/table.rb +38 -0
- data/lib/page-object/platforms/watir_webdriver/table_row.rb +37 -0
- data/lib/page-object/platforms/watir_webdriver/text_area.rb +23 -0
- data/lib/page-object/platforms/watir_webdriver/text_field.rb +16 -0
- data/lib/page-object/platforms/watir_webdriver/unordered_list.rb +36 -0
- data/lib/page-object/platforms/watir_webdriver.rb +18 -0
- data/lib/page-object/platforms.rb +18 -0
- data/lib/page-object/version.rb +4 -0
- data/lib/page-object/widgets.rb +133 -0
- data/lib/page-object.rb +408 -0
- data/meeane-page-object.gemspec +32 -0
- data/pageobject.gems +1 -0
- data/spec/page-object/element_locators_spec.rb +1065 -0
- data/spec/page-object/elements/area_spec.rb +45 -0
- data/spec/page-object/elements/button_spec.rb +50 -0
- data/spec/page-object/elements/canvas_spec.rb +40 -0
- data/spec/page-object/elements/check_box_spec.rb +49 -0
- data/spec/page-object/elements/div_spec.rb +28 -0
- data/spec/page-object/elements/element_spec.rb +114 -0
- data/spec/page-object/elements/file_field_spec.rb +39 -0
- data/spec/page-object/elements/form_spec.rb +28 -0
- data/spec/page-object/elements/heading_spec.rb +48 -0
- data/spec/page-object/elements/hidden_field_spec.rb +28 -0
- data/spec/page-object/elements/image_spec.rb +66 -0
- data/spec/page-object/elements/label_spec.rb +29 -0
- data/spec/page-object/elements/link_spec.rb +49 -0
- data/spec/page-object/elements/list_item_spec.rb +28 -0
- data/spec/page-object/elements/nested_element_spec.rb +254 -0
- data/spec/page-object/elements/option_spec.rb +11 -0
- data/spec/page-object/elements/ordered_list_spec.rb +94 -0
- data/spec/page-object/elements/paragraph_spec.rb +28 -0
- data/spec/page-object/elements/select_list_spec.rb +142 -0
- data/spec/page-object/elements/selenium/radio_button_spec.rb +44 -0
- data/spec/page-object/elements/selenium/text_field_spec.rb +49 -0
- data/spec/page-object/elements/selenium_element_spec.rb +172 -0
- data/spec/page-object/elements/span_spec.rb +26 -0
- data/spec/page-object/elements/table_cell_spec.rb +21 -0
- data/spec/page-object/elements/table_row_spec.rb +70 -0
- data/spec/page-object/elements/table_spec.rb +98 -0
- data/spec/page-object/elements/text_area_spec.rb +39 -0
- data/spec/page-object/elements/unordered_list_spec.rb +95 -0
- data/spec/page-object/elements/watir_element_spec.rb +142 -0
- data/spec/page-object/javascript_framework_facade_spec.rb +61 -0
- data/spec/page-object/loads_platform_spec.rb +53 -0
- data/spec/page-object/page-object_spec.rb +405 -0
- data/spec/page-object/page_factory_spec.rb +256 -0
- data/spec/page-object/page_populator_spec.rb +122 -0
- data/spec/page-object/platforms/selenium_webdriver/selenium_page_object_spec.rb +68 -0
- data/spec/page-object/platforms/selenium_webdriver_spec.rb +29 -0
- data/spec/page-object/platforms/watir_webdriver/watir_page_object_spec.rb +29 -0
- data/spec/page-object/platforms/watir_webdriver_spec.rb +9 -0
- data/spec/page-object/selenium_accessors_spec.rb +589 -0
- data/spec/page-object/watir_accessors_spec.rb +1107 -0
- data/spec/page-object/widget_spec.rb +226 -0
- data/spec/spec_helper.rb +44 -0
- metadata +404 -0
@@ -0,0 +1,1065 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class ElementLocatorsTestPageObject
|
4
|
+
include PageObject
|
5
|
+
end
|
6
|
+
|
7
|
+
|
8
|
+
describe PageObject::ElementLocators do
|
9
|
+
|
10
|
+
context "when using Watir" do
|
11
|
+
let(:watir_browser) { mock_watir_browser }
|
12
|
+
let(:watir_page_object) { ElementLocatorsTestPageObject.new(watir_browser) }
|
13
|
+
|
14
|
+
it "should find a button element" do
|
15
|
+
watir_browser.should_receive(:button).with(:id => 'blah').and_return(watir_browser)
|
16
|
+
element = watir_page_object.button_element(:id => 'blah')
|
17
|
+
element.should be_instance_of PageObject::Elements::Button
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should find a button element using a default identifier" do
|
21
|
+
watir_browser.should_receive(:button).with(:index => 0).and_return(watir_browser)
|
22
|
+
watir_page_object.button_element
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should find all button elements" do
|
26
|
+
watir_browser.should_receive(:buttons).with(:id => 'blah').and_return([watir_browser])
|
27
|
+
elements = watir_page_object.button_elements(:id => 'blah')
|
28
|
+
elements[0].should be_instance_of PageObject::Elements::Button
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should find all buttons with no identifier" do
|
32
|
+
watir_browser.should_receive(:buttons).with({}).and_return([watir_browser])
|
33
|
+
watir_page_object.button_elements
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should find a text field element" do
|
37
|
+
watir_browser.should_receive(:text_field).with(:id => 'blah').and_return(watir_browser)
|
38
|
+
element = watir_page_object.text_field_element(:id => 'blah')
|
39
|
+
element.should be_instance_of PageObject::Elements::TextField
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should find a text field element using a default identifier" do
|
43
|
+
watir_browser.should_receive(:text_field).with(:index => 0).and_return(watir_browser)
|
44
|
+
watir_page_object.text_field_element
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should find all text field elements" do
|
48
|
+
watir_browser.should_receive(:text_fields).with(:id => 'blah').and_return([watir_browser])
|
49
|
+
watir_browser.should_receive(:tag_name).and_return('input')
|
50
|
+
elements = watir_page_object.text_field_elements(:id => 'blah')
|
51
|
+
elements[0].should be_instance_of PageObject::Elements::TextField
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should find all text fields with no identifier" do
|
55
|
+
watir_browser.should_receive(:text_fields).with({}).and_return([watir_browser])
|
56
|
+
watir_browser.should_receive(:tag_name).and_return('input')
|
57
|
+
watir_page_object.text_field_elements
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should find a hidden field element" do
|
61
|
+
watir_browser.should_receive(:hidden).with(:id => 'blah').and_return(watir_browser)
|
62
|
+
element = watir_page_object.hidden_field_element(:id => 'blah')
|
63
|
+
element.should be_instance_of PageObject::Elements::HiddenField
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should find a hidden field using a default identifier" do
|
67
|
+
watir_browser.should_receive(:hidden).with(:index => 0).and_return(watir_browser)
|
68
|
+
watir_page_object.hidden_field_element
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should find all hidden field elements" do
|
72
|
+
watir_browser.should_receive(:hiddens).with(:id => 'blah').and_return([watir_browser])
|
73
|
+
elements = watir_page_object.hidden_field_elements(:id => 'blah')
|
74
|
+
elements[0].should be_instance_of(PageObject::Elements::HiddenField)
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should find all hidden field elements using no identifier" do
|
78
|
+
watir_browser.should_receive(:hiddens).with({}).and_return([watir_browser])
|
79
|
+
watir_page_object.hidden_field_elements
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should find a text area element" do
|
83
|
+
watir_browser.should_receive(:textarea).with(:id => 'blah').and_return(watir_browser)
|
84
|
+
element = watir_page_object.text_area_element(:id => 'blah')
|
85
|
+
element.should be_instance_of PageObject::Elements::TextArea
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should find a text area using a default identifier" do
|
89
|
+
watir_browser.should_receive(:textarea).with(:index => 0).and_return(watir_browser)
|
90
|
+
watir_page_object.text_area_element
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should find all text area elements" do
|
94
|
+
watir_browser.should_receive(:textareas).with(:id => 'blah').and_return([watir_browser])
|
95
|
+
elements = watir_page_object.text_area_elements(:id => 'blah')
|
96
|
+
elements[0].should be_instance_of PageObject::Elements::TextArea
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should find all text area elements using no identifier" do
|
100
|
+
watir_browser.should_receive(:textareas).with({}).and_return([watir_browser])
|
101
|
+
watir_page_object.text_area_elements
|
102
|
+
end
|
103
|
+
|
104
|
+
it "should find a select list element" do
|
105
|
+
watir_browser.should_receive(:select_list).with(:id => 'blah').and_return(watir_browser)
|
106
|
+
element = watir_page_object.select_list_element(:id => 'blah')
|
107
|
+
element.should be_instance_of PageObject::Elements::SelectList
|
108
|
+
end
|
109
|
+
|
110
|
+
it "should find a select list using a default identifier" do
|
111
|
+
watir_browser.should_receive(:select_list).with(:index => 0).and_return(watir_browser)
|
112
|
+
watir_page_object.select_list_element
|
113
|
+
end
|
114
|
+
|
115
|
+
it "should find all select list elements" do
|
116
|
+
watir_browser.should_receive(:select_lists).with(:id => 'blah').and_return([watir_browser])
|
117
|
+
elements = watir_page_object.select_list_elements(:id => 'blah')
|
118
|
+
elements[0].should be_instance_of PageObject::Elements::SelectList
|
119
|
+
end
|
120
|
+
|
121
|
+
it "should find all select list elements using no identifier" do
|
122
|
+
watir_browser.should_receive(:select_lists).with({}).and_return([watir_browser])
|
123
|
+
watir_page_object.select_list_elements
|
124
|
+
end
|
125
|
+
|
126
|
+
it "should find a link element" do
|
127
|
+
watir_browser.should_receive(:link).with(:id => 'blah').and_return(watir_browser)
|
128
|
+
element = watir_page_object.link_element(:id => 'blah')
|
129
|
+
element.should be_instance_of PageObject::Elements::Link
|
130
|
+
end
|
131
|
+
|
132
|
+
it "should find a link element using a default identifier" do
|
133
|
+
watir_browser.should_receive(:link).with(:index => 0).and_return(watir_browser)
|
134
|
+
watir_page_object.link_element
|
135
|
+
end
|
136
|
+
|
137
|
+
it "should find all link elements" do
|
138
|
+
watir_browser.should_receive(:links).with(:id => 'blah').and_return([watir_browser])
|
139
|
+
elements = watir_page_object.link_elements(:id => 'blah')
|
140
|
+
elements[0].should be_instance_of PageObject::Elements::Link
|
141
|
+
end
|
142
|
+
|
143
|
+
it "should find all links using no identifier" do
|
144
|
+
watir_browser.should_receive(:links).with({}).and_return([watir_browser])
|
145
|
+
watir_page_object.link_elements
|
146
|
+
end
|
147
|
+
|
148
|
+
it "should find a check box" do
|
149
|
+
watir_browser.should_receive(:checkbox).with(:id => 'blah').and_return(watir_browser)
|
150
|
+
element = watir_page_object.checkbox_element(:id => 'blah')
|
151
|
+
element.should be_instance_of PageObject::Elements::CheckBox
|
152
|
+
end
|
153
|
+
|
154
|
+
it "should find a check box using a default identifier" do
|
155
|
+
watir_browser.should_receive(:checkbox).with(:index => 0).and_return(watir_browser)
|
156
|
+
watir_page_object.checkbox_element
|
157
|
+
end
|
158
|
+
|
159
|
+
it "should find all check box elements" do
|
160
|
+
watir_browser.should_receive(:checkboxes).with(:id => 'blah').and_return([watir_browser])
|
161
|
+
elements = watir_page_object.checkbox_elements(:id => 'blah')
|
162
|
+
elements[0].should be_instance_of PageObject::Elements::CheckBox
|
163
|
+
end
|
164
|
+
|
165
|
+
it "should find all check box elements using no identifier" do
|
166
|
+
watir_browser.should_receive(:checkboxes).with({}).and_return([watir_browser])
|
167
|
+
watir_page_object.checkbox_elements
|
168
|
+
end
|
169
|
+
|
170
|
+
it "should find a radio button" do
|
171
|
+
watir_browser.should_receive(:radio).with(:id => 'blah').and_return(watir_browser)
|
172
|
+
element = watir_page_object.radio_button_element(:id => 'blah')
|
173
|
+
element.should be_instance_of PageObject::Elements::RadioButton
|
174
|
+
end
|
175
|
+
|
176
|
+
it "should find a radio button using a default identifier" do
|
177
|
+
watir_browser.should_receive(:radio).with(:index => 0).and_return(watir_browser)
|
178
|
+
watir_page_object.radio_button_element
|
179
|
+
end
|
180
|
+
|
181
|
+
it "should find all radio buttons" do
|
182
|
+
watir_browser.should_receive(:radios).with(:id => 'blah').and_return([watir_browser])
|
183
|
+
elements = watir_page_object.radio_button_elements(:id => 'blah')
|
184
|
+
elements[0].should be_instance_of PageObject::Elements::RadioButton
|
185
|
+
end
|
186
|
+
|
187
|
+
it "should find all radio buttons using no identifier" do
|
188
|
+
watir_browser.should_receive(:radios).with({}).and_return([watir_browser])
|
189
|
+
watir_page_object.radio_button_elements
|
190
|
+
end
|
191
|
+
|
192
|
+
it "should find a div" do
|
193
|
+
watir_browser.should_receive(:div).with(:id => 'blah').and_return(watir_browser)
|
194
|
+
element = watir_page_object.div_element(:id => 'blah')
|
195
|
+
element.should be_instance_of PageObject::Elements::Div
|
196
|
+
end
|
197
|
+
|
198
|
+
it "should find a div using a default identifier" do
|
199
|
+
watir_browser.should_receive(:div).with(:index => 0).and_return(watir_browser)
|
200
|
+
watir_page_object.div_element
|
201
|
+
end
|
202
|
+
|
203
|
+
it "should find all div elements" do
|
204
|
+
watir_browser.should_receive(:divs).with(:id => 'blah').and_return([watir_browser])
|
205
|
+
elements = watir_page_object.div_elements(:id => 'blah')
|
206
|
+
elements[0].should be_instance_of PageObject::Elements::Div
|
207
|
+
end
|
208
|
+
|
209
|
+
it "should find all div elements using no identifier" do
|
210
|
+
watir_browser.should_receive(:divs).with({}).and_return([watir_browser])
|
211
|
+
watir_page_object.div_elements
|
212
|
+
end
|
213
|
+
|
214
|
+
it "should find a span" do
|
215
|
+
watir_browser.should_receive(:span).with(:id => 'blah').and_return(watir_browser)
|
216
|
+
element = watir_page_object.span_element(:id => 'blah')
|
217
|
+
element.should be_instance_of PageObject::Elements::Span
|
218
|
+
end
|
219
|
+
|
220
|
+
it "should find a span using a default identifier" do
|
221
|
+
watir_browser.should_receive(:span).with(:index => 0).and_return(watir_browser)
|
222
|
+
watir_page_object.span_element
|
223
|
+
end
|
224
|
+
|
225
|
+
it "should find all span elements" do
|
226
|
+
watir_browser.should_receive(:spans).with(:id => 'blah').and_return([watir_browser])
|
227
|
+
elements = watir_page_object.span_elements(:id => 'blah')
|
228
|
+
elements[0].should be_instance_of PageObject::Elements::Span
|
229
|
+
end
|
230
|
+
|
231
|
+
it "should find all span elements using no identifier" do
|
232
|
+
watir_browser.should_receive(:spans).with({}).and_return([watir_browser])
|
233
|
+
watir_page_object.span_elements
|
234
|
+
end
|
235
|
+
|
236
|
+
it "should find a table" do
|
237
|
+
watir_browser.should_receive(:table).with(:id => 'blah').and_return(watir_browser)
|
238
|
+
element = watir_page_object.table_element(:id => 'blah')
|
239
|
+
element.should be_instance_of PageObject::Elements::Table
|
240
|
+
end
|
241
|
+
|
242
|
+
it "should find a table using a default identifier" do
|
243
|
+
watir_browser.should_receive(:table).with(:index => 0).and_return(watir_browser)
|
244
|
+
watir_page_object.table_element
|
245
|
+
end
|
246
|
+
|
247
|
+
it "should find all table elements" do
|
248
|
+
watir_browser.should_receive(:tables).with(:id => 'blah').and_return([watir_browser])
|
249
|
+
elements = watir_page_object.table_elements(:id => 'blah')
|
250
|
+
elements[0].should be_instance_of PageObject::Elements::Table
|
251
|
+
end
|
252
|
+
|
253
|
+
it "should find all table elements using no identifier" do
|
254
|
+
watir_browser.should_receive(:tables).with({}).and_return([watir_browser])
|
255
|
+
watir_page_object.table_elements
|
256
|
+
end
|
257
|
+
|
258
|
+
it "should find a table cell" do
|
259
|
+
watir_browser.should_receive(:td).with(:id => 'blah').and_return(watir_browser)
|
260
|
+
element = watir_page_object.cell_element(:id => 'blah')
|
261
|
+
element.should be_instance_of PageObject::Elements::TableCell
|
262
|
+
end
|
263
|
+
|
264
|
+
it "should find a table cell using a default identifier" do
|
265
|
+
watir_browser.should_receive(:td).with(:index => 0).and_return(watir_browser)
|
266
|
+
watir_page_object.cell_element
|
267
|
+
end
|
268
|
+
|
269
|
+
it "should find all table cells" do
|
270
|
+
watir_browser.should_receive(:tds).with(:id => 'blah').and_return([watir_browser])
|
271
|
+
elements = watir_page_object.cell_elements(:id => 'blah')
|
272
|
+
elements[0].should be_instance_of PageObject::Elements::TableCell
|
273
|
+
end
|
274
|
+
|
275
|
+
it "should find all table cells using no identifier" do
|
276
|
+
watir_browser.should_receive(:tds).with({}).and_return([watir_browser])
|
277
|
+
watir_page_object.cell_elements
|
278
|
+
end
|
279
|
+
|
280
|
+
it "should find an image" do
|
281
|
+
watir_browser.should_receive(:image).with(:id => 'blah').and_return(watir_browser)
|
282
|
+
element = watir_page_object.image_element(:id => 'blah')
|
283
|
+
element.should be_instance_of PageObject::Elements::Image
|
284
|
+
end
|
285
|
+
|
286
|
+
it "should find an image using a default identifier" do
|
287
|
+
watir_browser.should_receive(:image).with(:index => 0).and_return(watir_browser)
|
288
|
+
watir_page_object.image_element
|
289
|
+
end
|
290
|
+
|
291
|
+
it "should find all images" do
|
292
|
+
watir_browser.should_receive(:images).with(:id => 'blah').and_return([watir_browser])
|
293
|
+
elements = watir_page_object.image_elements(:id => 'blah')
|
294
|
+
elements[0].should be_instance_of PageObject::Elements::Image
|
295
|
+
end
|
296
|
+
|
297
|
+
it "should find all images using no identifier" do
|
298
|
+
watir_browser.should_receive(:images).with({}).and_return([watir_browser])
|
299
|
+
watir_page_object.image_elements
|
300
|
+
end
|
301
|
+
|
302
|
+
it "should find a form" do
|
303
|
+
watir_browser.should_receive(:form).with(:id => 'blah').and_return(watir_browser)
|
304
|
+
element = watir_page_object.form_element(:id => 'blah')
|
305
|
+
element.should be_instance_of PageObject::Elements::Form
|
306
|
+
end
|
307
|
+
|
308
|
+
it "should find a form using a default identifier" do
|
309
|
+
watir_browser.should_receive(:form).with(:index => 0).and_return(watir_browser)
|
310
|
+
watir_page_object.form_element
|
311
|
+
end
|
312
|
+
|
313
|
+
it "should find all forms" do
|
314
|
+
watir_browser.should_receive(:forms).with(:id => 'blah').and_return([watir_browser])
|
315
|
+
elements = watir_page_object.form_elements(:id => 'blah')
|
316
|
+
elements[0].should be_instance_of PageObject::Elements::Form
|
317
|
+
end
|
318
|
+
|
319
|
+
it "should find all forms using no identifier" do
|
320
|
+
watir_browser.should_receive(:forms).with({}).and_return([watir_browser])
|
321
|
+
watir_page_object.form_elements
|
322
|
+
end
|
323
|
+
|
324
|
+
it "should find a list item" do
|
325
|
+
watir_browser.should_receive(:li).with(:id => 'blah').and_return(watir_browser)
|
326
|
+
element = watir_page_object.list_item_element(:id => 'blah')
|
327
|
+
element.should be_instance_of PageObject::Elements::ListItem
|
328
|
+
end
|
329
|
+
|
330
|
+
it "should find a list item using a default identifier" do
|
331
|
+
watir_browser.should_receive(:li).with(:index => 0).and_return(watir_browser)
|
332
|
+
watir_page_object.list_item_element
|
333
|
+
end
|
334
|
+
|
335
|
+
it "should find all list items" do
|
336
|
+
watir_browser.should_receive(:lis).with(:id => 'blah').and_return([watir_browser])
|
337
|
+
elements = watir_page_object.list_item_elements(:id => 'blah')
|
338
|
+
elements[0].should be_instance_of PageObject::Elements::ListItem
|
339
|
+
end
|
340
|
+
|
341
|
+
it "should find all list items using no parameter" do
|
342
|
+
watir_browser.should_receive(:lis).with({}).and_return([watir_browser])
|
343
|
+
watir_page_object.list_item_elements
|
344
|
+
end
|
345
|
+
|
346
|
+
it "should find an unordered list" do
|
347
|
+
watir_browser.should_receive(:ul).with(:id => 'blah').and_return(watir_browser)
|
348
|
+
element = watir_page_object.unordered_list_element(:id => 'blah')
|
349
|
+
element.should be_instance_of PageObject::Elements::UnorderedList
|
350
|
+
end
|
351
|
+
|
352
|
+
it "should find an unordered list using a default identifier" do
|
353
|
+
watir_browser.should_receive(:ul).with(:index => 0).and_return(watir_browser)
|
354
|
+
watir_page_object.unordered_list_element
|
355
|
+
end
|
356
|
+
|
357
|
+
it "should find all unordered lists" do
|
358
|
+
watir_browser.should_receive(:uls).with(:id => 'blah').and_return([watir_browser])
|
359
|
+
elements = watir_page_object.unordered_list_elements(:id => 'blah')
|
360
|
+
elements[0].should be_instance_of PageObject::Elements::UnorderedList
|
361
|
+
end
|
362
|
+
|
363
|
+
it "should find all unordered lists using no parameters" do
|
364
|
+
watir_browser.should_receive(:uls).with({}).and_return([watir_browser])
|
365
|
+
watir_page_object.unordered_list_elements
|
366
|
+
end
|
367
|
+
|
368
|
+
it "should find an ordered list" do
|
369
|
+
watir_browser.should_receive(:ol).with(:id => 'blah').and_return(watir_browser)
|
370
|
+
element = watir_page_object.ordered_list_element(:id => 'blah')
|
371
|
+
element.should be_instance_of PageObject::Elements::OrderedList
|
372
|
+
end
|
373
|
+
|
374
|
+
it "should find an orderd list using a default identifier" do
|
375
|
+
watir_browser.should_receive(:ol).with(:index => 0).and_return(watir_browser)
|
376
|
+
watir_page_object.ordered_list_element
|
377
|
+
end
|
378
|
+
|
379
|
+
it "should find all ordered lists" do
|
380
|
+
watir_browser.should_receive(:ols).with(:id => 'blah').and_return([watir_browser])
|
381
|
+
elements = watir_page_object.ordered_list_elements(:id => 'blah')
|
382
|
+
elements[0].should be_instance_of PageObject::Elements::OrderedList
|
383
|
+
end
|
384
|
+
|
385
|
+
it "should find all orderd lists using no parameters" do
|
386
|
+
watir_browser.should_receive(:ols).with({}).and_return([watir_browser])
|
387
|
+
watir_page_object.ordered_list_elements
|
388
|
+
end
|
389
|
+
|
390
|
+
it "should find a h1 element" do
|
391
|
+
watir_browser.should_receive(:h1).with(:id => 'blah').and_return(watir_browser)
|
392
|
+
element = watir_page_object.h1_element(:id => 'blah')
|
393
|
+
element.should be_instance_of PageObject::Elements::Heading
|
394
|
+
end
|
395
|
+
|
396
|
+
it "should find a h1 element using a default identifier" do
|
397
|
+
watir_browser.should_receive(:h1).with(:index => 0).and_return(watir_browser)
|
398
|
+
watir_page_object.h1_element
|
399
|
+
end
|
400
|
+
|
401
|
+
it "should find all h1 elements" do
|
402
|
+
watir_browser.should_receive(:h1s).with(:id => 'blah').and_return([watir_browser])
|
403
|
+
elements = watir_page_object.h1_elements(:id => 'blah')
|
404
|
+
elements[0].should be_instance_of PageObject::Elements::Heading
|
405
|
+
end
|
406
|
+
|
407
|
+
it "should find all h1 elements using no parameters" do
|
408
|
+
watir_browser.should_receive(:h1s).with({}).and_return([watir_browser])
|
409
|
+
watir_page_object.h1_elements
|
410
|
+
end
|
411
|
+
|
412
|
+
it "should find a h2 element" do
|
413
|
+
watir_browser.should_receive(:h2).with(:id => 'blah').and_return(watir_browser)
|
414
|
+
element = watir_page_object.h2_element(:id => 'blah')
|
415
|
+
element.should be_instance_of PageObject::Elements::Heading
|
416
|
+
end
|
417
|
+
|
418
|
+
it "should find a h2 element using default identifier" do
|
419
|
+
watir_browser.should_receive(:h2).with(:index => 0).and_return(watir_browser)
|
420
|
+
watir_page_object.h2_element
|
421
|
+
end
|
422
|
+
|
423
|
+
it "should find all h2 elements" do
|
424
|
+
watir_browser.should_receive(:h2s).with(:id => 'blah').and_return([watir_browser])
|
425
|
+
elements = watir_page_object.h2_elements(:id => 'blah')
|
426
|
+
elements[0].should be_instance_of PageObject::Elements::Heading
|
427
|
+
end
|
428
|
+
|
429
|
+
it "should find all h2 elements using no identifier" do
|
430
|
+
watir_browser.should_receive(:h2s).with({}).and_return([watir_browser])
|
431
|
+
watir_page_object.h2_elements
|
432
|
+
end
|
433
|
+
|
434
|
+
it "should find a h3 element" do
|
435
|
+
watir_browser.should_receive(:h3).with(:id => 'blah').and_return(watir_browser)
|
436
|
+
element = watir_page_object.h3_element(:id => 'blah')
|
437
|
+
element.should be_instance_of PageObject::Elements::Heading
|
438
|
+
end
|
439
|
+
|
440
|
+
it "should find a h3 element using a default identifier" do
|
441
|
+
watir_browser.should_receive(:h3).with(:index => 0).and_return(watir_browser)
|
442
|
+
watir_page_object.h3_element
|
443
|
+
end
|
444
|
+
|
445
|
+
it "should find all h3 elements" do
|
446
|
+
watir_browser.should_receive(:h3s).with(:id => 'blah').and_return([watir_browser])
|
447
|
+
elements = watir_page_object.h3_elements(:id => 'blah')
|
448
|
+
elements[0].should be_instance_of PageObject::Elements::Heading
|
449
|
+
end
|
450
|
+
|
451
|
+
it "should find all h3 elements using no identifiers" do
|
452
|
+
watir_browser.should_receive(:h3s).with({}).and_return([watir_browser])
|
453
|
+
watir_page_object.h3_elements
|
454
|
+
end
|
455
|
+
|
456
|
+
it "should find a h4 element" do
|
457
|
+
watir_browser.should_receive(:h4).with(:id => 'blah').and_return(watir_browser)
|
458
|
+
element = watir_page_object.h4_element(:id => 'blah')
|
459
|
+
element.should be_instance_of PageObject::Elements::Heading
|
460
|
+
end
|
461
|
+
|
462
|
+
it "should find a h4 element using a default identifier" do
|
463
|
+
watir_browser.should_receive(:h4).with(:index => 0).and_return(watir_browser)
|
464
|
+
watir_page_object.h4_element
|
465
|
+
end
|
466
|
+
|
467
|
+
it "should find all h4 elements" do
|
468
|
+
watir_browser.should_receive(:h4s).with(:id => 'blah').and_return([watir_browser])
|
469
|
+
elements = watir_page_object.h4_elements(:id => 'blah')
|
470
|
+
elements[0].should be_instance_of PageObject::Elements::Heading
|
471
|
+
end
|
472
|
+
|
473
|
+
it "should find all h4 elements using no identifier" do
|
474
|
+
watir_browser.should_receive(:h4s).with({}).and_return([watir_browser])
|
475
|
+
watir_page_object.h4_elements
|
476
|
+
end
|
477
|
+
|
478
|
+
it "should find a h5 element" do
|
479
|
+
watir_browser.should_receive(:h5).with(:id => 'blah').and_return(watir_browser)
|
480
|
+
element = watir_page_object.h5_element(:id => 'blah')
|
481
|
+
element.should be_instance_of PageObject::Elements::Heading
|
482
|
+
end
|
483
|
+
|
484
|
+
it "should find a h5 element using a default identifier" do
|
485
|
+
watir_browser.should_receive(:h5).with(:index => 0).and_return(watir_browser)
|
486
|
+
watir_page_object.h5_element
|
487
|
+
end
|
488
|
+
|
489
|
+
it "should find all h5 elements" do
|
490
|
+
watir_browser.should_receive(:h5s).with(:id => 'blah').and_return([watir_browser])
|
491
|
+
elements = watir_page_object.h5_elements(:id => 'blah')
|
492
|
+
elements[0].should be_instance_of PageObject::Elements::Heading
|
493
|
+
end
|
494
|
+
|
495
|
+
it "should find all h5 elements using no identifier" do
|
496
|
+
watir_browser.should_receive(:h5s).with({}).and_return([watir_browser])
|
497
|
+
watir_page_object.h5_elements
|
498
|
+
end
|
499
|
+
|
500
|
+
it "should find a h6 element" do
|
501
|
+
watir_browser.should_receive(:h6).with(:id => 'blah').and_return(watir_browser)
|
502
|
+
element = watir_page_object.h6_element(:id => 'blah')
|
503
|
+
element.should be_instance_of PageObject::Elements::Heading
|
504
|
+
end
|
505
|
+
|
506
|
+
it "should find a h6 element using a default identifier" do
|
507
|
+
watir_browser.should_receive(:h6).with(:index => 0).and_return(watir_browser)
|
508
|
+
watir_page_object.h6_element
|
509
|
+
end
|
510
|
+
|
511
|
+
it "should find all h6 elements" do
|
512
|
+
watir_browser.should_receive(:h6s).with(:id => 'blah').and_return([watir_browser])
|
513
|
+
elements = watir_page_object.h6_elements(:id => 'blah')
|
514
|
+
elements[0].should be_instance_of PageObject::Elements::Heading
|
515
|
+
end
|
516
|
+
|
517
|
+
it "should find all h6 elements using no identifier" do
|
518
|
+
watir_browser.should_receive(:h6s).with({}).and_return([watir_browser])
|
519
|
+
watir_page_object.h6_elements
|
520
|
+
end
|
521
|
+
|
522
|
+
it "should find a paragraph element" do
|
523
|
+
watir_browser.should_receive(:p).with(:id => 'blah').and_return(watir_browser)
|
524
|
+
element = watir_page_object.paragraph_element(:id => 'blah')
|
525
|
+
element.should be_instance_of PageObject::Elements::Paragraph
|
526
|
+
end
|
527
|
+
|
528
|
+
it "should find a paragraph element using a default identifier" do
|
529
|
+
watir_browser.should_receive(:p).with(:index => 0).and_return(watir_browser)
|
530
|
+
watir_page_object.paragraph_element
|
531
|
+
end
|
532
|
+
|
533
|
+
it "should find all paragraph elements" do
|
534
|
+
watir_browser.should_receive(:ps).with(:id => 'blah').and_return([watir_browser])
|
535
|
+
elements = watir_page_object.paragraph_elements(:id => 'blah')
|
536
|
+
elements[0].should be_instance_of PageObject::Elements::Paragraph
|
537
|
+
end
|
538
|
+
|
539
|
+
it "should find all paragraph elements using no identifier" do
|
540
|
+
watir_browser.should_receive(:ps).with({}).and_return([watir_browser])
|
541
|
+
watir_page_object.paragraph_elements
|
542
|
+
end
|
543
|
+
|
544
|
+
it "should find a label" do
|
545
|
+
watir_browser.should_receive(:label).with(:id => 'blah').and_return(watir_browser)
|
546
|
+
element = watir_page_object.label_element(:id => 'blah')
|
547
|
+
element.should be_instance_of PageObject::Elements::Label
|
548
|
+
end
|
549
|
+
|
550
|
+
it "should find a label element using default parameters" do
|
551
|
+
watir_browser.should_receive(:label).with(:index => 0).and_return(watir_browser)
|
552
|
+
watir_page_object.label_element
|
553
|
+
end
|
554
|
+
|
555
|
+
it "should find all label elements" do
|
556
|
+
watir_browser.should_receive(:labels).with(:id => 'blah').and_return([watir_browser])
|
557
|
+
elements = watir_page_object.label_elements(:id => 'blah')
|
558
|
+
elements[0].should be_instance_of PageObject::Elements::Label
|
559
|
+
end
|
560
|
+
|
561
|
+
it "should find all label elements using no parameters" do
|
562
|
+
watir_browser.should_receive(:labels).with({}).and_return([watir_browser])
|
563
|
+
watir_page_object.label_elements
|
564
|
+
end
|
565
|
+
|
566
|
+
it "should find a file field element" do
|
567
|
+
watir_browser.should_receive(:file_field).with(:id => 'blah').and_return(watir_browser)
|
568
|
+
element = watir_page_object.file_field_element(:id => 'blah')
|
569
|
+
element.should be_instance_of PageObject::Elements::FileField
|
570
|
+
end
|
571
|
+
|
572
|
+
it "should find a file field element using a default identifier" do
|
573
|
+
watir_browser.should_receive(:file_field).with(:index => 0).and_return(watir_browser)
|
574
|
+
watir_page_object.file_field_element
|
575
|
+
end
|
576
|
+
|
577
|
+
it "should find all file field elements" do
|
578
|
+
watir_browser.should_receive(:file_fields).with(:id => 'blah').and_return([watir_browser])
|
579
|
+
element = watir_page_object.file_field_elements(:id => 'blah')
|
580
|
+
element[0].should be_instance_of PageObject::Elements::FileField
|
581
|
+
end
|
582
|
+
|
583
|
+
it "should find all file fields using no identifier" do
|
584
|
+
watir_browser.should_receive(:file_fields).with({}).and_return([watir_browser])
|
585
|
+
watir_page_object.file_field_elements
|
586
|
+
end
|
587
|
+
|
588
|
+
it "should find an area element" do
|
589
|
+
watir_browser.should_receive(:area).with(:id => 'blah').and_return(watir_browser)
|
590
|
+
element = watir_page_object.area_element(:id => 'blah')
|
591
|
+
element.should be_instance_of PageObject::Elements::Area
|
592
|
+
end
|
593
|
+
|
594
|
+
it "should find an area element using a default identifier" do
|
595
|
+
watir_browser.should_receive(:area).with(:index => 0).and_return(watir_browser)
|
596
|
+
watir_page_object.area_element
|
597
|
+
end
|
598
|
+
|
599
|
+
it "should find all area elements" do
|
600
|
+
watir_browser.should_receive(:areas).with(:id => 'blah').and_return([watir_browser])
|
601
|
+
elements = watir_page_object.area_elements(:id => 'blah')
|
602
|
+
elements[0].should be_instance_of PageObject::Elements::Area
|
603
|
+
end
|
604
|
+
|
605
|
+
it "should find all areas with no identifier" do
|
606
|
+
watir_browser.should_receive(:areas).with({}).and_return([watir_browser])
|
607
|
+
watir_page_object.area_elements
|
608
|
+
end
|
609
|
+
|
610
|
+
it "should find a canvas element" do
|
611
|
+
watir_browser.should_receive(:canvas).with(:id => 'blah').and_return(watir_browser)
|
612
|
+
element = watir_page_object.canvas_element(:id => 'blah')
|
613
|
+
element.should be_instance_of PageObject::Elements::Canvas
|
614
|
+
end
|
615
|
+
|
616
|
+
it "should find a canvas element using a default identifier" do
|
617
|
+
watir_browser.should_receive(:canvas).with(:index => 0).and_return(watir_browser)
|
618
|
+
watir_page_object.canvas_element
|
619
|
+
end
|
620
|
+
|
621
|
+
it "should find all canvas elements" do
|
622
|
+
watir_browser.should_receive(:canvases).with(:id => 'blah').and_return([watir_browser])
|
623
|
+
elements = watir_page_object.canvas_elements(:id => 'blah')
|
624
|
+
elements[0].should be_instance_of PageObject::Elements::Canvas
|
625
|
+
end
|
626
|
+
|
627
|
+
it "should find all canvases with no identifier" do
|
628
|
+
watir_browser.should_receive(:canvases).with({}).and_return([watir_browser])
|
629
|
+
watir_page_object.canvas_elements
|
630
|
+
end
|
631
|
+
|
632
|
+
it "should find an audio element" do
|
633
|
+
watir_browser.should_receive(:audio).with(:id => 'blah').and_return(watir_browser)
|
634
|
+
element = watir_page_object.audio_element(:id => 'blah')
|
635
|
+
element.should be_instance_of PageObject::Elements::Audio
|
636
|
+
end
|
637
|
+
|
638
|
+
it "should find an audio element using a default identifier" do
|
639
|
+
watir_browser.should_receive(:audio).with(:index => 0).and_return(watir_browser)
|
640
|
+
watir_page_object.audio_element
|
641
|
+
end
|
642
|
+
|
643
|
+
it "should find all audio elements" do
|
644
|
+
watir_browser.should_receive(:audios).with(:id => 'blah').and_return([watir_browser])
|
645
|
+
elements = watir_page_object.audio_elements(:id => 'blah')
|
646
|
+
elements[0].should be_instance_of PageObject::Elements::Audio
|
647
|
+
end
|
648
|
+
|
649
|
+
it "should find all audio elements with no identifier" do
|
650
|
+
watir_browser.should_receive(:audios).with({}).and_return([watir_browser])
|
651
|
+
watir_page_object.audio_elements
|
652
|
+
end
|
653
|
+
|
654
|
+
it "should find a video element" do
|
655
|
+
watir_browser.should_receive(:video).with(:id => 'blah').and_return(watir_browser)
|
656
|
+
element = watir_page_object.video_element(:id => 'blah')
|
657
|
+
element.should be_instance_of PageObject::Elements::Video
|
658
|
+
end
|
659
|
+
|
660
|
+
it "should find a video element using a default identifier" do
|
661
|
+
watir_browser.should_receive(:video).with(:index => 0).and_return(watir_browser)
|
662
|
+
watir_page_object.video_element
|
663
|
+
end
|
664
|
+
|
665
|
+
it "should find all video elements" do
|
666
|
+
watir_browser.should_receive(:videos).with(:id => 'blah').and_return([watir_browser])
|
667
|
+
elements = watir_page_object.video_elements(:id => 'blah')
|
668
|
+
elements[0].should be_instance_of PageObject::Elements::Video
|
669
|
+
end
|
670
|
+
|
671
|
+
it "should find all video elements with no identifier" do
|
672
|
+
watir_browser.should_receive(:videos).with({}).and_return([watir_browser])
|
673
|
+
watir_page_object.video_elements
|
674
|
+
end
|
675
|
+
|
676
|
+
it "should find an element" do
|
677
|
+
watir_browser.should_receive(:audio).with(:id => 'blah').and_return(watir_browser)
|
678
|
+
element = watir_page_object.element(:audio, :id => 'blah')
|
679
|
+
element.should be_instance_of PageObject::Elements::Element
|
680
|
+
end
|
681
|
+
|
682
|
+
it "should find an element using a default identifier" do
|
683
|
+
watir_browser.should_receive(:audio).with(:index => 0).and_return(watir_browser)
|
684
|
+
watir_page_object.element(:audio)
|
685
|
+
end
|
686
|
+
end
|
687
|
+
|
688
|
+
context "when using Selenium" do
|
689
|
+
let(:selenium_browser) { mock_selenium_browser }
|
690
|
+
let(:selenium_page_object) { ElementLocatorsTestPageObject.new(selenium_browser) }
|
691
|
+
|
692
|
+
it "should find a button element" do
|
693
|
+
selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
694
|
+
element = selenium_page_object.button_element(:id => 'blah')
|
695
|
+
element.should be_instance_of PageObject::Elements::Button
|
696
|
+
end
|
697
|
+
|
698
|
+
it "should find all button elements" do
|
699
|
+
selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
700
|
+
elements = selenium_page_object.button_elements(:id => 'blah')
|
701
|
+
elements[0].should be_instance_of PageObject::Elements::Button
|
702
|
+
end
|
703
|
+
|
704
|
+
it "should find a text field element" do
|
705
|
+
selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
706
|
+
element = selenium_page_object.text_field_element(:id => 'blah')
|
707
|
+
element.should be_instance_of PageObject::Elements::TextField
|
708
|
+
end
|
709
|
+
|
710
|
+
it "should find all text field elements" do
|
711
|
+
selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
712
|
+
elements = selenium_page_object.text_field_elements(:id => 'blah')
|
713
|
+
elements[0].should be_instance_of PageObject::Elements::TextField
|
714
|
+
end
|
715
|
+
|
716
|
+
it "should find a hidden field element" do
|
717
|
+
selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
718
|
+
element = selenium_page_object.hidden_field_element(:id => 'blah')
|
719
|
+
element.should be_instance_of PageObject::Elements::HiddenField
|
720
|
+
end
|
721
|
+
|
722
|
+
it "should find all hidden field elements" do
|
723
|
+
selenium_browser.should_receive(:find_elements).with(:id, "blah").and_return([selenium_browser])
|
724
|
+
elements = selenium_page_object.hidden_field_elements(:id => 'blah')
|
725
|
+
elements[0].should be_instance_of PageObject::Elements::HiddenField
|
726
|
+
|
727
|
+
end
|
728
|
+
|
729
|
+
it "should find a text area element" do
|
730
|
+
selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
731
|
+
element = selenium_page_object.text_area_element(:id => 'blah')
|
732
|
+
element.should be_instance_of PageObject::Elements::TextArea
|
733
|
+
end
|
734
|
+
|
735
|
+
it "should find all text area elements" do
|
736
|
+
selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
737
|
+
elements = selenium_page_object.text_area_elements(:id => 'blah')
|
738
|
+
elements[0].should be_instance_of PageObject::Elements::TextArea
|
739
|
+
end
|
740
|
+
|
741
|
+
it "should find a select list element" do
|
742
|
+
selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
743
|
+
element = selenium_page_object.select_list_element(:id => 'blah')
|
744
|
+
element.should be_instance_of PageObject::Elements::SelectList
|
745
|
+
end
|
746
|
+
|
747
|
+
it "should find all select list elements" do
|
748
|
+
selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
749
|
+
elements = selenium_page_object.select_list_elements(:id => 'blah')
|
750
|
+
elements[0].should be_instance_of PageObject::Elements::SelectList
|
751
|
+
end
|
752
|
+
|
753
|
+
it "should find a link element" do
|
754
|
+
selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
755
|
+
element = selenium_page_object.link_element(:id => 'blah')
|
756
|
+
element.should be_instance_of PageObject::Elements::Link
|
757
|
+
end
|
758
|
+
|
759
|
+
it "should find all link elements" do
|
760
|
+
selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
761
|
+
elements = selenium_page_object.link_elements(:id => 'blah')
|
762
|
+
elements[0].should be_instance_of PageObject::Elements::Link
|
763
|
+
end
|
764
|
+
|
765
|
+
it "should find a check box" do
|
766
|
+
selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
767
|
+
element = selenium_page_object.checkbox_element(:id => 'blah')
|
768
|
+
element.should be_instance_of PageObject::Elements::CheckBox
|
769
|
+
end
|
770
|
+
|
771
|
+
it "should find all checkbox elements" do
|
772
|
+
selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
773
|
+
elements = selenium_page_object.checkbox_elements(:id => 'blah')
|
774
|
+
elements[0].should be_instance_of PageObject::Elements::CheckBox
|
775
|
+
end
|
776
|
+
|
777
|
+
it "should find a radio button" do
|
778
|
+
selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
779
|
+
element = selenium_page_object.radio_button_element(:id => 'blah')
|
780
|
+
element.should be_instance_of PageObject::Elements::RadioButton
|
781
|
+
end
|
782
|
+
|
783
|
+
it "should find all radio button elements" do
|
784
|
+
selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
785
|
+
elements = selenium_page_object.radio_button_elements(:id => 'blah')
|
786
|
+
elements[0].should be_instance_of PageObject::Elements::RadioButton
|
787
|
+
end
|
788
|
+
|
789
|
+
it "should find a div" do
|
790
|
+
selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
791
|
+
element = selenium_page_object.div_element(:id => 'blah')
|
792
|
+
element.should be_instance_of PageObject::Elements::Div
|
793
|
+
end
|
794
|
+
|
795
|
+
it "should find all div elements" do
|
796
|
+
selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
797
|
+
elements = selenium_page_object.div_elements(:id => 'blah')
|
798
|
+
elements[0].should be_instance_of PageObject::Elements::Div
|
799
|
+
end
|
800
|
+
|
801
|
+
it "should find a span" do
|
802
|
+
selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
803
|
+
element = selenium_page_object.span_element(:id => 'blah')
|
804
|
+
element.should be_instance_of PageObject::Elements::Span
|
805
|
+
end
|
806
|
+
|
807
|
+
it "should find all span elements" do
|
808
|
+
selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
809
|
+
elements = selenium_page_object.span_elements(:id => 'blah')
|
810
|
+
elements[0].should be_instance_of PageObject::Elements::Span
|
811
|
+
end
|
812
|
+
|
813
|
+
it "should find a table" do
|
814
|
+
selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
815
|
+
element = selenium_page_object.table_element(:id => 'blah')
|
816
|
+
element.should be_instance_of PageObject::Elements::Table
|
817
|
+
end
|
818
|
+
|
819
|
+
it "should find all table elements" do
|
820
|
+
selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
821
|
+
elements = selenium_page_object.table_elements(:id => 'blah')
|
822
|
+
elements[0].should be_instance_of PageObject::Elements::Table
|
823
|
+
end
|
824
|
+
|
825
|
+
it "should find a table cell" do
|
826
|
+
selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
827
|
+
element = selenium_page_object.cell_element(:id => 'blah')
|
828
|
+
element.should be_instance_of PageObject::Elements::TableCell
|
829
|
+
end
|
830
|
+
|
831
|
+
it "should find all table cell elements" do
|
832
|
+
selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
833
|
+
elements = selenium_page_object.cell_elements(:id => 'blah')
|
834
|
+
elements[0].should be_instance_of PageObject::Elements::TableCell
|
835
|
+
end
|
836
|
+
|
837
|
+
it "should find an image" do
|
838
|
+
selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
839
|
+
element = selenium_page_object.image_element(:id => 'blah')
|
840
|
+
element.should be_instance_of PageObject::Elements::Image
|
841
|
+
end
|
842
|
+
|
843
|
+
it "should find all image elements" do
|
844
|
+
selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
845
|
+
elements = selenium_page_object.image_elements(:id => 'blah')
|
846
|
+
elements[0].should be_instance_of PageObject::Elements::Image
|
847
|
+
end
|
848
|
+
|
849
|
+
it "should find a form" do
|
850
|
+
selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
851
|
+
element = selenium_page_object.form_element(:id => 'blah')
|
852
|
+
element.should be_instance_of PageObject::Elements::Form
|
853
|
+
end
|
854
|
+
|
855
|
+
it "should find all forms" do
|
856
|
+
selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
857
|
+
elements = selenium_page_object.form_elements(:id => 'blah')
|
858
|
+
elements[0].should be_instance_of PageObject::Elements::Form
|
859
|
+
end
|
860
|
+
|
861
|
+
it "should find a list item" do
|
862
|
+
selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
863
|
+
element = selenium_page_object.list_item_element(:id => 'blah')
|
864
|
+
element.should be_instance_of PageObject::Elements::ListItem
|
865
|
+
end
|
866
|
+
|
867
|
+
it "should find all list items" do
|
868
|
+
selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
869
|
+
element = selenium_page_object.list_item_elements(:id => 'blah')
|
870
|
+
element[0].should be_instance_of PageObject::Elements::ListItem
|
871
|
+
end
|
872
|
+
|
873
|
+
it "should find an unordered list" do
|
874
|
+
selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
875
|
+
element = selenium_page_object.unordered_list_element(:id => 'blah')
|
876
|
+
element.should be_instance_of PageObject::Elements::UnorderedList
|
877
|
+
end
|
878
|
+
|
879
|
+
it "should find all unordered lists" do
|
880
|
+
selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
881
|
+
elements = selenium_page_object.unordered_list_elements(:id => 'blah')
|
882
|
+
elements[0].should be_instance_of PageObject::Elements::UnorderedList
|
883
|
+
end
|
884
|
+
|
885
|
+
it "should find an ordered list" do
|
886
|
+
selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
887
|
+
element = selenium_page_object.ordered_list_element(:id => 'blah')
|
888
|
+
element.should be_instance_of PageObject::Elements::OrderedList
|
889
|
+
end
|
890
|
+
|
891
|
+
it "should find all orderd list elements" do
|
892
|
+
selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
893
|
+
elements = selenium_page_object.ordered_list_elements(:id => 'blah')
|
894
|
+
elements[0].should be_instance_of PageObject::Elements::OrderedList
|
895
|
+
end
|
896
|
+
|
897
|
+
it "should find a h1 element" do
|
898
|
+
selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
899
|
+
element = selenium_page_object.h1_element(:id => 'blah')
|
900
|
+
element.should be_instance_of PageObject::Elements::Heading
|
901
|
+
end
|
902
|
+
|
903
|
+
it "should find all h1 elements" do
|
904
|
+
selenium_browser.should_receive(:find_elements).with(:id, "blah").and_return([selenium_browser])
|
905
|
+
elements = selenium_page_object.h1_elements(:id => 'blah')
|
906
|
+
elements[0].should be_instance_of PageObject::Elements::Heading
|
907
|
+
end
|
908
|
+
|
909
|
+
it "should find a h2 element" do
|
910
|
+
selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
911
|
+
element = selenium_page_object.h2_element(:id => 'blah')
|
912
|
+
element.should be_instance_of PageObject::Elements::Heading
|
913
|
+
end
|
914
|
+
|
915
|
+
it "should find all h2 elements" do
|
916
|
+
selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
917
|
+
elements = selenium_page_object.h2_elements(:id => 'blah')
|
918
|
+
elements[0].should be_instance_of PageObject::Elements::Heading
|
919
|
+
end
|
920
|
+
|
921
|
+
it "should find a h3 element" do
|
922
|
+
selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
923
|
+
element = selenium_page_object.h3_element(:id => 'blah')
|
924
|
+
element.should be_instance_of PageObject::Elements::Heading
|
925
|
+
end
|
926
|
+
|
927
|
+
it "should find all h3 elements" do
|
928
|
+
selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
929
|
+
elements = selenium_page_object.h3_elements(:id => 'blah')
|
930
|
+
elements[0].should be_instance_of PageObject::Elements::Heading
|
931
|
+
end
|
932
|
+
|
933
|
+
it "should find a h4 element" do
|
934
|
+
selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
935
|
+
element = selenium_page_object.h4_element(:id => 'blah')
|
936
|
+
element.should be_instance_of PageObject::Elements::Heading
|
937
|
+
end
|
938
|
+
|
939
|
+
it "should find all h4 elements" do
|
940
|
+
selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
941
|
+
elements = selenium_page_object.h4_elements(:id => 'blah')
|
942
|
+
elements[0].should be_instance_of PageObject::Elements::Heading
|
943
|
+
end
|
944
|
+
|
945
|
+
it "should find a h5 element" do
|
946
|
+
selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
947
|
+
element = selenium_page_object.h5_element(:id => 'blah')
|
948
|
+
element.should be_instance_of PageObject::Elements::Heading
|
949
|
+
end
|
950
|
+
|
951
|
+
it "should find all h5 elements" do
|
952
|
+
selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
953
|
+
elements = selenium_page_object.h5_elements(:id => 'blah')
|
954
|
+
elements[0].should be_instance_of PageObject::Elements::Heading
|
955
|
+
end
|
956
|
+
|
957
|
+
it "should find a h6 element" do
|
958
|
+
selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
959
|
+
element = selenium_page_object.h6_element(:id => 'blah')
|
960
|
+
element.should be_instance_of PageObject::Elements::Heading
|
961
|
+
end
|
962
|
+
|
963
|
+
it "should find all h6 elements" do
|
964
|
+
selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
965
|
+
elements = selenium_page_object.h6_elements(:id => 'blah')
|
966
|
+
elements[0].should be_instance_of PageObject::Elements::Heading
|
967
|
+
end
|
968
|
+
|
969
|
+
it "should find a paragraph element" do
|
970
|
+
selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
971
|
+
element = selenium_page_object.paragraph_element(:id => 'blah')
|
972
|
+
element.should be_instance_of PageObject::Elements::Paragraph
|
973
|
+
end
|
974
|
+
|
975
|
+
it "should find all paragraph elements" do
|
976
|
+
selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
977
|
+
elements = selenium_page_object.paragraph_elements(:id => 'blah')
|
978
|
+
elements[0].should be_instance_of PageObject::Elements::Paragraph
|
979
|
+
end
|
980
|
+
|
981
|
+
it "should find a label" do
|
982
|
+
selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
983
|
+
element = selenium_page_object.label_element(:id => 'blah')
|
984
|
+
element.should be_instance_of PageObject::Elements::Label
|
985
|
+
end
|
986
|
+
|
987
|
+
it "should find all label elements" do
|
988
|
+
selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
989
|
+
elements = selenium_page_object.label_elements(:id => 'blah')
|
990
|
+
elements[0].should be_instance_of PageObject::Elements::Label
|
991
|
+
end
|
992
|
+
|
993
|
+
it "should find a file field element" do
|
994
|
+
selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
995
|
+
element = selenium_page_object.file_field_element(:id => 'blah')
|
996
|
+
element.should be_instance_of PageObject::Elements::FileField
|
997
|
+
end
|
998
|
+
|
999
|
+
it "should find an area element" do
|
1000
|
+
selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
1001
|
+
element = selenium_page_object.area_element(:id => 'blah')
|
1002
|
+
element.should be_instance_of PageObject::Elements::Area
|
1003
|
+
end
|
1004
|
+
|
1005
|
+
it "should find an area element using a default identifier" do
|
1006
|
+
selenium_browser.should_receive(:find_element).with(:xpath, '(.//area)[1]').and_return(selenium_browser)
|
1007
|
+
selenium_page_object.area_element
|
1008
|
+
end
|
1009
|
+
|
1010
|
+
it "should find all area elements" do
|
1011
|
+
selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
1012
|
+
elements = selenium_page_object.area_elements(:id => 'blah')
|
1013
|
+
elements[0].should be_instance_of PageObject::Elements::Area
|
1014
|
+
end
|
1015
|
+
|
1016
|
+
it "should find all areas with no identifier" do
|
1017
|
+
selenium_browser.should_receive(:find_elements).with(:tag_name, 'area').and_return([selenium_browser])
|
1018
|
+
selenium_page_object.area_elements
|
1019
|
+
end
|
1020
|
+
|
1021
|
+
it "should find a canvas element" do
|
1022
|
+
selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
1023
|
+
element = selenium_page_object.canvas_element(:id => 'blah')
|
1024
|
+
element.should be_instance_of PageObject::Elements::Canvas
|
1025
|
+
end
|
1026
|
+
|
1027
|
+
it "should find a canvas element using a default identifier" do
|
1028
|
+
selenium_browser.should_receive(:find_element).with(:xpath, '(.//canvas)[1]').and_return(selenium_browser)
|
1029
|
+
selenium_page_object.canvas_element
|
1030
|
+
end
|
1031
|
+
|
1032
|
+
it "should find all canvas elements" do
|
1033
|
+
selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
1034
|
+
elements = selenium_page_object.canvas_elements(:id => 'blah')
|
1035
|
+
elements[0].should be_instance_of PageObject::Elements::Canvas
|
1036
|
+
end
|
1037
|
+
|
1038
|
+
it "should find all canvases with no identifier" do
|
1039
|
+
selenium_browser.should_receive(:find_elements).with(:tag_name, 'canvas').and_return([selenium_browser])
|
1040
|
+
selenium_page_object.canvas_elements
|
1041
|
+
end
|
1042
|
+
|
1043
|
+
it "should find an audio element" do
|
1044
|
+
selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
1045
|
+
element = selenium_page_object.audio_element(:id => 'blah')
|
1046
|
+
element.should be_instance_of PageObject::Elements::Audio
|
1047
|
+
end
|
1048
|
+
|
1049
|
+
it "should find an audio element using a default identifier" do
|
1050
|
+
selenium_browser.should_receive(:find_element).with(:xpath, '(.//audio)[1]').and_return(selenium_browser)
|
1051
|
+
selenium_page_object.audio_element
|
1052
|
+
end
|
1053
|
+
|
1054
|
+
it "should find all audio elements" do
|
1055
|
+
selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
1056
|
+
elements = selenium_page_object.audio_elements(:id => 'blah')
|
1057
|
+
elements[0].should be_instance_of PageObject::Elements::Audio
|
1058
|
+
end
|
1059
|
+
|
1060
|
+
it "should find all audio elements with no identifier" do
|
1061
|
+
selenium_browser.should_receive(:find_elements).with(:tag_name, 'audio').and_return([selenium_browser])
|
1062
|
+
selenium_page_object.audio_elements
|
1063
|
+
end
|
1064
|
+
end
|
1065
|
+
end
|