page-object 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +22 -12
- data/ChangeLog +10 -0
- data/Gemfile +4 -2
- data/Guardfile +1 -1
- data/README.md +2 -2
- data/lib/page-object/accessors.rb +57 -35
- data/lib/page-object/elements/element.rb +26 -0
- data/lib/page-object/locator_generator.rb +46 -0
- data/lib/page-object/platforms/selenium_webdriver/element.rb +6 -6
- data/lib/page-object/platforms/selenium_webdriver/page_object.rb +14 -0
- data/lib/page-object/platforms/watir_webdriver/element.rb +0 -7
- data/lib/page-object/platforms/watir_webdriver/page_object.rb +16 -3
- data/lib/page-object/version.rb +1 -1
- data/page-object.gemspec +7 -10
- metadata +34 -375
- data/features/area.feature +0 -35
- data/features/async.feature +0 -21
- data/features/audio.feature +0 -64
- data/features/bold.feature +0 -21
- data/features/button.feature +0 -98
- data/features/canvas.feature +0 -37
- data/features/check_box.feature +0 -55
- data/features/div.feature +0 -45
- data/features/element.feature +0 -343
- data/features/file_field.feature +0 -40
- data/features/form.feature +0 -43
- data/features/frames.feature +0 -75
- data/features/generic_elements.feature +0 -29
- data/features/gxt_table_extension.feature +0 -23
- data/features/headings.feature +0 -97
- data/features/hidden_field.feature +0 -45
- data/features/html/04-Death_Becomes_Fur.mp4 +0 -0
- data/features/html/04-Death_Becomes_Fur.oga +0 -0
- data/features/html/async.html +0 -36
- data/features/html/double_click.html +0 -13
- data/features/html/failure.html +0 -8
- data/features/html/frame_1.html +0 -18
- data/features/html/frame_2.html +0 -16
- data/features/html/frame_3.html +0 -14
- data/features/html/frames.html +0 -12
- data/features/html/hover.html +0 -12
- data/features/html/iframes.html +0 -12
- data/features/html/images/circle.png +0 -0
- data/features/html/images/img_pulpit.jpg +0 -0
- data/features/html/images/submit.gif +0 -0
- data/features/html/indexed_property.html +0 -55
- data/features/html/modal.html +0 -17
- data/features/html/modal_1.html +0 -38
- data/features/html/modal_2.html +0 -27
- data/features/html/movie.mp4 +0 -0
- data/features/html/movie.ogg +0 -0
- data/features/html/multi_elements.html +0 -145
- data/features/html/nested_elements.html +0 -77
- data/features/html/nested_frame_1.html +0 -1
- data/features/html/nested_frame_2.html +0 -11
- data/features/html/nested_frame_3.html +0 -14
- data/features/html/nested_frames.html +0 -10
- data/features/html/planets.gif +0 -0
- data/features/html/static_elements.html +0 -194
- data/features/html/success.html +0 -8
- data/features/html/sun.gif +0 -0
- data/features/html/sun.html +0 -7
- data/features/html/widgets.html +0 -20
- data/features/image.feature +0 -50
- data/features/indexed_property.feature +0 -117
- data/features/italic.feature +0 -21
- data/features/javascript.feature +0 -28
- data/features/label.feature +0 -46
- data/features/link.feature +0 -52
- data/features/list_item.feature +0 -36
- data/features/modal_dialog.feature +0 -15
- data/features/multi_elements.feature +0 -498
- data/features/nested_elements.feature +0 -117
- data/features/ordered_list.feature +0 -56
- data/features/page_level_actions.feature +0 -90
- data/features/paragraph.feature +0 -35
- data/features/radio_button.feature +0 -58
- data/features/radio_button_group.feature +0 -29
- data/features/sample-app/public/audio_video.html +0 -23
- data/features/sample-app/public/jquery-1.3.2.js +0 -4376
- data/features/sample-app/public/jquery.html +0 -30
- data/features/sample-app/public/prototype-1.6.0.3.js +0 -4320
- data/features/sample-app/public/prototype.html +0 -35
- data/features/sample-app/sample_app.rb +0 -35
- data/features/section.feature +0 -136
- data/features/select_list.feature +0 -86
- data/features/span.feature +0 -37
- data/features/step_definitions/accessor_steps.rb +0 -64
- data/features/step_definitions/area_steps.rb +0 -19
- data/features/step_definitions/async_steps.rb +0 -83
- data/features/step_definitions/audio_steps.rb +0 -27
- data/features/step_definitions/bold_steps.rb +0 -12
- data/features/step_definitions/button_steps.rb +0 -48
- data/features/step_definitions/canvas_steps.rb +0 -15
- data/features/step_definitions/check_box_steps.rb +0 -35
- data/features/step_definitions/div_steps.rb +0 -19
- data/features/step_definitions/element_steps.rb +0 -294
- data/features/step_definitions/file_field_steps.rb +0 -19
- data/features/step_definitions/form_steps.rb +0 -19
- data/features/step_definitions/frames_steps.rb +0 -159
- data/features/step_definitions/generic_element_steps.rb +0 -31
- data/features/step_definitions/gxt_table_steps.rb +0 -53
- data/features/step_definitions/headings_steps.rb +0 -12
- data/features/step_definitions/hidden_field_steps.rb +0 -27
- data/features/step_definitions/image_steps.rb +0 -27
- data/features/step_definitions/indexed_property_steps.rb +0 -163
- data/features/step_definitions/italic_steps.rb +0 -12
- data/features/step_definitions/javascript_steps.rb +0 -53
- data/features/step_definitions/label_steps.rb +0 -19
- data/features/step_definitions/link_steps.rb +0 -40
- data/features/step_definitions/list_item_steps.rb +0 -19
- data/features/step_definitions/modal_dialog_steps.rb +0 -62
- data/features/step_definitions/multi_elements_steps.rb +0 -554
- data/features/step_definitions/nested_elements_steps.rb +0 -212
- data/features/step_definitions/ordered_list_steps.rb +0 -23
- data/features/step_definitions/page_level_actions_steps.rb +0 -135
- data/features/step_definitions/page_traversal_steps.rb +0 -8
- data/features/step_definitions/paragraph_steps.rb +0 -28
- data/features/step_definitions/radio_button_group_steps.rb +0 -36
- data/features/step_definitions/radio_button_steps.rb +0 -27
- data/features/step_definitions/section_steps.rb +0 -277
- data/features/step_definitions/select_list_steps.rb +0 -65
- data/features/step_definitions/span_steps.rb +0 -19
- data/features/step_definitions/table_cell_steps.rb +0 -15
- data/features/step_definitions/table_row_steps.rb +0 -23
- data/features/step_definitions/table_steps.rb +0 -70
- data/features/step_definitions/text_area_steps.rb +0 -35
- data/features/step_definitions/text_field_steps.rb +0 -35
- data/features/step_definitions/unordered_list_steps.rb +0 -23
- data/features/step_definitions/video_steps.rb +0 -45
- data/features/support/ajax_text_environment.rb +0 -26
- data/features/support/audio_video_page.rb +0 -24
- data/features/support/env.rb +0 -8
- data/features/support/hooks.rb +0 -8
- data/features/support/page.rb +0 -373
- data/features/support/persistent_browser.rb +0 -70
- data/features/support/targets/firefox14_osx.rb +0 -6
- data/features/support/targets/firefox14_windows7.rb +0 -6
- data/features/support/url_helper.rb +0 -61
- data/features/table.feature +0 -122
- data/features/table_cell.feature +0 -45
- data/features/table_row.feature +0 -43
- data/features/text_area.feature +0 -51
- data/features/text_field.feature +0 -70
- data/features/unordered_list.feature +0 -56
- data/features/video.feature +0 -69
- data/spec/page-object/accessors_spec.rb +0 -40
- data/spec/page-object/element_locators_spec.rb +0 -1144
- data/spec/page-object/elements/area_spec.rb +0 -45
- data/spec/page-object/elements/bold_spec.rb +0 -29
- data/spec/page-object/elements/button_spec.rb +0 -64
- data/spec/page-object/elements/canvas_spec.rb +0 -41
- data/spec/page-object/elements/check_box_spec.rb +0 -49
- data/spec/page-object/elements/div_spec.rb +0 -28
- data/spec/page-object/elements/element_spec.rb +0 -196
- data/spec/page-object/elements/file_field_spec.rb +0 -39
- data/spec/page-object/elements/form_spec.rb +0 -28
- data/spec/page-object/elements/heading_spec.rb +0 -48
- data/spec/page-object/elements/hidden_field_spec.rb +0 -28
- data/spec/page-object/elements/image_spec.rb +0 -66
- data/spec/page-object/elements/italic_spec.rb +0 -29
- data/spec/page-object/elements/label_spec.rb +0 -29
- data/spec/page-object/elements/link_spec.rb +0 -49
- data/spec/page-object/elements/list_item_spec.rb +0 -29
- data/spec/page-object/elements/media_spec.rb +0 -63
- data/spec/page-object/elements/nested_element_spec.rb +0 -254
- data/spec/page-object/elements/option_spec.rb +0 -11
- data/spec/page-object/elements/ordered_list_spec.rb +0 -78
- data/spec/page-object/elements/paragraph_spec.rb +0 -27
- data/spec/page-object/elements/select_list_spec.rb +0 -142
- data/spec/page-object/elements/selenium/radio_button_spec.rb +0 -44
- data/spec/page-object/elements/selenium/text_field_spec.rb +0 -49
- data/spec/page-object/elements/selenium_element_spec.rb +0 -218
- data/spec/page-object/elements/span_spec.rb +0 -26
- data/spec/page-object/elements/table_cell_spec.rb +0 -21
- data/spec/page-object/elements/table_row_spec.rb +0 -70
- data/spec/page-object/elements/table_spec.rb +0 -98
- data/spec/page-object/elements/text_area_spec.rb +0 -39
- data/spec/page-object/elements/unordered_list_spec.rb +0 -77
- data/spec/page-object/elements/video_spec.rb +0 -33
- data/spec/page-object/elements/watir_element_spec.rb +0 -193
- data/spec/page-object/javascript_framework_facade_spec.rb +0 -61
- data/spec/page-object/loads_platform_spec.rb +0 -53
- data/spec/page-object/page-object_spec.rb +0 -435
- data/spec/page-object/page_factory_spec.rb +0 -238
- data/spec/page-object/page_populator_spec.rb +0 -122
- data/spec/page-object/page_section_spec.rb +0 -80
- data/spec/page-object/platforms/selenium_webdriver/selenium_page_object_spec.rb +0 -68
- data/spec/page-object/platforms/selenium_webdriver_spec.rb +0 -29
- data/spec/page-object/platforms/watir_webdriver/watir_page_object_spec.rb +0 -29
- data/spec/page-object/platforms/watir_webdriver_spec.rb +0 -9
- data/spec/page-object/selenium_accessors_spec.rb +0 -628
- data/spec/page-object/watir_accessors_spec.rb +0 -1191
- data/spec/page-object/widget_spec.rb +0 -226
- data/spec/spec_helper.rb +0 -43
@@ -1,1191 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
class WatirAccessorsTestPageObject
|
4
|
-
include PageObject
|
5
|
-
|
6
|
-
page_url "http://apple.com"
|
7
|
-
expected_title "Expected Title"
|
8
|
-
expected_element :google_search
|
9
|
-
link(:google_search, :link => 'Google Search')
|
10
|
-
text_field(:first_name, :id => 'first_name')
|
11
|
-
hidden_field(:social_security_number, :id => 'ssn')
|
12
|
-
text_area(:address, :id => 'address')
|
13
|
-
select_list(:state, :id => 'state')
|
14
|
-
checkbox(:active, :id => 'is_active_id')
|
15
|
-
radio_button(:first, :id => 'first_choice')
|
16
|
-
button(:click_me, :id => 'button_submit')
|
17
|
-
div(:message, :id => 'message_id')
|
18
|
-
table(:cart, :id => 'cart_id')
|
19
|
-
cell(:total, :id => 'total')
|
20
|
-
span(:alert_span, :id => 'alert_id')
|
21
|
-
image(:logo, :id => 'logo')
|
22
|
-
form(:login, :id => 'login')
|
23
|
-
list_item(:item_one, :id => 'one')
|
24
|
-
unordered_list(:menu, :id => 'main_menu')
|
25
|
-
ordered_list(:top_five, :id => 'top')
|
26
|
-
h1(:heading1, :id => 'main_heading')
|
27
|
-
h2(:heading2, :id => 'main_heading')
|
28
|
-
h3(:heading3, :id => 'main_heading')
|
29
|
-
h4(:heading4, :id => 'main_heading')
|
30
|
-
h5(:heading5, :id => 'main_heading')
|
31
|
-
h6(:heading6, :id => 'main_heading')
|
32
|
-
paragraph(:first_para, :id => 'first')
|
33
|
-
file_field(:upload_me, :id => 'the_file')
|
34
|
-
area(:img_area, :id => 'area')
|
35
|
-
canvas(:my_canvas, :id => 'canvas_id')
|
36
|
-
audio(:acdc, :id => 'audio_id')
|
37
|
-
video(:movie, :id => 'video_id')
|
38
|
-
b(:bold, :id => 'bold')
|
39
|
-
i(:italic, :id => 'italic')
|
40
|
-
end
|
41
|
-
|
42
|
-
class WatirBlockPageObject
|
43
|
-
include PageObject
|
44
|
-
|
45
|
-
attr_reader :value
|
46
|
-
|
47
|
-
text_field :first_name do |element|
|
48
|
-
"text_field"
|
49
|
-
end
|
50
|
-
hidden_field :secret do |element|
|
51
|
-
"hidden_field"
|
52
|
-
end
|
53
|
-
text_area :address do |element|
|
54
|
-
"text_area"
|
55
|
-
end
|
56
|
-
select_list :state do |element|
|
57
|
-
"select_list"
|
58
|
-
end
|
59
|
-
link :continue do |element|
|
60
|
-
"link"
|
61
|
-
end
|
62
|
-
checkbox :active do |element|
|
63
|
-
"checkbox"
|
64
|
-
end
|
65
|
-
radio_button :first do |element|
|
66
|
-
"radio_button"
|
67
|
-
end
|
68
|
-
button :click_me do |element|
|
69
|
-
"button"
|
70
|
-
end
|
71
|
-
div :footer do |element|
|
72
|
-
"div"
|
73
|
-
end
|
74
|
-
span :alert_span do |element|
|
75
|
-
"span"
|
76
|
-
end
|
77
|
-
table :cart do |element|
|
78
|
-
"table"
|
79
|
-
end
|
80
|
-
cell :total do |element|
|
81
|
-
"cell"
|
82
|
-
end
|
83
|
-
image :logo do |element|
|
84
|
-
"image"
|
85
|
-
end
|
86
|
-
form :login do |element|
|
87
|
-
"form"
|
88
|
-
end
|
89
|
-
list_item :item_one do |element|
|
90
|
-
"list_item"
|
91
|
-
end
|
92
|
-
unordered_list :menu do |element|
|
93
|
-
"unordered_list"
|
94
|
-
end
|
95
|
-
ordered_list :top_five do |element|
|
96
|
-
"ordered_list"
|
97
|
-
end
|
98
|
-
h1 :heading1 do |element|
|
99
|
-
"h1"
|
100
|
-
end
|
101
|
-
h2 :heading2 do |element|
|
102
|
-
"h2"
|
103
|
-
end
|
104
|
-
h3 :heading3 do |element|
|
105
|
-
"h3"
|
106
|
-
end
|
107
|
-
h4 :heading4 do |element|
|
108
|
-
"h4"
|
109
|
-
end
|
110
|
-
h5 :heading5 do |element|
|
111
|
-
"h5"
|
112
|
-
end
|
113
|
-
h6 :heading6 do |element|
|
114
|
-
"h6"
|
115
|
-
end
|
116
|
-
paragraph :first_para do |element|
|
117
|
-
"p"
|
118
|
-
end
|
119
|
-
file_field :a_file do |element|
|
120
|
-
"file_field"
|
121
|
-
end
|
122
|
-
area :img_area do |element|
|
123
|
-
"area"
|
124
|
-
end
|
125
|
-
canvas :my_canvas do |element|
|
126
|
-
"canvas"
|
127
|
-
end
|
128
|
-
audio :acdc do |element|
|
129
|
-
"audio"
|
130
|
-
end
|
131
|
-
video :movie do |element|
|
132
|
-
"video"
|
133
|
-
end
|
134
|
-
b :bold do |element|
|
135
|
-
"b"
|
136
|
-
end
|
137
|
-
i :italic do |element|
|
138
|
-
"i"
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
describe PageObject::Accessors do
|
143
|
-
let(:watir_browser) { mock_watir_browser }
|
144
|
-
let(:watir_page_object) { WatirAccessorsTestPageObject.new(watir_browser) }
|
145
|
-
let(:block_page_object) { WatirBlockPageObject.new(watir_browser) }
|
146
|
-
|
147
|
-
context "goto a page" do
|
148
|
-
|
149
|
-
it "should navigate to a page when requested" do
|
150
|
-
expect(watir_browser).to receive(:goto)
|
151
|
-
WatirAccessorsTestPageObject.new(watir_browser, true)
|
152
|
-
end
|
153
|
-
|
154
|
-
it "should call a method when page_url called with a symbol" do
|
155
|
-
class SymbolPageUrl
|
156
|
-
include PageObject
|
157
|
-
page_url :custom_url
|
158
|
-
|
159
|
-
attr_reader :custom_url
|
160
|
-
def initialize(b, v, url)
|
161
|
-
@custom_url = url
|
162
|
-
super(b, v)
|
163
|
-
end
|
164
|
-
end
|
165
|
-
expect(watir_browser).to receive(:goto).with('custom')
|
166
|
-
SymbolPageUrl.new(watir_browser, true, 'custom')
|
167
|
-
|
168
|
-
expect(watir_browser).to receive(:goto).with('different')
|
169
|
-
SymbolPageUrl.new(watir_browser, true, 'different')
|
170
|
-
end
|
171
|
-
|
172
|
-
it "should not navigate to a page when not requested" do
|
173
|
-
expect(watir_browser).not_to receive(:goto)
|
174
|
-
WatirAccessorsTestPageObject.new(watir_browser)
|
175
|
-
end
|
176
|
-
|
177
|
-
it "should not navigate to a page when 'page_url' not specified" do
|
178
|
-
expect(watir_browser).not_to receive(:goto)
|
179
|
-
WatirBlockPageObject.new(watir_browser, true)
|
180
|
-
end
|
181
|
-
|
182
|
-
it "should provide the page url" do
|
183
|
-
expect(watir_page_object.page_url_value).to eql 'http://apple.com'
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
context "validating the page title" do
|
188
|
-
it "should validate the title" do
|
189
|
-
expect(watir_browser).to receive(:title).and_return("Expected Title")
|
190
|
-
expect(watir_page_object).to have_expected_title
|
191
|
-
end
|
192
|
-
|
193
|
-
it "should validate the by regexp" do
|
194
|
-
class RegexpExpectedTitle
|
195
|
-
include PageObject
|
196
|
-
expected_title /\w+ \w+/
|
197
|
-
end
|
198
|
-
expect(watir_browser).to receive(:title).and_return("Expected Title")
|
199
|
-
expect(RegexpExpectedTitle.new(watir_browser)).to have_expected_title
|
200
|
-
end
|
201
|
-
|
202
|
-
it "should raise error when it does not have expected title" do
|
203
|
-
expect(watir_browser).to receive(:title).once.and_return("Not Expected")
|
204
|
-
expect { watir_page_object.has_expected_title? }.to raise_error
|
205
|
-
end
|
206
|
-
end
|
207
|
-
|
208
|
-
context "validating the existence of an element" do
|
209
|
-
it "should validate an element exists" do
|
210
|
-
expect(watir_page_object).to receive(:google_search_element).and_return(watir_browser)
|
211
|
-
expect(watir_browser).to receive(:when_present).and_return(true)
|
212
|
-
watir_page_object.has_expected_element?
|
213
|
-
end
|
214
|
-
|
215
|
-
it "should handle non-existent elements gracefully" do
|
216
|
-
class FakePage
|
217
|
-
include PageObject
|
218
|
-
expected_element :foo
|
219
|
-
end
|
220
|
-
expect(FakePage.new(watir_browser)).not_to have_expected_element
|
221
|
-
end
|
222
|
-
end
|
223
|
-
|
224
|
-
context "using element accessor" do
|
225
|
-
class WatirDefaultElementTagToElement
|
226
|
-
include PageObject
|
227
|
-
# verify that the explicit :element tag can be omitted
|
228
|
-
# element('button', :element, {:css => 'some css'})
|
229
|
-
element('button', { :css => 'some css' })
|
230
|
-
elements('button2', { :css => 'some css' })
|
231
|
-
end
|
232
|
-
|
233
|
-
let (:page) { WatirDefaultElementTagToElement.new(watir_browser) }
|
234
|
-
|
235
|
-
def mock_driver_for(tag)
|
236
|
-
expect(watir_browser).to receive(tag).with(:css => 'some css').and_return(watir_browser)
|
237
|
-
end
|
238
|
-
|
239
|
-
it "should default element tag to element" do
|
240
|
-
mock_driver_for :element
|
241
|
-
page.button_element
|
242
|
-
end
|
243
|
-
|
244
|
-
it "should default elements tag to element" do
|
245
|
-
mock_driver_for :elements
|
246
|
-
expect(watir_browser).to receive(:map).and_return([])
|
247
|
-
page.button2_elements.to_a
|
248
|
-
end
|
249
|
-
end
|
250
|
-
|
251
|
-
context "using default identifiers" do
|
252
|
-
class WatirDefaultIdentifier
|
253
|
-
include PageObject
|
254
|
-
text_field(:default_tf)
|
255
|
-
hidden_field(:default_hf)
|
256
|
-
text_area(:default_ta)
|
257
|
-
select_list(:default_sl)
|
258
|
-
link(:default_link)
|
259
|
-
checkbox(:default_cb)
|
260
|
-
radio_button(:default_rb)
|
261
|
-
button(:default_but)
|
262
|
-
div(:default_div)
|
263
|
-
span(:default_span)
|
264
|
-
table(:default_tab)
|
265
|
-
cell(:default_cell)
|
266
|
-
image(:default_im)
|
267
|
-
form(:default_form)
|
268
|
-
list_item(:default_li)
|
269
|
-
unordered_list(:default_ul)
|
270
|
-
ordered_list(:default_ol)
|
271
|
-
h1(:default_h1)
|
272
|
-
h2(:default_h2)
|
273
|
-
h3(:default_h3)
|
274
|
-
h4(:default_h4)
|
275
|
-
h5(:default_h5)
|
276
|
-
h6(:default_h6)
|
277
|
-
paragraph(:default_p)
|
278
|
-
file_field(:default_ff)
|
279
|
-
label(:default_lab)
|
280
|
-
element(:default_el, :audio)
|
281
|
-
end
|
282
|
-
|
283
|
-
let(:default_identifier) { WatirDefaultIdentifier.new(watir_browser) }
|
284
|
-
|
285
|
-
def mock_driver_for(tag)
|
286
|
-
expect(watir_browser).to receive(tag).with(:index => 0).and_return(watir_browser)
|
287
|
-
allow(watir_browser).to receive(:exists?).with(no_args)
|
288
|
-
end
|
289
|
-
|
290
|
-
it "should work with a text_field" do
|
291
|
-
mock_driver_for :text_field
|
292
|
-
default_identifier.default_tf?
|
293
|
-
end
|
294
|
-
|
295
|
-
it "should work with a hidden field" do
|
296
|
-
mock_driver_for :hidden
|
297
|
-
default_identifier.default_hf?
|
298
|
-
end
|
299
|
-
|
300
|
-
it "should work with a text area" do
|
301
|
-
mock_driver_for :textarea
|
302
|
-
default_identifier.default_ta?
|
303
|
-
end
|
304
|
-
|
305
|
-
it "should work with a select list" do
|
306
|
-
mock_driver_for :select_list
|
307
|
-
default_identifier.default_sl?
|
308
|
-
end
|
309
|
-
|
310
|
-
it "should work with a link" do
|
311
|
-
mock_driver_for :link
|
312
|
-
default_identifier.default_link?
|
313
|
-
end
|
314
|
-
|
315
|
-
it "should work with a checkbox" do
|
316
|
-
mock_driver_for :checkbox
|
317
|
-
default_identifier.default_cb?
|
318
|
-
end
|
319
|
-
|
320
|
-
it "should work with a radio button" do
|
321
|
-
mock_driver_for :radio
|
322
|
-
default_identifier.default_rb?
|
323
|
-
end
|
324
|
-
|
325
|
-
it "should work with a button" do
|
326
|
-
mock_driver_for :button
|
327
|
-
default_identifier.default_but?
|
328
|
-
end
|
329
|
-
|
330
|
-
it "should work with a div" do
|
331
|
-
mock_driver_for :div
|
332
|
-
default_identifier.default_div?
|
333
|
-
end
|
334
|
-
|
335
|
-
it "should work with a span" do
|
336
|
-
mock_driver_for :span
|
337
|
-
default_identifier.default_span?
|
338
|
-
end
|
339
|
-
|
340
|
-
it "should work for a table" do
|
341
|
-
mock_driver_for :table
|
342
|
-
expect(default_identifier.default_tab_element).not_to be_nil
|
343
|
-
end
|
344
|
-
|
345
|
-
it "should work for a cell" do
|
346
|
-
mock_driver_for :td
|
347
|
-
default_identifier.default_cell?
|
348
|
-
end
|
349
|
-
|
350
|
-
it "should work for an image" do
|
351
|
-
mock_driver_for :image
|
352
|
-
default_identifier.default_im?
|
353
|
-
end
|
354
|
-
|
355
|
-
it "should work for a form" do
|
356
|
-
mock_driver_for :form
|
357
|
-
default_identifier.default_form?
|
358
|
-
end
|
359
|
-
|
360
|
-
it "should work for a list item" do
|
361
|
-
mock_driver_for :li
|
362
|
-
default_identifier.default_li?
|
363
|
-
end
|
364
|
-
|
365
|
-
it "should work for unordered lists" do
|
366
|
-
mock_driver_for :ul
|
367
|
-
default_identifier.default_ul?
|
368
|
-
end
|
369
|
-
|
370
|
-
it "should work for ordered lists" do
|
371
|
-
mock_driver_for :ol
|
372
|
-
default_identifier.default_ol?
|
373
|
-
end
|
374
|
-
|
375
|
-
it "should work for h1" do
|
376
|
-
mock_driver_for :h1
|
377
|
-
default_identifier.default_h1?
|
378
|
-
end
|
379
|
-
|
380
|
-
it "should work for h2" do
|
381
|
-
mock_driver_for :h2
|
382
|
-
default_identifier.default_h2?
|
383
|
-
end
|
384
|
-
|
385
|
-
it "should work for h3" do
|
386
|
-
mock_driver_for :h3
|
387
|
-
default_identifier.default_h3?
|
388
|
-
end
|
389
|
-
|
390
|
-
it "should work for a h4" do
|
391
|
-
mock_driver_for :h4
|
392
|
-
default_identifier.default_h4?
|
393
|
-
end
|
394
|
-
|
395
|
-
it "should work for a h5" do
|
396
|
-
mock_driver_for :h5
|
397
|
-
default_identifier.default_h5?
|
398
|
-
end
|
399
|
-
|
400
|
-
it "should work for a h6" do
|
401
|
-
mock_driver_for :h6
|
402
|
-
default_identifier.default_h6?
|
403
|
-
end
|
404
|
-
|
405
|
-
it "should work with a paragraph" do
|
406
|
-
mock_driver_for :p
|
407
|
-
default_identifier.default_p?
|
408
|
-
end
|
409
|
-
|
410
|
-
it "should work with a file_field" do
|
411
|
-
mock_driver_for :file_field
|
412
|
-
default_identifier.default_ff?
|
413
|
-
end
|
414
|
-
|
415
|
-
it "should work with a label" do
|
416
|
-
mock_driver_for :label
|
417
|
-
default_identifier.default_lab?
|
418
|
-
end
|
419
|
-
|
420
|
-
it "should work with an element" do
|
421
|
-
mock_driver_for :audio
|
422
|
-
default_identifier.default_el?
|
423
|
-
end
|
424
|
-
|
425
|
-
end
|
426
|
-
|
427
|
-
context "link accessors" do
|
428
|
-
context "when called on a page object" do
|
429
|
-
it "should generate accessor methods" do
|
430
|
-
expect(watir_page_object).to respond_to(:google_search)
|
431
|
-
expect(watir_page_object).to respond_to(:google_search_element)
|
432
|
-
end
|
433
|
-
|
434
|
-
it "should call a block on the element method when present" do
|
435
|
-
expect(block_page_object.continue_element).to eql "link"
|
436
|
-
end
|
437
|
-
end
|
438
|
-
|
439
|
-
it "should select a link" do
|
440
|
-
expect(watir_browser).to receive_messages(link: watir_browser, click: watir_browser)
|
441
|
-
watir_page_object.google_search
|
442
|
-
end
|
443
|
-
|
444
|
-
it "should return a link element" do
|
445
|
-
expect(watir_browser).to receive(:link).and_return(watir_browser)
|
446
|
-
element = watir_page_object.google_search_element
|
447
|
-
expect(element).to be_instance_of PageObject::Elements::Link
|
448
|
-
end
|
449
|
-
end
|
450
|
-
|
451
|
-
|
452
|
-
describe "text_field accessors" do
|
453
|
-
context "when called on a page object" do
|
454
|
-
it "should generate accessor methods" do
|
455
|
-
expect(watir_page_object).to respond_to(:first_name)
|
456
|
-
expect(watir_page_object).to respond_to(:first_name=)
|
457
|
-
expect(watir_page_object).to respond_to(:first_name_element)
|
458
|
-
expect(watir_page_object).to respond_to(:first_name?)
|
459
|
-
end
|
460
|
-
|
461
|
-
it "should call a block on the element method when present" do
|
462
|
-
expect(block_page_object.first_name_element).to eql "text_field"
|
463
|
-
end
|
464
|
-
end
|
465
|
-
|
466
|
-
it "should get the text from the text field element" do
|
467
|
-
expect(watir_browser).to receive(:text_field).and_return(watir_browser)
|
468
|
-
expect(watir_browser).to receive(:value).and_return('Kim')
|
469
|
-
expect(watir_page_object.first_name).to eql 'Kim'
|
470
|
-
end
|
471
|
-
|
472
|
-
it "should set some text on a text field element" do
|
473
|
-
expect(watir_browser).to receive(:text_field).and_return(watir_browser)
|
474
|
-
expect(watir_browser).to receive(:set).with('Kim')
|
475
|
-
watir_page_object.first_name = 'Kim'
|
476
|
-
end
|
477
|
-
|
478
|
-
it "should retrieve a text field element" do
|
479
|
-
expect(watir_browser).to receive(:text_field).and_return(watir_browser)
|
480
|
-
element = watir_page_object.first_name_element
|
481
|
-
expect(element).to be_instance_of PageObject::Elements::TextField
|
482
|
-
end
|
483
|
-
end
|
484
|
-
|
485
|
-
|
486
|
-
describe "hidden field accessors" do
|
487
|
-
context "when called on a page object" do
|
488
|
-
it "should generate accessor methods" do
|
489
|
-
expect(watir_page_object).to respond_to(:social_security_number)
|
490
|
-
expect(watir_page_object).to respond_to(:social_security_number_element)
|
491
|
-
end
|
492
|
-
|
493
|
-
it "should call a block on the element method when present" do
|
494
|
-
expect(block_page_object.secret_element).to eql "hidden_field"
|
495
|
-
end
|
496
|
-
end
|
497
|
-
|
498
|
-
it "should get the text from a hidden field" do
|
499
|
-
expect(watir_browser).to receive(:hidden).and_return(watir_browser)
|
500
|
-
expect(watir_browser).to receive(:value).and_return("value")
|
501
|
-
expect(watir_page_object.social_security_number).to eql "value"
|
502
|
-
end
|
503
|
-
|
504
|
-
it "should retrieve a hidden field element" do
|
505
|
-
expect(watir_browser).to receive(:hidden).and_return(watir_browser)
|
506
|
-
element = watir_page_object.social_security_number_element
|
507
|
-
expect(element).to be_instance_of(PageObject::Elements::HiddenField)
|
508
|
-
end
|
509
|
-
end
|
510
|
-
|
511
|
-
describe "text area accessors" do
|
512
|
-
context "when called on a page object" do
|
513
|
-
it "should generate accessor methods" do
|
514
|
-
expect(watir_page_object).to respond_to(:address)
|
515
|
-
expect(watir_page_object).to respond_to(:address=)
|
516
|
-
expect(watir_page_object).to respond_to(:address_element)
|
517
|
-
end
|
518
|
-
|
519
|
-
it "should call a block on the element method when present" do
|
520
|
-
expect(block_page_object.address_element).to eql "text_area"
|
521
|
-
end
|
522
|
-
end
|
523
|
-
|
524
|
-
it "should set some text on the text area" do
|
525
|
-
expect(watir_browser).to receive(:textarea).and_return(watir_browser)
|
526
|
-
expect(watir_browser).to receive(:set).with("123 main street")
|
527
|
-
watir_page_object.address = "123 main street"
|
528
|
-
end
|
529
|
-
|
530
|
-
it "should get the text from the text area" do
|
531
|
-
expect(watir_browser).to receive(:textarea).and_return(watir_browser)
|
532
|
-
expect(watir_browser).to receive(:value).and_return("123 main street")
|
533
|
-
expect(watir_page_object.address).to eql "123 main street"
|
534
|
-
end
|
535
|
-
|
536
|
-
it "should retrieve a text area element" do
|
537
|
-
expect(watir_browser).to receive(:textarea).and_return(watir_browser)
|
538
|
-
element = watir_page_object.address_element
|
539
|
-
expect(element).to be_instance_of PageObject::Elements::TextArea
|
540
|
-
end
|
541
|
-
end
|
542
|
-
|
543
|
-
describe "select_list accessors" do
|
544
|
-
context "when called on a page object" do
|
545
|
-
it "should generate accessor methods" do
|
546
|
-
expect(watir_page_object).to respond_to :state
|
547
|
-
expect(watir_page_object).to respond_to :state=
|
548
|
-
expect(watir_page_object).to respond_to(:state_element)
|
549
|
-
end
|
550
|
-
|
551
|
-
it "should call a block on the element method when present" do
|
552
|
-
expect(block_page_object.state_element).to eql "select_list"
|
553
|
-
end
|
554
|
-
end
|
555
|
-
|
556
|
-
it "should get the current item from a select list" do
|
557
|
-
selected = "OH"
|
558
|
-
expect(selected).to receive(:selected?).and_return(selected)
|
559
|
-
expect(selected).to receive(:text).and_return("OH")
|
560
|
-
expect(watir_browser).to receive(:select_list).and_return watir_browser
|
561
|
-
expect(watir_browser).to receive(:options).and_return([selected])
|
562
|
-
expect(watir_page_object.state).to eql "OH"
|
563
|
-
end
|
564
|
-
|
565
|
-
it "should set the current item of a select list" do
|
566
|
-
expect(watir_browser).to receive(:select_list).and_return watir_browser
|
567
|
-
expect(watir_browser).to receive(:select).with("OH")
|
568
|
-
watir_page_object.state = "OH"
|
569
|
-
end
|
570
|
-
|
571
|
-
it "should retreive the select list element" do
|
572
|
-
expect(watir_browser).to receive(:select_list).and_return(watir_browser)
|
573
|
-
element = watir_page_object.state_element
|
574
|
-
expect(element).to be_instance_of PageObject::Elements::SelectList
|
575
|
-
end
|
576
|
-
|
577
|
-
it "should return list of selection options" do
|
578
|
-
option1 = double('option')
|
579
|
-
option2 = double('option')
|
580
|
-
expect(option1).to receive(:text).and_return("CA")
|
581
|
-
expect(option2).to receive(:text).and_return("OH")
|
582
|
-
|
583
|
-
select_element = double("select")
|
584
|
-
expect(select_element).to receive(:options).twice.and_return([option1, option2])
|
585
|
-
expect(watir_page_object).to receive(:state_element).and_return(select_element)
|
586
|
-
|
587
|
-
expect(watir_page_object.state_options).to eql ["CA","OH"]
|
588
|
-
end
|
589
|
-
end
|
590
|
-
|
591
|
-
describe "check_box accessors" do
|
592
|
-
context "when called on a page object" do
|
593
|
-
it "should generate accessor methods" do
|
594
|
-
expect(watir_page_object).to respond_to :check_active
|
595
|
-
expect(watir_page_object).to respond_to :uncheck_active
|
596
|
-
expect(watir_page_object).to respond_to :active_checked?
|
597
|
-
expect(watir_page_object).to respond_to :active_element
|
598
|
-
end
|
599
|
-
|
600
|
-
it "should call a block on the element method when present" do
|
601
|
-
expect(block_page_object.active_element).to eql "checkbox"
|
602
|
-
end
|
603
|
-
end
|
604
|
-
|
605
|
-
it "should check a check box element" do
|
606
|
-
expect(watir_browser).to receive(:checkbox).and_return(watir_browser)
|
607
|
-
expect(watir_browser).to receive(:set)
|
608
|
-
watir_page_object.check_active
|
609
|
-
end
|
610
|
-
|
611
|
-
it "should clear a check box element" do
|
612
|
-
expect(watir_browser).to receive(:checkbox).and_return(watir_browser)
|
613
|
-
expect(watir_browser).to receive(:clear)
|
614
|
-
watir_page_object.uncheck_active
|
615
|
-
end
|
616
|
-
|
617
|
-
it "should know if a check box element is selected" do
|
618
|
-
expect(watir_browser).to receive(:checkbox).and_return(watir_browser)
|
619
|
-
expect(watir_browser).to receive(:set?).and_return(true)
|
620
|
-
expect(watir_page_object.active_checked?).to be true
|
621
|
-
end
|
622
|
-
|
623
|
-
it "should retrieve a checkbox element" do
|
624
|
-
expect(watir_browser).to receive(:checkbox).and_return(watir_browser)
|
625
|
-
element = watir_page_object.active_element
|
626
|
-
expect(element).to be_instance_of PageObject::Elements::CheckBox
|
627
|
-
end
|
628
|
-
end
|
629
|
-
|
630
|
-
|
631
|
-
describe "radio accessors" do
|
632
|
-
context "when called on a page object" do
|
633
|
-
it "should generate accessor methods" do
|
634
|
-
expect(watir_page_object).to respond_to :select_first
|
635
|
-
expect(watir_page_object).to respond_to :first_selected?
|
636
|
-
expect(watir_page_object).to respond_to(:first_element)
|
637
|
-
end
|
638
|
-
|
639
|
-
it "should call a block on the element method when present" do
|
640
|
-
expect(block_page_object.first_element).to eql "radio_button"
|
641
|
-
end
|
642
|
-
end
|
643
|
-
|
644
|
-
it "should select a radio button" do
|
645
|
-
expect(watir_browser).to receive(:radio).and_return(watir_browser)
|
646
|
-
expect(watir_browser).to receive(:set)
|
647
|
-
watir_page_object.select_first
|
648
|
-
end
|
649
|
-
|
650
|
-
it "should determine if a radio is selected" do
|
651
|
-
expect(watir_browser).to receive(:radio).and_return(watir_browser)
|
652
|
-
expect(watir_browser).to receive(:set?)
|
653
|
-
watir_page_object.first_selected?
|
654
|
-
end
|
655
|
-
|
656
|
-
it "should retrieve a radio button element" do
|
657
|
-
expect(watir_browser).to receive(:radio).and_return(watir_browser)
|
658
|
-
element = watir_page_object.first_element
|
659
|
-
expect(element).to be_instance_of PageObject::Elements::RadioButton
|
660
|
-
end
|
661
|
-
end
|
662
|
-
|
663
|
-
describe "button accessors" do
|
664
|
-
context "when called on a page object" do
|
665
|
-
it "should generate accessor methods" do
|
666
|
-
expect(watir_page_object).to respond_to :click_me
|
667
|
-
expect(watir_page_object).to respond_to :click_me_element
|
668
|
-
end
|
669
|
-
|
670
|
-
it "should call a block on the element method when present" do
|
671
|
-
expect(block_page_object.click_me_element).to eql "button"
|
672
|
-
end
|
673
|
-
end
|
674
|
-
|
675
|
-
it "should be able to click a button" do
|
676
|
-
expect(watir_browser).to receive(:button).and_return(watir_browser)
|
677
|
-
expect(watir_browser).to receive(:click)
|
678
|
-
watir_page_object.click_me
|
679
|
-
end
|
680
|
-
|
681
|
-
it "should retrieve a button element" do
|
682
|
-
expect(watir_browser).to receive(:button).and_return(watir_browser)
|
683
|
-
element = watir_page_object.click_me_element
|
684
|
-
expect(element).to be_instance_of PageObject::Elements::Button
|
685
|
-
end
|
686
|
-
end
|
687
|
-
|
688
|
-
describe "div accessors" do
|
689
|
-
context "when called on a page object" do
|
690
|
-
it "should generate accessor methods" do
|
691
|
-
expect(watir_page_object).to respond_to(:message)
|
692
|
-
expect(watir_page_object).to respond_to(:message_element)
|
693
|
-
end
|
694
|
-
|
695
|
-
it "should call a block on the element method when present" do
|
696
|
-
expect(block_page_object.footer_element).to eql "div"
|
697
|
-
end
|
698
|
-
end
|
699
|
-
|
700
|
-
it "should retrieve the text from a div" do
|
701
|
-
expect(watir_browser).to receive(:div).and_return(watir_browser)
|
702
|
-
expect(watir_browser).to receive(:text).and_return("Message from div")
|
703
|
-
expect(watir_page_object.message).to eql "Message from div"
|
704
|
-
end
|
705
|
-
|
706
|
-
it "should retrieve the div element from the page" do
|
707
|
-
expect(watir_browser).to receive(:div).and_return(watir_browser)
|
708
|
-
element = watir_page_object.message_element
|
709
|
-
expect(element).to be_instance_of PageObject::Elements::Div
|
710
|
-
end
|
711
|
-
end
|
712
|
-
|
713
|
-
describe "span accessors" do
|
714
|
-
context "when called on a page object" do
|
715
|
-
it "should generate accessor methods" do
|
716
|
-
expect(watir_page_object).to respond_to(:alert_span)
|
717
|
-
expect(watir_page_object).to respond_to(:alert_span_element)
|
718
|
-
end
|
719
|
-
|
720
|
-
it "should call a block on the element method when present" do
|
721
|
-
expect(block_page_object.alert_span_element).to eql "span"
|
722
|
-
end
|
723
|
-
end
|
724
|
-
|
725
|
-
it "should retrieve the text from a span" do
|
726
|
-
expect(watir_browser).to receive(:span).and_return(watir_browser)
|
727
|
-
expect(watir_browser).to receive(:text).and_return("Alert")
|
728
|
-
expect(watir_page_object.alert_span).to eql "Alert"
|
729
|
-
end
|
730
|
-
|
731
|
-
it "should retrieve the span element from the page" do
|
732
|
-
expect(watir_browser).to receive(:span).and_return(watir_browser)
|
733
|
-
element = watir_page_object.alert_span_element
|
734
|
-
expect(element).to be_instance_of PageObject::Elements::Span
|
735
|
-
end
|
736
|
-
end
|
737
|
-
|
738
|
-
describe "table accessors" do
|
739
|
-
context "when called on a page object" do
|
740
|
-
it "should generate accessor methods" do
|
741
|
-
expect(watir_page_object).to respond_to(:cart)
|
742
|
-
expect(watir_page_object).to respond_to(:cart_element)
|
743
|
-
end
|
744
|
-
|
745
|
-
it "should call a block on the element method when present" do
|
746
|
-
expect(block_page_object.cart_element).to eql "table"
|
747
|
-
end
|
748
|
-
end
|
749
|
-
|
750
|
-
it "should retrieve the table element from the page" do
|
751
|
-
expect(watir_browser).to receive(:table).and_return(watir_browser)
|
752
|
-
element = watir_page_object.cart_element
|
753
|
-
expect(element).to be_instance_of PageObject::Elements::Table
|
754
|
-
end
|
755
|
-
end
|
756
|
-
|
757
|
-
describe "table cell accessors" do
|
758
|
-
context "when called on a page object" do
|
759
|
-
it "should generate accessor methods" do
|
760
|
-
expect(watir_page_object).to respond_to(:total)
|
761
|
-
expect(watir_page_object).to respond_to(:total_element)
|
762
|
-
end
|
763
|
-
|
764
|
-
it "should call a block on the element method when present" do
|
765
|
-
expect(block_page_object.total_element).to eql "cell"
|
766
|
-
end
|
767
|
-
end
|
768
|
-
|
769
|
-
it "should retrieve the text for the cell" do
|
770
|
-
expect(watir_browser).to receive(:td).and_return(watir_browser)
|
771
|
-
expect(watir_browser).to receive(:text).and_return('10.00')
|
772
|
-
expect(watir_page_object.total).to eql '10.00'
|
773
|
-
end
|
774
|
-
|
775
|
-
it "should retrieve the cell element from the page" do
|
776
|
-
expect(watir_browser).to receive(:td).and_return(watir_browser)
|
777
|
-
element = watir_page_object.total_element
|
778
|
-
expect(element).to be_instance_of PageObject::Elements::TableCell
|
779
|
-
end
|
780
|
-
end
|
781
|
-
|
782
|
-
describe "image accessors" do
|
783
|
-
context "when called on a page object" do
|
784
|
-
it "should generate accessor methods" do
|
785
|
-
expect(watir_page_object).to respond_to(:logo_element)
|
786
|
-
end
|
787
|
-
|
788
|
-
it "should call a block on the element method when present" do
|
789
|
-
expect(block_page_object.logo_element).to eql "image"
|
790
|
-
end
|
791
|
-
end
|
792
|
-
|
793
|
-
it "should retrieve the image element from the page" do
|
794
|
-
expect(watir_browser).to receive(:image).and_return(watir_browser)
|
795
|
-
element = watir_page_object.logo_element
|
796
|
-
expect(element).to be_instance_of PageObject::Elements::Image
|
797
|
-
end
|
798
|
-
end
|
799
|
-
|
800
|
-
describe "form accessors" do
|
801
|
-
context "when called on a page object" do
|
802
|
-
it "should generate accessor methods" do
|
803
|
-
expect(watir_page_object).to respond_to(:login_element)
|
804
|
-
end
|
805
|
-
|
806
|
-
it "should call a block on the element method when present" do
|
807
|
-
expect(block_page_object.login_element).to eql "form"
|
808
|
-
end
|
809
|
-
end
|
810
|
-
|
811
|
-
it "should retrieve the form element from the page" do
|
812
|
-
expect(watir_browser).to receive(:form).and_return(watir_browser)
|
813
|
-
element = watir_page_object.login_element
|
814
|
-
expect(element).to be_instance_of PageObject::Elements::Form
|
815
|
-
end
|
816
|
-
end
|
817
|
-
|
818
|
-
describe "list item accessors" do
|
819
|
-
context "when called on a page object" do
|
820
|
-
it "should generate accessor methods" do
|
821
|
-
expect(watir_page_object).to respond_to(:item_one)
|
822
|
-
expect(watir_page_object).to respond_to(:item_one_element)
|
823
|
-
end
|
824
|
-
|
825
|
-
it "should call a block on the element method when present" do
|
826
|
-
expect(block_page_object.item_one_element).to eql "list_item"
|
827
|
-
end
|
828
|
-
end
|
829
|
-
|
830
|
-
it "should retrieve the text from the list item" do
|
831
|
-
expect(watir_browser).to receive(:li).and_return(watir_browser)
|
832
|
-
expect(watir_browser).to receive(:text).and_return("value")
|
833
|
-
expect(watir_page_object.item_one).to eql "value"
|
834
|
-
end
|
835
|
-
|
836
|
-
it "should retrieve the list item element from the page" do
|
837
|
-
expect(watir_browser).to receive(:li).and_return(watir_browser)
|
838
|
-
element = watir_page_object.item_one_element
|
839
|
-
expect(element).to be_instance_of PageObject::Elements::ListItem
|
840
|
-
end
|
841
|
-
end
|
842
|
-
|
843
|
-
describe "unordered list accessors" do
|
844
|
-
context "when called on a page object" do
|
845
|
-
it "should generate accessor methods" do
|
846
|
-
expect(watir_page_object).to respond_to(:menu_element)
|
847
|
-
end
|
848
|
-
|
849
|
-
it "should call a block on the element method when present" do
|
850
|
-
expect(block_page_object.menu_element).to eql "unordered_list"
|
851
|
-
end
|
852
|
-
end
|
853
|
-
|
854
|
-
it "should retrieve the element from the page" do
|
855
|
-
expect(watir_browser).to receive(:ul).and_return(watir_browser)
|
856
|
-
element = watir_page_object.menu_element
|
857
|
-
expect(element).to be_instance_of PageObject::Elements::UnorderedList
|
858
|
-
end
|
859
|
-
end
|
860
|
-
|
861
|
-
describe "ordered list accessors" do
|
862
|
-
context "when called on a page object" do
|
863
|
-
it "should generate accessor methods" do
|
864
|
-
expect(watir_page_object).to respond_to(:top_five_element)
|
865
|
-
end
|
866
|
-
|
867
|
-
it "should call a block on the element method when present" do
|
868
|
-
expect(block_page_object.top_five_element).to eql "ordered_list"
|
869
|
-
end
|
870
|
-
end
|
871
|
-
|
872
|
-
it "should retrieve the element from the page" do
|
873
|
-
expect(watir_browser).to receive(:ol).and_return(watir_browser)
|
874
|
-
element = watir_page_object.top_five_element
|
875
|
-
expect(element).to be_instance_of PageObject::Elements::OrderedList
|
876
|
-
end
|
877
|
-
end
|
878
|
-
|
879
|
-
describe "h1 accessors" do
|
880
|
-
context "when called on a page object" do
|
881
|
-
it "should generate accessor methods" do
|
882
|
-
expect(watir_page_object).to respond_to(:heading1)
|
883
|
-
expect(watir_page_object).to respond_to(:heading1_element)
|
884
|
-
end
|
885
|
-
|
886
|
-
it "should call a block on the element method when present" do
|
887
|
-
expect(block_page_object.heading1_element).to eql "h1"
|
888
|
-
end
|
889
|
-
end
|
890
|
-
|
891
|
-
it "should retrieve the text from the h1" do
|
892
|
-
expect(watir_browser).to receive(:h1).and_return(watir_browser)
|
893
|
-
expect(watir_browser).to receive(:text).and_return("value")
|
894
|
-
expect(watir_page_object.heading1).to eql "value"
|
895
|
-
end
|
896
|
-
|
897
|
-
it "should retrieve the element from the page" do
|
898
|
-
expect(watir_browser).to receive(:h1).and_return(watir_browser)
|
899
|
-
element = watir_page_object.heading1_element
|
900
|
-
expect(element).to be_instance_of PageObject::Elements::Heading
|
901
|
-
end
|
902
|
-
end
|
903
|
-
|
904
|
-
describe "h2 accessors" do
|
905
|
-
context "when called on a page object" do
|
906
|
-
it "should generate accessor methods" do
|
907
|
-
expect(watir_page_object).to respond_to(:heading2)
|
908
|
-
expect(watir_page_object).to respond_to(:heading2_element)
|
909
|
-
end
|
910
|
-
|
911
|
-
it "should call a block on the element method when present" do
|
912
|
-
expect(block_page_object.heading2_element).to eql "h2"
|
913
|
-
end
|
914
|
-
end
|
915
|
-
|
916
|
-
it "should retrieve the text from the h2" do
|
917
|
-
expect(watir_browser).to receive(:h2).and_return(watir_browser)
|
918
|
-
expect(watir_browser).to receive(:text).and_return("value")
|
919
|
-
expect(watir_page_object.heading2).to eql "value"
|
920
|
-
end
|
921
|
-
|
922
|
-
it "should retrieve the element from the page" do
|
923
|
-
expect(watir_browser).to receive(:h2).and_return(watir_browser)
|
924
|
-
element = watir_page_object.heading2_element
|
925
|
-
expect(element).to be_instance_of PageObject::Elements::Heading
|
926
|
-
end
|
927
|
-
end
|
928
|
-
|
929
|
-
describe "h3 accessors" do
|
930
|
-
context "when called on a page object" do
|
931
|
-
it "should generate accessor methods" do
|
932
|
-
expect(watir_page_object).to respond_to(:heading3)
|
933
|
-
expect(watir_page_object).to respond_to(:heading3_element)
|
934
|
-
end
|
935
|
-
|
936
|
-
it "should call a block on the element method when present" do
|
937
|
-
expect(block_page_object.heading3_element).to eql "h3"
|
938
|
-
end
|
939
|
-
end
|
940
|
-
|
941
|
-
it "should retrieve the text from the h3" do
|
942
|
-
expect(watir_browser).to receive(:h3).and_return(watir_browser)
|
943
|
-
expect(watir_browser).to receive(:text).and_return("value")
|
944
|
-
expect(watir_page_object.heading3).to eql "value"
|
945
|
-
end
|
946
|
-
|
947
|
-
it "should retrieve the element from the page" do
|
948
|
-
expect(watir_browser).to receive(:h3).and_return(watir_browser)
|
949
|
-
element = watir_page_object.heading3_element
|
950
|
-
expect(element).to be_instance_of PageObject::Elements::Heading
|
951
|
-
end
|
952
|
-
end
|
953
|
-
|
954
|
-
describe "h4 accessors" do
|
955
|
-
context "when called on a page object" do
|
956
|
-
it "should generate accessor methods" do
|
957
|
-
expect(watir_page_object).to respond_to(:heading4)
|
958
|
-
expect(watir_page_object).to respond_to(:heading4_element)
|
959
|
-
end
|
960
|
-
|
961
|
-
it "should call a block on the element method when present" do
|
962
|
-
expect(block_page_object.heading4_element).to eql "h4"
|
963
|
-
end
|
964
|
-
end
|
965
|
-
|
966
|
-
it "should retrieve the text from the h4" do
|
967
|
-
expect(watir_browser).to receive(:h4).and_return(watir_browser)
|
968
|
-
expect(watir_browser).to receive(:text).and_return("value")
|
969
|
-
expect(watir_page_object.heading4).to eql "value"
|
970
|
-
end
|
971
|
-
|
972
|
-
it "should retrieve the element from the page" do
|
973
|
-
expect(watir_browser).to receive(:h4).and_return(watir_browser)
|
974
|
-
element = watir_page_object.heading4_element
|
975
|
-
expect(element).to be_instance_of PageObject::Elements::Heading
|
976
|
-
end
|
977
|
-
end
|
978
|
-
|
979
|
-
describe "h5 accessors" do
|
980
|
-
context "when called on a page object" do
|
981
|
-
it "should generate accessor methods" do
|
982
|
-
expect(watir_page_object).to respond_to(:heading5)
|
983
|
-
expect(watir_page_object).to respond_to(:heading5_element)
|
984
|
-
end
|
985
|
-
|
986
|
-
it "should call a block on the element method when present" do
|
987
|
-
expect(block_page_object.heading5_element).to eql "h5"
|
988
|
-
end
|
989
|
-
end
|
990
|
-
|
991
|
-
it "should retrieve the text from the h5" do
|
992
|
-
expect(watir_browser).to receive(:h5).and_return(watir_browser)
|
993
|
-
expect(watir_browser).to receive(:text).and_return("value")
|
994
|
-
expect(watir_page_object.heading5).to eql "value"
|
995
|
-
end
|
996
|
-
|
997
|
-
it "should retrieve the element from the page" do
|
998
|
-
expect(watir_browser).to receive(:h5).and_return(watir_browser)
|
999
|
-
element = watir_page_object.heading5_element
|
1000
|
-
expect(element).to be_instance_of PageObject::Elements::Heading
|
1001
|
-
end
|
1002
|
-
end
|
1003
|
-
|
1004
|
-
describe "h6 accessors" do
|
1005
|
-
context "when called on a page object" do
|
1006
|
-
it "should generate accessor methods" do
|
1007
|
-
expect(watir_page_object).to respond_to(:heading6)
|
1008
|
-
expect(watir_page_object).to respond_to(:heading6_element)
|
1009
|
-
end
|
1010
|
-
|
1011
|
-
it "should call a block on the element method when present" do
|
1012
|
-
expect(block_page_object.heading6_element).to eql "h6"
|
1013
|
-
end
|
1014
|
-
end
|
1015
|
-
|
1016
|
-
it "should retrieve the text from the h6" do
|
1017
|
-
expect(watir_browser).to receive(:h6).and_return(watir_browser)
|
1018
|
-
expect(watir_browser).to receive(:text).and_return("value")
|
1019
|
-
expect(watir_page_object.heading6).to eql "value"
|
1020
|
-
end
|
1021
|
-
|
1022
|
-
it "should retrieve the element from the page" do
|
1023
|
-
expect(watir_browser).to receive(:h6).and_return(watir_browser)
|
1024
|
-
element = watir_page_object.heading6_element
|
1025
|
-
expect(element).to be_instance_of PageObject::Elements::Heading
|
1026
|
-
end
|
1027
|
-
end
|
1028
|
-
|
1029
|
-
|
1030
|
-
describe "p accessors" do
|
1031
|
-
context "when called on a page object" do
|
1032
|
-
it "should generate accessor methods" do
|
1033
|
-
expect(watir_page_object).to respond_to(:first_para)
|
1034
|
-
expect(watir_page_object).to respond_to(:first_para_element)
|
1035
|
-
end
|
1036
|
-
|
1037
|
-
it "should call a block on the element method when present" do
|
1038
|
-
expect(block_page_object.first_para_element).to eql "p"
|
1039
|
-
end
|
1040
|
-
end
|
1041
|
-
|
1042
|
-
it "should retrieve the text from the p" do
|
1043
|
-
expect(watir_browser).to receive(:p).and_return(watir_browser)
|
1044
|
-
expect(watir_browser).to receive(:text).and_return("value")
|
1045
|
-
expect(watir_page_object.first_para).to eql "value"
|
1046
|
-
end
|
1047
|
-
|
1048
|
-
it "should retrieve the element from the page" do
|
1049
|
-
expect(watir_browser).to receive(:p).and_return(watir_browser)
|
1050
|
-
element = watir_page_object.first_para_element
|
1051
|
-
expect(element).to be_instance_of PageObject::Elements::Paragraph
|
1052
|
-
end
|
1053
|
-
end
|
1054
|
-
|
1055
|
-
describe "file_field accessors" do
|
1056
|
-
context "when called on a page object" do
|
1057
|
-
it "should generate accessor methods" do
|
1058
|
-
expect(watir_page_object).to respond_to(:upload_me=)
|
1059
|
-
expect(watir_page_object).to respond_to(:upload_me_element)
|
1060
|
-
end
|
1061
|
-
|
1062
|
-
it "should call a block on the element method when present" do
|
1063
|
-
expect(block_page_object.a_file_element).to eql "file_field"
|
1064
|
-
end
|
1065
|
-
end
|
1066
|
-
|
1067
|
-
it "should set the file name" do
|
1068
|
-
expect(watir_browser).to receive(:file_field).and_return(watir_browser)
|
1069
|
-
expect(watir_browser).to receive(:set).with('some_file')
|
1070
|
-
watir_page_object.upload_me = 'some_file'
|
1071
|
-
end
|
1072
|
-
|
1073
|
-
it "should retrieve a text field element" do
|
1074
|
-
expect(watir_browser).to receive(:file_field).and_return(watir_browser)
|
1075
|
-
element = watir_page_object.upload_me_element
|
1076
|
-
expect(element).to be_instance_of PageObject::Elements::FileField
|
1077
|
-
end
|
1078
|
-
end
|
1079
|
-
|
1080
|
-
describe "area accessors" do
|
1081
|
-
context "when called on a page object" do
|
1082
|
-
it "should generate accessor methods" do
|
1083
|
-
expect(watir_page_object).to respond_to(:img_area)
|
1084
|
-
expect(watir_page_object).to respond_to(:img_area_element)
|
1085
|
-
end
|
1086
|
-
|
1087
|
-
it "should call a block on the element method when present" do
|
1088
|
-
expect(block_page_object.img_area_element).to eql "area"
|
1089
|
-
end
|
1090
|
-
end
|
1091
|
-
|
1092
|
-
it "should click on the area" do
|
1093
|
-
expect(watir_browser).to receive(:area).and_return(watir_browser)
|
1094
|
-
expect(watir_browser).to receive(:click)
|
1095
|
-
watir_page_object.img_area
|
1096
|
-
end
|
1097
|
-
|
1098
|
-
it "should retrieve the element from the page" do
|
1099
|
-
expect(watir_browser).to receive(:area).and_return(watir_browser)
|
1100
|
-
element = watir_page_object.img_area_element
|
1101
|
-
expect(element).to be_instance_of PageObject::Elements::Area
|
1102
|
-
end
|
1103
|
-
end
|
1104
|
-
|
1105
|
-
describe "canvas accessors" do
|
1106
|
-
context "when called on a page object" do
|
1107
|
-
it "should generate accessor methods" do
|
1108
|
-
expect(watir_page_object).to respond_to(:my_canvas_element)
|
1109
|
-
end
|
1110
|
-
|
1111
|
-
it "should call a block on the element method when present" do
|
1112
|
-
expect(block_page_object.my_canvas_element).to eql "canvas"
|
1113
|
-
end
|
1114
|
-
end
|
1115
|
-
end
|
1116
|
-
|
1117
|
-
describe "audio accessors" do
|
1118
|
-
context "when called on a page object" do
|
1119
|
-
it "should generate accessor methods" do
|
1120
|
-
expect(watir_page_object).to respond_to(:acdc_element)
|
1121
|
-
end
|
1122
|
-
|
1123
|
-
it "should call a block on the element method when present" do
|
1124
|
-
expect(block_page_object.acdc_element).to eql "audio"
|
1125
|
-
end
|
1126
|
-
end
|
1127
|
-
end
|
1128
|
-
|
1129
|
-
describe "video accessors" do
|
1130
|
-
context "when called on a page object" do
|
1131
|
-
it "should generate accessor methods" do
|
1132
|
-
expect(watir_page_object).to respond_to(:movie_element)
|
1133
|
-
end
|
1134
|
-
|
1135
|
-
it "should call a block on the element method when present" do
|
1136
|
-
expect(block_page_object.movie_element).to eql "video"
|
1137
|
-
end
|
1138
|
-
end
|
1139
|
-
end
|
1140
|
-
|
1141
|
-
describe "b accessors" do
|
1142
|
-
context "when called on a page object" do
|
1143
|
-
it "should generate accessor methods" do
|
1144
|
-
expect(watir_page_object).to respond_to(:bold)
|
1145
|
-
expect(watir_page_object).to respond_to(:bold_element)
|
1146
|
-
end
|
1147
|
-
|
1148
|
-
it "should call a block on the element method when present" do
|
1149
|
-
expect(block_page_object.bold_element).to eql "b"
|
1150
|
-
end
|
1151
|
-
end
|
1152
|
-
|
1153
|
-
it "should retrieve the text from the b" do
|
1154
|
-
expect(watir_browser).to receive(:b).and_return(watir_browser)
|
1155
|
-
expect(watir_browser).to receive(:text).and_return("value")
|
1156
|
-
expect(watir_page_object.bold).to eql "value"
|
1157
|
-
end
|
1158
|
-
|
1159
|
-
it "should retrieve the element from the page" do
|
1160
|
-
expect(watir_browser).to receive(:b).and_return(watir_browser)
|
1161
|
-
element = watir_page_object.bold_element
|
1162
|
-
expect(element).to be_instance_of PageObject::Elements::Bold
|
1163
|
-
end
|
1164
|
-
end
|
1165
|
-
|
1166
|
-
describe "i accessors" do
|
1167
|
-
context "when called on a page object" do
|
1168
|
-
it "should generate accessor methods" do
|
1169
|
-
expect(watir_page_object).to respond_to(:italic)
|
1170
|
-
expect(watir_page_object).to respond_to(:italic_element)
|
1171
|
-
end
|
1172
|
-
|
1173
|
-
it "should call a block on the element method when present" do
|
1174
|
-
expect(block_page_object.italic_element).to eql "i"
|
1175
|
-
end
|
1176
|
-
end
|
1177
|
-
|
1178
|
-
it "should retrieve the text from the i" do
|
1179
|
-
expect(watir_browser).to receive(:i).and_return(watir_browser)
|
1180
|
-
expect(watir_browser).to receive(:text).and_return("value")
|
1181
|
-
expect(watir_page_object.italic).to eql "value"
|
1182
|
-
end
|
1183
|
-
|
1184
|
-
it "should retrieve the element from the page" do
|
1185
|
-
expect(watir_browser).to receive(:i).and_return(watir_browser)
|
1186
|
-
element = watir_page_object.italic_element
|
1187
|
-
expect(element).to be_instance_of PageObject::Elements::Italic
|
1188
|
-
end
|
1189
|
-
end
|
1190
|
-
|
1191
|
-
end
|