symbiont 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. data/Gemfile.lock +22 -7
  2. data/HISTORY.md +6 -0
  3. data/app/public/css/site.css +16 -0
  4. data/app/public/js/site.js +3 -1
  5. data/app/views/comics.erb +23 -1
  6. data/app/views/webobject.erb +1 -1
  7. data/lib/symbiont/data_setter.rb +7 -3
  8. data/lib/symbiont/enclosers.rb +24 -27
  9. data/lib/symbiont/evaluators.rb +52 -23
  10. data/lib/symbiont/factory.rb +19 -75
  11. data/lib/symbiont/generators.rb +172 -44
  12. data/lib/symbiont/platform_watir/platform_object.rb +202 -18
  13. data/lib/symbiont/version.rb +1 -1
  14. data/lib/symbiont/web_objects/button.rb +1 -1
  15. data/lib/symbiont/web_objects/checkbox.rb +1 -1
  16. data/lib/symbiont/web_objects/heading.rb +12 -0
  17. data/lib/symbiont/web_objects/hidden_field.rb +19 -0
  18. data/lib/symbiont/web_objects/label.rb +15 -0
  19. data/lib/symbiont/web_objects/list_item.rb +13 -0
  20. data/lib/symbiont/web_objects/ordered_list.rb +49 -0
  21. data/lib/symbiont/web_objects/radio.rb +1 -1
  22. data/lib/symbiont/web_objects/select_list.rb +1 -1
  23. data/lib/symbiont/web_objects/table.rb +4 -0
  24. data/lib/symbiont/web_objects/table_row.rb +4 -0
  25. data/lib/symbiont/web_objects/text_area.rb +26 -0
  26. data/lib/symbiont/web_objects/unordered_list.rb +49 -0
  27. data/lib/symbiont.rb +7 -0
  28. data/lucid.yml +6 -0
  29. data/spec/spec_helper.rb +70 -16
  30. data/spec/symbiont/data_setter_spec.rb +65 -62
  31. data/spec/symbiont/enclosers_spec.rb +76 -57
  32. data/spec/symbiont/evaluators_spec.rb +95 -75
  33. data/spec/symbiont/factory_spec.rb +174 -122
  34. data/spec/symbiont/generators/button_generators_spec.rb +34 -31
  35. data/spec/symbiont/generators/checkbox_generators_spec.rb +79 -75
  36. data/spec/symbiont/generators/div_generators_spec.rb +56 -52
  37. data/spec/symbiont/generators/hidden_field_generators_spec.rb +65 -0
  38. data/spec/symbiont/generators/link_generators_spec.rb +30 -27
  39. data/spec/symbiont/generators/paragraph_generators_spec.rb +22 -17
  40. data/spec/symbiont/generators/radio_generators_spec.rb +76 -77
  41. data/spec/symbiont/generators/select_list_generators_spec.rb +93 -77
  42. data/spec/symbiont/generators/span_generators_spec.rb +56 -52
  43. data/spec/symbiont/generators/{cell_generators_spec.rb → table_cell_generators_spec.rb} +56 -52
  44. data/spec/symbiont/generators/table_generators_spec.rb +56 -52
  45. data/spec/symbiont/generators/text_area_generators_spec.rb +72 -0
  46. data/spec/symbiont/generators/text_field_generators_spec.rb +30 -27
  47. data/spec/symbiont/generators_spec.rb +38 -28
  48. data/spec/symbiont/locators_spec.rb +68 -68
  49. data/spec/symbiont/platform_object_spec.rb +2 -4
  50. data/spec/symbiont/symbiont_spec.rb +10 -8
  51. data/spec/symbiont/web_object_spec.rb +194 -194
  52. data/spec/symbiont/web_objects/button_spec.rb +38 -30
  53. data/spec/symbiont/web_objects/checkbox_spec.rb +27 -27
  54. data/spec/symbiont/web_objects/div_spec.rb +18 -11
  55. data/spec/symbiont/web_objects/heading_spec.rb +22 -0
  56. data/spec/symbiont/web_objects/hidden_field_spec.rb +18 -0
  57. data/spec/symbiont/web_objects/label_spec.rb +18 -0
  58. data/spec/symbiont/web_objects/link_spec.rb +33 -33
  59. data/spec/symbiont/web_objects/list_item_spec.rb +18 -0
  60. data/spec/symbiont/web_objects/option_spec.rb +9 -9
  61. data/spec/symbiont/web_objects/ordered_list_spec.rb +53 -0
  62. data/spec/symbiont/web_objects/paragraph_spec.rb +9 -2
  63. data/spec/symbiont/web_objects/radio_spec.rb +27 -27
  64. data/spec/symbiont/web_objects/select_list_spec.rb +69 -69
  65. data/spec/symbiont/web_objects/span_spec.rb +18 -11
  66. data/spec/symbiont/web_objects/table_cell_spec.rb +19 -19
  67. data/spec/symbiont/web_objects/table_row_spec.rb +58 -58
  68. data/spec/symbiont/web_objects/table_spec.rb +61 -61
  69. data/spec/symbiont/web_objects/text_area_spec.rb +18 -0
  70. data/spec/symbiont/web_objects/text_field_spec.rb +39 -39
  71. data/spec/symbiont/web_objects/unordered_list_spec.rb +51 -0
  72. data/specs/common/support/browser.rb +25 -0
  73. data/specs/common/support/env.rb +6 -0
  74. data/specs/common/support/events.rb +15 -0
  75. data/specs/enclosers.feature +9 -0
  76. data/specs/evaluators.feature +26 -0
  77. data/specs/pages/characters.rb +22 -0
  78. data/specs/pages/home.rb +9 -0
  79. data/specs/pages/stardate.rb +23 -0
  80. data/specs/pages/web_objects.rb +77 -0
  81. data/specs/select_list.feature +53 -0
  82. data/specs/steps/enclosers_steps.rb +17 -0
  83. data/specs/steps/evaluators_steps.rb +44 -0
  84. data/specs/steps/navigation_steps.rb +14 -0
  85. data/specs/steps/select_list_steps.rb +94 -0
  86. data/specs/steps/table_cell_steps.rb +31 -0
  87. data/specs/steps/table_steps.rb +87 -0
  88. data/specs/table.feature +49 -0
  89. data/specs/table_cell.feature +27 -0
  90. data/symbiont.gemspec +4 -1
  91. metadata +72 -6
  92. data/cucumber.yml +0 -6
@@ -1,194 +1,194 @@
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 return no key for an unrecognized locator" do
9
- [:invalid].each do |s|
10
- locator = link.provide_locator_for s => 'value'
11
- locator.keys.first.should == nil
12
- end
13
- end
14
-
15
- it "should retrieve the value of an attribute" do
16
- watir_browser.should_receive(:attribute_value).and_return(true)
17
- watir_definition.attribute("readonly").should be_true
18
- end
19
-
20
- it "should retrieve the style of a web object" do
21
- watir_browser.should_receive(:style).with('display').and_return("none")
22
- watir_definition.style('display').should == 'none'
23
- end
24
-
25
- it "should retrieve the tag of a web object" do
26
- watir_browser.should_receive(:tag_name).and_return("div")
27
- watir_definition.tag_name.should == "div"
28
- end
29
-
30
- it "should retrieve the html of a web object" do
31
- watir_browser.should_receive(:html).and_return("<p>Testing</p>")
32
- watir_definition.html.should == "<p>Testing</p>"
33
- end
34
-
35
- it "should be able to hover over a web object" do
36
- watir_browser.should_receive(:hover).and_return(watir_definition)
37
- watir_definition.hover
38
- end
39
-
40
- it "should be able to focus on a web object" do
41
- watir_browser.should_receive(:focus).and_return(watir_definition)
42
- watir_definition.focus
43
- end
44
-
45
- it "should be able to fire an event on a web object" do
46
- watir_browser.should_receive(:fire_event).and_return("onclick")
47
- watir_definition.fire_event("onclick")
48
- end
49
-
50
- it "should retrieve the id of a web object" do
51
- watir_browser.should_receive(:id).and_return("id")
52
- watir_definition.id.should == "id"
53
- end
54
-
55
- it "should retrieve the value of a web object" do
56
- watir_browser.should_receive(:value).and_return("value")
57
- watir_definition.value.should == "value"
58
- end
59
-
60
- it "should be able to inspect a web object" do
61
- watir_browser.should_receive(:inspect).and_return(watir_definition)
62
- watir_definition.inspect.should be_instance_of Symbiont::WebObjects::WebObject
63
- end
64
-
65
- it "should be able to determine if a web object is equal to another" do
66
- watir_browser.should_receive(:==).and_return(true)
67
- watir_definition.should == watir_definition
68
- end
69
-
70
- it "should be able to flash a web_object" do
71
- watir_browser.should_receive(:flash).and_return(watir_definition)
72
- watir_definition.flash.should be_instance_of Symbiont::WebObjects::WebObject
73
- end
74
-
75
- it "should determine if a web object is enabled" do
76
- watir_browser.should_receive(:enabled?).twice.and_return(true)
77
- watir_definition.enabled?.should == true
78
- watir_definition.should be_enabled
79
- end
80
-
81
- it "should determine if a web object is disabled" do
82
- watir_browser.should_receive(:enabled?).twice.and_return(false)
83
- watir_definition.disabled?.should == true
84
- watir_definition.should be_disabled
85
- end
86
-
87
- it "should determine if a web object exists" do
88
- watir_browser.should_receive(:exists?).and_return(true)
89
- watir_definition.exists?.should == true
90
- end
91
-
92
- it "should determine if a web object does not exist" do
93
- watir_browser.should_receive(:exists?).and_return(false)
94
- watir_definition.exists?.should == false
95
- end
96
-
97
- it "should determine if a web object is visible" do
98
- watir_browser.should_receive(:present?).twice.and_return(true)
99
- watir_definition.visible?.should == true
100
- watir_definition.should be_visible
101
- end
102
-
103
- it "should determine if a web object is not visible" do
104
- watir_browser.should_receive(:present?).and_return(false)
105
- watir_definition.visible?.should == false
106
- end
107
-
108
- it "should return the text contained by a web object" do
109
- watir_browser.should_receive(:text).and_return("testing")
110
- watir_definition.text.should == "testing"
111
- end
112
-
113
- it "should simulate a click event on a web object" do
114
- watir_browser.should_receive(:click)
115
- watir_definition.click
116
- end
117
-
118
- it "should simulate a double-click event on a web object" do
119
- watir_browser.should_receive(:double_click)
120
- watir_definition.double_click
121
- end
122
-
123
- it "should allow a clear event on a web object" do
124
- watir_browser.should_receive(:clear)
125
- watir_definition.clear
126
- end
127
-
128
- it "should send key presses to a web object" do
129
- watir_browser.should_receive(:send_keys).with([:control, 'a'])
130
- watir_definition.send_keys([:control, 'a'])
131
- end
132
-
133
- it "should find the parent for a web object" do
134
- watir_browser.should_receive(:tag_name).twice.and_return(:p)
135
- watir_browser.should_receive(:parent).and_return(watir_definition)
136
- watir_definition.parent
137
- end
138
-
139
- it "should wait for a web object to be actionable" do
140
- watir_browser.should_receive(:wait_until_present).twice.with(5)
141
- watir_definition.when_actionable(5)
142
- watir_definition.when_present(5)
143
- end
144
-
145
- it "should use the provided element wait time for actionable checks" do
146
- Symbiont.element_level_wait = 30
147
- watir_browser.should_receive(:wait_until_present).with(30)
148
- watir_definition.when_present
149
- end
150
-
151
- it "should reference a web object when it is actionable" do
152
- watir_browser.should_receive(:wait_until_present).with(5)
153
- web_object = watir_definition.when_actionable(5)
154
- web_object.should === watir_definition
155
- end
156
-
157
- it "should wait for a web object to become non-actionable" do
158
- watir_browser.should_receive(:wait_while_present).and_return(false)
159
- watir_definition.when_not_present(5)
160
- end
161
-
162
- it "should wait for a web object to become visible" do
163
- watir_browser.should_receive(:present?).and_return(true)
164
- watir_definition.when_visible(5)
165
- end
166
-
167
- it "should reference a web object when it is visible" do
168
- watir_browser.should_receive(:present?).and_return(true)
169
- web_object = watir_definition.when_visible(5)
170
- web_object.should === watir_definition
171
- end
172
-
173
- it "should wait for a web object to become invisible" do
174
- watir_browser.should_receive(:present?).and_return(false)
175
- watir_definition.when_not_visible(5)
176
- end
177
-
178
- it "should reference a web object when it is not visible" do
179
- watir_browser.stub(:present?).and_return(false)
180
- web_object = watir_definition.when_not_visible(5)
181
- web_object.should === watir_definition
182
- end
183
-
184
- it "should wait until a specific condition occurs" do
185
- Object::Watir::Wait.stub(:until).with(5, "Condition occurred.")
186
- watir_definition.wait_until(5, "Condition occurred.") { true }
187
- end
188
-
189
- it "should scroll elements into view" do
190
- watir_browser.should_receive(:wd).and_return(watir_browser)
191
- watir_browser.should_receive(:location_once_scrolled_into_view)
192
- watir_definition.scroll_into_view
193
- end
194
- end
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,30 +1,38 @@
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].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
- end
30
- end
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 +1,27 @@
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
+ 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,11 +1,18 @@
1
- require 'spec_helper'
2
-
3
- describe Symbiont::WebObjects::Div do
4
- describe "implementation" do
5
- let(:div_object) { double('div_object') }
6
-
7
- it "should register with a div tag" do
8
- ::Symbiont::WebObjects.get_class_for(:div).should == ::Symbiont::WebObjects::Div
9
- end
10
- end
11
- end
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
@@ -0,0 +1,22 @@
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
@@ -0,0 +1,18 @@
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
@@ -0,0 +1,18 @@
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