symbiont 0.0.4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/HISTORY.md +6 -0
  2. data/cucumber.yml +1 -1
  3. data/lib/symbiont/generators.rb +279 -3
  4. data/lib/symbiont/platform_watir/platform_object.rb +217 -0
  5. data/lib/symbiont/version.rb +1 -1
  6. data/lib/symbiont/web_objects/_common.rb +22 -1
  7. data/lib/symbiont/web_objects/checkbox.rb +9 -0
  8. data/lib/symbiont/web_objects/div.rb +9 -0
  9. data/lib/symbiont/web_objects/radio.rb +9 -0
  10. data/lib/symbiont/web_objects/select_list.rb +9 -0
  11. data/lib/symbiont/web_objects/span.rb +9 -0
  12. data/lib/symbiont/web_objects/table.rb +38 -0
  13. data/lib/symbiont/web_objects/table_cell.rb +9 -0
  14. data/lib/symbiont/web_objects/table_row.rb +26 -0
  15. data/spec/spec_helper.rb +7 -0
  16. data/spec/symbiont/generators/cell_generators_spec.rb +52 -0
  17. data/spec/symbiont/generators/checkbox_generators_spec.rb +75 -0
  18. data/spec/symbiont/generators/div_generators_spec.rb +52 -0
  19. data/spec/symbiont/generators/radio_generators_spec.rb +78 -0
  20. data/spec/symbiont/generators/select_list_generators_spec.rb +77 -0
  21. data/spec/symbiont/generators/span_generators_spec.rb +52 -0
  22. data/spec/symbiont/generators/table_generators_spec.rb +45 -0
  23. data/spec/symbiont/web_object_spec.rb +20 -0
  24. data/spec/symbiont/web_objects/table_row_spec.rb +24 -0
  25. data/spec/symbiont/web_objects/table_spec.rb +33 -0
  26. data/specs/button.feature +22 -22
  27. data/specs/checkbox.feature +40 -0
  28. data/specs/definitions/pages.rb +88 -41
  29. data/specs/div.feature +11 -0
  30. data/specs/frame.feature +2 -2
  31. data/specs/link.feature +15 -15
  32. data/specs/radio.feature +38 -0
  33. data/specs/select_list.feature +38 -0
  34. data/specs/span.feature +11 -0
  35. data/specs/support/env.rb +2 -0
  36. data/specs/support/test_steps/action_steps_buttons.rb +67 -0
  37. data/specs/support/test_steps/action_steps_checkboxes.rb +75 -0
  38. data/specs/support/test_steps/action_steps_divs.rb +18 -0
  39. data/specs/support/test_steps/action_steps_frames.rb +13 -0
  40. data/specs/support/test_steps/action_steps_links.rb +41 -0
  41. data/specs/support/test_steps/action_steps_navigate.rb +15 -0
  42. data/specs/support/test_steps/action_steps_radios.rb +75 -0
  43. data/specs/support/test_steps/action_steps_select_lists.rb +72 -0
  44. data/specs/support/test_steps/action_steps_spans.rb +18 -0
  45. data/specs/support/test_steps/action_steps_tables.rb +69 -0
  46. data/specs/support/test_steps/action_steps_text_fields.rb +68 -0
  47. data/specs/table.feature +27 -0
  48. data/specs/text_field.feature +18 -18
  49. metadata +42 -9
  50. data/specs/support/test_steps/action_steps.rb +0 -207
data/HISTORY.md CHANGED
@@ -1,6 +1,12 @@
1
1
  Change Log and History
2
2
  ======================
3
3
 
4
+ Version 0.1.0 / 2012-05-16
5
+ --------------------------
6
+
7
+ This release marks the start of alpha testing for the Symbiont library. Symbiont is now able to work with many primary web objects. This release also contains a full set of acceptance tests for current Symbiont functionality (see specs directory) as well as a full set of unit tests (see spec directory). Symbiont versions will only be released if there is one hundred percent unit coverage and an acceptance test for each added or modified feature.
8
+
9
+
4
10
  Version 0.0.4 / 2012-04-14
5
11
  --------------------------
6
12
 
data/cucumber.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  <% browser = "BROWSER=firefox" %>
2
- <% std_opts = "--color --format pretty --no-source" %>
2
+ <% std_opts = "--tags ~@wip --color --format pretty --no-source" %>
3
3
 
4
4
  default: <%= browser %> <%= std_opts %> -r specs specs
@@ -1,4 +1,10 @@
1
1
  module Symbiont
2
+
3
+ # The Generators module is used to provide groupings of methods that are
4
+ # generated dynamically based on object declarations in page definitions.
5
+ # The method provided allow for referencing and accessing web objects.
6
+ # The platform object acts as a delegate for all method calls.
7
+
2
8
  module Generators
3
9
 
4
10
  # This method allows for a url_is() method in definitions that will
@@ -168,11 +174,11 @@ module Symbiont
168
174
  define_method(identifier) do
169
175
  @platform.get_text_field_value_for(locator.clone)
170
176
  end
171
-
177
+
172
178
  define_method("#{identifier}=") do |value|
173
179
  @platform.set_text_field_value_for(locator.clone, value)
174
180
  end
175
-
181
+
176
182
  define_method("#{identifier}_exists?") do
177
183
  @platform.check_text_field_for_existence(locator.clone)
178
184
  end
@@ -191,6 +197,276 @@ module Symbiont
191
197
 
192
198
  alias_method "#{identifier}!".to_sym, "#{identifier}_enabled?".to_sym
193
199
  end
194
-
200
+
201
+ # Definition method for select lists. Methods for the following actions
202
+ # will be created:
203
+ # * reference a checkbox (identifier_object, identifier_select_list)
204
+ # * check for existence (identifier?, identifier_exists?)
205
+ # * check for visibility (identifier_?, identifier_visible?)
206
+ # * check for enabled (identifier!, identifier_enabled?)
207
+ # * check for option (identifier_option?)
208
+ # * set selected value (identifier=)
209
+ # @param [Symbol] identifier the friendly name of the web object
210
+ # @param [optional, Hash] locator the key/values that identify the object
211
+ # @return [Object] instance of Symbiont::WebObjects::SelectList
212
+ def select_list(identifier, locator)
213
+ define_method("#{identifier}_object") do
214
+ @platform.get_select_list_for(locator.clone)
215
+ end
216
+
217
+ alias_method "#{identifier}_select_list".to_sym, "#{identifier}_object".to_sym
218
+
219
+ define_method(identifier) do
220
+ @platform.get_select_list_item_for(locator.clone)
221
+ end
222
+
223
+ define_method("#{identifier}_option?") do
224
+ @platform.get_select_list_value_for(locator.clone)
225
+ end
226
+
227
+ define_method("#{identifier}=") do |value|
228
+ @platform.set_select_list_value_for(locator.clone, value)
229
+ end
230
+
231
+ define_method("#{identifier}_exists?") do
232
+ @platform.check_select_list_for_existence(locator.clone)
233
+ end
234
+
235
+ alias_method "#{identifier}?".to_sym, "#{identifier}_exists?".to_sym
236
+
237
+ define_method("#{identifier}_visible?") do
238
+ @platform.check_select_list_for_visibility(locator.clone)
239
+ end
240
+
241
+ alias_method "#{identifier}_?".to_sym, "#{identifier}_visible?".to_sym
242
+
243
+ define_method("#{identifier}_enabled?") do
244
+ @platform.check_select_list_for_enabled(locator.clone)
245
+ end
246
+
247
+ alias_method "#{identifier}!".to_sym, "#{identifier}_enabled?".to_sym
248
+ end
249
+
250
+ # Definition method for checkboxes. Methods for the following actions
251
+ # will be created:
252
+ # * reference a checkbox (identifier_object, identifier_checkbox)
253
+ # * check for existence (identifier?, identifier_exists?)
254
+ # * check for visibility (identifier_?, identifier_visible?)
255
+ # * check for enabled (identifier!, identifier_enabled?)
256
+ # * check for checked (identifier_checked?)
257
+ # * set checked state (check_identifier)
258
+ # * set unchecked state (uncheck_identifier)
259
+ # @param [Symbol] identifier the friendly name of the web object
260
+ # @param [optional, Hash] locator the key/values that identify the object
261
+ # @return [Object] instance of Symbiont::WebObjects::CheckBox
262
+ def checkbox(identifier, locator)
263
+ define_method("#{identifier}_object") do
264
+ @platform.get_checkbox_for(locator.clone)
265
+ end
266
+
267
+ alias_method "#{identifier}_checkbox".to_sym, "#{identifier}_object".to_sym
268
+
269
+ define_method("check_#{identifier}") do
270
+ @platform.check_checkbox_for(locator.clone)
271
+ end
272
+
273
+ define_method("uncheck_#{identifier}") do
274
+ @platform.uncheck_checkbox_for(locator.clone)
275
+ end
276
+
277
+ define_method("#{identifier}_checked?") do
278
+ @platform.check_checkbox_for_checked(locator.clone)
279
+ end
280
+
281
+ define_method("#{identifier}_exists?") do
282
+ @platform.check_checkbox_for_existence(locator.clone)
283
+ end
284
+
285
+ alias_method "#{identifier}?".to_sym, "#{identifier}_exists?".to_sym
286
+
287
+ define_method("#{identifier}_visible?") do
288
+ @platform.check_checkbox_for_visibility(locator.clone)
289
+ end
290
+
291
+ alias_method "#{identifier}_?".to_sym, "#{identifier}_visible?".to_sym
292
+
293
+ define_method("#{identifier}_enabled?") do
294
+ @platform.check_checkbox_for_enabled(locator.clone)
295
+ end
296
+
297
+ alias_method "#{identifier}!".to_sym, "#{identifier}_enabled?".to_sym
298
+ end
299
+
300
+ # Definition method for radios. Methods for the following actions will be created:
301
+ # * reference a radio (identifier_object, identifier_radio, identifier_radio_button)
302
+ # * check for existence (identifier?, identifier_exists?)
303
+ # * check for visibility (identifier_?, identifier_visible?)
304
+ # * check for enabled (identifier!, identifier_enabled?)
305
+ # * check for selected (identifier_set?, identifier_selected?)
306
+ # * set selected state (set_identifier, select_identifier)
307
+ # @param [Symbol] identifier the friendly name of the web object
308
+ # @param [optional, Hash] locator the key/values that identify the object
309
+ # @return [Object] instance of Symbiont::WebObjects::Radio
310
+ def radio(identifier, locator)
311
+ define_method("#{identifier}_object") do
312
+ @platform.get_radio_for(locator.clone)
313
+ end
314
+
315
+ alias_method "#{identifier}_radio".to_sym, "#{identifier}_object".to_sym
316
+ alias_method "#{identifier}_radio_button".to_sym, "#{identifier}_object".to_sym
317
+
318
+ define_method("#{identifier}_selected?") do
319
+ @platform.check_radio_for_selected(locator.clone)
320
+ end
321
+
322
+ alias_method "#{identifier}_set?".to_sym, "#{identifier}_selected?".to_sym
323
+
324
+ define_method("select_#{identifier}") do
325
+ @platform.select_radio_for(locator.clone)
326
+ end
327
+
328
+ alias_method "set_#{identifier}".to_sym, "select_#{identifier}".to_sym
329
+
330
+ define_method("#{identifier}_exists?") do
331
+ @platform.check_radio_for_existence(locator.clone)
332
+ end
333
+
334
+ alias_method "#{identifier}?".to_sym, "#{identifier}_exists?".to_sym
335
+
336
+ define_method("#{identifier}_visible?") do
337
+ @platform.check_radio_for_visibility(locator.clone)
338
+ end
339
+
340
+ alias_method "#{identifier}_?".to_sym, "#{identifier}_visible?".to_sym
341
+
342
+ define_method("#{identifier}_enabled?") do
343
+ @platform.check_radio_for_enabled(locator.clone)
344
+ end
345
+
346
+ alias_method "#{identifier}!".to_sym, "#{identifier}_enabled?".to_sym
347
+ end
348
+
349
+ # Definition method for tables. Methods for the following actions will be created:
350
+ # * reference a table (identifier_object, identifier_table)
351
+ # * check for existence (identifier?, identifier_exists?)
352
+ # * check for visibility (identifier_?, identifier_visible?)
353
+ # @param [Symbol] identifier the friendly name of the web object
354
+ # @param [optional, Hash] locator the key/values that identify the object
355
+ # @return [Object] instance of Symbiont::WebObjects::Table
356
+ def table(identifier, locator)
357
+ define_method("#{identifier}_object") do
358
+ @platform.get_table_for(locator.clone)
359
+ end
360
+
361
+ alias_method "#{identifier}_table".to_sym, "#{identifier}_object".to_sym
362
+
363
+ define_method("#{identifier}_exists?") do
364
+ @platform.check_table_for_existence(locator.clone)
365
+ end
366
+
367
+ alias_method "#{identifier}?".to_sym, "#{identifier}_exists?".to_sym
368
+
369
+ define_method("#{identifier}_visible?") do
370
+ @platform.check_table_for_visibility(locator.clone)
371
+ end
372
+
373
+ alias_method "#{identifier}_?".to_sym, "#{identifier}_visible?".to_sym
374
+ end
375
+
376
+ # Definition method for table cells. Methods for the following actions will be created:
377
+ # * reference a table cell (identifier_object, identifier_cell)
378
+ # * check for existence (identifier?, identifier_exists?)
379
+ # * check for visibility (identifier_?, identifier_visible?)
380
+ # * get text from cell (identifier)
381
+ # @param [Symbol] identifier the friendly name of the web object
382
+ # @param [optional, Hash] locator the key/values that identify the object
383
+ # @return [Object] instance of Symbiont::WebObjects::TableCell
384
+ def cell(identifier, locator)
385
+ define_method("#{identifier}_object") do
386
+ @platform.get_table_cell_for(locator.clone)
387
+ end
388
+
389
+ alias_method "#{identifier}_cell".to_sym, "#{identifier}_object".to_sym
390
+
391
+ define_method("#{identifier}_exists?") do
392
+ @platform.check_table_cell_for_existence(locator.clone)
393
+ end
394
+
395
+ alias_method "#{identifier}?".to_sym, "#{identifier}_exists?".to_sym
396
+
397
+ define_method("#{identifier}_visible?") do
398
+ @platform.check_table_cell_for_visibility(locator.clone)
399
+ end
400
+
401
+ alias_method "#{identifier}_?".to_sym, "#{identifier}_visible?".to_sym
402
+
403
+ define_method("#{identifier}") do
404
+ @platform.get_table_cell_text_for(locator.clone)
405
+ end
406
+ end
407
+
408
+ # Definition method for div objects. Methods for the following actions will be created:
409
+ # * reference a div (identifier_object, identifier_div)
410
+ # * check for existence (identifier?, identifier_exists?)
411
+ # * check for visibility (identifier_?, identifier_visible?)
412
+ # * get text from div (identifier)
413
+ # @param [Symbol] identifier the friendly name of the web object
414
+ # @param [optional, Hash] locator the key/values that identify the object
415
+ # @return [Object] instance of Symbiont::WebObjects::Div
416
+ def div(identifier, locator)
417
+ define_method("#{identifier}_object") do
418
+ @platform.get_div_for(locator.clone)
419
+ end
420
+
421
+ alias_method "#{identifier}_div".to_sym, "#{identifier}_object".to_sym
422
+
423
+ define_method("#{identifier}_exists?") do
424
+ @platform.check_div_for_existence(locator.clone)
425
+ end
426
+
427
+ alias_method "#{identifier}?".to_sym, "#{identifier}_exists?".to_sym
428
+
429
+ define_method("#{identifier}_visible?") do
430
+ @platform.check_div_for_visibility(locator.clone)
431
+ end
432
+
433
+ alias_method "#{identifier}_?".to_sym, "#{identifier}_visible?".to_sym
434
+
435
+ define_method("#{identifier}") do
436
+ @platform.get_div_text_for(locator.clone)
437
+ end
438
+ end
439
+
440
+ # Definition method for span objects. Methods for the following actions will be created:
441
+ # * reference a span (identifier_object, identifier_span)
442
+ # * check for existence (identifier?, identifier_exists?)
443
+ # * check for visibility (identifier_?, identifier_visible?)
444
+ # * get text from span (identifier)
445
+ # @param [Symbol] identifier the friendly name of the web object
446
+ # @param [optional, Hash] locator the key/values that identify the object
447
+ # @return [Object] instance of Symbiont::WebObjects::Span
448
+ def span(identifier, locator)
449
+ define_method("#{identifier}_object") do
450
+ @platform.get_span_for(locator.clone)
451
+ end
452
+
453
+ alias_method "#{identifier}_span".to_sym, "#{identifier}_object".to_sym
454
+
455
+ define_method("#{identifier}_exists?") do
456
+ @platform.check_span_for_existence(locator.clone)
457
+ end
458
+
459
+ alias_method "#{identifier}?".to_sym, "#{identifier}_exists?".to_sym
460
+
461
+ define_method("#{identifier}_visible?") do
462
+ @platform.check_span_for_visibility(locator.clone)
463
+ end
464
+
465
+ alias_method "#{identifier}_?".to_sym, "#{identifier}_visible?".to_sym
466
+
467
+ define_method("#{identifier}") do
468
+ @platform.get_span_text_for(locator.clone)
469
+ end
470
+ end
195
471
  end # module: Generators
196
472
  end # module: Symbiont
@@ -119,6 +119,223 @@ module Symbiont
119
119
  access_web_object("text_field(locator).enabled?", locator)
120
120
  end
121
121
 
122
+ # Platform method to return a select list object.
123
+ # Select list objects are of type: Symbiont::WebObjects::SelectList
124
+ # @see Symbiont::Generators#select_list
125
+ def get_select_list_for(locator)
126
+ reference_web_object("select_list(locator)", WebObjects::SelectList, locator)
127
+ end
128
+
129
+ # Platform method to retrieve the text of the current selection from a select list object.
130
+ # @see Symbiont::Generators#select_list
131
+ def get_select_list_item_for(locator)
132
+ access_web_object("select_list(locator).selected_options[0].text", locator)
133
+ end
134
+
135
+ # Platform method to retrieve the value of the current selection from a select list object.
136
+ # @see Symbiont::Generators#select_list
137
+ def get_select_list_value_for(locator)
138
+ access_web_object("select_list(locator).value", locator)
139
+ end
140
+
141
+ # Platform method to set the value of a select list object.
142
+ # @see Symbiont::Generators#select_list
143
+ def set_select_list_value_for(locator, value)
144
+ access_web_object("select_list(locator).select(value)", locator, value)
145
+ end
146
+
147
+ # Platform method to check if select_list object exists.
148
+ # @see Symbiont::Generators#select_list
149
+ def check_select_list_for_existence(locator)
150
+ access_web_object("select_list(locator).exists?", locator)
151
+ end
152
+
153
+ # Platform method to check if select list object is visible.
154
+ # @see Symbiont::Generators#select_list
155
+ def check_select_list_for_visibility(locator)
156
+ access_web_object("select_list(locator).visible?", locator)
157
+ end
158
+
159
+ # Platform method to check if select list object is enabled.
160
+ # @see Symbiont::Generators#select_list
161
+ def check_select_list_for_enabled(locator)
162
+ access_web_object("select_list(locator).enabled?", locator)
163
+ end
164
+
165
+ # Platform method to return a checkbox object.
166
+ # Checkbox objects are of type: Symbiont::WebObjects::CheckBox
167
+ # @see Symbiont::Generators#checkbox
168
+ def get_checkbox_for(locator)
169
+ reference_web_object("checkbox(locator)", WebObjects::CheckBox, locator)
170
+ end
171
+
172
+ # Platform method to check if checkbox object exists.
173
+ # @see Symbiont::Generators#checkbox
174
+ def check_checkbox_for_existence(locator)
175
+ access_web_object("checkbox(locator).exists?", locator)
176
+ end
177
+
178
+ # Platform method to check if checkbox object is visible.
179
+ # @see Symbiont::Generators#checkbox
180
+ def check_checkbox_for_visibility(locator)
181
+ access_web_object("checkbox(locator).visible?", locator)
182
+ end
183
+
184
+ # Platform method to check if checkbox object is enabled.
185
+ # @see Symbiont::Generators#checkbox
186
+ def check_checkbox_for_enabled(locator)
187
+ access_web_object("checkbox(locator).enabled?", locator)
188
+ end
189
+
190
+ # Platform method to determine if a checkbox is checked.
191
+ # @see Symbiont::Generators#checkbox
192
+ def check_checkbox_for_checked(locator)
193
+ access_web_object("checkbox(locator).set?", locator)
194
+ end
195
+
196
+ # Platform method to check a checkbox object.
197
+ # @see Symbiont::Generators#checkbox
198
+ def check_checkbox_for(locator)
199
+ access_web_object("checkbox(locator).set", locator)
200
+ end
201
+
202
+ # Platform method to uncheck a checkbox object.
203
+ # @see Symbiont::Generators#checkbox
204
+ def uncheck_checkbox_for(locator)
205
+ access_web_object("checkbox(locator).clear", locator)
206
+ end
207
+
208
+ # Platform method to return a radio object.
209
+ # Radio objects are of type: Symbiont::WebObjects::Radio
210
+ # @see Symbiont::Generators#radio
211
+ def get_radio_for(locator)
212
+ reference_web_object("radio(locator)", WebObjects::Radio, locator)
213
+ end
214
+
215
+ # Platform method to check if radio object exists.
216
+ # @see Symbiont::Generators#radio
217
+ def check_radio_for_existence(locator)
218
+ access_web_object("radio(locator).exists?", locator)
219
+ end
220
+
221
+ # Platform method to check if radio object is visible.
222
+ # @see Symbiont::Generators#radio
223
+ def check_radio_for_visibility(locator)
224
+ access_web_object("radio(locator).visible?", locator)
225
+ end
226
+
227
+ # Platform method to check if radio object is enabled.
228
+ # @see Symbiont::Generators#radio
229
+ def check_radio_for_enabled(locator)
230
+ access_web_object("radio(locator).enabled?", locator)
231
+ end
232
+
233
+ # Platform method to determine if a radio is selected.
234
+ # @see Symbiont::Generators#radio
235
+ def check_radio_for_selected(locator)
236
+ access_web_object("radio(locator).set?", locator)
237
+ end
238
+
239
+ # Platform method to select a radio object.
240
+ # @see Symbiont::Generators#radio
241
+ def select_radio_for(locator)
242
+ access_web_object("radio(locator).set", locator)
243
+ end
244
+
245
+ # Platform method to return a table object.
246
+ # Table objects are of type: Symbiont::WebObjects::Table
247
+ # @see Symbiont::Generators#table
248
+ def get_table_for(locator)
249
+ reference_web_object("table(locator)", WebObjects::Table, locator)
250
+ end
251
+
252
+ # Platform method to check if table object exists.
253
+ # @see Symbiont::Generators#table
254
+ def check_table_for_existence(locator)
255
+ access_web_object("table(locator).exists?", locator)
256
+ end
257
+
258
+ # Platform method to check if table object is visible.
259
+ # @see Symbiont::Generators#table
260
+ def check_table_for_visibility(locator)
261
+ access_web_object("table(locator).visible?", locator)
262
+ end
263
+
264
+ # Platform method to return a table cell object.
265
+ # Table cell objects are of type: Symbiont::WebObjects::TableCell
266
+ # @see Symbiont::Generators#cell
267
+ def get_table_cell_for(locator)
268
+ reference_web_object("td(locator)", WebObjects::TableCell, locator)
269
+ end
270
+
271
+ # Platform method to check if table cell object exists.
272
+ # @see Symbiont::Generators#cell
273
+ def check_table_cell_for_existence(locator)
274
+ access_web_object("td(locator).exists?", locator)
275
+ end
276
+
277
+ # Platform method to check if table cell object is visible.
278
+ # @see Symbiont::Generators#cell
279
+ def check_table_cell_for_visibility(locator)
280
+ access_web_object("td(locator).visible?", locator)
281
+ end
282
+
283
+ # Platform method to get text of table cell object.
284
+ # @see Symbiont::Generators#cell
285
+ def get_table_cell_text_for(locator)
286
+ access_web_object("td(locator).text", locator)
287
+ end
288
+
289
+ # Platform method to return a div object.
290
+ # Div objects are of type: Symbiont::WebObjects::Div
291
+ # @see Symbiont::Generators#div
292
+ def get_div_for(locator)
293
+ reference_web_object("div(locator)", WebObjects::Div, locator)
294
+ end
295
+
296
+ # Platform method to check if div object exists.
297
+ # @see Symbiont::Generators#div
298
+ def check_div_for_existence(locator)
299
+ access_web_object("div(locator).exists?", locator)
300
+ end
301
+
302
+ # Platform method to check if div object is visible.
303
+ # @see Symbiont::Generators#div
304
+ def check_div_for_visibility(locator)
305
+ access_web_object("div(locator).visible?", locator)
306
+ end
307
+
308
+ # Platform method to get text of div object.
309
+ # @see Symbiont::Generators#div
310
+ def get_div_text_for(locator)
311
+ access_web_object("div(locator).text", locator)
312
+ end
313
+
314
+ # Platform method to return a span object.
315
+ # Span objects are of type: Symbiont::WebObjects::Span
316
+ # @see Symbiont::Generators#span
317
+ def get_span_for(locator)
318
+ reference_web_object("span(locator)", WebObjects::Span, locator)
319
+ end
320
+
321
+ # Platform method to check if span object exists.
322
+ # @see Symbiont::Generators#span
323
+ def check_span_for_existence(locator)
324
+ access_web_object("span(locator).exists?", locator)
325
+ end
326
+
327
+ # Platform method to check if span object is visible.
328
+ # @see Symbiont::Generators#span
329
+ def check_span_for_visibility(locator)
330
+ access_web_object("span(locator).visible?", locator)
331
+ end
332
+
333
+ # Platform method to get text of span object.
334
+ # @see Symbiont::Generators#span
335
+ def get_span_text_for(locator)
336
+ access_web_object("span(locator).text", locator)
337
+ end
338
+
122
339
  private
123
340
 
124
341
  # This method is called by any platform methods that require getting
@@ -1,3 +1,3 @@
1
1
  module Symbiont
2
- VERSION = "0.0.4"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -1,11 +1,32 @@
1
1
  module Symbiont
2
2
  module WebObjects
3
-
3
+
4
+ # This class is designed to provide methods for functionality that is
5
+ # common to all web objects and that may need to be called directly
6
+ # on a web object (as opposed to a web object wrapped up by the
7
+ # platform).
8
+
4
9
  class WebObject
5
10
  def initialize(web_object)
6
11
  @web_object = web_object
7
12
  end
8
13
 
14
+ def enabled?
15
+ @web_object.enabled?
16
+ end
17
+
18
+ def disabled?
19
+ not enabled?
20
+ end
21
+
22
+ def exists?
23
+ @web_object.exists?
24
+ end
25
+
26
+ def visible?
27
+ @web_object.visible?
28
+ end
29
+
9
30
  def text
10
31
  @web_object.text
11
32
  end
@@ -0,0 +1,9 @@
1
+ module Symbiont
2
+ module WebObjects
3
+
4
+ class CheckBox < WebObject
5
+
6
+ end # class: CheckBox
7
+
8
+ end # module: WebObjects
9
+ end # module: Symbiont
@@ -0,0 +1,9 @@
1
+ module Symbiont
2
+ module WebObjects
3
+
4
+ class Div < WebObject
5
+
6
+ end # class: Div
7
+
8
+ end # module: WebObjects
9
+ end # module: Symbiont
@@ -0,0 +1,9 @@
1
+ module Symbiont
2
+ module WebObjects
3
+
4
+ class Radio < WebObject
5
+
6
+ end # class: Radio
7
+
8
+ end # module: WebObjects
9
+ end # module: Symbiont
@@ -0,0 +1,9 @@
1
+ module Symbiont
2
+ module WebObjects
3
+
4
+ class SelectList < WebObject
5
+
6
+ end # class: SelectList
7
+
8
+ end # module: WebObjects
9
+ end # module: Symbiont
@@ -0,0 +1,9 @@
1
+ module Symbiont
2
+ module WebObjects
3
+
4
+ class Span < WebObject
5
+
6
+ end # class: Span
7
+
8
+ end # module: WebObjects
9
+ end # module: Symbiont
@@ -0,0 +1,38 @@
1
+ module Symbiont
2
+ module WebObjects
3
+
4
+ class Table < WebObject
5
+
6
+ # This method is used to return a TableRow object based on the index provided.
7
+ # @return [Symbiont::WebObjects::TableRow]
8
+ def [](index)
9
+ Object::Symbiont::WebObjects::TableRow.new(@web_object[index])
10
+ end
11
+
12
+ # This method will return the number of rows in a table.
13
+ def rows
14
+ @web_object.wd.find_elements(:xpath, row_xpath).size
15
+ end
16
+
17
+ # Returns a reference to the first row web object of a table.
18
+ # @return [Symbiont::WebObjects::TableRow]
19
+ def first_row
20
+ self[0]
21
+ end
22
+
23
+ # Returns a reference to the last row web object of a table.
24
+ # @return [Symbiont::WebObjects::TableRow]
25
+ def last_row
26
+ self[-1]
27
+ end
28
+
29
+ protected
30
+
31
+ def row_xpath
32
+ ".//child::tr"
33
+ end
34
+
35
+ end # class: Table
36
+
37
+ end # module: WebObjects
38
+ end # module: Symbiont
@@ -0,0 +1,9 @@
1
+ module Symbiont
2
+ module WebObjects
3
+
4
+ class TableCell < WebObject
5
+
6
+ end # class: TableCell
7
+
8
+ end # module: WebObjects
9
+ end # module: Symbiont