page-object 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +22 -12
  3. data/ChangeLog +10 -0
  4. data/Gemfile +4 -2
  5. data/Guardfile +1 -1
  6. data/README.md +2 -2
  7. data/lib/page-object/accessors.rb +57 -35
  8. data/lib/page-object/elements/element.rb +26 -0
  9. data/lib/page-object/locator_generator.rb +46 -0
  10. data/lib/page-object/platforms/selenium_webdriver/element.rb +6 -6
  11. data/lib/page-object/platforms/selenium_webdriver/page_object.rb +14 -0
  12. data/lib/page-object/platforms/watir_webdriver/element.rb +0 -7
  13. data/lib/page-object/platforms/watir_webdriver/page_object.rb +16 -3
  14. data/lib/page-object/version.rb +1 -1
  15. data/page-object.gemspec +7 -10
  16. metadata +34 -375
  17. data/features/area.feature +0 -35
  18. data/features/async.feature +0 -21
  19. data/features/audio.feature +0 -64
  20. data/features/bold.feature +0 -21
  21. data/features/button.feature +0 -98
  22. data/features/canvas.feature +0 -37
  23. data/features/check_box.feature +0 -55
  24. data/features/div.feature +0 -45
  25. data/features/element.feature +0 -343
  26. data/features/file_field.feature +0 -40
  27. data/features/form.feature +0 -43
  28. data/features/frames.feature +0 -75
  29. data/features/generic_elements.feature +0 -29
  30. data/features/gxt_table_extension.feature +0 -23
  31. data/features/headings.feature +0 -97
  32. data/features/hidden_field.feature +0 -45
  33. data/features/html/04-Death_Becomes_Fur.mp4 +0 -0
  34. data/features/html/04-Death_Becomes_Fur.oga +0 -0
  35. data/features/html/async.html +0 -36
  36. data/features/html/double_click.html +0 -13
  37. data/features/html/failure.html +0 -8
  38. data/features/html/frame_1.html +0 -18
  39. data/features/html/frame_2.html +0 -16
  40. data/features/html/frame_3.html +0 -14
  41. data/features/html/frames.html +0 -12
  42. data/features/html/hover.html +0 -12
  43. data/features/html/iframes.html +0 -12
  44. data/features/html/images/circle.png +0 -0
  45. data/features/html/images/img_pulpit.jpg +0 -0
  46. data/features/html/images/submit.gif +0 -0
  47. data/features/html/indexed_property.html +0 -55
  48. data/features/html/modal.html +0 -17
  49. data/features/html/modal_1.html +0 -38
  50. data/features/html/modal_2.html +0 -27
  51. data/features/html/movie.mp4 +0 -0
  52. data/features/html/movie.ogg +0 -0
  53. data/features/html/multi_elements.html +0 -145
  54. data/features/html/nested_elements.html +0 -77
  55. data/features/html/nested_frame_1.html +0 -1
  56. data/features/html/nested_frame_2.html +0 -11
  57. data/features/html/nested_frame_3.html +0 -14
  58. data/features/html/nested_frames.html +0 -10
  59. data/features/html/planets.gif +0 -0
  60. data/features/html/static_elements.html +0 -194
  61. data/features/html/success.html +0 -8
  62. data/features/html/sun.gif +0 -0
  63. data/features/html/sun.html +0 -7
  64. data/features/html/widgets.html +0 -20
  65. data/features/image.feature +0 -50
  66. data/features/indexed_property.feature +0 -117
  67. data/features/italic.feature +0 -21
  68. data/features/javascript.feature +0 -28
  69. data/features/label.feature +0 -46
  70. data/features/link.feature +0 -52
  71. data/features/list_item.feature +0 -36
  72. data/features/modal_dialog.feature +0 -15
  73. data/features/multi_elements.feature +0 -498
  74. data/features/nested_elements.feature +0 -117
  75. data/features/ordered_list.feature +0 -56
  76. data/features/page_level_actions.feature +0 -90
  77. data/features/paragraph.feature +0 -35
  78. data/features/radio_button.feature +0 -58
  79. data/features/radio_button_group.feature +0 -29
  80. data/features/sample-app/public/audio_video.html +0 -23
  81. data/features/sample-app/public/jquery-1.3.2.js +0 -4376
  82. data/features/sample-app/public/jquery.html +0 -30
  83. data/features/sample-app/public/prototype-1.6.0.3.js +0 -4320
  84. data/features/sample-app/public/prototype.html +0 -35
  85. data/features/sample-app/sample_app.rb +0 -35
  86. data/features/section.feature +0 -136
  87. data/features/select_list.feature +0 -86
  88. data/features/span.feature +0 -37
  89. data/features/step_definitions/accessor_steps.rb +0 -64
  90. data/features/step_definitions/area_steps.rb +0 -19
  91. data/features/step_definitions/async_steps.rb +0 -83
  92. data/features/step_definitions/audio_steps.rb +0 -27
  93. data/features/step_definitions/bold_steps.rb +0 -12
  94. data/features/step_definitions/button_steps.rb +0 -48
  95. data/features/step_definitions/canvas_steps.rb +0 -15
  96. data/features/step_definitions/check_box_steps.rb +0 -35
  97. data/features/step_definitions/div_steps.rb +0 -19
  98. data/features/step_definitions/element_steps.rb +0 -294
  99. data/features/step_definitions/file_field_steps.rb +0 -19
  100. data/features/step_definitions/form_steps.rb +0 -19
  101. data/features/step_definitions/frames_steps.rb +0 -159
  102. data/features/step_definitions/generic_element_steps.rb +0 -31
  103. data/features/step_definitions/gxt_table_steps.rb +0 -53
  104. data/features/step_definitions/headings_steps.rb +0 -12
  105. data/features/step_definitions/hidden_field_steps.rb +0 -27
  106. data/features/step_definitions/image_steps.rb +0 -27
  107. data/features/step_definitions/indexed_property_steps.rb +0 -163
  108. data/features/step_definitions/italic_steps.rb +0 -12
  109. data/features/step_definitions/javascript_steps.rb +0 -53
  110. data/features/step_definitions/label_steps.rb +0 -19
  111. data/features/step_definitions/link_steps.rb +0 -40
  112. data/features/step_definitions/list_item_steps.rb +0 -19
  113. data/features/step_definitions/modal_dialog_steps.rb +0 -62
  114. data/features/step_definitions/multi_elements_steps.rb +0 -554
  115. data/features/step_definitions/nested_elements_steps.rb +0 -212
  116. data/features/step_definitions/ordered_list_steps.rb +0 -23
  117. data/features/step_definitions/page_level_actions_steps.rb +0 -135
  118. data/features/step_definitions/page_traversal_steps.rb +0 -8
  119. data/features/step_definitions/paragraph_steps.rb +0 -28
  120. data/features/step_definitions/radio_button_group_steps.rb +0 -36
  121. data/features/step_definitions/radio_button_steps.rb +0 -27
  122. data/features/step_definitions/section_steps.rb +0 -277
  123. data/features/step_definitions/select_list_steps.rb +0 -65
  124. data/features/step_definitions/span_steps.rb +0 -19
  125. data/features/step_definitions/table_cell_steps.rb +0 -15
  126. data/features/step_definitions/table_row_steps.rb +0 -23
  127. data/features/step_definitions/table_steps.rb +0 -70
  128. data/features/step_definitions/text_area_steps.rb +0 -35
  129. data/features/step_definitions/text_field_steps.rb +0 -35
  130. data/features/step_definitions/unordered_list_steps.rb +0 -23
  131. data/features/step_definitions/video_steps.rb +0 -45
  132. data/features/support/ajax_text_environment.rb +0 -26
  133. data/features/support/audio_video_page.rb +0 -24
  134. data/features/support/env.rb +0 -8
  135. data/features/support/hooks.rb +0 -8
  136. data/features/support/page.rb +0 -373
  137. data/features/support/persistent_browser.rb +0 -70
  138. data/features/support/targets/firefox14_osx.rb +0 -6
  139. data/features/support/targets/firefox14_windows7.rb +0 -6
  140. data/features/support/url_helper.rb +0 -61
  141. data/features/table.feature +0 -122
  142. data/features/table_cell.feature +0 -45
  143. data/features/table_row.feature +0 -43
  144. data/features/text_area.feature +0 -51
  145. data/features/text_field.feature +0 -70
  146. data/features/unordered_list.feature +0 -56
  147. data/features/video.feature +0 -69
  148. data/spec/page-object/accessors_spec.rb +0 -40
  149. data/spec/page-object/element_locators_spec.rb +0 -1144
  150. data/spec/page-object/elements/area_spec.rb +0 -45
  151. data/spec/page-object/elements/bold_spec.rb +0 -29
  152. data/spec/page-object/elements/button_spec.rb +0 -64
  153. data/spec/page-object/elements/canvas_spec.rb +0 -41
  154. data/spec/page-object/elements/check_box_spec.rb +0 -49
  155. data/spec/page-object/elements/div_spec.rb +0 -28
  156. data/spec/page-object/elements/element_spec.rb +0 -196
  157. data/spec/page-object/elements/file_field_spec.rb +0 -39
  158. data/spec/page-object/elements/form_spec.rb +0 -28
  159. data/spec/page-object/elements/heading_spec.rb +0 -48
  160. data/spec/page-object/elements/hidden_field_spec.rb +0 -28
  161. data/spec/page-object/elements/image_spec.rb +0 -66
  162. data/spec/page-object/elements/italic_spec.rb +0 -29
  163. data/spec/page-object/elements/label_spec.rb +0 -29
  164. data/spec/page-object/elements/link_spec.rb +0 -49
  165. data/spec/page-object/elements/list_item_spec.rb +0 -29
  166. data/spec/page-object/elements/media_spec.rb +0 -63
  167. data/spec/page-object/elements/nested_element_spec.rb +0 -254
  168. data/spec/page-object/elements/option_spec.rb +0 -11
  169. data/spec/page-object/elements/ordered_list_spec.rb +0 -78
  170. data/spec/page-object/elements/paragraph_spec.rb +0 -27
  171. data/spec/page-object/elements/select_list_spec.rb +0 -142
  172. data/spec/page-object/elements/selenium/radio_button_spec.rb +0 -44
  173. data/spec/page-object/elements/selenium/text_field_spec.rb +0 -49
  174. data/spec/page-object/elements/selenium_element_spec.rb +0 -218
  175. data/spec/page-object/elements/span_spec.rb +0 -26
  176. data/spec/page-object/elements/table_cell_spec.rb +0 -21
  177. data/spec/page-object/elements/table_row_spec.rb +0 -70
  178. data/spec/page-object/elements/table_spec.rb +0 -98
  179. data/spec/page-object/elements/text_area_spec.rb +0 -39
  180. data/spec/page-object/elements/unordered_list_spec.rb +0 -77
  181. data/spec/page-object/elements/video_spec.rb +0 -33
  182. data/spec/page-object/elements/watir_element_spec.rb +0 -193
  183. data/spec/page-object/javascript_framework_facade_spec.rb +0 -61
  184. data/spec/page-object/loads_platform_spec.rb +0 -53
  185. data/spec/page-object/page-object_spec.rb +0 -435
  186. data/spec/page-object/page_factory_spec.rb +0 -238
  187. data/spec/page-object/page_populator_spec.rb +0 -122
  188. data/spec/page-object/page_section_spec.rb +0 -80
  189. data/spec/page-object/platforms/selenium_webdriver/selenium_page_object_spec.rb +0 -68
  190. data/spec/page-object/platforms/selenium_webdriver_spec.rb +0 -29
  191. data/spec/page-object/platforms/watir_webdriver/watir_page_object_spec.rb +0 -29
  192. data/spec/page-object/platforms/watir_webdriver_spec.rb +0 -9
  193. data/spec/page-object/selenium_accessors_spec.rb +0 -628
  194. data/spec/page-object/watir_accessors_spec.rb +0 -1191
  195. data/spec/page-object/widget_spec.rb +0 -226
  196. data/spec/spec_helper.rb +0 -43
@@ -1,29 +0,0 @@
1
- require 'spec_helper'
2
-
3
-
4
- describe PageObject::Platforms::SeleniumWebDriver do
5
-
6
- it "should be registered as an adapter" do
7
- expect(PageObject::Platforms.get[:selenium_webdriver]).to be PageObject::Platforms::SeleniumWebDriver
8
- end
9
-
10
- describe 'create page object' do
11
- let(:browser) { double('browser') }
12
- let(:subject) { PageObject::Platforms::SeleniumWebDriver.create_page_object(browser) }
13
-
14
- it "should create a SeleniumPageObject" do
15
- expect(subject).to be_kind_of PageObject::Platforms::SeleniumWebDriver::PageObject
16
- end
17
- end
18
-
19
- describe "is for?" do
20
- it "should be true when the browser is a selenium driver" do
21
- browser = mock_selenium_browser()
22
- expect(PageObject::Platforms::SeleniumWebDriver.is_for?(browser)).to eql true
23
- end
24
-
25
- it "should be false when the browser is anything else" do
26
- expect(PageObject::Platforms::SeleniumWebDriver.is_for?("asdf")).to eql false
27
- end
28
- end
29
- end
@@ -1,29 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe PageObject::Platforms::WatirWebDriver do
4
- describe "create page object" do
5
- let(:browser) { double('browser') }
6
- let(:subject) { PageObject::Platforms::WatirWebDriver.create_page_object(browser) }
7
-
8
- it "should create a WatirPageObject" do
9
- expect(subject).to be_kind_of PageObject::Platforms::WatirWebDriver::PageObject
10
- end
11
-
12
- it "should give the watir page object the browser" do
13
- expect(subject.browser).to be browser
14
- end
15
- end
16
-
17
- describe "is for?" do
18
- it "should be true when the browser is Watir::Browser" do
19
- browser = mock_watir_browser()
20
- expect(PageObject::Platforms::WatirWebDriver.is_for?(browser)).to be true
21
- end
22
-
23
- it "should be false at any other point" do
24
- browser = 'asdf'
25
- expect(PageObject::Platforms::WatirWebDriver.is_for?('asdf')).to be false
26
- end
27
- end
28
- end
29
-
@@ -1,9 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe PageObject::Platforms::WatirWebDriver do
4
-
5
- it "should be in the PageObjects Adapters list" do
6
- expect(PageObject::Platforms.get[:watir_webdriver]).to be PageObject::Platforms::WatirWebDriver
7
- end
8
-
9
- end
@@ -1,628 +0,0 @@
1
- require 'spec_helper'
2
-
3
- class SeleniumAccessorsTestPageObject
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')
36
- audio(:acdc, :id => 'audio_id')
37
- video(:movie, :id => 'movie_id')
38
- b(:bold, :id => 'bold')
39
- i(:italic, :id => 'italic')
40
- end
41
-
42
- class SeleniumBlockPageObject
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
-
135
- b :bold do |element|
136
- 'b'
137
- end
138
-
139
- i :italic do |element|
140
- 'i'
141
- end
142
- end
143
-
144
- describe PageObject::Accessors do
145
- let(:selenium_browser) { mock_selenium_browser }
146
- let(:selenium_page_object) { SeleniumAccessorsTestPageObject.new(selenium_browser) }
147
- let(:block_page_object) { SeleniumBlockPageObject.new(selenium_browser) }
148
-
149
- before(:each) do
150
- allow(selenium_browser).to receive(:switch_to).and_return(selenium_browser)
151
- allow(selenium_browser).to receive(:default_content)
152
- end
153
-
154
- describe "link accessors" do
155
- it "should select a link" do
156
- allow(selenium_browser).to receive_messages(find_element: selenium_browser, click: selenium_browser)
157
- selenium_page_object.google_search
158
- end
159
-
160
- it "should return a link element" do
161
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
162
- element = selenium_page_object.google_search_element
163
- expect(element).to be_instance_of PageObject::Elements::Link
164
- end
165
- end
166
-
167
-
168
- describe "text_field accessors" do
169
- it "should get the text from the text field element" do
170
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
171
- expect(selenium_browser).to receive(:attribute).with('value').and_return('Katie')
172
- expect(selenium_page_object.first_name).to eql 'Katie'
173
- end
174
-
175
- it "should set some text on a text field element" do
176
- expect(selenium_browser).to receive(:find_element).twice.and_return(selenium_browser)
177
- expect(selenium_browser).to receive(:clear)
178
- expect(selenium_browser).to receive(:send_keys).with('Katie')
179
- selenium_page_object.first_name = 'Katie'
180
- end
181
-
182
- it "should retrieve a text field element" do
183
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
184
- element = selenium_page_object.first_name_element
185
- expect(element).to be_instance_of PageObject::Elements::TextField
186
- end
187
- end
188
-
189
-
190
- describe "hidden field accessors" do
191
- it "should get the text from a hidden field" do
192
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
193
- expect(selenium_browser).to receive(:attribute).with('value').and_return("12345")
194
- expect(selenium_page_object.social_security_number).to eql "12345"
195
- end
196
-
197
- it "should retrieve a hidden field element" do
198
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
199
- element = selenium_page_object.social_security_number_element
200
- expect(element).to be_instance_of PageObject::Elements::HiddenField
201
- end
202
- end
203
-
204
- describe "text area accessors" do
205
- it "should set some text on the text area" do
206
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
207
- expect(selenium_browser).to receive(:clear)
208
- expect(selenium_browser).to receive(:send_keys).with("123 main street")
209
- selenium_page_object.address = "123 main street"
210
- end
211
-
212
- it "should get the text from the text area" do
213
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
214
- expect(selenium_browser).to receive(:attribute).with('value').and_return("123 main street")
215
- expect(selenium_page_object.address).to eql "123 main street"
216
- end
217
-
218
- it "should retrieve a text area element" do
219
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
220
- element = selenium_page_object.address_element
221
- expect(element).to be_instance_of PageObject::Elements::TextArea
222
- end
223
- end
224
-
225
- describe "select_list accessors" do
226
- it "should should get the current item from a select list" do
227
- selected = "OH"
228
- expect(selected).to receive(:selected?).and_return(selected)
229
- expect(selected).to receive(:text).and_return("OH")
230
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
231
- expect(selenium_browser).to receive(:find_elements).and_return([selected])
232
- expect(selenium_page_object.state).to eql "OH"
233
- end
234
-
235
- it "should set the current item of a select list" do
236
- option = double('option')
237
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
238
- expect(selenium_browser).to receive(:find_elements).and_return([option])
239
- expect(option).to receive(:text).and_return('OH')
240
- expect(option).to receive(:click)
241
- selenium_page_object.state = "OH"
242
- end
243
-
244
- it "should retrieve the select list element" do
245
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
246
- element = selenium_page_object.state_element
247
- expect(element).to be_instance_of PageObject::Elements::SelectList
248
- end
249
-
250
- it "should return list of selection options" do
251
- option1 = double('option')
252
- option2 = double('option')
253
- expect(option1).to receive(:text).and_return("CA")
254
- expect(option2).to receive(:text).and_return("OH")
255
-
256
- select_element = double("select")
257
- expect(select_element).to receive(:options).twice.and_return([option1, option2])
258
- expect(selenium_page_object).to receive(:state_element).and_return(select_element)
259
-
260
- expect(selenium_page_object.state_options).to eql ["CA","OH"]
261
- end
262
-
263
- end
264
-
265
-
266
- describe "check_box accessors" do
267
- it "should check a check box element" do
268
- expect(selenium_browser).to receive(:find_element).twice.and_return(selenium_browser)
269
- expect(selenium_browser).to receive(:selected?).and_return(false)
270
- expect(selenium_browser).to receive(:click)
271
- selenium_page_object.check_active
272
- end
273
-
274
- it "should clear a check box element" do
275
- expect(selenium_browser).to receive(:find_element).twice.and_return(selenium_browser)
276
- expect(selenium_browser).to receive(:selected?).and_return(true)
277
- expect(selenium_browser).to receive(:click)
278
- selenium_page_object.uncheck_active
279
- end
280
-
281
- it "should know if a check box element is selected" do
282
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
283
- expect(selenium_browser).to receive(:selected?).and_return(true)
284
- expect(selenium_page_object.active_checked?).to be true
285
- end
286
-
287
- it "should retrieve a checkbox element" do
288
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
289
- element = selenium_page_object.active_element
290
- expect(element).to be_instance_of PageObject::Elements::CheckBox
291
- end
292
- end
293
-
294
-
295
- describe "radio accessors" do
296
- it "should select a radio button" do
297
- expect(selenium_browser).to receive(:find_element).twice.and_return(selenium_browser)
298
- expect(selenium_browser).to receive(:selected?).and_return(false)
299
- expect(selenium_browser).to receive(:click)
300
- selenium_page_object.select_first
301
- end
302
-
303
- it "should determine if a radio is selected" do
304
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
305
- expect(selenium_browser).to receive(:selected?).and_return(true)
306
- selenium_page_object.first_selected?
307
- end
308
-
309
- it "should retrieve a radio button element" do
310
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
311
- element = selenium_page_object.first_element
312
- expect(element).to be_instance_of PageObject::Elements::RadioButton
313
- end
314
- end
315
-
316
- describe "button accessors" do
317
- it "should be able to click a button" do
318
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
319
- expect(selenium_browser).to receive(:click)
320
- selenium_page_object.click_me
321
- end
322
-
323
- it "should retrieve a button element" do
324
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
325
- element = selenium_page_object.click_me_element
326
- expect(element).to be_instance_of PageObject::Elements::Button
327
- end
328
- end
329
-
330
- describe "div accessors" do
331
- it "should retrieve the text from a div" do
332
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
333
- expect(selenium_browser).to receive(:text).and_return("Message from div")
334
- expect(selenium_page_object.message).to eql "Message from div"
335
- end
336
-
337
- it "should retrieve the div element from the page" do
338
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
339
- element = selenium_page_object.message_element
340
- expect(element).to be_instance_of PageObject::Elements::Div
341
- end
342
- end
343
-
344
- describe "span accessors" do
345
- it "should retrieve the text from a span" do
346
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
347
- expect(selenium_browser).to receive(:text).and_return("Alert")
348
- expect(selenium_page_object.alert_span).to eql "Alert"
349
- end
350
-
351
- it "should retrieve the span element from the page" do
352
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
353
- element = selenium_page_object.alert_span_element
354
- expect(element).to be_instance_of PageObject::Elements::Span
355
- end
356
- end
357
-
358
- describe "table accessors" do
359
- it "should retrieve the table element from the page" do
360
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
361
- element = selenium_page_object.cart_element
362
- expect(element).to be_instance_of(PageObject::Elements::Table)
363
- end
364
- end
365
-
366
- describe "table cell accessors" do
367
- it "should retrieve the text from the cell" do
368
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
369
- expect(selenium_browser).to receive(:text).and_return('celldata')
370
- expect(selenium_page_object.total).to eql 'celldata'
371
- end
372
-
373
- it "should retrieve the cell element from the page" do
374
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
375
- element = selenium_page_object.total_element
376
- expect(element).to be_instance_of PageObject::Elements::TableCell
377
- end
378
- end
379
-
380
- describe "image accessors" do
381
- it "should retrieve the image element from the page" do
382
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
383
- element = selenium_page_object.logo_element
384
- expect(element).to be_instance_of PageObject::Elements::Image
385
- end
386
- end
387
-
388
- describe "form accessors" do
389
- it "should retrieve the form element from the page" do
390
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
391
- element = selenium_page_object.login_element
392
- expect(element).to be_instance_of PageObject::Elements::Form
393
- end
394
- end
395
-
396
- describe "list item accessors" do
397
- it "should retrieve the text from the list item" do
398
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
399
- expect(selenium_browser).to receive(:text).and_return("value")
400
- expect(selenium_page_object.item_one).to eql "value"
401
- end
402
-
403
- it "should retrieve the list item from the page" do
404
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
405
- element = selenium_page_object.item_one_element
406
- expect(element).to be_instance_of PageObject::Elements::ListItem
407
- end
408
- end
409
-
410
- describe "unordered list accessors" do
411
- it "should retrieve the element from the page" do
412
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
413
- element = selenium_page_object.menu_element
414
- expect(element).to be_instance_of PageObject::Elements::UnorderedList
415
- end
416
- end
417
-
418
- describe "ordered list accessors" do
419
- it "should retrieve the element from the page" do
420
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
421
- element = selenium_page_object.top_five_element
422
- expect(element).to be_instance_of PageObject::Elements::OrderedList
423
- end
424
- end
425
-
426
- describe "h1 accessors" do
427
- it "should retrieve the text from the h1" do
428
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
429
- expect(selenium_browser).to receive(:text).and_return("value")
430
- expect(selenium_page_object.heading1).to eql "value"
431
- end
432
-
433
- it "should retrieve the element from the page" do
434
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
435
- element = selenium_page_object.heading1_element
436
- expect(element).to be_instance_of PageObject::Elements::Heading
437
- end
438
- end
439
-
440
- describe "h2 accessors" do
441
- it "should retrieve the text from the h2" do
442
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
443
- expect(selenium_browser).to receive(:text).and_return("value")
444
- expect(selenium_page_object.heading2).to eql "value"
445
- end
446
-
447
- it "should retrieve the element from the page" do
448
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
449
- element = selenium_page_object.heading2_element
450
- expect(element).to be_instance_of PageObject::Elements::Heading
451
- end
452
- end
453
-
454
- describe "h3 accessors" do
455
- it "should retrieve the text from the h3" do
456
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
457
- expect(selenium_browser).to receive(:text).and_return("value")
458
- expect(selenium_page_object.heading3).to eql "value"
459
- end
460
-
461
- it "should retrieve the element from the page" do
462
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
463
- element = selenium_page_object.heading3_element
464
- expect(element).to be_instance_of PageObject::Elements::Heading
465
- end
466
- end
467
-
468
- describe "h4 accessors" do
469
- it "should retrieve the text from the h4" do
470
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
471
- expect(selenium_browser).to receive(:text).and_return("value")
472
- expect(selenium_page_object.heading4).to eql "value"
473
- end
474
-
475
- it "should retrieve the element from the page" do
476
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
477
- element = selenium_page_object.heading4_element
478
- expect(element).to be_instance_of PageObject::Elements::Heading
479
- end
480
- end
481
-
482
- describe "h5 accessors" do
483
- it "should retrieve the text from the h5" do
484
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
485
- expect(selenium_browser).to receive(:text).and_return("value")
486
- expect(selenium_page_object.heading5).to eql "value"
487
- end
488
-
489
- it "should retrieve the element from the page" do
490
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
491
- element = selenium_page_object.heading5_element
492
- expect(element).to be_instance_of PageObject::Elements::Heading
493
- end
494
- end
495
-
496
- describe "h6 accessors" do
497
- it "should retrieve the text from the h6" do
498
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
499
- expect(selenium_browser).to receive(:text).and_return("value")
500
- expect(selenium_page_object.heading6).to eql "value"
501
- end
502
-
503
- it "should retrieve the element from the page" do
504
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
505
- element = selenium_page_object.heading6_element
506
- expect(element).to be_instance_of PageObject::Elements::Heading
507
- end
508
- end
509
-
510
-
511
- describe "p accessors" do
512
- it "should retrieve the text from the p" do
513
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
514
- expect(selenium_browser).to receive(:text).and_return("value")
515
- expect(selenium_page_object.first_para).to eql "value"
516
- end
517
-
518
- it "should retrieve the element from the page" do
519
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
520
- element = selenium_page_object.first_para_element
521
- expect(element).to be_instance_of PageObject::Elements::Paragraph
522
- end
523
- end
524
-
525
- describe "file_field accessors" do
526
- it "should set the file name" do
527
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
528
- expect(selenium_browser).to receive(:send_keys).with('some_file')
529
- selenium_page_object.upload_me = 'some_file'
530
- end
531
-
532
- it "should retrieve a file_field element" do
533
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
534
- element = selenium_page_object.upload_me_element
535
- expect(element).to be_instance_of PageObject::Elements::FileField
536
- end
537
- end
538
-
539
- describe "area accessors" do
540
- context "when called on a page object" do
541
- it "should generate accessor methods" do
542
- expect(selenium_page_object).to respond_to(:img_area)
543
- expect(selenium_page_object).to respond_to(:img_area_element)
544
- end
545
-
546
- it "should call a block on the element method when present" do
547
- expect(block_page_object.img_area_element).to eql "area"
548
- end
549
- end
550
-
551
- it "should click on the area" do
552
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
553
- expect(selenium_browser).to receive(:click)
554
- selenium_page_object.img_area
555
- end
556
-
557
- it "should retrieve the element from the page" do
558
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
559
- element = selenium_page_object.img_area_element
560
- expect(element).to be_instance_of PageObject::Elements::Area
561
- end
562
- end
563
-
564
- describe "canvas accessors" do
565
- context "when called on a page object" do
566
- it "should generate accessor methods" do
567
- expect(selenium_page_object).to respond_to(:my_canvas_element)
568
- end
569
-
570
- it "should call a block on the element method when present" do
571
- expect(block_page_object.my_canvas_element).to eql "canvas"
572
- end
573
- end
574
- end
575
-
576
- describe "audio accessors" do
577
- context "when called on a page object" do
578
- it "should generate accessor methods" do
579
- expect(selenium_page_object).to respond_to(:acdc_element)
580
- end
581
-
582
- it "should call a block on the element method when present" do
583
- expect(block_page_object.acdc_element).to eql "audio"
584
- end
585
- end
586
- end
587
-
588
- describe "video accessors" do
589
- context "when called on a page object" do
590
- it "should generate accessor methods" do
591
- expect(selenium_page_object).to respond_to(:movie_element)
592
- end
593
-
594
- it "should call a block on the elmenet method when present" do
595
- expect(block_page_object.movie_element).to eql "video"
596
- end
597
- end
598
- end
599
-
600
- describe "b accessors" do
601
- it "should retrieve the text from the b" do
602
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
603
- expect(selenium_browser).to receive(:text).and_return("value")
604
- expect(selenium_page_object.bold).to eql "value"
605
- end
606
-
607
- it "should retrieve the element from the page" do
608
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
609
- element = selenium_page_object.bold_element
610
- expect(element).to be_instance_of PageObject::Elements::Bold
611
- end
612
- end
613
-
614
- describe "i accessors" do
615
- it "should retrieve the text from the i" do
616
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
617
- expect(selenium_browser).to receive(:text).and_return("value")
618
- expect(selenium_page_object.italic).to eql "value"
619
- end
620
-
621
- it "should retrieve the element from the page" do
622
- expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
623
- element = selenium_page_object.italic_element
624
- expect(element).to be_instance_of PageObject::Elements::Italic
625
- end
626
- end
627
-
628
- end