meeane-page-object 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +7 -7
- data/.rspec +2 -2
- data/.ruby-gemset +1 -1
- data/.ruby-version +1 -1
- data/.travis.yml +10 -10
- data/ChangeLog +790 -790
- data/Gemfile +13 -13
- data/Guardfile +20 -20
- data/LICENSE +20 -20
- data/README.md +1 -1
- data/Rakefile +35 -35
- data/cucumber.yml +10 -10
- data/features/area.feature +35 -35
- data/features/async.feature +30 -30
- data/features/audio.feature +68 -68
- data/features/button.feature +88 -87
- data/features/canvas.feature +37 -37
- data/features/check_box.feature +55 -55
- data/features/div.feature +45 -45
- data/features/element.feature +322 -322
- data/features/file_field.feature +40 -40
- data/features/form.feature +43 -43
- data/features/frames.feature +75 -75
- data/features/generic_elements.feature +29 -29
- data/features/gxt_table_extension.feature +24 -24
- data/features/headings.feature +97 -97
- data/features/hidden_field.feature +45 -45
- data/features/html/async.html +36 -36
- data/features/html/double_click.html +12 -12
- data/features/html/failure.html +7 -7
- data/features/html/frame_1.html +17 -17
- data/features/html/frame_2.html +15 -15
- data/features/html/frame_3.html +14 -14
- data/features/html/frames.html +12 -12
- data/features/html/hover.html +11 -11
- data/features/html/iframes.html +12 -12
- data/features/html/indexed_property.html +51 -51
- data/features/html/modal.html +17 -17
- data/features/html/modal_1.html +37 -37
- data/features/html/modal_2.html +26 -26
- data/features/html/multi_elements.html +144 -144
- data/features/html/nested_elements.html +77 -77
- data/features/html/nested_frame_2.html +11 -11
- data/features/html/nested_frame_3.html +14 -14
- data/features/html/nested_frames.html +10 -10
- data/features/html/static_elements.html +233 -226
- data/features/html/success.html +7 -7
- data/features/html/sun.html +7 -7
- data/features/image.feature +50 -50
- data/features/indexed_property.feature +97 -97
- data/features/javascript.feature +27 -27
- data/features/label.feature +46 -46
- data/features/link.feature +52 -52
- data/features/list_item.feature +36 -36
- data/features/modal_dialog.feature +15 -15
- data/features/multi_elements.feature +486 -486
- data/features/nested_elements.feature +117 -117
- data/features/ordered_list.feature +56 -56
- data/features/page_level_actions.feature +90 -90
- data/features/paragraph.feature +35 -35
- data/features/radio_button.feature +58 -58
- data/features/radio_button_collinson.feature +12 -58
- data/features/radio_button_group.feature +29 -29
- data/features/sample-app/public/jquery-1.3.2.js +4376 -4376
- data/features/sample-app/public/jquery.html +30 -30
- data/features/sample-app/public/prototype-1.6.0.3.js +4319 -4319
- data/features/sample-app/public/prototype.html +35 -35
- data/features/sample-app/sample_app.rb +35 -35
- data/features/select_list.feature +86 -86
- data/features/span.feature +37 -37
- data/features/step_definitions/accessor_steps.rb +60 -60
- data/features/step_definitions/area_steps.rb +19 -19
- data/features/step_definitions/async_steps.rb +83 -83
- data/features/step_definitions/audio_steps.rb +27 -27
- data/features/step_definitions/button_steps.rb +43 -43
- data/features/step_definitions/canvas_steps.rb +15 -15
- data/features/step_definitions/check_box_steps.rb +35 -35
- data/features/step_definitions/div_steps.rb +19 -19
- data/features/step_definitions/element_steps.rb +266 -266
- data/features/step_definitions/file_field_steps.rb +19 -19
- data/features/step_definitions/form_steps.rb +18 -18
- data/features/step_definitions/frames_steps.rb +159 -159
- data/features/step_definitions/generic_element_steps.rb +31 -31
- data/features/step_definitions/gxt_table_steps.rb +58 -58
- data/features/step_definitions/headings_steps.rb +12 -12
- data/features/step_definitions/hidden_field_steps.rb +26 -26
- data/features/step_definitions/image_steps.rb +27 -27
- data/features/step_definitions/indexed_property_steps.rb +128 -128
- data/features/step_definitions/javascript_steps.rb +52 -52
- data/features/step_definitions/label_steps.rb +19 -19
- data/features/step_definitions/link_steps.rb +40 -40
- data/features/step_definitions/list_item_steps.rb +19 -19
- data/features/step_definitions/modal_dialog_steps.rb +62 -62
- data/features/step_definitions/multi_elements_steps.rb +528 -528
- data/features/step_definitions/nested_elements_steps.rb +212 -212
- data/features/step_definitions/ordered_list_steps.rb +23 -23
- data/features/step_definitions/page_level_actions_steps.rb +135 -135
- data/features/step_definitions/page_traversal_steps.rb +4 -4
- data/features/step_definitions/paragraph_steps.rb +28 -28
- data/features/step_definitions/radio_button_collinson_steps.rb +2 -46
- data/features/step_definitions/radio_button_group_steps.rb +35 -35
- data/features/step_definitions/radio_button_steps.rb +26 -46
- data/features/step_definitions/select_list_steps.rb +65 -65
- data/features/step_definitions/span_steps.rb +19 -19
- data/features/step_definitions/table_cell_steps.rb +14 -14
- data/features/step_definitions/table_steps.rb +66 -66
- data/features/step_definitions/text_area_steps.rb +34 -34
- data/features/step_definitions/text_field_steps.rb +35 -35
- data/features/step_definitions/unordered_list_steps.rb +23 -23
- data/features/step_definitions/video_steps.rb +45 -45
- data/features/support/ajax_text_environment.rb +26 -26
- data/features/support/env.rb +8 -8
- data/features/support/hooks.rb +8 -8
- data/features/support/page.rb +370 -364
- data/features/support/persistent_browser.rb +70 -70
- data/features/support/targets/firefox14_osx.rb +6 -6
- data/features/support/targets/firefox14_windows7.rb +6 -6
- data/features/support/url_helper.rb +57 -57
- data/features/table.feature +114 -114
- data/features/table_cell.feature +45 -45
- data/features/text_area.feature +51 -51
- data/features/text_field.feature +70 -70
- data/features/unordered_list.feature +56 -56
- data/features/video.feature +73 -73
- data/lib/page-object.rb +408 -408
- data/lib/page-object/accessors.rb +1313 -1313
- data/lib/page-object/core_ext/string.rb +4 -4
- data/lib/page-object/element_locators.rb +21 -21
- data/lib/page-object/elements.rb +59 -59
- data/lib/page-object/elements/area.rb +31 -31
- data/lib/page-object/elements/audio.rb +9 -9
- data/lib/page-object/elements/button.rb +35 -35
- data/lib/page-object/elements/canvas.rb +23 -23
- data/lib/page-object/elements/check_box.rb +37 -37
- data/lib/page-object/elements/div.rb +19 -19
- data/lib/page-object/elements/element.rb +226 -226
- data/lib/page-object/elements/file_field.rb +38 -38
- data/lib/page-object/elements/form.rb +36 -36
- data/lib/page-object/elements/heading.rb +15 -15
- data/lib/page-object/elements/hidden_field.rb +22 -22
- data/lib/page-object/elements/image.rb +36 -36
- data/lib/page-object/elements/label.rb +36 -36
- data/lib/page-object/elements/link.rb +46 -46
- data/lib/page-object/elements/list_item.rb +19 -19
- data/lib/page-object/elements/media.rb +45 -45
- data/lib/page-object/elements/option.rb +10 -10
- data/lib/page-object/elements/ordered_list.rb +50 -50
- data/lib/page-object/elements/paragraph.rb +9 -9
- data/lib/page-object/elements/radio_button.rb +37 -37
- data/lib/page-object/elements/select_list.rb +42 -42
- data/lib/page-object/elements/span.rb +19 -19
- data/lib/page-object/elements/table.rb +68 -68
- data/lib/page-object/elements/table_cell.rb +28 -28
- data/lib/page-object/elements/table_row.rb +50 -50
- data/lib/page-object/elements/text_area.rb +38 -38
- data/lib/page-object/elements/text_field.rb +42 -42
- data/lib/page-object/elements/unordered_list.rb +51 -51
- data/lib/page-object/elements/video.rb +18 -18
- data/lib/page-object/indexed_properties.rb +36 -36
- data/lib/page-object/javascript/jquery.rb +14 -14
- data/lib/page-object/javascript/prototype.rb +14 -14
- data/lib/page-object/javascript/yui.rb +18 -18
- data/lib/page-object/javascript_framework_facade.rb +78 -78
- data/lib/page-object/loads_platform.rb +26 -26
- data/lib/page-object/locator_generator.rb +129 -129
- data/lib/page-object/nested_elements.rb +17 -17
- data/lib/page-object/page_factory.rb +108 -108
- data/lib/page-object/page_populator.rb +92 -92
- data/lib/page-object/platforms.rb +18 -18
- data/lib/page-object/platforms/selenium_webdriver.rb +17 -17
- data/lib/page-object/platforms/selenium_webdriver/button.rb +14 -14
- data/lib/page-object/platforms/selenium_webdriver/check_box.rb +29 -29
- data/lib/page-object/platforms/selenium_webdriver/element.rb +291 -291
- data/lib/page-object/platforms/selenium_webdriver/file_field.rb +16 -16
- data/lib/page-object/platforms/selenium_webdriver/form.rb +16 -16
- data/lib/page-object/platforms/selenium_webdriver/image.rb +28 -28
- data/lib/page-object/platforms/selenium_webdriver/label.rb +17 -18
- data/lib/page-object/platforms/selenium_webdriver/link.rb +23 -23
- data/lib/page-object/platforms/selenium_webdriver/ordered_list.rb +39 -39
- data/lib/page-object/platforms/selenium_webdriver/page_object.rb +1136 -1136
- data/lib/page-object/platforms/selenium_webdriver/radio_button.rb +22 -22
- data/lib/page-object/platforms/selenium_webdriver/select_list.rb +93 -93
- data/lib/page-object/platforms/selenium_webdriver/surrogate_selenium_element.rb +42 -42
- data/lib/page-object/platforms/selenium_webdriver/table.rb +42 -42
- data/lib/page-object/platforms/selenium_webdriver/table_row.rb +43 -43
- data/lib/page-object/platforms/selenium_webdriver/text_area.rb +17 -17
- data/lib/page-object/platforms/selenium_webdriver/text_field.rb +17 -17
- data/lib/page-object/platforms/selenium_webdriver/unordered_list.rb +39 -39
- data/lib/page-object/platforms/watir_webdriver.rb +18 -18
- data/lib/page-object/platforms/watir_webdriver/check_box.rb +29 -29
- data/lib/page-object/platforms/watir_webdriver/element.rb +249 -249
- data/lib/page-object/platforms/watir_webdriver/file_field.rb +16 -16
- data/lib/page-object/platforms/watir_webdriver/form.rb +16 -16
- data/lib/page-object/platforms/watir_webdriver/image.rb +22 -22
- data/lib/page-object/platforms/watir_webdriver/label.rb +17 -18
- data/lib/page-object/platforms/watir_webdriver/link.rb +15 -15
- data/lib/page-object/platforms/watir_webdriver/ordered_list.rb +35 -35
- data/lib/page-object/platforms/watir_webdriver/page_object.rb +1029 -1029
- data/lib/page-object/platforms/watir_webdriver/radio_button.rb +22 -22
- data/lib/page-object/platforms/watir_webdriver/select_list.rb +74 -74
- data/lib/page-object/platforms/watir_webdriver/table.rb +38 -38
- data/lib/page-object/platforms/watir_webdriver/table_row.rb +37 -37
- data/lib/page-object/platforms/watir_webdriver/text_area.rb +23 -23
- data/lib/page-object/platforms/watir_webdriver/text_field.rb +16 -16
- data/lib/page-object/platforms/watir_webdriver/unordered_list.rb +36 -36
- data/lib/page-object/version.rb +4 -4
- data/lib/page-object/widgets.rb +133 -133
- data/meeane-page-object.gemspec +32 -32
- data/spec/page-object/element_locators_spec.rb +1065 -1065
- data/spec/page-object/elements/area_spec.rb +45 -45
- data/spec/page-object/elements/button_spec.rb +50 -50
- data/spec/page-object/elements/canvas_spec.rb +40 -40
- data/spec/page-object/elements/check_box_spec.rb +49 -49
- data/spec/page-object/elements/div_spec.rb +28 -28
- data/spec/page-object/elements/element_spec.rb +114 -114
- data/spec/page-object/elements/file_field_spec.rb +39 -39
- data/spec/page-object/elements/form_spec.rb +28 -28
- data/spec/page-object/elements/heading_spec.rb +48 -48
- data/spec/page-object/elements/hidden_field_spec.rb +28 -28
- data/spec/page-object/elements/image_spec.rb +66 -66
- data/spec/page-object/elements/label_spec.rb +29 -29
- data/spec/page-object/elements/link_spec.rb +49 -49
- data/spec/page-object/elements/list_item_spec.rb +28 -28
- data/spec/page-object/elements/nested_element_spec.rb +254 -254
- data/spec/page-object/elements/option_spec.rb +11 -11
- data/spec/page-object/elements/ordered_list_spec.rb +94 -94
- data/spec/page-object/elements/paragraph_spec.rb +28 -28
- data/spec/page-object/elements/select_list_spec.rb +142 -142
- data/spec/page-object/elements/selenium/radio_button_spec.rb +44 -44
- data/spec/page-object/elements/selenium/text_field_spec.rb +49 -49
- data/spec/page-object/elements/selenium_element_spec.rb +172 -172
- data/spec/page-object/elements/span_spec.rb +26 -26
- data/spec/page-object/elements/table_cell_spec.rb +21 -21
- data/spec/page-object/elements/table_row_spec.rb +70 -70
- data/spec/page-object/elements/table_spec.rb +98 -98
- data/spec/page-object/elements/text_area_spec.rb +39 -39
- data/spec/page-object/elements/unordered_list_spec.rb +95 -95
- data/spec/page-object/elements/watir_element_spec.rb +142 -142
- data/spec/page-object/javascript_framework_facade_spec.rb +61 -61
- data/spec/page-object/loads_platform_spec.rb +53 -53
- data/spec/page-object/page-object_spec.rb +405 -405
- data/spec/page-object/page_factory_spec.rb +256 -256
- data/spec/page-object/page_populator_spec.rb +122 -122
- data/spec/page-object/platforms/selenium_webdriver/selenium_page_object_spec.rb +68 -68
- data/spec/page-object/platforms/selenium_webdriver_spec.rb +28 -28
- data/spec/page-object/platforms/watir_webdriver/watir_page_object_spec.rb +29 -29
- data/spec/page-object/platforms/watir_webdriver_spec.rb +9 -9
- data/spec/page-object/selenium_accessors_spec.rb +589 -589
- data/spec/page-object/watir_accessors_spec.rb +1107 -1107
- data/spec/page-object/widget_spec.rb +226 -226
- data/spec/spec_helper.rb +44 -44
- metadata +193 -43
data/lib/page-object/version.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
module PageObject
|
2
|
-
# @private
|
3
|
-
VERSION = "0.1.
|
4
|
-
end
|
1
|
+
module PageObject
|
2
|
+
# @private
|
3
|
+
VERSION = "0.1.11"
|
4
|
+
end
|
data/lib/page-object/widgets.rb
CHANGED
@@ -1,133 +1,133 @@
|
|
1
|
-
require 'page-object/elements'
|
2
|
-
require 'page-object/platforms/selenium_webdriver/page_object'
|
3
|
-
require 'page-object/platforms/watir_webdriver/page_object'
|
4
|
-
|
5
|
-
module PageObject
|
6
|
-
module Widgets
|
7
|
-
|
8
|
-
#
|
9
|
-
# Module that allows for the registration of widget classes which extend the functionality of PageObject
|
10
|
-
# Allows any classes which extend PageObject::Element to be used as PageObject elements.
|
11
|
-
# This allows such widgets to be created using the defined tags.
|
12
|
-
#
|
13
|
-
# @param [Symbol] defines the symbol which will be used as an accessor name.
|
14
|
-
# @param [Class] the widget class extending PageObject::Elements::Element
|
15
|
-
# @param [Symbol] the symbol of the html element used when searching for this widget.
|
16
|
-
#
|
17
|
-
#
|
18
|
-
def self.register_widget(widget_tag, widget_class, base_element_tag)
|
19
|
-
if widget_class.ancestors.include? Elements::Element
|
20
|
-
define_accessors(Accessors, widget_tag, widget_class)
|
21
|
-
define_nested_elements(Elements::Element, widget_tag)
|
22
|
-
define_locators(PageObject, widget_tag)
|
23
|
-
define_selenium_accessors(Platforms::SeleniumWebDriver::PageObject, widget_tag, widget_class, base_element_tag)
|
24
|
-
define_watir_accessors(Platforms::WatirWebDriver::PageObject, widget_tag, widget_class, base_element_tag)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
def self.define_accessors(base, widget_tag, widget_class)
|
31
|
-
accessors_module = Module.new do
|
32
|
-
define_method widget_tag do |name, *identifier_args, &block|
|
33
|
-
|
34
|
-
identifier = identifier_args.first
|
35
|
-
identifier = {:index => 0} if identifier.nil?
|
36
|
-
|
37
|
-
define_method("#{name}_element") do
|
38
|
-
return call_block(&block) if block
|
39
|
-
platform.send("#{widget_tag}_for", identifier.clone)
|
40
|
-
end
|
41
|
-
define_method("#{name}?") do
|
42
|
-
return call_block(&block).exists? if block
|
43
|
-
platform.send("#{widget_tag}_for", identifier.clone).exists?
|
44
|
-
end
|
45
|
-
if widget_class.respond_to? :accessor_methods
|
46
|
-
widget_class.accessor_methods(self, name)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
define_method widget_class.plural_form do |name, *identifier_args, &block|
|
50
|
-
define_method("#{name}_elements") do
|
51
|
-
return call_block(&block) unless block.nil?
|
52
|
-
platform_method = "#{widget_tag.to_s}s_for"
|
53
|
-
platform.send platform_method, (identifier_args.first ? identifier_args.first.clone : {})
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
base.send(:include, accessors_module)
|
59
|
-
end
|
60
|
-
|
61
|
-
def self.define_watir_accessors(base, widget_tag, widget_class, base_element_tag)
|
62
|
-
define_singular_watir_accessor(base, base_element_tag, widget_class, widget_tag)
|
63
|
-
define_multiple_watir_accessor(base, base_element_tag, widget_class, widget_tag)
|
64
|
-
end
|
65
|
-
|
66
|
-
def self.define_multiple_watir_accessor(base, base_element_tag, widget_class, widget_tag)
|
67
|
-
base.send(:define_method, "#{widget_tag}s_for") do |identifier|
|
68
|
-
find_watir_elements("#{base_element_tag}s(identifier)", widget_class, identifier, base_element_tag)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def self.define_singular_watir_accessor(base, base_element_tag, widget_class, widget_tag)
|
73
|
-
base.send(:define_method, "#{widget_tag}_for") do |identifier|
|
74
|
-
find_watir_element("#{base_element_tag}(identifier)", widget_class, identifier, base_element_tag)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
def self.define_selenium_accessors(base, widget_tag, widget_class, base_element_tag)
|
79
|
-
define_singular_selenium_accessor(base, base_element_tag, widget_class, widget_tag)
|
80
|
-
define_multiple_selenium_accessor(base, base_element_tag, widget_class, widget_tag)
|
81
|
-
end
|
82
|
-
|
83
|
-
def self.define_multiple_selenium_accessor(base, base_element_tag, widget_class, widget_tag)
|
84
|
-
base.send(:define_method, "#{widget_tag}s_for") do |identifier|
|
85
|
-
find_selenium_elements(identifier, widget_class, base_element_tag)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
def self.define_singular_selenium_accessor(base, base_element_tag, widget_class, widget_tag)
|
90
|
-
base.send(:define_method, "#{widget_tag}_for") do |identifier|
|
91
|
-
find_selenium_element(identifier, widget_class, base_element_tag)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
def self.define_nested_elements(base, widget_tag)
|
96
|
-
define_singular_nested_accessor(base, widget_tag)
|
97
|
-
define_multiple_nested_accessor(base, widget_tag)
|
98
|
-
end
|
99
|
-
|
100
|
-
def self.define_multiple_nested_accessor(base, widget_tag)
|
101
|
-
base.send(:define_method, "#{widget_tag}_elements") do |*args|
|
102
|
-
identifier = args[0] ? args[0] : {:index => 0}
|
103
|
-
@platform.send("#{widget_tag}s_for", identifier.clone)
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
def self.define_singular_nested_accessor(base, widget_tag)
|
108
|
-
base.send(:define_method, "#{widget_tag}_element") do |*args|
|
109
|
-
identifier = args[0] ? args[0] : {:index => 0}
|
110
|
-
@platform.send("#{widget_tag}_for", identifier.clone)
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
def self.define_locators(base, widget_tag)
|
115
|
-
define_singular_locator(base, widget_tag)
|
116
|
-
define_multiple_locator(base, widget_tag)
|
117
|
-
end
|
118
|
-
|
119
|
-
def self.define_multiple_locator(base, widget_tag)
|
120
|
-
base.send(:define_method, "#{widget_tag}_elements") do |*args|
|
121
|
-
identifier = args[0] ? args[0] : {}
|
122
|
-
platform.send("#{widget_tag}s_for", identifier.clone)
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
def self.define_singular_locator(base, widget_tag)
|
127
|
-
base.send(:define_method, "#{widget_tag}_element") do |*args|
|
128
|
-
identifier = args[0] ? args[0] : {:index => 0}
|
129
|
-
platform.send("#{widget_tag}_for", identifier.clone)
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
1
|
+
require 'page-object/elements'
|
2
|
+
require 'page-object/platforms/selenium_webdriver/page_object'
|
3
|
+
require 'page-object/platforms/watir_webdriver/page_object'
|
4
|
+
|
5
|
+
module PageObject
|
6
|
+
module Widgets
|
7
|
+
|
8
|
+
#
|
9
|
+
# Module that allows for the registration of widget classes which extend the functionality of PageObject
|
10
|
+
# Allows any classes which extend PageObject::Element to be used as PageObject elements.
|
11
|
+
# This allows such widgets to be created using the defined tags.
|
12
|
+
#
|
13
|
+
# @param [Symbol] defines the symbol which will be used as an accessor name.
|
14
|
+
# @param [Class] the widget class extending PageObject::Elements::Element
|
15
|
+
# @param [Symbol] the symbol of the html element used when searching for this widget.
|
16
|
+
#
|
17
|
+
#
|
18
|
+
def self.register_widget(widget_tag, widget_class, base_element_tag)
|
19
|
+
if widget_class.ancestors.include? Elements::Element
|
20
|
+
define_accessors(Accessors, widget_tag, widget_class)
|
21
|
+
define_nested_elements(Elements::Element, widget_tag)
|
22
|
+
define_locators(PageObject, widget_tag)
|
23
|
+
define_selenium_accessors(Platforms::SeleniumWebDriver::PageObject, widget_tag, widget_class, base_element_tag)
|
24
|
+
define_watir_accessors(Platforms::WatirWebDriver::PageObject, widget_tag, widget_class, base_element_tag)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def self.define_accessors(base, widget_tag, widget_class)
|
31
|
+
accessors_module = Module.new do
|
32
|
+
define_method widget_tag do |name, *identifier_args, &block|
|
33
|
+
|
34
|
+
identifier = identifier_args.first
|
35
|
+
identifier = {:index => 0} if identifier.nil?
|
36
|
+
|
37
|
+
define_method("#{name}_element") do
|
38
|
+
return call_block(&block) if block
|
39
|
+
platform.send("#{widget_tag}_for", identifier.clone)
|
40
|
+
end
|
41
|
+
define_method("#{name}?") do
|
42
|
+
return call_block(&block).exists? if block
|
43
|
+
platform.send("#{widget_tag}_for", identifier.clone).exists?
|
44
|
+
end
|
45
|
+
if widget_class.respond_to? :accessor_methods
|
46
|
+
widget_class.accessor_methods(self, name)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
define_method widget_class.plural_form do |name, *identifier_args, &block|
|
50
|
+
define_method("#{name}_elements") do
|
51
|
+
return call_block(&block) unless block.nil?
|
52
|
+
platform_method = "#{widget_tag.to_s}s_for"
|
53
|
+
platform.send platform_method, (identifier_args.first ? identifier_args.first.clone : {})
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
base.send(:include, accessors_module)
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.define_watir_accessors(base, widget_tag, widget_class, base_element_tag)
|
62
|
+
define_singular_watir_accessor(base, base_element_tag, widget_class, widget_tag)
|
63
|
+
define_multiple_watir_accessor(base, base_element_tag, widget_class, widget_tag)
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.define_multiple_watir_accessor(base, base_element_tag, widget_class, widget_tag)
|
67
|
+
base.send(:define_method, "#{widget_tag}s_for") do |identifier|
|
68
|
+
find_watir_elements("#{base_element_tag}s(identifier)", widget_class, identifier, base_element_tag)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.define_singular_watir_accessor(base, base_element_tag, widget_class, widget_tag)
|
73
|
+
base.send(:define_method, "#{widget_tag}_for") do |identifier|
|
74
|
+
find_watir_element("#{base_element_tag}(identifier)", widget_class, identifier, base_element_tag)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.define_selenium_accessors(base, widget_tag, widget_class, base_element_tag)
|
79
|
+
define_singular_selenium_accessor(base, base_element_tag, widget_class, widget_tag)
|
80
|
+
define_multiple_selenium_accessor(base, base_element_tag, widget_class, widget_tag)
|
81
|
+
end
|
82
|
+
|
83
|
+
def self.define_multiple_selenium_accessor(base, base_element_tag, widget_class, widget_tag)
|
84
|
+
base.send(:define_method, "#{widget_tag}s_for") do |identifier|
|
85
|
+
find_selenium_elements(identifier, widget_class, base_element_tag)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def self.define_singular_selenium_accessor(base, base_element_tag, widget_class, widget_tag)
|
90
|
+
base.send(:define_method, "#{widget_tag}_for") do |identifier|
|
91
|
+
find_selenium_element(identifier, widget_class, base_element_tag)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def self.define_nested_elements(base, widget_tag)
|
96
|
+
define_singular_nested_accessor(base, widget_tag)
|
97
|
+
define_multiple_nested_accessor(base, widget_tag)
|
98
|
+
end
|
99
|
+
|
100
|
+
def self.define_multiple_nested_accessor(base, widget_tag)
|
101
|
+
base.send(:define_method, "#{widget_tag}_elements") do |*args|
|
102
|
+
identifier = args[0] ? args[0] : {:index => 0}
|
103
|
+
@platform.send("#{widget_tag}s_for", identifier.clone)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def self.define_singular_nested_accessor(base, widget_tag)
|
108
|
+
base.send(:define_method, "#{widget_tag}_element") do |*args|
|
109
|
+
identifier = args[0] ? args[0] : {:index => 0}
|
110
|
+
@platform.send("#{widget_tag}_for", identifier.clone)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.define_locators(base, widget_tag)
|
115
|
+
define_singular_locator(base, widget_tag)
|
116
|
+
define_multiple_locator(base, widget_tag)
|
117
|
+
end
|
118
|
+
|
119
|
+
def self.define_multiple_locator(base, widget_tag)
|
120
|
+
base.send(:define_method, "#{widget_tag}_elements") do |*args|
|
121
|
+
identifier = args[0] ? args[0] : {}
|
122
|
+
platform.send("#{widget_tag}s_for", identifier.clone)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def self.define_singular_locator(base, widget_tag)
|
127
|
+
base.send(:define_method, "#{widget_tag}_element") do |*args|
|
128
|
+
identifier = args[0] ? args[0] : {:index => 0}
|
129
|
+
platform.send("#{widget_tag}_for", identifier.clone)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
data/meeane-page-object.gemspec
CHANGED
@@ -1,32 +1,32 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
require "page-object/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |s|
|
6
|
-
s.name = "meeane-page-object"
|
7
|
-
s.version = PageObject::VERSION
|
8
|
-
s.platform = Gem::Platform::RUBY
|
9
|
-
s.authors = ["Jeff Morgan/Steven Hobbs"]
|
10
|
-
s.email = ["stevenhobbs@meeane.co.uk"]
|
11
|
-
s.license = 'MIT'
|
12
|
-
s.homepage = "https://github.com/hobbs90/page-object"
|
13
|
-
s.summary = %q{Page Object DSL for browser testing Columbus Direct websites based on Jeff Morgan's page-object gem (version 1.0.2}
|
14
|
-
s.description = %q{Page Object DSL that works with both Watir and Selenium}
|
15
|
-
|
16
|
-
s.rubyforge_project = "meeane-page-object"
|
17
|
-
|
18
|
-
s.files = `git ls-files`.split("\n")
|
19
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
21
|
-
s.require_paths = ["lib"]
|
22
|
-
|
23
|
-
s.add_dependency 'watir-webdriver', '>= 0.6.9'
|
24
|
-
s.add_dependency 'selenium-webdriver', '>= 2.42.0'
|
25
|
-
s.add_dependency 'page_navigation', '>= 0.9'
|
26
|
-
|
27
|
-
s.add_development_dependency 'rspec', '< 3.0'
|
28
|
-
s.add_development_dependency 'cucumber', '>= 1.3.0'
|
29
|
-
s.add_development_dependency 'yard', '>= 0.7.2'
|
30
|
-
s.add_development_dependency 'rack', '>= 1.0'
|
31
|
-
|
32
|
-
end
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "page-object/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "meeane-page-object"
|
7
|
+
s.version = PageObject::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Jeff Morgan/Steven Hobbs"]
|
10
|
+
s.email = ["stevenhobbs@meeane.co.uk"]
|
11
|
+
s.license = 'MIT'
|
12
|
+
s.homepage = "https://github.com/hobbs90/page-object"
|
13
|
+
s.summary = %q{Page Object DSL for browser testing Columbus Direct websites based on Jeff Morgan's page-object gem (version 1.0.2}
|
14
|
+
s.description = %q{Page Object DSL that works with both Watir and Selenium}
|
15
|
+
|
16
|
+
s.rubyforge_project = "meeane-page-object"
|
17
|
+
|
18
|
+
s.files = `git ls-files`.split("\n")
|
19
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
21
|
+
s.require_paths = ["lib"]
|
22
|
+
|
23
|
+
s.add_dependency 'watir-webdriver', '>= 0.6.9'
|
24
|
+
s.add_dependency 'selenium-webdriver', '>= 2.42.0'
|
25
|
+
s.add_dependency 'page_navigation', '>= 0.9'
|
26
|
+
|
27
|
+
s.add_development_dependency 'rspec', '< 3.0'
|
28
|
+
s.add_development_dependency 'cucumber', '>= 1.3.0'
|
29
|
+
s.add_development_dependency 'yard', '>= 0.7.2'
|
30
|
+
s.add_development_dependency 'rack', '>= 1.0'
|
31
|
+
|
32
|
+
end
|
@@ -1,1065 +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
|
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
|