symbiont 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (214) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +22 -22
  4. data/.travis.yml +25 -14
  5. data/Gemfile +4 -2
  6. data/{LICENSE → LICENSE.txt} +22 -22
  7. data/README.md +57 -65
  8. data/Rakefile +28 -34
  9. data/lib/symbiont/accessor.rb +7 -0
  10. data/lib/symbiont/assertions.rb +33 -0
  11. data/lib/symbiont/elements.rb +69 -0
  12. data/lib/symbiont/errors.rb +7 -0
  13. data/lib/symbiont/factory.rb +75 -46
  14. data/lib/symbiont/helpers.rb +49 -0
  15. data/lib/symbiont/logging.rb +5 -0
  16. data/lib/symbiont/pages.rb +32 -0
  17. data/lib/symbiont/platform.rb +12 -0
  18. data/lib/symbiont/version.rb +3 -3
  19. data/lib/symbiont.rb +34 -92
  20. data/spec/fixtures/element_definitions.rb +32 -0
  21. data/spec/fixtures/mock_drivers.rb +8 -0
  22. data/spec/fixtures/page_definitions.rb +36 -0
  23. data/spec/spec_helper.rb +31 -80
  24. data/spec/symbiont/assertion_spec.rb +88 -0
  25. data/spec/symbiont/driver_spec.rb +41 -0
  26. data/spec/symbiont/element_spec.rb +8 -0
  27. data/spec/symbiont/factory_spec.rb +70 -130
  28. data/spec/symbiont/page_spec.rb +50 -0
  29. data/symbiont.gemspec +52 -27
  30. data/test/symbiont-script.rb +97 -0
  31. metadata +89 -230
  32. data/Gemfile.lock +0 -44
  33. data/HISTORY.md +0 -99
  34. data/app/app.rb +0 -48
  35. data/app/public/css/cupertino/images/ui-bg_diagonals-thick_90_eeeeee_40x40.png +0 -0
  36. data/app/public/css/cupertino/images/ui-bg_flat_15_cd0a0a_40x100.png +0 -0
  37. data/app/public/css/cupertino/images/ui-bg_glass_100_e4f1fb_1x400.png +0 -0
  38. data/app/public/css/cupertino/images/ui-bg_glass_50_3baae3_1x400.png +0 -0
  39. data/app/public/css/cupertino/images/ui-bg_glass_80_d7ebf9_1x400.png +0 -0
  40. data/app/public/css/cupertino/images/ui-bg_highlight-hard_100_f2f5f7_1x100.png +0 -0
  41. data/app/public/css/cupertino/images/ui-bg_highlight-hard_70_000000_1x100.png +0 -0
  42. data/app/public/css/cupertino/images/ui-bg_highlight-soft_100_deedf7_1x100.png +0 -0
  43. data/app/public/css/cupertino/images/ui-bg_highlight-soft_25_ffef8f_1x100.png +0 -0
  44. data/app/public/css/cupertino/images/ui-icons_2694e8_256x240.png +0 -0
  45. data/app/public/css/cupertino/images/ui-icons_2e83ff_256x240.png +0 -0
  46. data/app/public/css/cupertino/images/ui-icons_3d80b3_256x240.png +0 -0
  47. data/app/public/css/cupertino/images/ui-icons_72a7cf_256x240.png +0 -0
  48. data/app/public/css/cupertino/images/ui-icons_ffffff_256x240.png +0 -0
  49. data/app/public/css/cupertino/jquery-ui-1.8.16.custom.css +0 -290
  50. data/app/public/css/demo_table_jui.css +0 -471
  51. data/app/public/css/font/ColabLig-webfont.eot +0 -0
  52. data/app/public/css/font/ColabLig-webfont.svg +0 -149
  53. data/app/public/css/font/ColabLig-webfont.ttf +0 -0
  54. data/app/public/css/font/ColabLig-webfont.woff +0 -0
  55. data/app/public/css/font/ColabMed-webfont.eot +0 -0
  56. data/app/public/css/font/ColabMed-webfont.svg +0 -149
  57. data/app/public/css/font/ColabMed-webfont.ttf +0 -0
  58. data/app/public/css/font/ColabMed-webfont.woff +0 -0
  59. data/app/public/css/font/ColabReg-webfont.eot +0 -0
  60. data/app/public/css/font/ColabReg-webfont.svg +0 -149
  61. data/app/public/css/font/ColabReg-webfont.ttf +0 -0
  62. data/app/public/css/font/ColabReg-webfont.woff +0 -0
  63. data/app/public/css/font/ColabThi-webfont.eot +0 -0
  64. data/app/public/css/font/ColabThi-webfont.svg +0 -149
  65. data/app/public/css/font/ColabThi-webfont.ttf +0 -0
  66. data/app/public/css/font/ColabThi-webfont.woff +0 -0
  67. data/app/public/css/normalize.css +0 -376
  68. data/app/public/css/site.css +0 -446
  69. data/app/public/fancybox/blank.gif +0 -0
  70. data/app/public/fancybox/fancy_close.png +0 -0
  71. data/app/public/fancybox/fancy_loading.png +0 -0
  72. data/app/public/fancybox/fancy_nav_left.png +0 -0
  73. data/app/public/fancybox/fancy_nav_right.png +0 -0
  74. data/app/public/fancybox/fancy_shadow_e.png +0 -0
  75. data/app/public/fancybox/fancy_shadow_n.png +0 -0
  76. data/app/public/fancybox/fancy_shadow_ne.png +0 -0
  77. data/app/public/fancybox/fancy_shadow_nw.png +0 -0
  78. data/app/public/fancybox/fancy_shadow_s.png +0 -0
  79. data/app/public/fancybox/fancy_shadow_se.png +0 -0
  80. data/app/public/fancybox/fancy_shadow_sw.png +0 -0
  81. data/app/public/fancybox/fancy_shadow_w.png +0 -0
  82. data/app/public/fancybox/fancy_title_left.png +0 -0
  83. data/app/public/fancybox/fancy_title_main.png +0 -0
  84. data/app/public/fancybox/fancy_title_over.png +0 -0
  85. data/app/public/fancybox/fancy_title_right.png +0 -0
  86. data/app/public/fancybox/fancybox-x.png +0 -0
  87. data/app/public/fancybox/fancybox-y.png +0 -0
  88. data/app/public/fancybox/fancybox.png +0 -0
  89. data/app/public/fancybox/jquery.fancybox-1.3.4.css +0 -359
  90. data/app/public/fancybox/jquery.fancybox-1.3.4.js +0 -1156
  91. data/app/public/fancybox/jquery.fancybox-1.3.4.min.js +0 -1
  92. data/app/public/img/Sorting icons.psd +0 -0
  93. data/app/public/img/back_disabled.png +0 -0
  94. data/app/public/img/back_enabled.png +0 -0
  95. data/app/public/img/back_enabled_hover.png +0 -0
  96. data/app/public/img/close.png +0 -0
  97. data/app/public/img/favicon.ico +0 -0
  98. data/app/public/img/forward_disabled.png +0 -0
  99. data/app/public/img/forward_enabled.png +0 -0
  100. data/app/public/img/forward_enabled_hover.png +0 -0
  101. data/app/public/img/lucid-bg.png +0 -0
  102. data/app/public/img/lucid-ft.png +0 -0
  103. data/app/public/img/open.png +0 -0
  104. data/app/public/img/sort_asc.png +0 -0
  105. data/app/public/img/sort_asc_disabled.png +0 -0
  106. data/app/public/img/sort_both.png +0 -0
  107. data/app/public/img/sort_desc.png +0 -0
  108. data/app/public/img/sort_desc_disabled.png +0 -0
  109. data/app/public/js/comics.js +0 -11
  110. data/app/public/js/signup.js +0 -141
  111. data/app/public/js/site.js +0 -42
  112. data/app/public/js/stardate.js +0 -35
  113. data/app/public/js/vendor/html5shiv.js +0 -5
  114. data/app/public/js/vendor/jquery-1.8.3.min.js +0 -2
  115. data/app/public/js/vendor/jquery.dataTables.min.js +0 -151
  116. data/app/public/js/vendor/jquery.validate.min.js +0 -4
  117. data/app/views/comics.erb +0 -344
  118. data/app/views/index.erb +0 -7
  119. data/app/views/layout.erb +0 -72
  120. data/app/views/layout_small.erb +0 -21
  121. data/app/views/stardate.erb +0 -5
  122. data/app/views/stardate_calc.erb +0 -30
  123. data/app/views/webobject.erb +0 -147
  124. data/lib/symbiont/data_setter.rb +0 -53
  125. data/lib/symbiont/enclosers.rb +0 -118
  126. data/lib/symbiont/evaluators.rb +0 -92
  127. data/lib/symbiont/generators.rb +0 -331
  128. data/lib/symbiont/locators.rb +0 -43
  129. data/lib/symbiont/logger.rb +0 -5
  130. data/lib/symbiont/platform_watir/platform_object.rb +0 -466
  131. data/lib/symbiont/platform_watir.rb +0 -9
  132. data/lib/symbiont/platforms.rb +0 -23
  133. data/lib/symbiont/web_objects/_common.rb +0 -174
  134. data/lib/symbiont/web_objects/button.rb +0 -22
  135. data/lib/symbiont/web_objects/checkbox.rb +0 -31
  136. data/lib/symbiont/web_objects/div.rb +0 -15
  137. data/lib/symbiont/web_objects/heading.rb +0 -12
  138. data/lib/symbiont/web_objects/hidden_field.rb +0 -19
  139. data/lib/symbiont/web_objects/label.rb +0 -15
  140. data/lib/symbiont/web_objects/link.rb +0 -23
  141. data/lib/symbiont/web_objects/list_item.rb +0 -13
  142. data/lib/symbiont/web_objects/option.rb +0 -10
  143. data/lib/symbiont/web_objects/ordered_list.rb +0 -49
  144. data/lib/symbiont/web_objects/paragraph.rb +0 -11
  145. data/lib/symbiont/web_objects/radio.rb +0 -31
  146. data/lib/symbiont/web_objects/select_list.rb +0 -82
  147. data/lib/symbiont/web_objects/span.rb +0 -15
  148. data/lib/symbiont/web_objects/table.rb +0 -71
  149. data/lib/symbiont/web_objects/table_cell.rb +0 -24
  150. data/lib/symbiont/web_objects/table_row.rb +0 -59
  151. data/lib/symbiont/web_objects/text_area.rb +0 -26
  152. data/lib/symbiont/web_objects/text_field.rb +0 -31
  153. data/lib/symbiont/web_objects/unordered_list.rb +0 -49
  154. data/lib/symbiont/web_objects.rb +0 -22
  155. data/lucid.yml +0 -6
  156. data/spec/symbiont/data_setter_spec.rb +0 -65
  157. data/spec/symbiont/enclosers_spec.rb +0 -76
  158. data/spec/symbiont/evaluators_spec.rb +0 -95
  159. data/spec/symbiont/generators/button_generators_spec.rb +0 -72
  160. data/spec/symbiont/generators/checkbox_generators_spec.rb +0 -79
  161. data/spec/symbiont/generators/div_generators_spec.rb +0 -56
  162. data/spec/symbiont/generators/hidden_field_generators_spec.rb +0 -65
  163. data/spec/symbiont/generators/link_generators_spec.rb +0 -62
  164. data/spec/symbiont/generators/paragraph_generators_spec.rb +0 -57
  165. data/spec/symbiont/generators/radio_generators_spec.rb +0 -76
  166. data/spec/symbiont/generators/select_list_generators_spec.rb +0 -93
  167. data/spec/symbiont/generators/span_generators_spec.rb +0 -56
  168. data/spec/symbiont/generators/table_cell_generators_spec.rb +0 -56
  169. data/spec/symbiont/generators/table_generators_spec.rb +0 -56
  170. data/spec/symbiont/generators/text_area_generators_spec.rb +0 -72
  171. data/spec/symbiont/generators/text_field_generators_spec.rb +0 -72
  172. data/spec/symbiont/generators_spec.rb +0 -59
  173. data/spec/symbiont/locators_spec.rb +0 -68
  174. data/spec/symbiont/platform_object_spec.rb +0 -18
  175. data/spec/symbiont/symbiont_spec.rb +0 -29
  176. data/spec/symbiont/web_object_spec.rb +0 -194
  177. data/spec/symbiont/web_objects/button_spec.rb +0 -38
  178. data/spec/symbiont/web_objects/checkbox_spec.rb +0 -27
  179. data/spec/symbiont/web_objects/div_spec.rb +0 -18
  180. data/spec/symbiont/web_objects/heading_spec.rb +0 -22
  181. data/spec/symbiont/web_objects/hidden_field_spec.rb +0 -18
  182. data/spec/symbiont/web_objects/label_spec.rb +0 -18
  183. data/spec/symbiont/web_objects/link_spec.rb +0 -33
  184. data/spec/symbiont/web_objects/list_item_spec.rb +0 -18
  185. data/spec/symbiont/web_objects/option_spec.rb +0 -9
  186. data/spec/symbiont/web_objects/ordered_list_spec.rb +0 -53
  187. data/spec/symbiont/web_objects/paragraph_spec.rb +0 -18
  188. data/spec/symbiont/web_objects/radio_spec.rb +0 -27
  189. data/spec/symbiont/web_objects/select_list_spec.rb +0 -69
  190. data/spec/symbiont/web_objects/span_spec.rb +0 -18
  191. data/spec/symbiont/web_objects/table_cell_spec.rb +0 -19
  192. data/spec/symbiont/web_objects/table_row_spec.rb +0 -58
  193. data/spec/symbiont/web_objects/table_spec.rb +0 -61
  194. data/spec/symbiont/web_objects/text_area_spec.rb +0 -18
  195. data/spec/symbiont/web_objects/text_field_spec.rb +0 -39
  196. data/spec/symbiont/web_objects/unordered_list_spec.rb +0 -51
  197. data/specs/common/support/browser.rb +0 -25
  198. data/specs/common/support/env.rb +0 -6
  199. data/specs/common/support/events.rb +0 -15
  200. data/specs/enclosers.feature +0 -9
  201. data/specs/evaluators.feature +0 -26
  202. data/specs/pages/characters.rb +0 -22
  203. data/specs/pages/home.rb +0 -9
  204. data/specs/pages/stardate.rb +0 -23
  205. data/specs/pages/web_objects.rb +0 -77
  206. data/specs/select_list.feature +0 -53
  207. data/specs/steps/enclosers_steps.rb +0 -17
  208. data/specs/steps/evaluators_steps.rb +0 -44
  209. data/specs/steps/navigation_steps.rb +0 -14
  210. data/specs/steps/select_list_steps.rb +0 -94
  211. data/specs/steps/table_cell_steps.rb +0 -31
  212. data/specs/steps/table_steps.rb +0 -87
  213. data/specs/table.feature +0 -49
  214. data/specs/table_cell.feature +0 -27
@@ -1,31 +0,0 @@
1
- module Symbiont
2
- module WebObjects
3
-
4
- class CheckBox < WebObject
5
-
6
- def initialize(web_object)
7
- @web_object = web_object
8
- end
9
-
10
- def check
11
- web_object.set
12
- end
13
-
14
- def uncheck
15
- web_object.clear
16
- end
17
-
18
- def checked?
19
- web_object.set?
20
- end
21
-
22
- def self.usable_selectors
23
- super + [:value, :label]
24
- end
25
-
26
- end # class: CheckBox
27
-
28
- ::Symbiont::WebObjects.class_for_type[:checkbox] = ::Symbiont::WebObjects::CheckBox
29
-
30
- end # module: WebObjects
31
- end # module: Symbiont
@@ -1,15 +0,0 @@
1
- module Symbiont
2
- module WebObjects
3
-
4
- class Div < WebObject
5
-
6
- def self.usable_selectors
7
- super + [:text, :title]
8
- end
9
-
10
- end # class: Div
11
-
12
- ::Symbiont::WebObjects.class_for_tag[:div] = ::Symbiont::WebObjects::Div
13
-
14
- end # module: WebObjects
15
- end # module: Symbiont
@@ -1,12 +0,0 @@
1
- module Symbiont
2
- module WebObjects
3
-
4
- class Heading < WebObject
5
-
6
- end # class: Heading
7
-
8
- ::Symbiont::WebObjects.class_for_tag[:h1] = ::Symbiont::WebObjects::Heading
9
- ::Symbiont::WebObjects.class_for_tag[:h2] = ::Symbiont::WebObjects::Heading
10
-
11
- end # module: WebObjects
12
- end # module: Symbiont
@@ -1,19 +0,0 @@
1
- module Symbiont
2
- module WebObjects
3
-
4
- class HiddenField < WebObject
5
-
6
- def initialize(web_object)
7
- @web_object = web_object
8
- end
9
-
10
- def self.usable_selectors
11
- super + [:text, :value]
12
- end
13
-
14
- end # class: HiddenField
15
-
16
- ::Symbiont::WebObjects.class_for_tag[:hidden] = ::Symbiont::WebObjects::HiddenField
17
-
18
- end # module: WebObjects
19
- end # module: Symbiont
@@ -1,15 +0,0 @@
1
- module Symbiont
2
- module WebObjects
3
-
4
- class Label < WebObject
5
-
6
- def self.usable_selectors
7
- super + [:text]
8
- end
9
-
10
- end # class: Label
11
-
12
- ::Symbiont::WebObjects.class_for_tag[:label] = ::Symbiont::WebObjects::Label
13
-
14
- end # module: WebObjects
15
- end # module: Symbiont
@@ -1,23 +0,0 @@
1
- module Symbiont
2
- module WebObjects
3
-
4
- class Link < WebObject
5
-
6
- def initialize(web_object)
7
- @web_object = web_object
8
- end
9
-
10
- def self.usable_selectors
11
- super + [:href, :text, :title, :css]
12
- end
13
-
14
- def self.selector_mapping
15
- super.merge({:link => :text, :link_text => :text})
16
- end
17
-
18
- end # class: Link
19
-
20
- ::Symbiont::WebObjects.class_for_tag[:a] = ::Symbiont::WebObjects::Link
21
-
22
- end # module: WebObjects
23
- end # module: Symbiont
@@ -1,13 +0,0 @@
1
- module Symbiont
2
- module WebObjects
3
-
4
- class ListItem < WebObject
5
- def self.usable_selectors
6
- super + [:text]
7
- end
8
- end
9
-
10
- ::Symbiont::WebObjects.class_for_tag[:li] = ::Symbiont::WebObjects::ListItem
11
-
12
- end # module: WebObjects
13
- end # module: Symbiont
@@ -1,10 +0,0 @@
1
- module Symbiont
2
- module WebObjects
3
- class Option < WebObject
4
-
5
- end # class: Option
6
-
7
- ::Symbiont::WebObjects.class_for_tag[:option] = ::Symbiont::WebObjects::Option
8
-
9
- end # module: WebObjects
10
- end # module: Symbiont
@@ -1,49 +0,0 @@
1
- module Symbiont
2
- module WebObjects
3
-
4
- class OrderedList < WebObject
5
- include Enumerable
6
-
7
- def initialize(web_object)
8
- @web_object = web_object
9
- end
10
-
11
- # @return [Symbiont::WebObjects::ListItem]
12
- def [](index)
13
- ::Symbiont::WebObjects::ListItem.new(children[index])
14
- end
15
-
16
- # Return the number of list items contained in the ordered list.
17
- def items
18
- children.size
19
- end
20
-
21
- # @return [Symbiont::WebObjects::ListItem]
22
- def each
23
- for index in 1..self.items do
24
- yield self[index - 1]
25
- end
26
- end
27
-
28
- protected
29
-
30
- def list_item_xpath
31
- ".//child::li"
32
- end
33
-
34
- private
35
-
36
- def children
37
- list_items.find_all { |item| item.parent == web_object }
38
- end
39
-
40
- def list_items
41
- web_object.ols(:xpath => list_item_xpath)
42
- end
43
-
44
- end # class: OrderedList
45
-
46
- ::Symbiont::WebObjects.class_for_tag[:ol] = ::Symbiont::WebObjects::OrderedList
47
-
48
- end # module: WebObjects
49
- end # module: Symbiont
@@ -1,11 +0,0 @@
1
- module Symbiont
2
- module WebObjects
3
-
4
- class Paragraph < WebObject
5
-
6
- end # class: Paragraph
7
-
8
- ::Symbiont::WebObjects.class_for_tag[:p] = ::Symbiont::WebObjects::Paragraph
9
-
10
- end # module: WebObjects
11
- end # module: Symbiont
@@ -1,31 +0,0 @@
1
- module Symbiont
2
- module WebObjects
3
-
4
- class Radio < WebObject
5
-
6
- def initialize(web_object)
7
- @web_object = web_object
8
- end
9
-
10
- def self.usable_selectors
11
- super + [:value, :label]
12
- end
13
-
14
- def select
15
- web_object.set
16
- end
17
-
18
- def clear
19
- web_object.clear
20
- end
21
-
22
- def selected?
23
- web_object.set?
24
- end
25
-
26
- end # class: Radio
27
-
28
- ::Symbiont::WebObjects.class_for_type[:radio] = ::Symbiont::WebObjects::Radio
29
-
30
- end # module: WebObjects
31
- end # module: Symbiont
@@ -1,82 +0,0 @@
1
- module Symbiont
2
- module WebObjects
3
-
4
- class SelectList < WebObject
5
- def initialize(web_object)
6
- @web_object = web_object
7
- end
8
-
9
- def self.usable_selectors
10
- super + [:value, :text, :label]
11
- end
12
-
13
- # This method is used to return an Option object based on the index provided.
14
- # @return [Symbiont::WebObjects::Option]
15
- def [](idx)
16
- ::Symbiont::WebObjects::Option.new(options[idx])
17
- end
18
-
19
- # Selects an option from the select list.
20
- def select(value)
21
- web_object.select(value)
22
- end
23
-
24
- # Selects the option whose value attribute matches the provided string.
25
- def select_value(value)
26
- web_object.select_value(value)
27
- end
28
-
29
- # This method returns an array of Option objects that are contained within
30
- # a select list object.
31
- # @return [array of Symbiont::WebObjects::Option]
32
- def options
33
- web_objects = []
34
- options = web_object.wd.find_elements(:xpath, option_xpath)
35
- options.each do |opt|
36
- web_objects << ::Symbiont::WebObjects::Option.new(opt)
37
- end
38
- web_objects
39
- end
40
-
41
- # This method returns an array of strings that contain the text of the
42
- # currently selected options in a select list.
43
- # @return [Array<String>]
44
- def selected_options
45
- web_object.selected_options.map { |e| e.text }.compact
46
- end
47
-
48
- # This method returns an array of strings that contain the values of the
49
- # currently selected options in a select list.
50
- # @return [Array<String>]
51
- def selected_values
52
- web_object.selected_options.map { |e| e.value }.compact
53
- end
54
-
55
- # This method returns true if any of the text or the label of any option
56
- # that is selected matches the provided value.
57
- # @param [String, Regexp] value A value to check for
58
- # @return [Boolean]
59
- def selected?(value)
60
- web_object.selected? value
61
- end
62
-
63
- # This method checks to see if the select list has one or more options
64
- # where the text or the label matches the provided value.
65
- # @param [String, Regexp] value A value to check for.
66
- # @return [Boolean]
67
- def include?(value)
68
- web_object.include? value
69
- end
70
-
71
- protected
72
-
73
- def option_xpath
74
- ".//child::option"
75
- end
76
-
77
- end # class: SelectList
78
-
79
- ::Symbiont::WebObjects.class_for_tag[:select] = ::Symbiont::WebObjects::SelectList
80
-
81
- end # module: WebObjects
82
- end # module: Symbiont
@@ -1,15 +0,0 @@
1
- module Symbiont
2
- module WebObjects
3
-
4
- class Span < WebObject
5
-
6
- def self.usable_selectors
7
- super + [:text, :title]
8
- end
9
-
10
- end # class: Span
11
-
12
- ::Symbiont::WebObjects.class_for_tag[:span] = ::Symbiont::WebObjects::Span
13
-
14
- end # module: WebObjects
15
- end # module: Symbiont
@@ -1,71 +0,0 @@
1
- module Symbiont
2
- module WebObjects
3
-
4
- class Table < WebObject
5
- include Enumerable
6
-
7
- def initialize(web_object)
8
- @web_object = web_object
9
- end
10
-
11
- # This method is used to return a TableRow object based on the index provided. When
12
- # the index provided is a string, the text will be matched with the text from the first
13
- # column.
14
- # @return [Symbiont::WebObjects::TableRow]
15
- def [](index)
16
- index = find_by_title(index) if index.kind_of?(String)
17
- return nil unless index
18
- ::Symbiont::WebObjects::TableRow.new(web_object[index])
19
- end
20
-
21
- # This method is an iterator that returns a TableRow object each time through
22
- # the loop.
23
- # @return [Symbiont::WebObjects::TableRow]
24
- def each
25
- for index in 1..self.rows do
26
- yield self[index - 1]
27
- end
28
- end
29
-
30
- # This method will return the number of rows in a table.
31
- def rows
32
- web_object.wd.find_elements(:xpath, row_xpath).size
33
- end
34
-
35
- # Returns a reference to the first row web object of a table.
36
- # @return [Symbiont::WebObjects::TableRow]
37
- def first_row
38
- self[0]
39
- end
40
-
41
- # Returns a reference to the last row web object of a table.
42
- # @return [Symbiont::WebObjects::TableRow]
43
- def last_row
44
- self[-1]
45
- end
46
-
47
- protected
48
-
49
- def row_xpath
50
- ".//child::tr"
51
- end
52
-
53
- def initialize_row(element)
54
- ::Symbiont::WebObjects::TableRow.new(element)
55
- end
56
-
57
- private
58
-
59
- def find_by_title(row_text)
60
- #web_object.rows.find_index {|row| row[0].text == row_text}
61
- web_object.rows.find_index do |row|
62
- row.cells.any? { |col| col.text.include? row_text }
63
- end
64
- end
65
-
66
- end # class: Table
67
-
68
- ::Symbiont::WebObjects.class_for_tag[:table] = ::Symbiont::WebObjects::Table
69
-
70
- end # module: WebObjects
71
- end # module: Symbiont
@@ -1,24 +0,0 @@
1
- module Symbiont
2
- module WebObjects
3
-
4
- class TableCell < WebObject
5
-
6
- def initialize(web_object)
7
- @web_object = web_object
8
- end
9
-
10
- def enabled?
11
- true
12
- end
13
-
14
- def self.usable_selectors
15
- super + [:text]
16
- end
17
-
18
- end # class: TableCell
19
-
20
- ::Symbiont::WebObjects.class_for_tag[:td] = ::Symbiont::WebObjects::TableCell
21
- ::Symbiont::WebObjects.class_for_tag[:th] = ::Symbiont::WebObjects::TableCell
22
-
23
- end # module: WebObjects
24
- end # module: Symbiont
@@ -1,59 +0,0 @@
1
- module Symbiont
2
- module WebObjects
3
-
4
- class TableRow < WebObject
5
- include Enumerable
6
-
7
- def initialize(web_object)
8
- @web_object = web_object
9
- end
10
-
11
- # This method is used to return a TableCell object based on the index provided. When
12
- # the index provided is a string, the text will be matched with the text from the
13
- # columns in the first row.
14
- # @return [Symbiont::WebObjects::TableCell]
15
- def [](index)
16
- index = find_by_title(index) if index.kind_of?(String)
17
- return nil unless index && columns >= index + 1
18
- ::Symbiont::WebObjects::TableCell.new(web_object[index])
19
- end
20
-
21
- # This method is an iterator that returns a TableCell object each time through
22
- # the loop.
23
- # @return [Symbiont::WebObjects::TableCell]
24
- def each
25
- for index in 1..self.columns do
26
- yield self[index - 1]
27
- end
28
- end
29
-
30
- # This method returns the number of columns in a table object.
31
- def columns
32
- web_object.wd.find_elements(:xpath, cell_xpath).size
33
- end
34
-
35
- protected
36
-
37
- def cell_xpath
38
- ".//child::td|th"
39
- end
40
-
41
- def initialize_cell(element)
42
- ::Symbiont::WebObjects::TableCell.new(element)
43
- end
44
-
45
- private
46
-
47
- def find_by_title(column_text)
48
- table = web_object.parent
49
- table = table.parent if table.tag_name == 'tbody'
50
- first_row = table[0]
51
- first_row.cells.find_index {|column| column.text.include? column_text}
52
- end
53
-
54
- end # class: TableRow
55
-
56
- ::Symbiont::WebObjects.class_for_tag[:tr] = ::Symbiont::WebObjects::TableRow
57
-
58
- end # module: WebObjects
59
- end # module: Symbiont
@@ -1,26 +0,0 @@
1
- module Symbiont
2
- module WebObjects
3
-
4
- class TextArea < WebObject
5
- def initialize(web_object)
6
- @web_object = web_object
7
- end
8
-
9
- def value=(value)
10
- web_object.set value
11
- end
12
-
13
- def clear
14
- web_object.wd.clear
15
- end
16
-
17
- def self.usable_selectors
18
- super + [:title, :value, :text, :label]
19
- end
20
-
21
- end # class: TextArea
22
-
23
- ::Symbiont::WebObjects.class_for_tag[:textarea] = ::Symbiont::WebObjects::TextArea
24
-
25
- end # module: WebObjects
26
- end # module: Symbiont
@@ -1,31 +0,0 @@
1
- module Symbiont
2
- module WebObjects
3
-
4
- class TextField < WebObject
5
- def initialize(web_object)
6
- @web_object = web_object
7
- end
8
-
9
- def value
10
- web_object.value
11
- end
12
-
13
- def value=(value)
14
- web_object.set value
15
- end
16
-
17
- def append(text)
18
- web_object.send_keys text
19
- end
20
-
21
- def self.usable_selectors
22
- super + [:title, :value, :text, :label]
23
- end
24
-
25
- end # class: TextField
26
-
27
- ::Symbiont::WebObjects.class_for_type[:text] = ::Symbiont::WebObjects::TextField
28
- ::Symbiont::WebObjects.class_for_type[:password] = ::Symbiont::WebObjects::TextField
29
-
30
- end # module: WebObjects
31
- end # module: Symbiont
@@ -1,49 +0,0 @@
1
- module Symbiont
2
- module WebObjects
3
-
4
- class UnorderedList < WebObject
5
- include Enumerable
6
-
7
- def initialize(web_object)
8
- @web_object = web_object
9
- end
10
-
11
- # @return [Symbiont::WebObjects::ListItem]
12
- def [](index)
13
- ::Symbiont::WebObjects::ListItem.new(children[index])
14
- end
15
-
16
- # Return the number of list items contained in the ordered list.
17
- def items
18
- children.size
19
- end
20
-
21
- # @return [Symbiont::WebObjects::ListItem]
22
- def each
23
- for index in 1..self.items do
24
- yield self[index - 1]
25
- end
26
- end
27
-
28
- protected
29
-
30
- def list_item_xpath
31
- ".//child::li"
32
- end
33
-
34
- private
35
-
36
- def children
37
- list_items.find_all { |item| item.parent == web_object }
38
- end
39
-
40
- def list_items
41
- web_object.uls(:xpath => list_item_xpath)
42
- end
43
-
44
- end # class: UnorderedList
45
-
46
- ::Symbiont::WebObjects.class_for_tag[:ul] = ::Symbiont::WebObjects::UnorderedList
47
-
48
- end # module: WebObjects
49
- end # module: Symbiont
@@ -1,22 +0,0 @@
1
- module Symbiont
2
- module WebObjects
3
-
4
- class << self
5
- def class_for_tag
6
- @class_for_tag ||= {}
7
- end
8
-
9
- def class_for_type
10
- @class_for_type ||= {}
11
- end
12
-
13
- def get_class_for(tag, type=nil)
14
- return class_for_type[type.to_sym] if type
15
- class_for_tag[tag.to_sym] || ::Symbiont::WebObjects::WebObject
16
- end
17
- end
18
-
19
- end
20
- end
21
-
22
- require 'symbiont/web_objects/_common'
data/lucid.yml DELETED
@@ -1,6 +0,0 @@
1
- options: BROWSER=firefox --no-source --format pretty
2
- spec_path: specs
3
- step_path: specs\steps
4
- requires:
5
- - specs\common
6
- - specs\pages