browsercms 3.1.5 → 3.3.0.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (425) hide show
  1. data/app/controllers/cms/base_controller.rb +3 -3
  2. data/app/controllers/cms/content_block_controller.rb +2 -2
  3. data/app/controllers/cms/content_controller.rb +5 -4
  4. data/app/controllers/cms/error_handling.rb +1 -1
  5. data/app/controllers/cms/routes_controller.rb +4 -5
  6. data/app/controllers/cms/section_nodes_controller.rb +1 -6
  7. data/app/controllers/cms/sections_controller.rb +2 -3
  8. data/app/controllers/cms/tasks_controller.rb +3 -0
  9. data/app/controllers/cms/users_controller.rb +1 -1
  10. data/app/helpers/cms/application_helper.rb +137 -34
  11. data/app/helpers/cms/form_builder.rb +33 -21
  12. data/app/helpers/cms/page_helper.rb +43 -10
  13. data/app/helpers/cms/path_helper.rb +1 -1
  14. data/app/helpers/cms/rendering_helper.rb +3 -4
  15. data/app/helpers/cms/section_nodes_helper.rb +5 -43
  16. data/app/models/abstract_file_block.rb +1 -16
  17. data/app/models/attachment.rb +57 -22
  18. data/app/models/category.rb +4 -4
  19. data/app/models/category_type.rb +2 -2
  20. data/app/models/cms/view_context.rb +46 -0
  21. data/app/models/connector.rb +7 -6
  22. data/app/models/content_type.rb +3 -3
  23. data/app/models/dynamic_view.rb +1 -1
  24. data/app/models/email_message.rb +2 -2
  25. data/app/models/file_block.rb +12 -0
  26. data/app/models/group.rb +4 -4
  27. data/app/models/group_type.rb +4 -4
  28. data/app/models/html_block.rb +1 -1
  29. data/app/models/image_block.rb +12 -0
  30. data/app/models/link.rb +22 -5
  31. data/app/models/page.rb +87 -46
  32. data/app/models/page_route.rb +61 -6
  33. data/app/models/permission.rb +1 -1
  34. data/app/models/portlet.rb +14 -4
  35. data/app/models/section.rb +48 -86
  36. data/app/models/section_node.rb +25 -40
  37. data/app/models/site.rb +1 -1
  38. data/app/models/tag.rb +1 -1
  39. data/app/models/task.rb +8 -7
  40. data/app/models/user.rb +2 -7
  41. data/app/portlets/forgot_password_portlet.rb +6 -2
  42. data/app/portlets/reset_password_portlet.rb +1 -1
  43. data/app/views/cms/blocks/_toolbar.html.erb +1 -1
  44. data/app/views/cms/blocks/_toolbar_for_collection.html.erb +3 -6
  45. data/app/views/cms/blocks/_toolbar_for_member.html.erb +3 -5
  46. data/app/views/cms/blocks/edit.html.erb +4 -4
  47. data/app/views/cms/blocks/index.html.erb +7 -7
  48. data/app/views/cms/blocks/new.html.erb +4 -4
  49. data/app/views/cms/blocks/show.html.erb +2 -2
  50. data/app/views/cms/blocks/usages.html.erb +2 -2
  51. data/app/views/cms/blocks/versions.html.erb +4 -4
  52. data/app/views/cms/cache/show.html.erb +2 -2
  53. data/app/views/cms/categories/_form.html.erb +2 -2
  54. data/app/views/cms/connectors/new.html.erb +6 -8
  55. data/app/views/cms/content/no_page.html.erb +1 -1
  56. data/app/views/cms/content/show.html.erb +2 -7
  57. data/app/views/cms/dashboard/_page_drafts.html.erb +1 -1
  58. data/app/views/cms/dashboard/_tasks.html.erb +1 -1
  59. data/app/views/cms/dashboard/index.html.erb +1 -1
  60. data/app/views/cms/dynamic_views/_form.html.erb +2 -2
  61. data/app/views/cms/dynamic_views/index.html.erb +7 -10
  62. data/app/views/cms/email_messages/show.html.erb +2 -2
  63. data/app/views/cms/file_blocks/_form.html.erb +4 -4
  64. data/app/views/cms/form_builder/_cms_fancy_drop_down.html.erb +2 -2
  65. data/app/views/cms/form_builder/_cms_file_field.html.erb +2 -2
  66. data/app/views/cms/form_builder/_cms_tag_list.html.erb +2 -2
  67. data/app/views/cms/form_builder/_cms_text_editor.html.erb +2 -2
  68. data/app/views/cms/groups/_form.html.erb +5 -5
  69. data/app/views/cms/groups/_permissions.html.erb +4 -4
  70. data/app/views/cms/groups/_sections.html.erb +1 -2
  71. data/app/views/cms/groups/index.html.erb +1 -1
  72. data/app/views/cms/html_blocks/render.html.erb +1 -1
  73. data/app/views/cms/image_blocks/_form.html.erb +4 -5
  74. data/app/views/cms/links/_form.html.erb +1 -1
  75. data/app/views/cms/links/edit.html.erb +2 -2
  76. data/app/views/cms/links/new.html.erb +2 -2
  77. data/app/views/cms/page_routes/_form.html.erb +2 -2
  78. data/app/views/cms/page_routes/index.html.erb +6 -9
  79. data/app/views/cms/page_routes/show.html.erb +5 -8
  80. data/app/views/cms/pages/_edit_connector.html.erb +1 -1
  81. data/app/views/cms/pages/_form.html.erb +3 -3
  82. data/app/views/cms/pages/edit.html.erb +2 -2
  83. data/app/views/cms/pages/new.html.erb +7 -7
  84. data/app/views/cms/pages/versions.html.erb +4 -4
  85. data/app/views/cms/redirects/_form.html.erb +2 -2
  86. data/app/views/cms/redirects/index.html.erb +8 -7
  87. data/app/views/cms/routes/index.html.erb +2 -2
  88. data/app/views/cms/section_nodes/_link.html.erb +3 -6
  89. data/app/views/cms/section_nodes/_node.html.erb +4 -13
  90. data/app/views/cms/section_nodes/_page.html.erb +7 -13
  91. data/app/views/cms/section_nodes/_section.html.erb +8 -24
  92. data/app/views/cms/section_nodes/_section_node.html.erb +10 -0
  93. data/app/views/cms/section_nodes/index.html.erb +18 -30
  94. data/app/views/cms/sections/_form.html.erb +4 -6
  95. data/app/views/cms/sections/edit.html.erb +2 -2
  96. data/app/views/cms/sections/index.html.erb +3 -3
  97. data/app/views/cms/sections/new.html.erb +3 -3
  98. data/app/views/cms/sessions/new.html.erb +3 -3
  99. data/app/views/cms/shared/_pagination.html.erb +1 -1
  100. data/app/views/cms/shared/error.html.erb +1 -1
  101. data/app/views/cms/tags/render.html.erb +2 -2
  102. data/app/views/cms/tasks/new.html.erb +4 -4
  103. data/app/views/cms/users/_form.html.erb +3 -3
  104. data/app/views/cms/users/_toolbar.html.erb +3 -3
  105. data/app/views/cms/users/change_password.html.erb +5 -5
  106. data/app/views/cms/users/edit.html.erb +2 -2
  107. data/app/views/cms/users/index.html.erb +4 -4
  108. data/app/views/cms/users/new.html.erb +2 -2
  109. data/app/views/cms/users/show.html.erb +16 -16
  110. data/app/views/layouts/_cms_toolbar.html.erb +5 -5
  111. data/app/views/layouts/_page_toolbar.html.erb +11 -11
  112. data/app/views/layouts/cms/_footer.erb +1 -1
  113. data/app/views/layouts/cms/_head.html.erb +2 -6
  114. data/app/views/layouts/cms/administration.html.erb +32 -32
  115. data/app/views/layouts/cms/content_library.html.erb +5 -5
  116. data/app/views/layouts/cms/toolbar.html.erb +1 -1
  117. data/app/views/portlets/email_page/render.html.erb +2 -2
  118. data/app/views/portlets/forgot_password/render.html.erb +1 -1
  119. data/app/views/portlets/login/render.html.erb +4 -2
  120. data/app/views/portlets/reset_password/render.html.erb +1 -1
  121. data/app/views/tests/pretend/open_with_layout.html.erb +1 -1
  122. data/bin/bcms +0 -0
  123. data/bin/bcms-upgrade +232 -0
  124. data/bin/browsercms +2 -2
  125. data/browsercms.gemspec +16 -14
  126. data/db/migrate/20100705083859_browsercms_3_3_0.rb +56 -0
  127. data/db/seeds.rb +58 -0
  128. data/doc/guides/html/authentication.html +448 -192
  129. data/doc/guides/html/build_it_yourself.html +454 -175
  130. data/doc/guides/html/building_modules.html +451 -220
  131. data/doc/guides/html/building_templates.html +448 -498
  132. data/doc/guides/html/content_blocks.html +450 -470
  133. data/doc/guides/html/customizing_browsercms.html +453 -169
  134. data/doc/guides/html/deployment_guide.html +443 -82
  135. data/doc/guides/html/files/bcmsorg.js +28 -0
  136. data/doc/guides/html/files/clearfix.css +8 -0
  137. data/doc/guides/html/files/cufon.js +7 -0
  138. data/doc/guides/html/files/global.css +190 -0
  139. data/doc/guides/html/files/helvetica.js +91 -0
  140. data/doc/guides/html/files/jquery.js +11 -0
  141. data/doc/guides/html/getting_started.html +454 -213
  142. data/doc/guides/html/index.html +454 -174
  143. data/doc/guides/html/installing_modules.html +454 -186
  144. data/doc/guides/html/portlets.html +451 -232
  145. data/doc/guides/html/user_guide.html +452 -270
  146. data/doc/guides/html/writing_guides.html +454 -161
  147. data/lib/acts_as_list.rb +1 -1
  148. data/lib/browsercms.rb +10 -6
  149. data/lib/cms/acts.rb +7 -0
  150. data/lib/cms/authentication.rb +4 -0
  151. data/lib/cms/authentication/controller.rb +1 -1
  152. data/lib/cms/behaviors.rb +1 -1
  153. data/lib/cms/behaviors/archiving.rb +2 -2
  154. data/lib/cms/behaviors/attaching.rb +28 -43
  155. data/lib/cms/behaviors/categorizing.rb +1 -1
  156. data/lib/cms/behaviors/connecting.rb +27 -12
  157. data/lib/cms/behaviors/dynamic_attributes.rb +8 -5
  158. data/lib/cms/behaviors/hiding.rb +2 -2
  159. data/lib/cms/behaviors/publishing.rb +32 -22
  160. data/lib/cms/behaviors/rendering.rb +41 -18
  161. data/lib/cms/behaviors/searching.rb +1 -1
  162. data/lib/cms/behaviors/soft_deleting.rb +58 -29
  163. data/lib/cms/behaviors/taggable.rb +1 -1
  164. data/lib/cms/behaviors/userstamping.rb +5 -4
  165. data/lib/cms/behaviors/versioning.rb +192 -111
  166. data/lib/cms/content_rendering_support.rb +3 -3
  167. data/lib/cms/date_picker.rb +23 -0
  168. data/lib/cms/engine.rb +46 -0
  169. data/lib/cms/extensions.rb +1 -1
  170. data/lib/cms/extensions/active_record/errors.rb +2 -2
  171. data/lib/cms/extensions/hash.rb +4 -2
  172. data/lib/cms/extensions/string.rb +7 -2
  173. data/lib/cms/init.rb +32 -21
  174. data/lib/cms/module.rb +22 -0
  175. data/lib/cms/module_installation.rb +38 -0
  176. data/lib/cms/routes.rb +127 -115
  177. data/lib/cms/version.rb +2 -2
  178. data/lib/generators/browser_cms.rb +12 -0
  179. data/lib/generators/browser_cms/cms/USAGE +2 -0
  180. data/lib/generators/browser_cms/cms/cms_generator.rb +36 -0
  181. data/{rails_generators/browser_cms → lib/generators/browser_cms/cms}/templates/README +0 -0
  182. data/{rails_generators/browser_cms_demo_site → lib/generators/browser_cms/demo_site}/USAGE +0 -0
  183. data/lib/generators/browser_cms/demo_site/demo_site_generator.rb +138 -0
  184. data/lib/generators/browser_cms/demo_site/templates/demo_site.rake +11 -0
  185. data/{rails_generators/browser_cms_demo_site/templates/migration.rb → lib/generators/browser_cms/demo_site/templates/migration.erb} +2 -8
  186. data/lib/generators/cms/content_block/USAGE +22 -0
  187. data/lib/generators/cms/content_block/content_block_generator.rb +55 -0
  188. data/{rails_generators → lib/generators/cms}/content_block/templates/_form.html.erb +0 -0
  189. data/{rails_generators → lib/generators/cms}/content_block/templates/content_block.rb +0 -0
  190. data/{rails_generators → lib/generators/cms}/content_block/templates/controller.rb +0 -0
  191. data/{rails_generators → lib/generators/cms}/content_block/templates/functional_test.erb +0 -0
  192. data/{rails_generators/content_block/templates/migration.rb → lib/generators/cms/content_block/templates/migration.erb} +1 -1
  193. data/{rails_generators → lib/generators/cms}/content_block/templates/render.html.erb +0 -0
  194. data/{rails_generators → lib/generators/cms}/content_block/templates/unit_test.erb +0 -0
  195. data/lib/generators/cms/install/USAGE +8 -0
  196. data/lib/generators/cms/install/install_generator.rb +20 -0
  197. data/{rails_generators → lib/generators/cms}/portlet/USAGE +3 -16
  198. data/lib/generators/cms/portlet/portlet_generator.rb +38 -0
  199. data/{rails_generators → lib/generators/cms}/portlet/templates/_form.html.erb +0 -0
  200. data/{rails_generators → lib/generators/cms}/portlet/templates/portlet.rb +0 -0
  201. data/{rails_generators → lib/generators/cms}/portlet/templates/portlet_helper.rb +0 -0
  202. data/{rails_generators → lib/generators/cms}/portlet/templates/render.html.erb +0 -0
  203. data/{rails_generators → lib/generators/cms}/portlet/templates/unit_test.erb +0 -0
  204. data/{rails_generators → lib/generators/cms}/template/USAGE +1 -1
  205. data/lib/generators/cms/template/template_generator.rb +18 -0
  206. data/lib/generators/cms/template/templates/template.erb +2 -0
  207. data/lib/generators/cms/upgrade_module/README.txt +3 -0
  208. data/lib/generators/cms/upgrade_module/templates/20100705083859_browsercms_3_3_0.rb +56 -0
  209. data/lib/generators/cms/upgrade_module/templates/README +1 -0
  210. data/lib/generators/cms/upgrade_module/templates/USAGE.erb +10 -0
  211. data/lib/generators/cms/upgrade_module/templates/build_gem.rake +5 -0
  212. data/lib/generators/cms/upgrade_module/templates/engine.erb +7 -0
  213. data/lib/generators/cms/upgrade_module/templates/gemspec.erb +25 -0
  214. data/lib/generators/cms/upgrade_module/templates/gitignore.erb +11 -0
  215. data/lib/generators/cms/upgrade_module/templates/install.erb +9 -0
  216. data/lib/generators/cms/upgrade_module/templates/module_file.erb +3 -0
  217. data/lib/generators/cms/upgrade_module/templates/routes.erb +7 -0
  218. data/lib/generators/cms/upgrade_module/upgrade_module_generator.rb +61 -0
  219. data/lib/tasks/build_gem.rake +1 -0
  220. data/lib/tasks/cms.rake +34 -6
  221. data/lib/tasks/cucumber.rake +53 -0
  222. data/lib/tasks/db.rake +2 -2
  223. data/public/javascripts/cms/application.js +144 -135
  224. data/public/javascripts/cms/sitemap.js +383 -357
  225. data/public/javascripts/jquery-ui.js +782 -591
  226. data/public/javascripts/jquery.cookie.js +38 -43
  227. data/public/javascripts/jquery.js +13 -8
  228. data/public/javascripts/jquery.taglist.js +7 -0
  229. data/public/stylesheets/cms/date_picker.css +49 -40
  230. data/rails/init.rb +2 -3
  231. data/templates/blank.rb +13 -7
  232. data/templates/demo.rb +15 -7
  233. data/templates/module.rb +12 -75
  234. metadata +87 -407
  235. data/app/helpers/cms/content_block_helper.rb +0 -27
  236. data/app/views/layouts/cms/thickbox.html.erb +0 -24
  237. data/db/migrate/20120117144039_browsercms315.rb +0 -94
  238. data/db/migrate/20121114172307_load_seeds.rb +0 -70
  239. data/lib/cms/addressable.rb +0 -83
  240. data/lib/cms/error_pages.rb +0 -8
  241. data/public/images/cms/thickbox/loadingAnimation.gif +0 -0
  242. data/public/images/cms/thickbox/macFFBgHack.png +0 -0
  243. data/public/javascripts/jquery.contextMenu.js +0 -211
  244. data/public/javascripts/jquery.dimensions.js +0 -119
  245. data/public/javascripts/jquery.thickbox.js +0 -10
  246. data/public/stylesheets/cms/jquery.contextMenu.css +0 -61
  247. data/public/stylesheets/cms/thickbox.css +0 -163
  248. data/rails_generators/browser_cms/USAGE +0 -2
  249. data/rails_generators/browser_cms/browser_cms_generator.rb +0 -35
  250. data/rails_generators/browser_cms_demo_site/browser_cms_demo_site_generator.rb +0 -63
  251. data/rails_generators/content_block/USAGE +0 -32
  252. data/rails_generators/content_block/content_block_generator.rb +0 -69
  253. data/rails_generators/portlet/portlet_generator.rb +0 -35
  254. data/rails_generators/template/template_generator.rb +0 -18
  255. data/rails_generators/template/templates/template.erb +0 -3
  256. data/test/custom_assertions.rb +0 -74
  257. data/test/factories.rb +0 -111
  258. data/test/factories/sitemap_factories.rb +0 -28
  259. data/test/fixtures/connectors.yml +0 -97
  260. data/test/fixtures/content_type_groups.yml +0 -13
  261. data/test/fixtures/content_types.yml +0 -50
  262. data/test/fixtures/dynamic_view_versions.yml +0 -26
  263. data/test/fixtures/dynamic_views.yml +0 -26
  264. data/test/fixtures/group_permissions.yml +0 -16
  265. data/test/fixtures/group_sections.yml +0 -31
  266. data/test/fixtures/group_type_permissions.yml +0 -11
  267. data/test/fixtures/group_types.yml +0 -25
  268. data/test/fixtures/groups.yml +0 -25
  269. data/test/fixtures/html_block_versions.yml +0 -67
  270. data/test/fixtures/html_blocks.yml +0 -63
  271. data/test/fixtures/page_versions.yml +0 -265
  272. data/test/fixtures/pages.yml +0 -85
  273. data/test/fixtures/permissions.yml +0 -28
  274. data/test/fixtures/section_nodes.yml +0 -46
  275. data/test/fixtures/sections.yml +0 -19
  276. data/test/fixtures/sites.yml +0 -9
  277. data/test/fixtures/user_group_memberships.yml +0 -11
  278. data/test/fixtures/users.yml +0 -15
  279. data/test/functional/cms/cache_controller_test.rb +0 -14
  280. data/test/functional/cms/categories_controller_test.rb +0 -25
  281. data/test/functional/cms/connectors_controller_test.rb +0 -60
  282. data/test/functional/cms/content_block_controller_test.rb +0 -120
  283. data/test/functional/cms/content_controller_test.rb +0 -439
  284. data/test/functional/cms/content_types_controller_test.rb +0 -18
  285. data/test/functional/cms/dashboard_controller_test.rb +0 -16
  286. data/test/functional/cms/dynamic_views_controller_test.rb +0 -52
  287. data/test/functional/cms/file_blocks_controller_test.rb +0 -52
  288. data/test/functional/cms/groups_controller_test.rb +0 -50
  289. data/test/functional/cms/home_controller_test.rb +0 -156
  290. data/test/functional/cms/html_blocks_controller_test.rb +0 -164
  291. data/test/functional/cms/image_blocks_controller_test.rb +0 -82
  292. data/test/functional/cms/links_controller_test.rb +0 -148
  293. data/test/functional/cms/pages_controller_test.rb +0 -227
  294. data/test/functional/cms/portlets_controller_test.rb +0 -67
  295. data/test/functional/cms/section_nodes_controller_test.rb +0 -112
  296. data/test/functional/cms/sections_controller_test.rb +0 -227
  297. data/test/functional/cms/sessions_controller_test.rb +0 -76
  298. data/test/functional/cms/toolbar_controller_test.rb +0 -64
  299. data/test/functional/cms/users_controller_test.rb +0 -231
  300. data/test/functional/tests/pretend_controller_test.rb +0 -57
  301. data/test/integration/cms/ckeditor_test.rb +0 -30
  302. data/test/integration/cms/password_management_test.rb +0 -56
  303. data/test/integration/login_test.rb +0 -14
  304. data/test/integration/sitemap_performance_test.rb +0 -26
  305. data/test/selenium-core/Blank.html +0 -7
  306. data/test/selenium-core/InjectedRemoteRunner.html +0 -8
  307. data/test/selenium-core/RemoteRunner.html +0 -110
  308. data/test/selenium-core/SeleniumLog.html +0 -109
  309. data/test/selenium-core/TestPrompt.html +0 -145
  310. data/test/selenium-core/TestRunner-splash.html +0 -55
  311. data/test/selenium-core/TestRunner.hta +0 -176
  312. data/test/selenium-core/TestRunner.html +0 -176
  313. data/test/selenium-core/domviewer/butmin.gif +0 -0
  314. data/test/selenium-core/domviewer/butplus.gif +0 -0
  315. data/test/selenium-core/domviewer/domviewer.css +0 -298
  316. data/test/selenium-core/domviewer/domviewer.html +0 -16
  317. data/test/selenium-core/domviewer/selenium-domviewer.js +0 -205
  318. data/test/selenium-core/icons/all.png +0 -0
  319. data/test/selenium-core/icons/continue.png +0 -0
  320. data/test/selenium-core/icons/continue_disabled.png +0 -0
  321. data/test/selenium-core/icons/pause.png +0 -0
  322. data/test/selenium-core/icons/pause_disabled.png +0 -0
  323. data/test/selenium-core/icons/selected.png +0 -0
  324. data/test/selenium-core/icons/step.png +0 -0
  325. data/test/selenium-core/icons/step_disabled.png +0 -0
  326. data/test/selenium-core/iedoc-core.xml +0 -1515
  327. data/test/selenium-core/iedoc.xml +0 -1469
  328. data/test/selenium-core/lib/cssQuery/cssQuery-p.js +0 -6
  329. data/test/selenium-core/lib/cssQuery/src/cssQuery-level2.js +0 -142
  330. data/test/selenium-core/lib/cssQuery/src/cssQuery-level3.js +0 -150
  331. data/test/selenium-core/lib/cssQuery/src/cssQuery-standard.js +0 -53
  332. data/test/selenium-core/lib/cssQuery/src/cssQuery.js +0 -356
  333. data/test/selenium-core/lib/prototype.js +0 -2006
  334. data/test/selenium-core/lib/scriptaculous/builder.js +0 -101
  335. data/test/selenium-core/lib/scriptaculous/controls.js +0 -815
  336. data/test/selenium-core/lib/scriptaculous/dragdrop.js +0 -915
  337. data/test/selenium-core/lib/scriptaculous/effects.js +0 -958
  338. data/test/selenium-core/lib/scriptaculous/scriptaculous.js +0 -47
  339. data/test/selenium-core/lib/scriptaculous/slider.js +0 -283
  340. data/test/selenium-core/lib/scriptaculous/unittest.js +0 -383
  341. data/test/selenium-core/scripts/find_matching_child.js +0 -69
  342. data/test/selenium-core/scripts/htmlutils.js +0 -894
  343. data/test/selenium-core/scripts/injection.html +0 -72
  344. data/test/selenium-core/scripts/js2html.js +0 -70
  345. data/test/selenium-core/scripts/narcissus-defs.js +0 -175
  346. data/test/selenium-core/scripts/narcissus-exec.js +0 -1054
  347. data/test/selenium-core/scripts/narcissus-parse.js +0 -1003
  348. data/test/selenium-core/scripts/se2html.js +0 -63
  349. data/test/selenium-core/scripts/selenium-api.js +0 -2409
  350. data/test/selenium-core/scripts/selenium-browserbot.js +0 -2203
  351. data/test/selenium-core/scripts/selenium-browserdetect.js +0 -150
  352. data/test/selenium-core/scripts/selenium-commandhandlers.js +0 -377
  353. data/test/selenium-core/scripts/selenium-executionloop.js +0 -175
  354. data/test/selenium-core/scripts/selenium-logging.js +0 -147
  355. data/test/selenium-core/scripts/selenium-remoterunner.js +0 -571
  356. data/test/selenium-core/scripts/selenium-testrunner.js +0 -1333
  357. data/test/selenium-core/scripts/selenium-version.js +0 -5
  358. data/test/selenium-core/scripts/user-extensions.js +0 -3
  359. data/test/selenium-core/scripts/user-extensions.js.sample +0 -75
  360. data/test/selenium-core/scripts/xmlextras.js +0 -153
  361. data/test/selenium-core/selenium-logo.png +0 -0
  362. data/test/selenium-core/selenium-test.css +0 -43
  363. data/test/selenium-core/selenium.css +0 -299
  364. data/test/selenium-core/xpath/dom.js +0 -428
  365. data/test/selenium-core/xpath/misc.js +0 -252
  366. data/test/selenium-core/xpath/xpath.js +0 -2223
  367. data/test/selenium/_login_as_cmsadmin.rsel +0 -4
  368. data/test/selenium/dashboard.rsel +0 -5
  369. data/test/selenium/html_blocks.rsel +0 -4
  370. data/test/selenium/login/failed_login.rsel +0 -8
  371. data/test/selenium/login/successful_login.rsel +0 -9
  372. data/test/selenium/page_templates.rsel +0 -12
  373. data/test/selenium/pages/edit_properties.rsel +0 -5
  374. data/test/selenium/site/view_home_page.rsel +0 -4
  375. data/test/selenium/sitemap/move_page.rsel +0 -9
  376. data/test/selenium/sitemap/open_section.rsel +0 -6
  377. data/test/selenium/sitemap/select_page.rsel +0 -12
  378. data/test/selenium/sitemap/select_section.rsel +0 -17
  379. data/test/test_helper.rb +0 -193
  380. data/test/test_logging.rb +0 -67
  381. data/test/unit/behaviors/attaching_test.rb +0 -357
  382. data/test/unit/behaviors/connectable_test.rb +0 -29
  383. data/test/unit/behaviors/dynamic_attributes_test.rb +0 -38
  384. data/test/unit/behaviors/publishable_test.rb +0 -84
  385. data/test/unit/behaviors/searching_test.rb +0 -102
  386. data/test/unit/behaviors/taggable_test.rb +0 -109
  387. data/test/unit/behaviors/versioning_test.rb +0 -36
  388. data/test/unit/extensions/active_record/base_test.rb +0 -10
  389. data/test/unit/extensions/hash_test.rb +0 -17
  390. data/test/unit/extensions/integer_test.rb +0 -10
  391. data/test/unit/helpers/application_helper_test.rb +0 -77
  392. data/test/unit/helpers/form_builder_test.rb +0 -36
  393. data/test/unit/helpers/menu_helper_test.rb +0 -242
  394. data/test/unit/helpers/page_helper_test.rb +0 -67
  395. data/test/unit/helpers/path_helper_test.rb +0 -57
  396. data/test/unit/lib/acts_as_content_page_test.rb +0 -72
  397. data/test/unit/lib/cms/authentication/controller_test.rb +0 -20
  398. data/test/unit/lib/cms/sitemap_test.rb +0 -206
  399. data/test/unit/lib/cms_domain_support_test.rb +0 -43
  400. data/test/unit/lib/command_line_test.rb +0 -70
  401. data/test/unit/lib/content_block_test.rb +0 -203
  402. data/test/unit/lib/content_rendering_support_test.rb +0 -40
  403. data/test/unit/lib/generators_test.rb +0 -40
  404. data/test/unit/lib/routes_test.rb +0 -57
  405. data/test/unit/models/attachment_test.rb +0 -116
  406. data/test/unit/models/category_test.rb +0 -40
  407. data/test/unit/models/category_type_test.rb +0 -8
  408. data/test/unit/models/connector_test.rb +0 -152
  409. data/test/unit/models/content_type_test.rb +0 -56
  410. data/test/unit/models/email_page_portlet_test.rb +0 -14
  411. data/test/unit/models/file_block_test.rb +0 -230
  412. data/test/unit/models/group_test.rb +0 -13
  413. data/test/unit/models/html_block_test.rb +0 -102
  414. data/test/unit/models/link_test.rb +0 -52
  415. data/test/unit/models/page_partial_test.rb +0 -29
  416. data/test/unit/models/page_route_test.rb +0 -29
  417. data/test/unit/models/page_template_test.rb +0 -40
  418. data/test/unit/models/page_test.rb +0 -792
  419. data/test/unit/models/permission_test.rb +0 -10
  420. data/test/unit/models/portlet_test.rb +0 -69
  421. data/test/unit/models/sections_test.rb +0 -264
  422. data/test/unit/models/site_test.rb +0 -50
  423. data/test/unit/models/task_test.rb +0 -141
  424. data/test/unit/models/user_test.rb +0 -352
  425. data/test/unit/schema_statements_test.rb +0 -41
@@ -1,175 +0,0 @@
1
- /*
2
- * Copyright 2004 ThoughtWorks, Inc
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- function TestLoop(commandFactory) {
18
- this.commandFactory = commandFactory;
19
- }
20
-
21
- TestLoop.prototype = {
22
-
23
- start : function() {
24
- selenium.reset();
25
- LOG.debug("currentTest.start()");
26
- this.continueTest();
27
- },
28
-
29
- continueTest : function() {
30
- /**
31
- * Select the next command and continue the test.
32
- */
33
- LOG.debug("currentTest.continueTest() - acquire the next command");
34
- if (! this.aborted) {
35
- this.currentCommand = this.nextCommand();
36
- }
37
- if (! this.requiresCallBack) {
38
- this.continueTestAtCurrentCommand();
39
- } // otherwise, just finish and let the callback invoke continueTestAtCurrentCommand()
40
- },
41
-
42
- continueTestAtCurrentCommand : function() {
43
- LOG.debug("currentTest.continueTestAtCurrentCommand()");
44
- if (this.currentCommand) {
45
- // TODO: rename commandStarted to commandSelected, OR roll it into nextCommand
46
- this.commandStarted(this.currentCommand);
47
- this._resumeAfterDelay();
48
- } else {
49
- this._testComplete();
50
- }
51
- },
52
-
53
- _resumeAfterDelay : function() {
54
- /**
55
- * Pause, then execute the current command.
56
- */
57
-
58
- // Get the command delay. If a pauseInterval is set, use it once
59
- // and reset it. Otherwise, use the defined command-interval.
60
- var delay = this.pauseInterval || this.getCommandInterval();
61
- this.pauseInterval = undefined;
62
-
63
- if (this.currentCommand.isBreakpoint || delay < 0) {
64
- // Pause: enable the "next/continue" button
65
- this.pause();
66
- } else {
67
- window.setTimeout(fnBind(this.resume, this), delay);
68
- }
69
- },
70
-
71
- resume: function() {
72
- /**
73
- * Select the next command and continue the test.
74
- */
75
- LOG.debug("currentTest.resume() - actually execute");
76
- try {
77
- selenium.browserbot.runScheduledPollers();
78
- this._executeCurrentCommand();
79
- this.continueTestWhenConditionIsTrue();
80
- } catch (e) {
81
- if (!this._handleCommandError(e)) {
82
- this.testComplete();
83
- } else {
84
- this.continueTest();
85
- }
86
- }
87
- },
88
-
89
- _testComplete : function() {
90
- selenium.ensureNoUnhandledPopups();
91
- this.testComplete();
92
- },
93
-
94
- _executeCurrentCommand : function() {
95
- /**
96
- * Execute the current command.
97
- *
98
- * @return a function which will be used to determine when
99
- * execution can continue, or null if we can continue immediately
100
- */
101
- var command = this.currentCommand;
102
- LOG.info("Executing: |" + command.command + " | " + command.target + " | " + command.value + " |");
103
-
104
- var handler = this.commandFactory.getCommandHandler(command.command);
105
- if (handler == null) {
106
- throw new SeleniumError("Unknown command: '" + command.command + "'");
107
- }
108
-
109
- command.target = selenium.preprocessParameter(command.target);
110
- command.value = selenium.preprocessParameter(command.value);
111
- LOG.debug("Command found, going to execute " + command.command);
112
- this.result = handler.execute(selenium, command);
113
-
114
-
115
- this.waitForCondition = this.result.terminationCondition;
116
-
117
- },
118
-
119
- _handleCommandError : function(e) {
120
- if (!e.isSeleniumError) {
121
- LOG.exception(e);
122
- var msg = "Selenium failure. Please report to the Selenium Users forum at http://forums.openqa.org, with error details from the log window.";
123
- msg += " The error message is: " + extractExceptionMessage(e);
124
- return this.commandError(msg);
125
- } else {
126
- LOG.error(e.message);
127
- return this.commandError(e.message);
128
- }
129
- },
130
-
131
- continueTestWhenConditionIsTrue: function () {
132
- /**
133
- * Busy wait for waitForCondition() to become true, and then carry
134
- * on with test. Fail the current test if there's a timeout or an
135
- * exception.
136
- */
137
- //LOG.debug("currentTest.continueTestWhenConditionIsTrue()");
138
- selenium.browserbot.runScheduledPollers();
139
- try {
140
- if (this.waitForCondition == null) {
141
- LOG.debug("null condition; let's continueTest()");
142
- LOG.debug("Command complete");
143
- this.commandComplete(this.result);
144
- this.continueTest();
145
- } else if (this.waitForCondition()) {
146
- LOG.debug("condition satisfied; let's continueTest()");
147
- this.waitForCondition = null;
148
- LOG.debug("Command complete");
149
- this.commandComplete(this.result);
150
- this.continueTest();
151
- } else {
152
- //LOG.debug("waitForCondition was false; keep waiting!");
153
- window.setTimeout(fnBind(this.continueTestWhenConditionIsTrue, this), 10);
154
- }
155
- } catch (e) {
156
- this.result = {};
157
- this.result.failed = true;
158
- this.result.failureMessage = extractExceptionMessage(e);
159
- this.commandComplete(this.result);
160
- this.continueTest();
161
- }
162
- },
163
-
164
- pause : function() {},
165
- nextCommand : function() {},
166
- commandStarted : function() {},
167
- commandComplete : function() {},
168
- commandError : function() {},
169
- testComplete : function() {},
170
-
171
- getCommandInterval : function() {
172
- return 0;
173
- }
174
-
175
- }
@@ -1,147 +0,0 @@
1
- /*
2
- * Copyright 2004 ThoughtWorks, Inc
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- var Logger = function() {
18
- this.logWindow = null;
19
- }
20
- Logger.prototype = {
21
-
22
- logLevels: {
23
- debug: 0,
24
- info: 1,
25
- warn: 2,
26
- error: 3,
27
- off: 999
28
- },
29
-
30
- pendingMessages: new Array(),
31
-
32
- threshold: "info",
33
-
34
- setLogLevelThreshold: function(logLevel) {
35
- this.threshold = logLevel;
36
- var logWindow = this.getLogWindow()
37
- if (logWindow && logWindow.setThresholdLevel) {
38
- logWindow.setThresholdLevel(logLevel);
39
- }
40
- // NOTE: log messages will be discarded until the log window is
41
- // fully loaded.
42
- },
43
-
44
- getLogWindow: function() {
45
- if (this.logWindow && this.logWindow.closed) {
46
- this.logWindow = null;
47
- }
48
- return this.logWindow;
49
- },
50
-
51
- openLogWindow: function() {
52
- this.logWindow = window.open(
53
- getDocumentBase(document) + "SeleniumLog.html?startingThreshold="+this.threshold, "SeleniumLog",
54
- "width=600,height=1000,bottom=0,right=0,status,scrollbars,resizable"
55
- );
56
- this.logWindow.moveTo(window.screenX + 1210, window.screenY + window.outerHeight - 1400);
57
- if (browserVersion.appearsToBeBrokenInitialIE6) {
58
- // I would really prefer for the message to immediately appear in the log window, the instant the user requests that the log window be
59
- // visible. But when I initially coded it this way, thou message simply didn't appear unless I stepped through the code with a debugger.
60
- // So obviously there is some timing issue here which I don't have the patience to figure out.
61
- var pendingMessage = new LogMessage("warn", "You appear to be running an unpatched IE 6, which is not stable and can crash due to memory problems. We recommend you run Windows update to install a more stable version of IE.");
62
- this.pendingMessages.push(pendingMessage);
63
- }
64
- return this.logWindow;
65
- },
66
-
67
- show: function() {
68
- if (! this.getLogWindow()) {
69
- this.openLogWindow();
70
- }
71
- setTimeout(function(){LOG.error("Log window displayed. Logging events will now be recorded to this window.");}, 500);
72
- },
73
-
74
- logHook: function(logLevel, message) {
75
- },
76
-
77
- log: function(logLevel, message) {
78
- if (this.logLevels[logLevel] < this.logLevels[this.threshold]) {
79
- return;
80
- }
81
- this.logHook(logLevel, message);
82
- var logWindow = this.getLogWindow();
83
- if (logWindow) {
84
- if (logWindow.append) {
85
- if (logWindow.disabled) {
86
- logWindow.callBack = fnBind(this.setLogLevelThreshold, this);
87
- logWindow.enableButtons();
88
- }
89
- if (this.pendingMessages.length > 0) {
90
- logWindow.append("info: Appending missed logging messages", "info");
91
- while (this.pendingMessages.length > 0) {
92
- var msg = this.pendingMessages.shift();
93
- logWindow.append(msg.type + ": " + msg.msg, msg.type);
94
- }
95
- logWindow.append("info: Done appending missed logging messages", "info");
96
- }
97
- logWindow.append(logLevel + ": " + message, logLevel);
98
- }
99
- } else {
100
- // TODO these logging messages are never flushed, which creates
101
- // an enormous array of strings that never stops growing.
102
- // there should at least be a way to clear the messages!
103
- this.pendingMessages.push(new LogMessage(logLevel, message));
104
- }
105
- },
106
-
107
- close: function(message) {
108
- if (this.logWindow != null) {
109
- try {
110
- this.logWindow.close();
111
- } catch (e) {
112
- // swallow exception
113
- // the window is probably closed if we get an exception here
114
- }
115
- this.logWindow = null;
116
- }
117
- },
118
-
119
- debug: function(message) {
120
- this.log("debug", message);
121
- },
122
-
123
- info: function(message) {
124
- this.log("info", message);
125
- },
126
-
127
- warn: function(message) {
128
- this.log("warn", message);
129
- },
130
-
131
- error: function(message) {
132
- this.log("error", message);
133
- },
134
-
135
- exception: function(exception) {
136
- this.error("Unexpected Exception: " + extractExceptionMessage(exception));
137
- this.error("Exception details: " + describe(exception, ', '));
138
- }
139
-
140
- };
141
-
142
- var LOG = new Logger();
143
-
144
- var LogMessage = function(type, msg) {
145
- this.type = type;
146
- this.msg = msg;
147
- }
@@ -1,571 +0,0 @@
1
- /*
2
- * Copyright 2005 ThoughtWorks, Inc
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- *
16
- */
17
-
18
- passColor = "#cfffcf";
19
- failColor = "#ffcfcf";
20
- errorColor = "#ffffff";
21
- workingColor = "#DEE7EC";
22
- doneColor = "#FFFFCC";
23
-
24
- var injectedSessionId;
25
- var cmd1 = document.createElement("div");
26
- var cmd2 = document.createElement("div");
27
- var cmd3 = document.createElement("div");
28
- var cmd4 = document.createElement("div");
29
-
30
- var postResult = "START";
31
- var debugMode = false;
32
- var relayToRC = null;
33
- var proxyInjectionMode = false;
34
- var uniqueId = 'sel_' + Math.round(100000 * Math.random());
35
- var seleniumSequenceNumber = 0;
36
-
37
- var RemoteRunnerOptions = classCreate();
38
- objectExtend(RemoteRunnerOptions.prototype, URLConfiguration.prototype);
39
- objectExtend(RemoteRunnerOptions.prototype, {
40
- initialize: function() {
41
- this._acquireQueryString();
42
- },
43
- isDebugMode: function() {
44
- return this._isQueryParameterTrue("debugMode");
45
- },
46
-
47
- getContinue: function() {
48
- return this._getQueryParameter("continue");
49
- },
50
-
51
- getDriverUrl: function() {
52
- return this._getQueryParameter("driverUrl");
53
- },
54
-
55
- getSessionId: function() {
56
- return this._getQueryParameter("sessionId");
57
- },
58
-
59
- _acquireQueryString: function () {
60
- if (this.queryString) return;
61
- if (browserVersion.isHTA) {
62
- var args = this._extractArgs();
63
- if (args.length < 2) return null;
64
- this.queryString = args[1];
65
- } else if (proxyInjectionMode) {
66
- this.queryString = window.location.search.substr(1);
67
- } else {
68
- this.queryString = top.location.search.substr(1);
69
- }
70
- }
71
-
72
- });
73
- var runOptions;
74
-
75
- function runSeleniumTest() {
76
- runOptions = new RemoteRunnerOptions();
77
- var testAppWindow;
78
-
79
- if (runOptions.isMultiWindowMode()) {
80
- testAppWindow = openSeparateApplicationWindow('Blank.html', true);
81
- } else if (sel$('selenium_myiframe') != null) {
82
- var myiframe = sel$('selenium_myiframe');
83
- if (myiframe) {
84
- testAppWindow = myiframe.contentWindow;
85
- }
86
- }
87
- else {
88
- proxyInjectionMode = true;
89
- testAppWindow = window;
90
- }
91
- selenium = Selenium.createForWindow(testAppWindow, proxyInjectionMode);
92
- if (runOptions.getBaseUrl()) {
93
- selenium.browserbot.baseUrl = runOptions.getBaseUrl();
94
- }
95
- if (!debugMode) {
96
- debugMode = runOptions.isDebugMode();
97
- }
98
- if (proxyInjectionMode) {
99
- LOG.logHook = logToRc;
100
- selenium.browserbot._modifyWindow(testAppWindow);
101
- }
102
- else if (debugMode) {
103
- LOG.logHook = logToRc;
104
- }
105
- window.selenium = selenium;
106
-
107
- commandFactory = new CommandHandlerFactory();
108
- commandFactory.registerAll(selenium);
109
-
110
- currentTest = new RemoteRunner(commandFactory);
111
-
112
- if (document.getElementById("commandList") != null) {
113
- document.getElementById("commandList").appendChild(cmd4);
114
- document.getElementById("commandList").appendChild(cmd3);
115
- document.getElementById("commandList").appendChild(cmd2);
116
- document.getElementById("commandList").appendChild(cmd1);
117
- }
118
-
119
- var doContinue = runOptions.getContinue();
120
- if (doContinue != null) postResult = "OK";
121
-
122
- currentTest.start();
123
- }
124
-
125
- function buildDriverUrl() {
126
- var driverUrl = runOptions.getDriverUrl();
127
- if (driverUrl != null) {
128
- return driverUrl;
129
- }
130
- var s = window.location.href
131
- var slashPairOffset = s.indexOf("//") + "//".length
132
- var pathSlashOffset = s.substring(slashPairOffset).indexOf("/")
133
- return s.substring(0, slashPairOffset + pathSlashOffset) + "/selenium-server/driver/";
134
- //return "http://localhost" + uniqueId + "/selenium-server/driver/";
135
- }
136
-
137
- function logToRc(logLevel, message) {
138
- if (debugMode) {
139
- if (logLevel == null) {
140
- logLevel = "debug";
141
- }
142
- sendToRCAndForget("logLevel=" + logLevel + ":" + message.replace(/[\n\r\015]/g, " ") + "\n", "logging=true");
143
- }
144
- }
145
-
146
- function serializeString(name, s) {
147
- return name + "=unescape(\"" + escape(s) + "\");";
148
- }
149
-
150
- function serializeObject(name, x)
151
- {
152
- var s = '';
153
-
154
- if (isArray(x))
155
- {
156
- s = name + "=new Array(); ";
157
- var len = x["length"];
158
- for (var j = 0; j < len; j++)
159
- {
160
- s += serializeString(name + "[" + j + "]", x[j]);
161
- }
162
- }
163
- else if (typeof x == "string")
164
- {
165
- s = serializeString(name, x);
166
- }
167
- else
168
- {
169
- throw "unrecognized object not encoded: " + name + "(" + x + ")";
170
- }
171
- return s;
172
- }
173
-
174
- function relayBotToRC(s) {
175
- }
176
-
177
- // seems like no one uses this, but in fact it is called using eval from server-side PI mode code; however,
178
- // because multiple names can map to the same popup, assigning a single name confuses matters sometimes;
179
- // thus, I'm disabling this for now. -Nelson 10/21/06
180
- function setSeleniumWindowName(seleniumWindowName) {
181
- //selenium.browserbot.getCurrentWindow()['seleniumWindowName'] = seleniumWindowName;
182
- }
183
-
184
- RemoteRunner = classCreate();
185
- objectExtend(RemoteRunner.prototype, new TestLoop());
186
- objectExtend(RemoteRunner.prototype, {
187
- initialize : function(commandFactory) {
188
- this.commandFactory = commandFactory;
189
- this.requiresCallBack = true;
190
- this.commandNode = null;
191
- this.xmlHttpForCommandsAndResults = null;
192
- },
193
-
194
- nextCommand : function() {
195
- var urlParms = "";
196
- if (postResult == "START") {
197
- urlParms += "seleniumStart=true";
198
- }
199
- this.xmlHttpForCommandsAndResults = XmlHttp.create();
200
- sendToRC(postResult, urlParms, fnBind(this._HandleHttpResponse, this), this.xmlHttpForCommandsAndResults);
201
- },
202
-
203
- commandStarted : function(command) {
204
- this.commandNode = document.createElement("div");
205
- var cmdText = command.command + '(';
206
- if (command.target != null && command.target != "") {
207
- cmdText += command.target;
208
- if (command.value != null && command.value != "") {
209
- cmdText += ', ' + command.value;
210
- }
211
- }
212
- cmdText += ")";
213
- if (cmdText.length >40) {
214
- cmdText = cmdText.substring(0,40);
215
- cmdText += "...";
216
- }
217
- this.commandNode.appendChild(document.createTextNode(cmdText));
218
- this.commandNode.style.backgroundColor = workingColor;
219
- if (document.getElementById("commandList") != null) {
220
- document.getElementById("commandList").removeChild(cmd1);
221
- document.getElementById("commandList").removeChild(cmd2);
222
- document.getElementById("commandList").removeChild(cmd3);
223
- document.getElementById("commandList").removeChild(cmd4);
224
- cmd4 = cmd3;
225
- cmd3 = cmd2;
226
- cmd2 = cmd1;
227
- cmd1 = this.commandNode;
228
- document.getElementById("commandList").appendChild(cmd4);
229
- document.getElementById("commandList").appendChild(cmd3);
230
- document.getElementById("commandList").appendChild(cmd2);
231
- document.getElementById("commandList").appendChild(cmd1);
232
- }
233
- },
234
-
235
- commandComplete : function(result) {
236
-
237
- if (result.failed) {
238
- if (postResult == "CONTINUATION") {
239
- currentTest.aborted = true;
240
- }
241
- postResult = result.failureMessage;
242
- this.commandNode.title = result.failureMessage;
243
- this.commandNode.style.backgroundColor = failColor;
244
- } else if (result.passed) {
245
- postResult = "OK";
246
- this.commandNode.style.backgroundColor = passColor;
247
- } else {
248
- if (result.result == null) {
249
- postResult = "OK";
250
- } else {
251
- var actualResult = result.result;
252
- actualResult = selArrayToString(actualResult);
253
- postResult = "OK," + actualResult;
254
- }
255
- this.commandNode.style.backgroundColor = doneColor;
256
- }
257
- },
258
-
259
- commandError : function(message) {
260
- postResult = "ERROR: " + message;
261
- this.commandNode.style.backgroundColor = errorColor;
262
- this.commandNode.title = message;
263
- },
264
-
265
- testComplete : function() {
266
- window.status = "Selenium Tests Complete, for this Test"
267
- // Continue checking for new results
268
- this.continueTest();
269
- postResult = "START";
270
- },
271
-
272
- _HandleHttpResponse : function() {
273
- // When request is completed
274
- if (this.xmlHttpForCommandsAndResults.readyState == 4) {
275
- // OK
276
- if (this.xmlHttpForCommandsAndResults.status == 200) {
277
- if (this.xmlHttpForCommandsAndResults.responseText=="") {
278
- LOG.error("saw blank string xmlHttpForCommandsAndResults.responseText");
279
- return;
280
- }
281
- var command = this._extractCommand(this.xmlHttpForCommandsAndResults);
282
- this.currentCommand = command;
283
- this.continueTestAtCurrentCommand();
284
- }
285
- // Not OK
286
- else {
287
- var s = 'xmlHttp returned: ' + this.xmlHttpForCommandsAndResults.status + ": " + this.xmlHttpForCommandsAndResults.statusText;
288
- LOG.error(s);
289
- this.currentCommand = null;
290
- setTimeout(fnBind(this.continueTestAtCurrentCommand, this), 2000);
291
- }
292
-
293
- }
294
- },
295
-
296
- _extractCommand : function(xmlHttp) {
297
- var command;
298
- try {
299
- var re = new RegExp("^(.*?)\n((.|[\r\n])*)");
300
- if (re.exec(xmlHttp.responseText)) {
301
- command = RegExp.$1;
302
- var rest = RegExp.$2;
303
- rest = rest.trim();
304
- if (rest) {
305
- eval(rest);
306
- }
307
- }
308
- else {
309
- command = xmlHttp.responseText;
310
- }
311
- } catch (e) {
312
- alert('could not get responseText: ' + e.message);
313
- }
314
- if (command.substr(0, '|testComplete'.length) == '|testComplete') {
315
- return null;
316
- }
317
-
318
- return this._createCommandFromRequest(command);
319
- },
320
-
321
-
322
- _delay : function(millis) {
323
- var startMillis = new Date();
324
- while (true) {
325
- milli = new Date();
326
- if (milli - startMillis > millis) {
327
- break;
328
- }
329
- }
330
- },
331
-
332
- // Parses a URI query string into a SeleniumCommand object
333
- _createCommandFromRequest : function(commandRequest) {
334
- //decodeURIComponent doesn't strip plus signs
335
- var processed = commandRequest.replace(/\+/g, "%20");
336
- // strip trailing spaces
337
- var processed = processed.replace(/\s+$/, "");
338
- var vars = processed.split("&");
339
- var cmdArgs = new Object();
340
- for (var i = 0; i < vars.length; i++) {
341
- var pair = vars[i].split("=");
342
- cmdArgs[pair[0]] = pair[1];
343
- }
344
- var cmd = cmdArgs['cmd'];
345
- var arg1 = cmdArgs['1'];
346
- if (null == arg1) arg1 = "";
347
- arg1 = decodeURIComponent(arg1);
348
- var arg2 = cmdArgs['2'];
349
- if (null == arg2) arg2 = "";
350
- arg2 = decodeURIComponent(arg2);
351
- if (cmd == null) {
352
- throw new Error("Bad command request: " + commandRequest);
353
- }
354
- return new SeleniumCommand(cmd, arg1, arg2);
355
- }
356
-
357
- })
358
-
359
-
360
- function sendToRC(dataToBePosted, urlParms, callback, xmlHttpObject, async) {
361
- if (async == null) {
362
- async = true;
363
- }
364
- if (xmlHttpObject == null) {
365
- xmlHttpObject = XmlHttp.create();
366
- }
367
- var url = buildDriverUrl() + "?"
368
- if (urlParms) {
369
- url += urlParms;
370
- }
371
- url = addUrlParams(url);
372
- url += "&sequenceNumber=" + seleniumSequenceNumber++;
373
-
374
- var wrappingCallback;
375
- if (callback == null) {
376
- callback = function() {};
377
- wrappingCallback = callback;
378
- } else {
379
- wrappingCallback = function() {
380
- if (xmlHttpObject.readyState == 4) {
381
- if (xmlHttpObject.status == 200) {
382
- var retry = false;
383
- if (typeof currentTest != 'undefined') {
384
- var command = currentTest._extractCommand(xmlHttpObject);
385
- //console.log("*********** " + command.command + " | " + command.target + " | " + command.value);
386
- if (command.command == 'retryLast') {
387
- retry = true;
388
- }
389
- }
390
- if (retry) {
391
- setTimeout(fnBind(function() {
392
- sendToRC("RETRY", "retry=true", callback, xmlHttpObject, async);
393
- }, this), 1000);
394
- } else {
395
- callback();
396
- }
397
- }
398
- }
399
- }
400
- }
401
-
402
- var postedData = "postedData=" + encodeURIComponent(dataToBePosted);
403
-
404
- //xmlHttpObject.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
405
- xmlHttpObject.open("POST", url, async);
406
- xmlHttpObject.onreadystatechange = wrappingCallback;
407
- xmlHttpObject.send(postedData);
408
- return null;
409
- }
410
-
411
- function addUrlParams(url) {
412
- return url + "&localFrameAddress=" + (proxyInjectionMode ? makeAddressToAUTFrame() : "top")
413
- + getSeleniumWindowNameURLparameters()
414
- + "&uniqueId=" + uniqueId
415
- + buildDriverParams() + preventBrowserCaching()
416
- }
417
-
418
- function sendToRCAndForget(dataToBePosted, urlParams) {
419
- var url;
420
- if (!(browserVersion.isChrome || browserVersion.isHTA)) {
421
- // DGF we're behind a proxy, so we can send our logging message to literally any host, to avoid 2-connection limit
422
- var protocol = "http:";
423
- if (window.location.protocol == "https:") {
424
- // DGF if we're in HTTPS, use another HTTPS url to avoid security warning
425
- protocol = "https:";
426
- }
427
- // we don't choose a super large random value, but rather 1 - 16, because this matches with the pre-computed
428
- // tunnels waiting on the Selenium Server side. This gives us higher throughput than the two-connection-per-host
429
- // limitation, but doesn't require we generate an extremely large ammount of fake SSL certs either.
430
- url = protocol + "//" + Math.floor(Math.random()* 16 + 1) + ".selenium.doesnotexist/selenium-server/driver/?" + urlParams;
431
- } else {
432
- url = buildDriverUrl() + "?" + urlParams;
433
- }
434
- url = addUrlParams(url);
435
-
436
- var method = "GET";
437
- if (method == "POST") {
438
- // DGF submit a request using an iframe; we can't see the response, but we don't need to
439
- // TODO not using this mechanism because it screws up back-button
440
- var loggingForm = document.createElement("form");
441
- loggingForm.method = "POST";
442
- loggingForm.action = url;
443
- loggingForm.target = "seleniumLoggingFrame";
444
- var postedDataInput = document.createElement("input");
445
- postedDataInput.type = "hidden";
446
- postedDataInput.name = "postedData";
447
- postedDataInput.value = dataToBePosted;
448
- loggingForm.appendChild(postedDataInput);
449
- document.body.appendChild(loggingForm);
450
- loggingForm.submit();
451
- document.body.removeChild(loggingForm);
452
- } else {
453
- var postedData = "&postedData=" + encodeURIComponent(dataToBePosted);
454
- var scriptTag = document.createElement("script");
455
- scriptTag.src = url + postedData;
456
- document.body.appendChild(scriptTag);
457
- document.body.removeChild(scriptTag);
458
- }
459
- }
460
-
461
- function buildDriverParams() {
462
- var params = "";
463
-
464
- var sessionId = runOptions.getSessionId();
465
- if (sessionId == undefined) {
466
- sessionId = injectedSessionId;
467
- }
468
- if (sessionId != undefined) {
469
- params = params + "&sessionId=" + sessionId;
470
- }
471
- return params;
472
- }
473
-
474
- function preventBrowserCaching() {
475
- var t = (new Date()).getTime();
476
- return "&counterToMakeURsUniqueAndSoStopPageCachingInTheBrowser=" + t;
477
- }
478
-
479
- //
480
- // Return URL parameters pertaining to the name(s?) of the current window
481
- //
482
- // In selenium, the main (i.e., first) window's name is a blank string.
483
- //
484
- // Additional pop-ups are associated with either 1.) the name given by the 2nd parameter to window.open, or 2.) the name of a
485
- // property on the opening window which points at the window.
486
- //
487
- // An example of #2: if window X contains JavaScript as follows:
488
- //
489
- // var windowABC = window.open(...)
490
- //
491
- // Note that the example JavaScript above is equivalent to
492
- //
493
- // window["windowABC"] = window.open(...)
494
- //
495
- function getSeleniumWindowNameURLparameters() {
496
- var w = (proxyInjectionMode ? selenium.browserbot.getCurrentWindow() : window).top;
497
- var s = "&seleniumWindowName=";
498
- if (w.opener == null) {
499
- return s;
500
- }
501
- if (w["seleniumWindowName"] == null) {
502
- if (w.name) {
503
- w["seleniumWindowName"] = w.name;
504
- } else {
505
- w["seleniumWindowName"] = 'generatedSeleniumWindowName_' + Math.round(100000 * Math.random());
506
- }
507
- }
508
- s += w["seleniumWindowName"];
509
- var windowOpener = w.opener;
510
- for (key in windowOpener) {
511
- var val = null;
512
- try {
513
- val = windowOpener[key];
514
- }
515
- catch(e) {
516
- }
517
- if (val==w) {
518
- s += "&jsWindowNameVar=" + key; // found a js variable in the opener referring to this window
519
- }
520
- }
521
- return s;
522
- }
523
-
524
- // construct a JavaScript expression which leads to my frame (i.e., the frame containing the window
525
- // in which this code is operating)
526
- function makeAddressToAUTFrame(w, frameNavigationalJSexpression)
527
- {
528
- if (w == null)
529
- {
530
- w = top;
531
- frameNavigationalJSexpression = "top";
532
- }
533
-
534
- if (w == selenium.browserbot.getCurrentWindow())
535
- {
536
- return frameNavigationalJSexpression;
537
- }
538
- for (var j = 0; j < w.frames.length; j++)
539
- {
540
- var t = makeAddressToAUTFrame(w.frames[j], frameNavigationalJSexpression + ".frames[" + j + "]");
541
- if (t != null)
542
- {
543
- return t;
544
- }
545
- }
546
- return null;
547
- }
548
-
549
- Selenium.prototype.doSetContext = function(context) {
550
- /**
551
- * Writes a message to the status bar and adds a note to the browser-side
552
- * log.
553
- *
554
- * @param context
555
- * the message to be sent to the browser
556
- */
557
- //set the current test title
558
- var ctx = document.getElementById("context");
559
- if (ctx != null) {
560
- ctx.innerHTML = context;
561
- }
562
- };
563
-
564
- Selenium.prototype.doCaptureScreenshot = function(filename) {
565
- /**
566
- * Captures a PNG screenshot to the specified file.
567
- *
568
- * @param filename the absolute path to the file to be written, e.g. "c:\blah\screenshot.png"
569
- */
570
- // This doesn't really do anything on the JS side; we let the Selenium Server take care of this for us!
571
- };