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,194 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Web Objects" do
4
- let(:watir_browser) { mock_browser_for_watir }
5
- let(:watir_definition) { ::Symbiont::WebObjects::WebObject.new(watir_browser) }
6
- let(:link) { Symbiont::WebObjects::Link }
7
-
8
- it "should determine if a web object is enabled" do
9
- watir_browser.should_receive(:enabled?).twice.and_return(true)
10
- watir_definition.enabled?.should == true
11
- watir_definition.should be_enabled
12
- end
13
-
14
- it "should determine if a web object is disabled" do
15
- watir_browser.should_receive(:enabled?).twice.and_return(false)
16
- watir_definition.disabled?.should == true
17
- watir_definition.should be_disabled
18
- end
19
-
20
- it "should determine if a web object is visible" do
21
- watir_browser.should_receive(:present?).twice.and_return(true)
22
- watir_definition.visible?.should == true
23
- watir_definition.should be_visible
24
- end
25
-
26
- it "should determine if a web object is not visible" do
27
- watir_browser.should_receive(:present?).and_return(false)
28
- watir_definition.visible?.should == false
29
- end
30
-
31
- it "should determine if a web object exists" do
32
- watir_browser.should_receive(:exists?).and_return(true)
33
- watir_definition.exists?.should == true
34
- end
35
-
36
- it "should determine if a web object does not exist" do
37
- watir_browser.should_receive(:exists?).and_return(false)
38
- watir_definition.exists?.should == false
39
- end
40
-
41
- it "should retrieve the id of a web object" do
42
- watir_browser.should_receive(:id).and_return("id")
43
- watir_definition.id.should == "id"
44
- end
45
-
46
- it "should retrieve the value of a web object" do
47
- watir_browser.should_receive(:value).and_return("value")
48
- watir_definition.value.should == "value"
49
- end
50
-
51
- it "should be able to flash a web_object" do
52
- watir_browser.should_receive(:flash).and_return(watir_definition)
53
- watir_definition.flash.should be_instance_of Symbiont::WebObjects::WebObject
54
- end
55
-
56
- it "should retrieve the value of an attribute" do
57
- watir_browser.should_receive(:attribute_value).and_return(true)
58
- watir_definition.attribute("readonly").should be_true
59
- end
60
-
61
- it "should be able to focus on a web object" do
62
- watir_browser.should_receive(:focus).and_return(watir_definition)
63
- watir_definition.focus
64
- end
65
-
66
- it "should return the text contained by a web object" do
67
- watir_browser.should_receive(:text).and_return("testing")
68
- watir_definition.text.should == "testing"
69
- end
70
-
71
- it "should retrieve the html of a web object" do
72
- watir_browser.should_receive(:html).and_return("<p>Testing</p>")
73
- watir_definition.html.should == "<p>Testing</p>"
74
- end
75
-
76
- it "should simulate a click event on a web object" do
77
- watir_browser.should_receive(:click)
78
- watir_definition.click
79
- end
80
-
81
- it "should simulate a double-click event on a web object" do
82
- watir_browser.should_receive(:double_click)
83
- watir_definition.double_click
84
- end
85
-
86
- it "should retrieve the tag of a web object" do
87
- watir_browser.should_receive(:tag_name).and_return("div")
88
- watir_definition.tag_name.should == "div"
89
- end
90
-
91
- it "should allow a clear event on a web object" do
92
- watir_browser.should_receive(:clear)
93
- watir_definition.clear
94
- end
95
-
96
- it "should retrieve the style of a web object" do
97
- watir_browser.should_receive(:style).with('display').and_return("none")
98
- watir_definition.style('display').should == 'none'
99
- end
100
-
101
- it "should be able to inspect a web object" do
102
- watir_browser.should_receive(:inspect).and_return(watir_definition)
103
- watir_definition.inspect.should be_instance_of Symbiont::WebObjects::WebObject
104
- end
105
-
106
- it "should be able to hover over a web object" do
107
- watir_browser.should_receive(:hover).and_return(watir_definition)
108
- watir_definition.hover
109
- end
110
-
111
- it "should be able to fire an event on a web object" do
112
- watir_browser.should_receive(:fire_event).and_return("onclick")
113
- watir_definition.fire_event("onclick")
114
- end
115
-
116
- it "should send key presses to a web object" do
117
- watir_browser.should_receive(:send_keys).with([:control, 'a'])
118
- watir_definition.send_keys([:control, 'a'])
119
- end
120
-
121
- it "should be able to determine if a web object is equal to another" do
122
- watir_browser.should_receive(:==).and_return(true)
123
- watir_definition.should == watir_definition
124
- end
125
-
126
- it "should find the parent for a web object" do
127
- watir_browser.should_receive(:tag_name).twice.and_return(:p)
128
- watir_browser.should_receive(:parent).and_return(watir_definition)
129
- watir_definition.parent
130
- end
131
-
132
- it "should wait until a specific condition occurs" do
133
- Object::Watir::Wait.stub(:until).with(5, "Condition occurred.")
134
- watir_definition.wait_until(5, "Condition occurred.") { true }
135
- end
136
-
137
- it "should wait for a web object to be actionable" do
138
- watir_browser.should_receive(:wait_until_present).twice.with(5)
139
- watir_definition.when_actionable(5)
140
- watir_definition.when_present(5)
141
- end
142
-
143
- it "should use the provided element wait time for actionable checks" do
144
- Symbiont.element_level_wait = 30
145
- watir_browser.should_receive(:wait_until_present).with(30)
146
- watir_definition.when_present
147
- end
148
-
149
- it "should reference a web object when it is actionable" do
150
- watir_browser.should_receive(:wait_until_present).with(5)
151
- web_object = watir_definition.when_actionable(5)
152
- web_object.should === watir_definition
153
- end
154
-
155
- it "should wait for a web object to become non-actionable" do
156
- watir_browser.should_receive(:wait_while_present).and_return(false)
157
- watir_definition.when_not_present(5)
158
- end
159
-
160
- it "should wait for a web object to become visible" do
161
- watir_browser.should_receive(:present?).and_return(true)
162
- watir_definition.when_visible(5)
163
- end
164
-
165
- it "should reference a web object when it is visible" do
166
- watir_browser.should_receive(:present?).and_return(true)
167
- web_object = watir_definition.when_visible(5)
168
- web_object.should === watir_definition
169
- end
170
-
171
- it "should wait for a web object to become invisible" do
172
- watir_browser.should_receive(:present?).and_return(false)
173
- watir_definition.when_not_visible(5)
174
- end
175
-
176
- it "should reference a web object when it is not visible" do
177
- watir_browser.stub(:present?).and_return(false)
178
- web_object = watir_definition.when_not_visible(5)
179
- web_object.should === watir_definition
180
- end
181
-
182
- it "should scroll elements into view" do
183
- watir_browser.should_receive(:wd).and_return(watir_browser)
184
- watir_browser.should_receive(:location_once_scrolled_into_view)
185
- watir_definition.scroll_into_view
186
- end
187
-
188
- it "should return no key for an unrecognized locator" do
189
- [:invalid].each do |s|
190
- locator = link.provide_locator_for s => 'value'
191
- locator.keys.first.should == nil
192
- end
193
- end
194
- end
@@ -1,38 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Symbiont::WebObjects::Button do
4
- describe "implementation" do
5
- let(:button_object) { double('button_object') }
6
- let(:button) { Symbiont::WebObjects::Button }
7
-
8
- it "should reference standard usable selectors" do
9
- [:class, :id, :name, :index, :xpath, :value, :src, :alt, :text].each do |s|
10
- locator = button.provide_locator_for s => 'value'
11
- locator.keys.first.should == s
12
- end
13
- end
14
-
15
- it "should reference specific usable selectors" do
16
- [:value, :text].each do |s|
17
- locator = button.provide_locator_for s => 'value'
18
- locator.keys.first.should == s
19
- end
20
- end
21
-
22
- it "should register with a submit type" do
23
- ::Symbiont::WebObjects.get_class_for(:input, :submit).should == ::Symbiont::WebObjects::Button
24
- end
25
-
26
- it "should register with a button type" do
27
- ::Symbiont::WebObjects.get_class_for(:input, :button).should == ::Symbiont::WebObjects::Button
28
- end
29
-
30
- it "should register with an image type" do
31
- ::Symbiont::WebObjects.get_class_for(:input, :image).should == ::Symbiont::WebObjects::Button
32
- end
33
-
34
- it "should register with an image type" do
35
- ::Symbiont::WebObjects.get_class_for(:input, :reset).should == ::Symbiont::WebObjects::Button
36
- end
37
- end
38
- end
@@ -1,27 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Symbiont::WebObjects::CheckBox do
4
- describe "implementation" do
5
- let(:checkbox_object) { double('checkbox_object') }
6
- let(:checkbox_definition) { Symbiont::WebObjects::CheckBox.new(checkbox_object) }
7
-
8
- it "should register with a submit type" do
9
- ::Symbiont::WebObjects.get_class_for(:input, :checkbox).should == ::Symbiont::WebObjects::CheckBox
10
- end
11
-
12
- it "should be able to check the definition" do
13
- checkbox_object.should_receive(:set)
14
- checkbox_definition.check
15
- end
16
-
17
- it "should be able to uncheck the definition" do
18
- checkbox_object.should_receive(:clear)
19
- checkbox_definition.uncheck
20
- end
21
-
22
- it "should be able to determine if the definition is checked" do
23
- checkbox_object.should_receive(:set?).and_return(true)
24
- checkbox_definition.checked?
25
- end
26
- end
27
- end
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Symbiont::WebObjects::Div do
4
- describe "implementation" do
5
- let(:div_object) { Symbiont::WebObjects::Div }
6
-
7
- it "should allow locators to be used" do
8
- [:class, :id, :text, :index, :xpath, :title, :name].each do |t|
9
- locator = div_object.provide_locator_for t => 'value'
10
- locator.keys.first.should == t
11
- end
12
- end
13
-
14
- it "should register with a div tag" do
15
- ::Symbiont::WebObjects.get_class_for(:div).should == ::Symbiont::WebObjects::Div
16
- end
17
- end
18
- end
@@ -1,22 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Symbiont::WebObjects::Heading do
4
- describe "implementation" do
5
- let(:heading_object) { Symbiont::WebObjects::Heading }
6
-
7
- it "should allow locators to be used" do
8
- [:class, :id, :index, :xpath, :name].each do |t|
9
- locator = heading_object.provide_locator_for t => 'value'
10
- locator.keys.first.should == t
11
- end
12
- end
13
-
14
- it "should register with an h1 tag" do
15
- ::Symbiont::WebObjects.get_class_for(:h1).should == ::Symbiont::WebObjects::Heading
16
- end
17
-
18
- it "should register with an h2 tag" do
19
- ::Symbiont::WebObjects.get_class_for(:h2).should == ::Symbiont::WebObjects::Heading
20
- end
21
- end
22
- end
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Symbiont::WebObjects::HiddenField do
4
- describe "implementation" do
5
- let(:hidden_field_object) { Symbiont::WebObjects::HiddenField }
6
-
7
- it "should reference standard usable selectors" do
8
- [:class, :id, :name, :index, :xpath, :value, :text].each do |s|
9
- locator = hidden_field_object.provide_locator_for s => 'value'
10
- locator.keys.first.should == s
11
- end
12
- end
13
-
14
- it "should register with a hidden tag" do
15
- ::Symbiont::WebObjects.get_class_for(:hidden).should == ::Symbiont::WebObjects::HiddenField
16
- end
17
- end
18
- end
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Symbiont::WebObjects::Label do
4
- describe "implementation" do
5
- let(:label_object) { Symbiont::WebObjects::Label }
6
-
7
- it "should allow locators to be used" do
8
- [:class, :id, :text, :index, :xpath].each do |t|
9
- locator = label_object.provide_locator_for t => 'value'
10
- locator.keys.first.should == t
11
- end
12
- end
13
-
14
- it "should register with a label tag" do
15
- ::Symbiont::WebObjects.get_class_for(:label).should == ::Symbiont::WebObjects::Label
16
- end
17
- end
18
- end
@@ -1,33 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Symbiont::WebObjects::Link do
4
- describe "implementation" do
5
- let(:link_object) { double('link_object') }
6
- let(:link) { Symbiont::WebObjects::Link }
7
-
8
- it "should reference standard usable selectors" do
9
- [:class, :id, :name, :index, :xpath].each do |s|
10
- locator = link.provide_locator_for s => 'value'
11
- locator.keys.first.should == s
12
- end
13
- end
14
-
15
- it "should reference specific usable selectors" do
16
- [:href, :text, :title, :css].each do |s|
17
- locator = link.provide_locator_for s => 'value'
18
- locator.keys.first.should == s
19
- end
20
- end
21
-
22
- it "should reference mappable selectors" do
23
- [:link, :link_text].each do |s|
24
- locator = link.provide_locator_for s => 'value'
25
- locator.keys.first.should == :text
26
- end
27
- end
28
-
29
- it "should register with an anchor tag" do
30
- ::Symbiont::WebObjects.get_class_for(:a).should == ::Symbiont::WebObjects::Link
31
- end
32
- end
33
- end
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Symbiont::WebObjects::ListItem do
4
- describe "implementation" do
5
- let(:list_item_object) { Symbiont::WebObjects::ListItem }
6
-
7
- it "should allow locators to be used" do
8
- [:class, :id, :index, :xpath, :name, :text].each do |t|
9
- locator = list_item_object.provide_locator_for t => 'value'
10
- locator.keys.first.should == t
11
- end
12
- end
13
-
14
- it "should register with a list item (li) tag" do
15
- ::Symbiont::WebObjects.get_class_for(:li).should == ::Symbiont::WebObjects::ListItem
16
- end
17
- end
18
- end
@@ -1,9 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Symbiont::WebObjects::Option do
4
- describe "implementation" do
5
- it "should register with an option tag" do
6
- ::Symbiont::WebObjects.get_class_for(:option).should == ::Symbiont::WebObjects::Option
7
- end
8
- end
9
- end
@@ -1,53 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Symbiont::WebObjects::OrderedList do
4
- describe "implementation" do
5
- let(:ordered_list_object) { Symbiont::WebObjects::OrderedList }
6
-
7
- it "should allow locators to be used" do
8
- [:class, :id, :index, :xpath, :name].each do |t|
9
- locator = ordered_list_object.provide_locator_for t => 'value'
10
- locator.keys.first.should == t
11
- end
12
- end
13
-
14
- it "should register with a ordered list (ol) tag" do
15
- ::Symbiont::WebObjects.get_class_for(:ol).should == ::Symbiont::WebObjects::OrderedList
16
- end
17
-
18
- context "on the watir platform" do
19
- let(:ol_element) { double('ol_element') }
20
- let(:watir_ordered_list) { Symbiont::WebObjects::OrderedList.new(ol_element) }
21
-
22
- it "should return a list item when indexed" do
23
- ol_element.stub(:ols).and_return([ol_element])
24
- ol_element.stub(:find_elements).and_return(ol_element)
25
- ol_element.stub(:map).and_return([ol_element])
26
- ol_element.stub(:parent).and_return(ol_element)
27
- ol_element.stub(:element).and_return(ol_element)
28
- ol_element.stub(:==).and_return(true)
29
- watir_ordered_list[1]
30
- end
31
-
32
- it "should know how many list items it contains" do
33
- ol_element.stub(:ols).and_return([ol_element])
34
- ol_element.stub(:find_elements).and_return(ol_element)
35
- ol_element.stub(:map).and_return([ol_element])
36
- ol_element.stub(:parent).and_return(ol_element)
37
- ol_element.stub(:element).and_return(ol_element)
38
- ol_element.stub(:==).and_return(true)
39
- watir_ordered_list.items.should == 1
40
- end
41
-
42
- it "should iterate over the list items" do
43
- watir_ordered_list.should_receive(:items).and_return(5)
44
- watir_ordered_list.stub(:[])
45
- count = 0
46
- watir_ordered_list.each { |item| count += 1 }
47
- count.should == 5
48
- end
49
-
50
- end
51
-
52
- end
53
- end
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Symbiont::WebObjects::Paragraph do
4
- describe "implementation" do
5
- let(:p_object) { Symbiont::WebObjects::Paragraph }
6
-
7
- it "should allow locators to be used" do
8
- [:class, :id, :index, :xpath, :name].each do |t|
9
- locator = p_object.provide_locator_for t => 'value'
10
- locator.keys.first.should == t
11
- end
12
- end
13
-
14
- it "should register with a paragraph (p) tag" do
15
- ::Symbiont::WebObjects.get_class_for(:p).should == ::Symbiont::WebObjects::Paragraph
16
- end
17
- end
18
- end
@@ -1,27 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Symbiont::WebObjects::Radio do
4
- describe "implementation" do
5
- let(:radio_object) { double('radio_object') }
6
- let(:radio) { Symbiont::WebObjects::Radio.new(radio_object) }
7
-
8
- it "should register with a radio type" do
9
- ::Symbiont::WebObjects.get_class_for(:input, :radio).should == ::Symbiont::WebObjects::Radio
10
- end
11
-
12
- it "should be able to select a radio" do
13
- radio_object.should_receive(:set).and_return(true)
14
- radio.select
15
- end
16
-
17
- it "should be able to clear a radio" do
18
- radio_object.should_receive(:clear).and_return(true)
19
- radio.clear
20
- end
21
-
22
- it "should be able to see if a radio is selected" do
23
- radio_object.should_receive(:set?).and_return(true)
24
- radio.selected?
25
- end
26
- end
27
- end
@@ -1,69 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Symbiont::WebObjects::SelectList do
4
- describe "implementation" do
5
- let(:select_list_object) { double('select_list_object') }
6
- let(:select_list) { Symbiont::WebObjects::SelectList }
7
- let(:select_list_actual) { Symbiont::WebObjects::SelectList.new(select_list_object) }
8
- let(:list_opts) { [select_list_object, select_list_object] }
9
-
10
- before(:each) do
11
- select_list_object.stub(:find_elements).and_return(select_list_object)
12
- select_list_object.stub(:wd).and_return(select_list_object)
13
- select_list_object.stub(:include?)
14
- end
15
-
16
- it "should reference standard usable selectors" do
17
- [:class, :id, :name, :index, :xpath].each do |s|
18
- locator = select_list.provide_locator_for s => 'value'
19
- locator.keys.first.should == s
20
- end
21
- end
22
-
23
- it "should register with a select list tag" do
24
- ::Symbiont::WebObjects.get_class_for(:select).should == ::Symbiont::WebObjects::SelectList
25
- end
26
-
27
- it "should return an option when indexed" do
28
- select_list_object.should_receive(:find_elements).with(:xpath, ".//child::option").and_return(list_opts)
29
- select_list_actual[0].should be_instance_of Symbiont::WebObjects::Option
30
- end
31
-
32
- it "should return an array of options" do
33
- select_list_object.should_receive(:find_elements).with(:xpath, ".//child::option").and_return(list_opts)
34
- select_list_actual.options.size.should == 2
35
- end
36
-
37
- it "should return an array of selected options" do
38
- select_list_object.stub(:selected_options).and_return(list_opts)
39
- select_list_object.stub(:text).and_return(select_list_object)
40
- select_list_actual.selected_options.should == list_opts
41
- end
42
-
43
- it "should determine if an option is selected" do
44
- select_list_object.stub(:selected?).with('testing').and_return(true)
45
- select_list_actual.selected?('testing')
46
- end
47
-
48
- it "should determine if an option is available" do
49
- select_list_object.stub(:include?).with('testing').and_return(true)
50
- select_list_actual.include?('testing')
51
- end
52
-
53
- it "should get the values for any selected options" do
54
- select_list_object.stub(:selected_options).and_return(list_opts)
55
- select_list_object.stub(:value).and_return(select_list_object)
56
- select_list_actual.selected_values.should == list_opts
57
- end
58
-
59
- it "should be able to select an item by value" do
60
- select_list_object.should_receive(:select_value).and_return(true)
61
- select_list_actual.select_value('testing')
62
- end
63
-
64
- it "should be able to select an item by option" do
65
- select_list_object.should_receive(:select).and_return(true)
66
- select_list_actual.select('testing')
67
- end
68
- end
69
- end
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Symbiont::WebObjects::Span do
4
- describe "implementation" do
5
- let(:span_object) { Symbiont::WebObjects::Span }
6
-
7
- it "should allow locators to be used" do
8
- [:class, :id, :text, :index, :xpath, :title, :name].each do |t|
9
- locator = span_object.provide_locator_for t => 'value'
10
- locator.keys.first.should == t
11
- end
12
- end
13
-
14
- it "should register with a span tag" do
15
- ::Symbiont::WebObjects.get_class_for(:span).should == ::Symbiont::WebObjects::Span
16
- end
17
- end
18
- end
@@ -1,19 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Symbiont::WebObjects::TableCell do
4
- describe "implementation" do
5
- it "should register with a table definition tag" do
6
- ::Symbiont::WebObjects.get_class_for(:td).should == ::Symbiont::WebObjects::TableCell
7
- end
8
-
9
- it "should register with a table header tag" do
10
- ::Symbiont::WebObjects.get_class_for(:th).should == ::Symbiont::WebObjects::TableCell
11
- end
12
-
13
- it "should always be enabled" do
14
- table_cell_object = double('table_cell_object')
15
- table_cell = Symbiont::WebObjects::TableCell.new(table_cell_object)
16
- table_cell.enabled?.should be_true
17
- end
18
- end
19
- end
@@ -1,58 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Symbiont::WebObjects::TableRow do
4
- describe "implementation" do
5
- let(:table_cell) { double('table_cell') }
6
- let(:table_row_object) { double('table_row_object') }
7
-
8
- context "on the watir platform" do
9
- it "should return a table cell when indexed" do
10
- table_row = Symbiont::WebObjects::TableRow.new(table_row_object)
11
- table_row_object.should_receive(:[]).with(1).and_return(table_cell)
12
-
13
- table_row_object.should_receive(:size).and_return(3)
14
- table_row_object.should_receive(:find_elements).with(:xpath, ".//child::td|th").and_return(table_row_object)
15
- table_row_object.should_receive(:wd).and_return(table_row_object)
16
-
17
- table_row[1].should be_instance_of Symbiont::WebObjects::TableCell
18
- end
19
-
20
- it "should return the number of columns" do
21
- table_row = Symbiont::WebObjects::TableRow.new(table_row_object)
22
- table_row_object.stub(:wd).and_return(table_row_object)
23
- table_row_object.should_receive(:find_elements).with(:xpath, ".//child::td|th").and_return(table_row_object)
24
- table_row_object.should_receive(:size).and_return(3)
25
- table_row.columns.should == 3
26
- end
27
-
28
- it "should iterate over the table columns" do
29
- table_row = Symbiont::WebObjects::TableRow.new(table_row_object)
30
- table_row.should_receive(:columns).and_return(2)
31
- table_row.stub(:[]).and_return(table_row_object)
32
- count = 0
33
- table_row.each { |e| count += 1 }
34
- count.should == 2
35
- end
36
-
37
- #it "should return a row using text from the first row" do
38
- #table_row = Symbiont::WebObjects::TableRow.new(table_row_object)
39
- #table_row_object.should_receive(:[]).with("column_text").and_return(table_row_object)
40
- #table_row_object.should_receive(:[]).with(0).and_return(table_row_object)
41
- #table_row_object.should_receive(:tag_name)
42
- #table_row_object.should_receive(:parent).and_return(table_row_object)
43
- #table_row_object.should_receive(:cells).and_return(table_row_object)
44
- #table_row_object.should_receive(:find_index).and_return("column_text")
45
-
46
- #table_row_object.should_receive(:size).and_return(1)
47
- #table_row_object.should_receive(:find_elements).with(:xpath, ".//child::td|th").and_return(table_row_object)
48
- #table_row_object.should_receive(:wd).and_return(table_row_object)
49
-
50
- #table_row[1]["column_text"].should be_instance_of Symbiont::WebObjects::TableCell
51
- #end
52
-
53
- it "should register with a table row tag" do
54
- ::Symbiont::WebObjects.get_class_for(:tr).should == ::Symbiont::WebObjects::TableRow
55
- end
56
- end
57
- end
58
- end