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,65 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Symbiont::DataSetter do
4
- let(:watir_browser) { mock_browser_for_watir }
5
- let(:watir_definition) { DefinitionTest.new(watir_browser) }
6
-
7
- it "should set data in a text field" do
8
- watir_definition.should_receive(:name=).with('jnyman')
9
- watir_definition.should_receive(:object_enabled_for).and_return(true)
10
- watir_definition.using('name' => 'jnyman')
11
- end
12
-
13
- it "should not set data in a non-existent text field" do
14
- watir_browser.should_not_receive(:text_field)
15
- watir_definition.using('fake_field' => 'fake data')
16
- end
17
-
18
- it "should not set data in a disabled text field" do
19
- watir_definition.should_not_receive(:name=)
20
- watir_definition.should_receive(:name_object).twice.and_return(watir_browser)
21
- watir_browser.should_receive(:enabled?).and_return(false)
22
- watir_browser.should_receive(:tag_name).with(no_args)
23
- watir_definition.using('name' => 'test data')
24
- end
25
-
26
- it "should set data in a select list field" do
27
- watir_definition.should_receive(:concepts=).with('physics')
28
- watir_definition.should_receive(:object_enabled_for).and_return(true)
29
- watir_definition.using('concepts' => 'physics')
30
- end
31
-
32
- it "should check a checkbox field" do
33
- watir_definition.should_receive(:check_apply_tax)
34
- watir_definition.should_receive(:object_enabled_for).and_return(true)
35
- watir_definition.using('apply_tax' => true)
36
- end
37
-
38
- it "should uncheck a checkbox field" do
39
- watir_definition.should_receive(:uncheck_apply_tax)
40
- watir_definition.should_receive(:object_enabled_for).and_return(true)
41
- watir_definition.using('apply_tax' => false)
42
- end
43
-
44
- it "should not check data in a disabled checkbox field" do
45
- watir_definition.should_not_receive(:check_apply_tax)
46
- watir_definition.should_receive(:apply_tax_object).twice.and_return(watir_browser)
47
- watir_browser.should_receive(:enabled?).and_return(false)
48
- watir_browser.should_receive(:tag_name).with(no_args)
49
- watir_definition.using('apply_tax' => true)
50
- end
51
-
52
- it "should select a radio field" do
53
- watir_definition.should_receive(:select_include_tax)
54
- watir_definition.should_receive(:object_enabled_for).and_return(true)
55
- watir_definition.using('include_tax' => true)
56
- end
57
-
58
- it "should not select data in a disable radio field" do
59
- watir_definition.should_not_receive(:select_include_tax)
60
- watir_definition.should_receive(:include_tax_object).twice.and_return(watir_browser)
61
- watir_browser.should_receive(:enabled?).and_return(false)
62
- watir_browser.should_receive(:tag_name).with(no_args)
63
- watir_definition.using('include_tax' => true)
64
- end
65
- end
@@ -1,76 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Symbiont::Enclosers do
4
- let(:watir_browser) { mock_browser_for_watir }
5
- let(:watir_definition) { DefinitionTest.new(watir_browser) }
6
-
7
- context "a definition using watir-webdriver" do
8
- it "should wait for a condition to be true" do
9
- watir_browser.should_receive(:wait_until).with(5, "some condition")
10
- watir_definition.wait_for(5, "some condition")
11
- end
12
-
13
- it "should wait for a condition to be true with any page level timeout" do
14
- Symbiont.page_level_wait = 30
15
- watir_browser.should_receive(:wait_until).with(30, nil)
16
- watir_definition.wait_for
17
- end
18
-
19
- it "should be able to attach to a window by using the title" do
20
- watir_browser.should_receive(:window).with(:title => /Display\ Results/).and_return(watir_browser)
21
- watir_browser.should_receive(:use)
22
- watir_definition.within_window(title: "Display Results")
23
- end
24
-
25
- it "should be able to attach to a window by using the url" do
26
- watir_browser.should_receive(:window).with(:url => /results\.html/).and_return(watir_browser)
27
- watir_browser.should_receive(:use)
28
- watir_definition.within_window(url: "results.html")
29
- end
30
-
31
- it "should allow frames to act as a context" do
32
- watir_browser.should_receive(:frame).with(id: "frame").and_return(watir_browser)
33
- watir_browser.should_receive(:text_field).and_return(watir_browser)
34
- watir_browser.should_receive(:wd).and_return(watir_browser)
35
- watir_browser.should_receive(:switch_to).and_return(watir_browser)
36
- watir_browser.should_receive(:default_content).and_return(watir_browser)
37
- web_object = watir_definition.framedLoginName_text_field
38
- web_object.should_not be_nil
39
- web_object.should be_instance_of Symbiont::WebObjects::TextField
40
- end
41
-
42
- it "should be able to convert a modal popup to a window" do
43
- watir_browser.should_receive(:execute_script)
44
- watir_definition.within_modal {}
45
- end
46
-
47
- it "should handle alert message boxes" do
48
- #watir_browser.should_receive(:wd).twice.and_return(watir_browser)
49
- #watir_browser.should_receive(:execute_script).twice
50
- watir_browser.should_receive(:alert).exactly(3).times.and_return(watir_browser)
51
- watir_browser.should_receive(:exists?).and_return(true)
52
- watir_browser.should_receive(:text)
53
- watir_browser.should_receive(:ok)
54
- watir_definition.will_alert do
55
- end
56
- end
57
-
58
- it "should handle confirmation message boxes" do
59
- #watir_browser.should_receive(:wd).twice.and_return(watir_browser)
60
- #watir_browser.should_receive(:execute_script).twice
61
- watir_browser.should_receive(:alert).exactly(3).times.and_return(watir_browser)
62
- watir_browser.should_receive(:exists?).and_return(true)
63
- watir_browser.should_receive(:text)
64
- watir_browser.should_receive(:ok)
65
- watir_definition.will_confirm(true) do
66
- end
67
- end
68
-
69
- it "should handle prompt message boxes" do
70
- watir_browser.should_receive(:wd).twice.and_return(watir_browser)
71
- watir_browser.should_receive(:execute_script).twice
72
- watir_definition.will_prompt("Question") do
73
- end
74
- end
75
- end
76
- end
@@ -1,95 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Symbiont::Evaluators do
4
- let(:watir_browser) { mock_browser_for_watir }
5
- let(:watir_definition) { DefinitionTest.new(watir_browser) }
6
-
7
- describe "browser-level actions" do
8
- context "a definition using watir-webdriver" do
9
- it "should visit a page" do
10
- watir_browser.should_receive(:goto).twice.with("http://localhost:9292")
11
- watir_definition.visit("http://localhost:9292")
12
- watir_definition.navigate_to("http://localhost:9292")
13
- end
14
-
15
- it "should get the active url" do
16
- watir_browser.should_receive(:url).twice.and_return("http://localhost:9292")
17
- watir_definition.url.should == "http://localhost:9292"
18
- watir_definition.current_url.should == "http://localhost:9292"
19
- end
20
-
21
- it "should get a screenshot" do
22
- watir_browser.should_receive(:wd).twice.and_return(watir_browser)
23
- watir_browser.should_receive(:save_screenshot).twice
24
- watir_definition.screenshot("testing.png")
25
- watir_definition.save_screenshot("testing.png")
26
- end
27
-
28
- it "should run a script against the browser" do
29
- watir_browser.should_receive(:execute_script).twice.and_return("input")
30
- watir_definition.run_script("return document.activeElement").should == "input"
31
- watir_definition.execute_script("return document.activeElement").should == "input"
32
- end
33
-
34
- it "should be able to go back to a previous page" do
35
- watir_browser.should_receive(:back)
36
- watir_definition.back
37
- end
38
-
39
- it "should be able to go forward to an already visited page" do
40
- watir_browser.should_receive(:forward)
41
- watir_definition.forward
42
- end
43
-
44
- it "should be able to refresh the page contents" do
45
- watir_browser.should_receive(:refresh)
46
- watir_definition.refresh
47
- end
48
-
49
- it "should be able to clear all of the cookies from the browser" do
50
- watir_browser.should_receive(:cookies).twice.and_return(watir_browser)
51
- watir_browser.should_receive(:clear).twice
52
- watir_definition.remove_cookies
53
- watir_definition.clear_cookies
54
- end
55
- end
56
- end
57
-
58
- describe "page-level actions" do
59
- context "a definition using watir-webdriver" do
60
- it "should return all the text on a page" do
61
- watir_browser.should_receive(:text).and_return("page text")
62
- watir_definition.text.should == "page text"
63
- end
64
-
65
- it "should return all the markup on a page" do
66
- watir_browser.should_receive(:html).twice.and_return("<h1>Page Title</h1>")
67
- watir_definition.markup.should == "<h1>Page Title</h1>"
68
- watir_definition.html.should == "<h1>Page Title</h1>"
69
- end
70
-
71
- it "should return the title of a page" do
72
- watir_browser.should_receive(:title).and_return("Page Title")
73
- watir_definition.title.should == "Page Title"
74
- end
75
-
76
- it "should return the web object that has focus" do
77
- watir_browser.should_receive(:execute_script).and_return(watir_browser)
78
- watir_browser.should_receive(:tag_name).twice.and_return(:input)
79
- watir_browser.should_receive(:type).and_return(:submit)
80
- watir_definition.focus.class.should == Symbiont::WebObjects::Button
81
- end
82
-
83
- it "should wait for jquery pending requests to finish" do
84
- watir_browser.should_receive(:execute_script).with('return jQuery.active').and_return(0)
85
- watir_definition.wait_for_pending_requests
86
- end
87
-
88
- it "should return an exception if pending requests did not finish" do
89
- watir_browser.should_receive(:execute_script).with('return jQuery.active')
90
- watir_browser.should_receive(:execute_script).with('return jQuery.active').and_return(1)
91
- expect { watir_definition.wait_for_pending_requests(1) }.to raise_error
92
- end
93
- end
94
- end
95
- end
@@ -1,72 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Symbiont::Generators do
4
- let(:watir_browser) { mock_browser_for_watir }
5
- let(:watir_definition) { DefinitionTest.new(watir_browser) }
6
-
7
- describe "button generators" do
8
- context "when declared on a page definition" do
9
- it "should generate methods for referencing the button" do
10
- watir_definition.should respond_to(:login_object)
11
- watir_definition.should respond_to(:login_button)
12
- end
13
-
14
- it "should generate methods for interacting with the button" do
15
- watir_definition.should respond_to(:login)
16
- watir_definition.should respond_to(:login_text)
17
- watir_definition.should respond_to(:login_exists?)
18
- watir_definition.should respond_to(:login_visible?)
19
- watir_definition.should respond_to(:login_enabled?)
20
- watir_definition.should respond_to(:login?)
21
- watir_definition.should respond_to(:login_?)
22
- watir_definition.should respond_to(:login!)
23
- end
24
- end
25
-
26
- context "when used by the watir platform" do
27
- it "should locate the button" do
28
- watir_browser.should_receive(:button).and_return(watir_browser)
29
- web_object = watir_definition.login_object
30
- web_object.should_not be_nil
31
- web_object.should be_instance_of Symbiont::WebObjects::Button
32
- end
33
-
34
- it "should return the text of the button" do
35
- watir_browser.should_receive(:button).and_return(watir_browser)
36
- watir_browser.should_receive(:text).and_return('Login')
37
- watir_definition.login_text.should == "Login"
38
- end
39
-
40
- it "should click the button" do
41
- watir_browser.should_receive(:button).and_return(watir_browser)
42
- watir_browser.should_receive(:click)
43
- watir_definition.login
44
- end
45
-
46
- it "should determine if a button exists" do
47
- watir_browser.should_receive(:button).twice.and_return(watir_browser)
48
- watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
49
- watir_definition.login?.should be_true
50
- watir_definition.login_exists?.should be_true
51
- end
52
-
53
- it "should determine if a button is visible" do
54
- watir_browser.should_receive(:button).twice.and_return(watir_browser)
55
- watir_browser.should_receive(:present?).twice.and_return(watir_browser)
56
- watir_definition.login_?.should be_true
57
- watir_definition.login_visible?.should be_true
58
- end
59
-
60
- it "should determine if a button is enabled" do
61
- watir_browser.should_receive(:button).twice.and_return(watir_browser)
62
- watir_browser.should_receive(:enabled?).twice.and_return(watir_browser)
63
- watir_definition.login_enabled?.should be_true
64
- watir_definition.login!.should be_true
65
- end
66
-
67
- it "should call a block on the button if specified" do
68
- watir_definition.logout_object.should == "logout"
69
- end
70
- end
71
- end
72
- end
@@ -1,79 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Symbiont::Generators do
4
- let(:watir_browser) { mock_browser_for_watir }
5
- let(:watir_definition) { DefinitionTest.new(watir_browser) }
6
-
7
- describe "checkbox generators" do
8
- context "when declared on a page definition" do
9
- it "should generate methods for referencing the checkbox" do
10
- watir_definition.should respond_to(:apply_tax_checkbox)
11
- watir_definition.should respond_to(:apply_tax_object)
12
- end
13
-
14
- it "should generate methods for interacting with the checkbox" do
15
- watir_definition.should respond_to(:apply_tax_exists?)
16
- watir_definition.should respond_to(:apply_tax_visible?)
17
- watir_definition.should respond_to(:apply_tax_enabled?)
18
- watir_definition.should respond_to(:apply_tax?)
19
- watir_definition.should respond_to(:apply_tax_?)
20
- watir_definition.should respond_to(:apply_tax!)
21
- watir_definition.should respond_to(:apply_tax_checked?)
22
- watir_definition.should respond_to(:check_apply_tax)
23
- watir_definition.should respond_to(:uncheck_apply_tax)
24
- end
25
- end
26
-
27
- context "when used by the watir platform" do
28
- it "should locate the checkbox" do
29
- watir_browser.should_receive(:checkbox).and_return(watir_browser)
30
- web_object = watir_definition.apply_tax_object
31
- web_object.should_not be_nil
32
- web_object.should be_instance_of Symbiont::WebObjects::CheckBox
33
- end
34
-
35
- it "should determine if a checkbox exists" do
36
- watir_browser.should_receive(:checkbox).twice.and_return(watir_browser)
37
- watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
38
- watir_definition.apply_tax_exists?.should be_true
39
- watir_definition.apply_tax?.should be_true
40
- end
41
-
42
- it "should determine if a checkbox is visible" do
43
- watir_browser.should_receive(:checkbox).twice.and_return(watir_browser)
44
- watir_browser.should_receive(:present?).twice.and_return(watir_browser)
45
- watir_definition.apply_tax_visible?.should be_true
46
- watir_definition.apply_tax_?.should be_true
47
- end
48
-
49
- it "should determine if a checkbox is enabled" do
50
- watir_browser.should_receive(:checkbox).twice.and_return(watir_browser)
51
- watir_browser.should_receive(:enabled?).twice.and_return(watir_browser)
52
- watir_definition.apply_tax_enabled?.should be_true
53
- watir_definition.apply_tax!.should be_true
54
- end
55
-
56
- it "should determine if a checkbox is checked" do
57
- watir_browser.should_receive(:checkbox).and_return(watir_browser)
58
- watir_browser.should_receive(:set?).and_return(true)
59
- watir_definition.apply_tax_checked?.should be_true
60
- end
61
-
62
- it "should be able to check a checkbox" do
63
- watir_browser.should_receive(:checkbox).and_return(watir_browser)
64
- watir_browser.should_receive(:set)
65
- watir_definition.check_apply_tax
66
- end
67
-
68
- it "should be able to uncheck a checkbox" do
69
- watir_browser.should_receive(:checkbox).and_return(watir_browser)
70
- watir_browser.should_receive(:clear)
71
- watir_definition.uncheck_apply_tax
72
- end
73
-
74
- it "should call a block on the checkbox if specified" do
75
- watir_definition.apply_fee_object.should == "apply_fee"
76
- end
77
- end
78
- end
79
- end
@@ -1,56 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Symbiont::Generators do
4
- let(:watir_browser) { mock_browser_for_watir }
5
- let(:watir_definition) { DefinitionTest.new(watir_browser) }
6
-
7
- describe "div generators" do
8
- context "when declared on a page definition" do
9
- it "should generate methods for referencing the div" do
10
- watir_definition.should respond_to(:section_div)
11
- watir_definition.should respond_to(:section_object)
12
- end
13
-
14
- it "should generate methods for interacting with the div" do
15
- watir_definition.should respond_to(:section_exists?)
16
- watir_definition.should respond_to(:section_visible?)
17
- watir_definition.should respond_to(:section?)
18
- watir_definition.should respond_to(:section_?)
19
- watir_definition.should respond_to(:section)
20
- end
21
- end
22
-
23
- context "when used by the watir platform" do
24
- it "should locate the div" do
25
- watir_browser.should_receive(:div).and_return(watir_browser)
26
- web_object = watir_definition.section_div
27
- web_object.should_not be_nil
28
- web_object.should be_instance_of Symbiont::WebObjects::Div
29
- end
30
-
31
- it "should determine if a div exists" do
32
- watir_browser.should_receive(:div).twice.and_return(watir_browser)
33
- watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
34
- watir_definition.section_exists?.should be_true
35
- watir_definition.section?.should be_true
36
- end
37
-
38
- it "should determine if a div is visible" do
39
- watir_browser.should_receive(:div).twice.and_return(watir_browser)
40
- watir_browser.should_receive(:present?).twice.and_return(watir_browser)
41
- watir_definition.section_visible?.should be_true
42
- watir_definition.section_?.should be_true
43
- end
44
-
45
- it "should return the text of a div" do
46
- watir_browser.should_receive(:div).and_return(watir_browser)
47
- watir_browser.should_receive(:text).and_return("testing")
48
- watir_definition.section.should == "testing"
49
- end
50
-
51
- it "should call a block on the div if specified" do
52
- watir_definition.aside_object.should == "aside"
53
- end
54
- end
55
- end
56
- end
@@ -1,65 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Symbiont::Generators do
4
- let(:watir_browser) { mock_browser_for_watir }
5
- let(:watir_definition) { DefinitionTest.new(watir_browser) }
6
-
7
- describe "hidden field generators" do
8
- context "when declared on a page definition" do
9
- it "should generate methods for referencing the hidden field" do
10
- watir_definition.should respond_to(:ssn_hidden_field)
11
- watir_definition.should respond_to(:ssn_object)
12
- end
13
-
14
- it "should generate methods for interacting with the hidden field" do
15
- watir_definition.should respond_to(:ssn)
16
- watir_definition.should respond_to(:ssn_exists?)
17
- watir_definition.should respond_to(:ssn_visible?)
18
- watir_definition.should respond_to(:ssn_enabled?)
19
- watir_definition.should respond_to(:ssn?)
20
- watir_definition.should respond_to(:ssn_?)
21
- watir_definition.should respond_to(:ssn!)
22
- end
23
- end
24
-
25
- context "when used by the watir platform" do
26
- it "should locate the hidden field" do
27
- watir_browser.should_receive(:hidden).and_return(watir_browser)
28
- web_object = watir_definition.ssn_object
29
- web_object.should_not be_nil
30
- web_object.should be_instance_of Symbiont::WebObjects::HiddenField
31
- end
32
-
33
- it "should retrieve text from the text field" do
34
- watir_browser.should_receive(:hidden).and_return(watir_browser)
35
- watir_browser.should_receive(:value).and_return("testing")
36
- watir_definition.ssn.should == "testing"
37
- end
38
-
39
- it "should determine if a hidden field exists" do
40
- watir_browser.should_receive(:hidden).twice.and_return(watir_browser)
41
- watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
42
- watir_definition.ssn_exists?.should be_true
43
- watir_definition.ssn?.should be_true
44
- end
45
-
46
- it "should determine if a hidden field is visible" do
47
- watir_browser.should_receive(:hidden).twice.and_return(watir_browser)
48
- watir_browser.should_receive(:present?).twice.and_return(watir_browser)
49
- watir_definition.ssn_visible?.should be_true
50
- watir_definition.ssn_?.should be_true
51
- end
52
-
53
- it "should determine if a hidden field is enabled" do
54
- watir_browser.should_receive(:hidden).twice.and_return(watir_browser)
55
- watir_browser.should_receive(:enabled?).twice.and_return(watir_browser)
56
- watir_definition.ssn_enabled?.should be_true
57
- watir_definition.ssn!.should be_true
58
- end
59
-
60
- it "should call a block on the hidden field if specified" do
61
- watir_definition.visa_object.should == "visa"
62
- end
63
- end
64
- end
65
- end
@@ -1,62 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Symbiont::Generators do
4
- let(:watir_browser) { mock_browser_for_watir }
5
- let(:watir_definition) { DefinitionTest.new(watir_browser) }
6
-
7
- describe "link generators" do
8
- context "when declared on a page definition" do
9
- it "should generate methods for referencing the link" do
10
- watir_definition.should respond_to(:welcome_object)
11
- watir_definition.should respond_to(:welcome_link)
12
- end
13
-
14
- it "should generate methods for interacting with the link" do
15
- watir_definition.should respond_to(:welcome)
16
- watir_definition.should respond_to(:welcome_text)
17
- watir_definition.should respond_to(:welcome_exists?)
18
- watir_definition.should respond_to(:welcome_visible?)
19
- watir_definition.should respond_to(:welcome?)
20
- watir_definition.should respond_to(:welcome_?)
21
- end
22
- end
23
-
24
- context "when used by the watir platform" do
25
- it "should click the link" do
26
- watir_browser.stub_chain(:link, :click)
27
- watir_definition.welcome
28
- end
29
-
30
- it "should locate the link" do
31
- watir_browser.should_receive(:link).and_return(watir_browser)
32
- web_object = watir_definition.welcome_object
33
- web_object.should_not be_nil
34
- web_object.should be_instance_of Symbiont::WebObjects::Link
35
- end
36
-
37
- it "should retrieve text from the link" do
38
- watir_browser.should_receive(:link).and_return(watir_browser)
39
- watir_browser.should_receive(:text).and_return('Welcome')
40
- watir_definition.welcome_text.should == "Welcome"
41
- end
42
-
43
- it "should determine if a link exists" do
44
- watir_browser.should_receive(:link).twice.and_return(watir_browser)
45
- watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
46
- watir_definition.welcome_exists?.should be_true
47
- watir_definition.welcome?.should be_true
48
- end
49
-
50
- it "should determine if a link is visible" do
51
- watir_browser.should_receive(:link).twice.and_return(watir_browser)
52
- watir_browser.should_receive(:present?).twice.and_return(watir_browser)
53
- watir_definition.welcome_visible?.should be_true
54
- watir_definition.welcome_?.should be_true
55
- end
56
-
57
- it "should call a block on the link if specified" do
58
- watir_definition.greetings_object.should == "greetings"
59
- end
60
- end
61
- end
62
- end
@@ -1,57 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Symbiont::Generators do
4
- let(:watir_browser) { mock_browser_for_watir }
5
- let(:watir_definition) { DefinitionTest.new(watir_browser) }
6
-
7
- describe "paragraph generators" do
8
- context "when declared on a page definition" do
9
- it "should generate methods for referencing the paragraph" do
10
- watir_definition.should respond_to(:first_paragraph)
11
- watir_definition.should respond_to(:first_object)
12
- watir_definition.should respond_to(:last_paragraph)
13
- end
14
-
15
- it "should generate methods for interacting with the paragraph" do
16
- watir_definition.should respond_to(:first_exists?)
17
- watir_definition.should respond_to(:first_visible?)
18
- watir_definition.should respond_to(:first?)
19
- watir_definition.should respond_to(:first_?)
20
- watir_definition.should respond_to(:first)
21
- end
22
- end
23
-
24
- context "when used by the watir platform" do
25
- it "should locate the paragraph" do
26
- watir_browser.should_receive(:p).and_return(watir_browser)
27
- web_object = watir_definition.first_paragraph
28
- web_object.should_not be_nil
29
- web_object.should be_instance_of Symbiont::WebObjects::Paragraph
30
- end
31
-
32
- it "should determine if a paragraph exists" do
33
- watir_browser.should_receive(:p).twice.and_return(watir_browser)
34
- watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
35
- watir_definition.first_exists?.should be_true
36
- watir_definition.first?.should be_true
37
- end
38
-
39
- it "should determine if a paragraph is visible" do
40
- watir_browser.should_receive(:p).twice.and_return(watir_browser)
41
- watir_browser.should_receive(:present?).twice.and_return(watir_browser)
42
- watir_definition.first_visible?.should be_true
43
- watir_definition.first_?.should be_true
44
- end
45
-
46
- it "should return the text of a paragraph" do
47
- watir_browser.should_receive(:p).and_return(watir_browser)
48
- watir_browser.should_receive(:text).and_return("testing")
49
- watir_definition.first.should == "testing"
50
- end
51
-
52
- it "should call a block on the paragraph if specified" do
53
- watir_definition.middle_object.should == "middle"
54
- end
55
- end
56
- end
57
- end