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.
- data/app/controllers/cms/base_controller.rb +3 -3
- data/app/controllers/cms/content_block_controller.rb +2 -2
- data/app/controllers/cms/content_controller.rb +5 -4
- data/app/controllers/cms/error_handling.rb +1 -1
- data/app/controllers/cms/routes_controller.rb +4 -5
- data/app/controllers/cms/section_nodes_controller.rb +1 -6
- data/app/controllers/cms/sections_controller.rb +2 -3
- data/app/controllers/cms/tasks_controller.rb +3 -0
- data/app/controllers/cms/users_controller.rb +1 -1
- data/app/helpers/cms/application_helper.rb +137 -34
- data/app/helpers/cms/form_builder.rb +33 -21
- data/app/helpers/cms/page_helper.rb +43 -10
- data/app/helpers/cms/path_helper.rb +1 -1
- data/app/helpers/cms/rendering_helper.rb +3 -4
- data/app/helpers/cms/section_nodes_helper.rb +5 -43
- data/app/models/abstract_file_block.rb +1 -16
- data/app/models/attachment.rb +57 -22
- data/app/models/category.rb +4 -4
- data/app/models/category_type.rb +2 -2
- data/app/models/cms/view_context.rb +46 -0
- data/app/models/connector.rb +7 -6
- data/app/models/content_type.rb +3 -3
- data/app/models/dynamic_view.rb +1 -1
- data/app/models/email_message.rb +2 -2
- data/app/models/file_block.rb +12 -0
- data/app/models/group.rb +4 -4
- data/app/models/group_type.rb +4 -4
- data/app/models/html_block.rb +1 -1
- data/app/models/image_block.rb +12 -0
- data/app/models/link.rb +22 -5
- data/app/models/page.rb +87 -46
- data/app/models/page_route.rb +61 -6
- data/app/models/permission.rb +1 -1
- data/app/models/portlet.rb +14 -4
- data/app/models/section.rb +48 -86
- data/app/models/section_node.rb +25 -40
- data/app/models/site.rb +1 -1
- data/app/models/tag.rb +1 -1
- data/app/models/task.rb +8 -7
- data/app/models/user.rb +2 -7
- data/app/portlets/forgot_password_portlet.rb +6 -2
- data/app/portlets/reset_password_portlet.rb +1 -1
- data/app/views/cms/blocks/_toolbar.html.erb +1 -1
- data/app/views/cms/blocks/_toolbar_for_collection.html.erb +3 -6
- data/app/views/cms/blocks/_toolbar_for_member.html.erb +3 -5
- data/app/views/cms/blocks/edit.html.erb +4 -4
- data/app/views/cms/blocks/index.html.erb +7 -7
- data/app/views/cms/blocks/new.html.erb +4 -4
- data/app/views/cms/blocks/show.html.erb +2 -2
- data/app/views/cms/blocks/usages.html.erb +2 -2
- data/app/views/cms/blocks/versions.html.erb +4 -4
- data/app/views/cms/cache/show.html.erb +2 -2
- data/app/views/cms/categories/_form.html.erb +2 -2
- data/app/views/cms/connectors/new.html.erb +6 -8
- data/app/views/cms/content/no_page.html.erb +1 -1
- data/app/views/cms/content/show.html.erb +2 -7
- data/app/views/cms/dashboard/_page_drafts.html.erb +1 -1
- data/app/views/cms/dashboard/_tasks.html.erb +1 -1
- data/app/views/cms/dashboard/index.html.erb +1 -1
- data/app/views/cms/dynamic_views/_form.html.erb +2 -2
- data/app/views/cms/dynamic_views/index.html.erb +7 -10
- data/app/views/cms/email_messages/show.html.erb +2 -2
- data/app/views/cms/file_blocks/_form.html.erb +4 -4
- data/app/views/cms/form_builder/_cms_fancy_drop_down.html.erb +2 -2
- data/app/views/cms/form_builder/_cms_file_field.html.erb +2 -2
- data/app/views/cms/form_builder/_cms_tag_list.html.erb +2 -2
- data/app/views/cms/form_builder/_cms_text_editor.html.erb +2 -2
- data/app/views/cms/groups/_form.html.erb +5 -5
- data/app/views/cms/groups/_permissions.html.erb +4 -4
- data/app/views/cms/groups/_sections.html.erb +1 -2
- data/app/views/cms/groups/index.html.erb +1 -1
- data/app/views/cms/html_blocks/render.html.erb +1 -1
- data/app/views/cms/image_blocks/_form.html.erb +4 -5
- data/app/views/cms/links/_form.html.erb +1 -1
- data/app/views/cms/links/edit.html.erb +2 -2
- data/app/views/cms/links/new.html.erb +2 -2
- data/app/views/cms/page_routes/_form.html.erb +2 -2
- data/app/views/cms/page_routes/index.html.erb +6 -9
- data/app/views/cms/page_routes/show.html.erb +5 -8
- data/app/views/cms/pages/_edit_connector.html.erb +1 -1
- data/app/views/cms/pages/_form.html.erb +3 -3
- data/app/views/cms/pages/edit.html.erb +2 -2
- data/app/views/cms/pages/new.html.erb +7 -7
- data/app/views/cms/pages/versions.html.erb +4 -4
- data/app/views/cms/redirects/_form.html.erb +2 -2
- data/app/views/cms/redirects/index.html.erb +8 -7
- data/app/views/cms/routes/index.html.erb +2 -2
- data/app/views/cms/section_nodes/_link.html.erb +3 -6
- data/app/views/cms/section_nodes/_node.html.erb +4 -13
- data/app/views/cms/section_nodes/_page.html.erb +7 -13
- data/app/views/cms/section_nodes/_section.html.erb +8 -24
- data/app/views/cms/section_nodes/_section_node.html.erb +10 -0
- data/app/views/cms/section_nodes/index.html.erb +18 -30
- data/app/views/cms/sections/_form.html.erb +4 -6
- data/app/views/cms/sections/edit.html.erb +2 -2
- data/app/views/cms/sections/index.html.erb +3 -3
- data/app/views/cms/sections/new.html.erb +3 -3
- data/app/views/cms/sessions/new.html.erb +3 -3
- data/app/views/cms/shared/_pagination.html.erb +1 -1
- data/app/views/cms/shared/error.html.erb +1 -1
- data/app/views/cms/tags/render.html.erb +2 -2
- data/app/views/cms/tasks/new.html.erb +4 -4
- data/app/views/cms/users/_form.html.erb +3 -3
- data/app/views/cms/users/_toolbar.html.erb +3 -3
- data/app/views/cms/users/change_password.html.erb +5 -5
- data/app/views/cms/users/edit.html.erb +2 -2
- data/app/views/cms/users/index.html.erb +4 -4
- data/app/views/cms/users/new.html.erb +2 -2
- data/app/views/cms/users/show.html.erb +16 -16
- data/app/views/layouts/_cms_toolbar.html.erb +5 -5
- data/app/views/layouts/_page_toolbar.html.erb +11 -11
- data/app/views/layouts/cms/_footer.erb +1 -1
- data/app/views/layouts/cms/_head.html.erb +2 -6
- data/app/views/layouts/cms/administration.html.erb +32 -32
- data/app/views/layouts/cms/content_library.html.erb +5 -5
- data/app/views/layouts/cms/toolbar.html.erb +1 -1
- data/app/views/portlets/email_page/render.html.erb +2 -2
- data/app/views/portlets/forgot_password/render.html.erb +1 -1
- data/app/views/portlets/login/render.html.erb +4 -2
- data/app/views/portlets/reset_password/render.html.erb +1 -1
- data/app/views/tests/pretend/open_with_layout.html.erb +1 -1
- data/bin/bcms +0 -0
- data/bin/bcms-upgrade +232 -0
- data/bin/browsercms +2 -2
- data/browsercms.gemspec +16 -14
- data/db/migrate/20100705083859_browsercms_3_3_0.rb +56 -0
- data/db/seeds.rb +58 -0
- data/doc/guides/html/authentication.html +448 -192
- data/doc/guides/html/build_it_yourself.html +454 -175
- data/doc/guides/html/building_modules.html +451 -220
- data/doc/guides/html/building_templates.html +448 -498
- data/doc/guides/html/content_blocks.html +450 -470
- data/doc/guides/html/customizing_browsercms.html +453 -169
- data/doc/guides/html/deployment_guide.html +443 -82
- data/doc/guides/html/files/bcmsorg.js +28 -0
- data/doc/guides/html/files/clearfix.css +8 -0
- data/doc/guides/html/files/cufon.js +7 -0
- data/doc/guides/html/files/global.css +190 -0
- data/doc/guides/html/files/helvetica.js +91 -0
- data/doc/guides/html/files/jquery.js +11 -0
- data/doc/guides/html/getting_started.html +454 -213
- data/doc/guides/html/index.html +454 -174
- data/doc/guides/html/installing_modules.html +454 -186
- data/doc/guides/html/portlets.html +451 -232
- data/doc/guides/html/user_guide.html +452 -270
- data/doc/guides/html/writing_guides.html +454 -161
- data/lib/acts_as_list.rb +1 -1
- data/lib/browsercms.rb +10 -6
- data/lib/cms/acts.rb +7 -0
- data/lib/cms/authentication.rb +4 -0
- data/lib/cms/authentication/controller.rb +1 -1
- data/lib/cms/behaviors.rb +1 -1
- data/lib/cms/behaviors/archiving.rb +2 -2
- data/lib/cms/behaviors/attaching.rb +28 -43
- data/lib/cms/behaviors/categorizing.rb +1 -1
- data/lib/cms/behaviors/connecting.rb +27 -12
- data/lib/cms/behaviors/dynamic_attributes.rb +8 -5
- data/lib/cms/behaviors/hiding.rb +2 -2
- data/lib/cms/behaviors/publishing.rb +32 -22
- data/lib/cms/behaviors/rendering.rb +41 -18
- data/lib/cms/behaviors/searching.rb +1 -1
- data/lib/cms/behaviors/soft_deleting.rb +58 -29
- data/lib/cms/behaviors/taggable.rb +1 -1
- data/lib/cms/behaviors/userstamping.rb +5 -4
- data/lib/cms/behaviors/versioning.rb +192 -111
- data/lib/cms/content_rendering_support.rb +3 -3
- data/lib/cms/date_picker.rb +23 -0
- data/lib/cms/engine.rb +46 -0
- data/lib/cms/extensions.rb +1 -1
- data/lib/cms/extensions/active_record/errors.rb +2 -2
- data/lib/cms/extensions/hash.rb +4 -2
- data/lib/cms/extensions/string.rb +7 -2
- data/lib/cms/init.rb +32 -21
- data/lib/cms/module.rb +22 -0
- data/lib/cms/module_installation.rb +38 -0
- data/lib/cms/routes.rb +127 -115
- data/lib/cms/version.rb +2 -2
- data/lib/generators/browser_cms.rb +12 -0
- data/lib/generators/browser_cms/cms/USAGE +2 -0
- data/lib/generators/browser_cms/cms/cms_generator.rb +36 -0
- data/{rails_generators/browser_cms → lib/generators/browser_cms/cms}/templates/README +0 -0
- data/{rails_generators/browser_cms_demo_site → lib/generators/browser_cms/demo_site}/USAGE +0 -0
- data/lib/generators/browser_cms/demo_site/demo_site_generator.rb +138 -0
- data/lib/generators/browser_cms/demo_site/templates/demo_site.rake +11 -0
- data/{rails_generators/browser_cms_demo_site/templates/migration.rb → lib/generators/browser_cms/demo_site/templates/migration.erb} +2 -8
- data/lib/generators/cms/content_block/USAGE +22 -0
- data/lib/generators/cms/content_block/content_block_generator.rb +55 -0
- data/{rails_generators → lib/generators/cms}/content_block/templates/_form.html.erb +0 -0
- data/{rails_generators → lib/generators/cms}/content_block/templates/content_block.rb +0 -0
- data/{rails_generators → lib/generators/cms}/content_block/templates/controller.rb +0 -0
- data/{rails_generators → lib/generators/cms}/content_block/templates/functional_test.erb +0 -0
- data/{rails_generators/content_block/templates/migration.rb → lib/generators/cms/content_block/templates/migration.erb} +1 -1
- data/{rails_generators → lib/generators/cms}/content_block/templates/render.html.erb +0 -0
- data/{rails_generators → lib/generators/cms}/content_block/templates/unit_test.erb +0 -0
- data/lib/generators/cms/install/USAGE +8 -0
- data/lib/generators/cms/install/install_generator.rb +20 -0
- data/{rails_generators → lib/generators/cms}/portlet/USAGE +3 -16
- data/lib/generators/cms/portlet/portlet_generator.rb +38 -0
- data/{rails_generators → lib/generators/cms}/portlet/templates/_form.html.erb +0 -0
- data/{rails_generators → lib/generators/cms}/portlet/templates/portlet.rb +0 -0
- data/{rails_generators → lib/generators/cms}/portlet/templates/portlet_helper.rb +0 -0
- data/{rails_generators → lib/generators/cms}/portlet/templates/render.html.erb +0 -0
- data/{rails_generators → lib/generators/cms}/portlet/templates/unit_test.erb +0 -0
- data/{rails_generators → lib/generators/cms}/template/USAGE +1 -1
- data/lib/generators/cms/template/template_generator.rb +18 -0
- data/lib/generators/cms/template/templates/template.erb +2 -0
- data/lib/generators/cms/upgrade_module/README.txt +3 -0
- data/lib/generators/cms/upgrade_module/templates/20100705083859_browsercms_3_3_0.rb +56 -0
- data/lib/generators/cms/upgrade_module/templates/README +1 -0
- data/lib/generators/cms/upgrade_module/templates/USAGE.erb +10 -0
- data/lib/generators/cms/upgrade_module/templates/build_gem.rake +5 -0
- data/lib/generators/cms/upgrade_module/templates/engine.erb +7 -0
- data/lib/generators/cms/upgrade_module/templates/gemspec.erb +25 -0
- data/lib/generators/cms/upgrade_module/templates/gitignore.erb +11 -0
- data/lib/generators/cms/upgrade_module/templates/install.erb +9 -0
- data/lib/generators/cms/upgrade_module/templates/module_file.erb +3 -0
- data/lib/generators/cms/upgrade_module/templates/routes.erb +7 -0
- data/lib/generators/cms/upgrade_module/upgrade_module_generator.rb +61 -0
- data/lib/tasks/build_gem.rake +1 -0
- data/lib/tasks/cms.rake +34 -6
- data/lib/tasks/cucumber.rake +53 -0
- data/lib/tasks/db.rake +2 -2
- data/public/javascripts/cms/application.js +144 -135
- data/public/javascripts/cms/sitemap.js +383 -357
- data/public/javascripts/jquery-ui.js +782 -591
- data/public/javascripts/jquery.cookie.js +38 -43
- data/public/javascripts/jquery.js +13 -8
- data/public/javascripts/jquery.taglist.js +7 -0
- data/public/stylesheets/cms/date_picker.css +49 -40
- data/rails/init.rb +2 -3
- data/templates/blank.rb +13 -7
- data/templates/demo.rb +15 -7
- data/templates/module.rb +12 -75
- metadata +87 -407
- data/app/helpers/cms/content_block_helper.rb +0 -27
- data/app/views/layouts/cms/thickbox.html.erb +0 -24
- data/db/migrate/20120117144039_browsercms315.rb +0 -94
- data/db/migrate/20121114172307_load_seeds.rb +0 -70
- data/lib/cms/addressable.rb +0 -83
- data/lib/cms/error_pages.rb +0 -8
- data/public/images/cms/thickbox/loadingAnimation.gif +0 -0
- data/public/images/cms/thickbox/macFFBgHack.png +0 -0
- data/public/javascripts/jquery.contextMenu.js +0 -211
- data/public/javascripts/jquery.dimensions.js +0 -119
- data/public/javascripts/jquery.thickbox.js +0 -10
- data/public/stylesheets/cms/jquery.contextMenu.css +0 -61
- data/public/stylesheets/cms/thickbox.css +0 -163
- data/rails_generators/browser_cms/USAGE +0 -2
- data/rails_generators/browser_cms/browser_cms_generator.rb +0 -35
- data/rails_generators/browser_cms_demo_site/browser_cms_demo_site_generator.rb +0 -63
- data/rails_generators/content_block/USAGE +0 -32
- data/rails_generators/content_block/content_block_generator.rb +0 -69
- data/rails_generators/portlet/portlet_generator.rb +0 -35
- data/rails_generators/template/template_generator.rb +0 -18
- data/rails_generators/template/templates/template.erb +0 -3
- data/test/custom_assertions.rb +0 -74
- data/test/factories.rb +0 -111
- data/test/factories/sitemap_factories.rb +0 -28
- data/test/fixtures/connectors.yml +0 -97
- data/test/fixtures/content_type_groups.yml +0 -13
- data/test/fixtures/content_types.yml +0 -50
- data/test/fixtures/dynamic_view_versions.yml +0 -26
- data/test/fixtures/dynamic_views.yml +0 -26
- data/test/fixtures/group_permissions.yml +0 -16
- data/test/fixtures/group_sections.yml +0 -31
- data/test/fixtures/group_type_permissions.yml +0 -11
- data/test/fixtures/group_types.yml +0 -25
- data/test/fixtures/groups.yml +0 -25
- data/test/fixtures/html_block_versions.yml +0 -67
- data/test/fixtures/html_blocks.yml +0 -63
- data/test/fixtures/page_versions.yml +0 -265
- data/test/fixtures/pages.yml +0 -85
- data/test/fixtures/permissions.yml +0 -28
- data/test/fixtures/section_nodes.yml +0 -46
- data/test/fixtures/sections.yml +0 -19
- data/test/fixtures/sites.yml +0 -9
- data/test/fixtures/user_group_memberships.yml +0 -11
- data/test/fixtures/users.yml +0 -15
- data/test/functional/cms/cache_controller_test.rb +0 -14
- data/test/functional/cms/categories_controller_test.rb +0 -25
- data/test/functional/cms/connectors_controller_test.rb +0 -60
- data/test/functional/cms/content_block_controller_test.rb +0 -120
- data/test/functional/cms/content_controller_test.rb +0 -439
- data/test/functional/cms/content_types_controller_test.rb +0 -18
- data/test/functional/cms/dashboard_controller_test.rb +0 -16
- data/test/functional/cms/dynamic_views_controller_test.rb +0 -52
- data/test/functional/cms/file_blocks_controller_test.rb +0 -52
- data/test/functional/cms/groups_controller_test.rb +0 -50
- data/test/functional/cms/home_controller_test.rb +0 -156
- data/test/functional/cms/html_blocks_controller_test.rb +0 -164
- data/test/functional/cms/image_blocks_controller_test.rb +0 -82
- data/test/functional/cms/links_controller_test.rb +0 -148
- data/test/functional/cms/pages_controller_test.rb +0 -227
- data/test/functional/cms/portlets_controller_test.rb +0 -67
- data/test/functional/cms/section_nodes_controller_test.rb +0 -112
- data/test/functional/cms/sections_controller_test.rb +0 -227
- data/test/functional/cms/sessions_controller_test.rb +0 -76
- data/test/functional/cms/toolbar_controller_test.rb +0 -64
- data/test/functional/cms/users_controller_test.rb +0 -231
- data/test/functional/tests/pretend_controller_test.rb +0 -57
- data/test/integration/cms/ckeditor_test.rb +0 -30
- data/test/integration/cms/password_management_test.rb +0 -56
- data/test/integration/login_test.rb +0 -14
- data/test/integration/sitemap_performance_test.rb +0 -26
- data/test/selenium-core/Blank.html +0 -7
- data/test/selenium-core/InjectedRemoteRunner.html +0 -8
- data/test/selenium-core/RemoteRunner.html +0 -110
- data/test/selenium-core/SeleniumLog.html +0 -109
- data/test/selenium-core/TestPrompt.html +0 -145
- data/test/selenium-core/TestRunner-splash.html +0 -55
- data/test/selenium-core/TestRunner.hta +0 -176
- data/test/selenium-core/TestRunner.html +0 -176
- data/test/selenium-core/domviewer/butmin.gif +0 -0
- data/test/selenium-core/domviewer/butplus.gif +0 -0
- data/test/selenium-core/domviewer/domviewer.css +0 -298
- data/test/selenium-core/domviewer/domviewer.html +0 -16
- data/test/selenium-core/domviewer/selenium-domviewer.js +0 -205
- data/test/selenium-core/icons/all.png +0 -0
- data/test/selenium-core/icons/continue.png +0 -0
- data/test/selenium-core/icons/continue_disabled.png +0 -0
- data/test/selenium-core/icons/pause.png +0 -0
- data/test/selenium-core/icons/pause_disabled.png +0 -0
- data/test/selenium-core/icons/selected.png +0 -0
- data/test/selenium-core/icons/step.png +0 -0
- data/test/selenium-core/icons/step_disabled.png +0 -0
- data/test/selenium-core/iedoc-core.xml +0 -1515
- data/test/selenium-core/iedoc.xml +0 -1469
- data/test/selenium-core/lib/cssQuery/cssQuery-p.js +0 -6
- data/test/selenium-core/lib/cssQuery/src/cssQuery-level2.js +0 -142
- data/test/selenium-core/lib/cssQuery/src/cssQuery-level3.js +0 -150
- data/test/selenium-core/lib/cssQuery/src/cssQuery-standard.js +0 -53
- data/test/selenium-core/lib/cssQuery/src/cssQuery.js +0 -356
- data/test/selenium-core/lib/prototype.js +0 -2006
- data/test/selenium-core/lib/scriptaculous/builder.js +0 -101
- data/test/selenium-core/lib/scriptaculous/controls.js +0 -815
- data/test/selenium-core/lib/scriptaculous/dragdrop.js +0 -915
- data/test/selenium-core/lib/scriptaculous/effects.js +0 -958
- data/test/selenium-core/lib/scriptaculous/scriptaculous.js +0 -47
- data/test/selenium-core/lib/scriptaculous/slider.js +0 -283
- data/test/selenium-core/lib/scriptaculous/unittest.js +0 -383
- data/test/selenium-core/scripts/find_matching_child.js +0 -69
- data/test/selenium-core/scripts/htmlutils.js +0 -894
- data/test/selenium-core/scripts/injection.html +0 -72
- data/test/selenium-core/scripts/js2html.js +0 -70
- data/test/selenium-core/scripts/narcissus-defs.js +0 -175
- data/test/selenium-core/scripts/narcissus-exec.js +0 -1054
- data/test/selenium-core/scripts/narcissus-parse.js +0 -1003
- data/test/selenium-core/scripts/se2html.js +0 -63
- data/test/selenium-core/scripts/selenium-api.js +0 -2409
- data/test/selenium-core/scripts/selenium-browserbot.js +0 -2203
- data/test/selenium-core/scripts/selenium-browserdetect.js +0 -150
- data/test/selenium-core/scripts/selenium-commandhandlers.js +0 -377
- data/test/selenium-core/scripts/selenium-executionloop.js +0 -175
- data/test/selenium-core/scripts/selenium-logging.js +0 -147
- data/test/selenium-core/scripts/selenium-remoterunner.js +0 -571
- data/test/selenium-core/scripts/selenium-testrunner.js +0 -1333
- data/test/selenium-core/scripts/selenium-version.js +0 -5
- data/test/selenium-core/scripts/user-extensions.js +0 -3
- data/test/selenium-core/scripts/user-extensions.js.sample +0 -75
- data/test/selenium-core/scripts/xmlextras.js +0 -153
- data/test/selenium-core/selenium-logo.png +0 -0
- data/test/selenium-core/selenium-test.css +0 -43
- data/test/selenium-core/selenium.css +0 -299
- data/test/selenium-core/xpath/dom.js +0 -428
- data/test/selenium-core/xpath/misc.js +0 -252
- data/test/selenium-core/xpath/xpath.js +0 -2223
- data/test/selenium/_login_as_cmsadmin.rsel +0 -4
- data/test/selenium/dashboard.rsel +0 -5
- data/test/selenium/html_blocks.rsel +0 -4
- data/test/selenium/login/failed_login.rsel +0 -8
- data/test/selenium/login/successful_login.rsel +0 -9
- data/test/selenium/page_templates.rsel +0 -12
- data/test/selenium/pages/edit_properties.rsel +0 -5
- data/test/selenium/site/view_home_page.rsel +0 -4
- data/test/selenium/sitemap/move_page.rsel +0 -9
- data/test/selenium/sitemap/open_section.rsel +0 -6
- data/test/selenium/sitemap/select_page.rsel +0 -12
- data/test/selenium/sitemap/select_section.rsel +0 -17
- data/test/test_helper.rb +0 -193
- data/test/test_logging.rb +0 -67
- data/test/unit/behaviors/attaching_test.rb +0 -357
- data/test/unit/behaviors/connectable_test.rb +0 -29
- data/test/unit/behaviors/dynamic_attributes_test.rb +0 -38
- data/test/unit/behaviors/publishable_test.rb +0 -84
- data/test/unit/behaviors/searching_test.rb +0 -102
- data/test/unit/behaviors/taggable_test.rb +0 -109
- data/test/unit/behaviors/versioning_test.rb +0 -36
- data/test/unit/extensions/active_record/base_test.rb +0 -10
- data/test/unit/extensions/hash_test.rb +0 -17
- data/test/unit/extensions/integer_test.rb +0 -10
- data/test/unit/helpers/application_helper_test.rb +0 -77
- data/test/unit/helpers/form_builder_test.rb +0 -36
- data/test/unit/helpers/menu_helper_test.rb +0 -242
- data/test/unit/helpers/page_helper_test.rb +0 -67
- data/test/unit/helpers/path_helper_test.rb +0 -57
- data/test/unit/lib/acts_as_content_page_test.rb +0 -72
- data/test/unit/lib/cms/authentication/controller_test.rb +0 -20
- data/test/unit/lib/cms/sitemap_test.rb +0 -206
- data/test/unit/lib/cms_domain_support_test.rb +0 -43
- data/test/unit/lib/command_line_test.rb +0 -70
- data/test/unit/lib/content_block_test.rb +0 -203
- data/test/unit/lib/content_rendering_support_test.rb +0 -40
- data/test/unit/lib/generators_test.rb +0 -40
- data/test/unit/lib/routes_test.rb +0 -57
- data/test/unit/models/attachment_test.rb +0 -116
- data/test/unit/models/category_test.rb +0 -40
- data/test/unit/models/category_type_test.rb +0 -8
- data/test/unit/models/connector_test.rb +0 -152
- data/test/unit/models/content_type_test.rb +0 -56
- data/test/unit/models/email_page_portlet_test.rb +0 -14
- data/test/unit/models/file_block_test.rb +0 -230
- data/test/unit/models/group_test.rb +0 -13
- data/test/unit/models/html_block_test.rb +0 -102
- data/test/unit/models/link_test.rb +0 -52
- data/test/unit/models/page_partial_test.rb +0 -29
- data/test/unit/models/page_route_test.rb +0 -29
- data/test/unit/models/page_template_test.rb +0 -40
- data/test/unit/models/page_test.rb +0 -792
- data/test/unit/models/permission_test.rb +0 -10
- data/test/unit/models/portlet_test.rb +0 -69
- data/test/unit/models/sections_test.rb +0 -264
- data/test/unit/models/site_test.rb +0 -50
- data/test/unit/models/task_test.rb +0 -141
- data/test/unit/models/user_test.rb +0 -352
- data/test/unit/schema_statements_test.rb +0 -41
@@ -1,1333 +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
|
-
|
18
|
-
// An object representing the current test, used external
|
19
|
-
var currentTest = null; // TODO: get rid of this global, which mirrors the htmlTestRunner.currentTest
|
20
|
-
var selenium = null;
|
21
|
-
|
22
|
-
var htmlTestRunner;
|
23
|
-
var HtmlTestRunner = classCreate();
|
24
|
-
objectExtend(HtmlTestRunner.prototype, {
|
25
|
-
initialize: function() {
|
26
|
-
this.metrics = new Metrics();
|
27
|
-
this.controlPanel = new HtmlTestRunnerControlPanel();
|
28
|
-
this.testFailed = false;
|
29
|
-
this.currentTest = null;
|
30
|
-
this.runAllTests = false;
|
31
|
-
this.appWindow = null;
|
32
|
-
// we use a timeout here to make sure the LOG has loaded first, so we can see _every_ error
|
33
|
-
setTimeout(fnBind(function() {
|
34
|
-
this.loadSuiteFrame();
|
35
|
-
}, this), 500);
|
36
|
-
},
|
37
|
-
|
38
|
-
getTestSuite: function() {
|
39
|
-
return suiteFrame.getCurrentTestSuite();
|
40
|
-
},
|
41
|
-
|
42
|
-
markFailed: function() {
|
43
|
-
this.testFailed = true;
|
44
|
-
this.getTestSuite().markFailed();
|
45
|
-
},
|
46
|
-
|
47
|
-
loadSuiteFrame: function() {
|
48
|
-
var logLevel = this.controlPanel.getDefaultLogLevel();
|
49
|
-
if (logLevel) {
|
50
|
-
LOG.setLogLevelThreshold(logLevel);
|
51
|
-
}
|
52
|
-
if (selenium == null) {
|
53
|
-
var appWindow = this._getApplicationWindow();
|
54
|
-
try { appWindow.location; }
|
55
|
-
catch (e) {
|
56
|
-
// when reloading, we may be pointing at an old window (Perm Denied)
|
57
|
-
setTimeout(fnBind(function() {
|
58
|
-
this.loadSuiteFrame();
|
59
|
-
}, this), 50);
|
60
|
-
return;
|
61
|
-
}
|
62
|
-
selenium = Selenium.createForWindow(appWindow);
|
63
|
-
this._registerCommandHandlers();
|
64
|
-
}
|
65
|
-
this.controlPanel.setHighlightOption();
|
66
|
-
var testSuiteName = this.controlPanel.getTestSuiteName();
|
67
|
-
var self = this;
|
68
|
-
if (testSuiteName) {
|
69
|
-
suiteFrame.load(testSuiteName, function() {setTimeout(fnBind(self._onloadTestSuite, self), 50)} );
|
70
|
-
selenium.browserbot.baseUrl = absolutify(testSuiteName, window.location.href);
|
71
|
-
}
|
72
|
-
// DGF or should we use the old default?
|
73
|
-
// selenium.browserbot.baseUrl = window.location.href;
|
74
|
-
if (this.controlPanel.getBaseUrl()) {
|
75
|
-
selenium.browserbot.baseUrl = this.controlPanel.getBaseUrl();
|
76
|
-
}
|
77
|
-
},
|
78
|
-
|
79
|
-
_getApplicationWindow: function () {
|
80
|
-
if (this.controlPanel.isMultiWindowMode()) {
|
81
|
-
return this._getSeparateApplicationWindow();
|
82
|
-
}
|
83
|
-
return sel$('selenium_myiframe').contentWindow;
|
84
|
-
},
|
85
|
-
|
86
|
-
_getSeparateApplicationWindow: function () {
|
87
|
-
if (this.appWindow == null) {
|
88
|
-
this.appWindow = openSeparateApplicationWindow('TestRunner-splash.html', this.controlPanel.isAutomatedRun());
|
89
|
-
}
|
90
|
-
return this.appWindow;
|
91
|
-
},
|
92
|
-
|
93
|
-
_onloadTestSuite:function () {
|
94
|
-
if (! this.getTestSuite().isAvailable()) {
|
95
|
-
return;
|
96
|
-
}
|
97
|
-
if (this.controlPanel.isAutomatedRun()) {
|
98
|
-
this.startTestSuite();
|
99
|
-
} else if (this.controlPanel.getAutoUrl()) {
|
100
|
-
//todo what is the autourl doing, left to check it out
|
101
|
-
addLoadListener(this._getApplicationWindow(), fnBind(this._startSingleTest, this));
|
102
|
-
this._getApplicationWindow().src = this.controlPanel.getAutoUrl();
|
103
|
-
} else {
|
104
|
-
var testCaseLoaded = fnBind(function(){this.testCaseLoaded=true;},this);
|
105
|
-
this.getTestSuite().getSuiteRows()[0].loadTestCase(testCaseLoaded);
|
106
|
-
}
|
107
|
-
},
|
108
|
-
|
109
|
-
_startSingleTest:function () {
|
110
|
-
removeLoadListener(getApplicationWindow(), fnBind(this._startSingleTest, this));
|
111
|
-
var singleTestName = this.controlPanel.getSingleTestName();
|
112
|
-
testFrame.load(singleTestName, fnBind(this.startTest, this));
|
113
|
-
},
|
114
|
-
|
115
|
-
_registerCommandHandlers: function () {
|
116
|
-
this.commandFactory = new CommandHandlerFactory();
|
117
|
-
this.commandFactory.registerAll(selenium);
|
118
|
-
},
|
119
|
-
|
120
|
-
startTestSuite: function() {
|
121
|
-
this.controlPanel.reset();
|
122
|
-
this.metrics.resetMetrics();
|
123
|
-
this.getTestSuite().reset();
|
124
|
-
this.runAllTests = true;
|
125
|
-
this.runNextTest();
|
126
|
-
},
|
127
|
-
|
128
|
-
runNextTest: function () {
|
129
|
-
this.getTestSuite().updateSuiteWithResultOfPreviousTest();
|
130
|
-
if (!this.runAllTests) {
|
131
|
-
return;
|
132
|
-
}
|
133
|
-
this.getTestSuite().runNextTestInSuite();
|
134
|
-
},
|
135
|
-
|
136
|
-
startTest: function () {
|
137
|
-
this.controlPanel.reset();
|
138
|
-
testFrame.scrollToTop();
|
139
|
-
//todo: move testFailed and storedVars to TestCase
|
140
|
-
this.testFailed = false;
|
141
|
-
storedVars = new Object();
|
142
|
-
this.currentTest = new HtmlRunnerTestLoop(testFrame.getCurrentTestCase(), this.metrics, this.commandFactory);
|
143
|
-
currentTest = this.currentTest;
|
144
|
-
this.currentTest.start();
|
145
|
-
},
|
146
|
-
|
147
|
-
runSingleTest:function() {
|
148
|
-
this.runAllTests = false;
|
149
|
-
this.metrics.resetMetrics();
|
150
|
-
this.startTest();
|
151
|
-
}
|
152
|
-
});
|
153
|
-
|
154
|
-
var runInterval = 0;
|
155
|
-
|
156
|
-
/** SeleniumFrame encapsulates an iframe element */
|
157
|
-
var SeleniumFrame = classCreate();
|
158
|
-
objectExtend(SeleniumFrame.prototype, {
|
159
|
-
|
160
|
-
initialize : function(frame) {
|
161
|
-
this.frame = frame;
|
162
|
-
addLoadListener(this.frame, fnBind(this._handleLoad, this));
|
163
|
-
},
|
164
|
-
|
165
|
-
getDocument : function() {
|
166
|
-
return this.frame.contentWindow.document;
|
167
|
-
},
|
168
|
-
|
169
|
-
_handleLoad: function() {
|
170
|
-
this._attachStylesheet();
|
171
|
-
this._onLoad();
|
172
|
-
if (this.loadCallback) {
|
173
|
-
this.loadCallback();
|
174
|
-
this.loadCallback = null;
|
175
|
-
}
|
176
|
-
},
|
177
|
-
|
178
|
-
_attachStylesheet: function() {
|
179
|
-
var d = this.getDocument();
|
180
|
-
var head = d.getElementsByTagName('head').item(0);
|
181
|
-
var styleLink = d.createElement("link");
|
182
|
-
styleLink.rel = "stylesheet";
|
183
|
-
styleLink.type = "text/css";
|
184
|
-
if (browserVersion && browserVersion.isChrome) {
|
185
|
-
// DGF We have to play a clever trick to get the right absolute path.
|
186
|
-
// This trick works on most browsers, (not IE), but is only needed in
|
187
|
-
// chrome
|
188
|
-
var tempLink = window.document.createElement("link");
|
189
|
-
tempLink.href = "selenium-test.css"; // this will become an absolute href
|
190
|
-
styleLink.href = tempLink.href;
|
191
|
-
} else {
|
192
|
-
// this works in every browser (except Firefox in chrome mode)
|
193
|
-
var styleSheetPath = window.location.pathname.replace(/[^\/\\]+$/, "selenium-test.css");
|
194
|
-
if (browserVersion.isIE && window.location.protocol == "file:") {
|
195
|
-
styleSheetPath = "file:///" + styleSheetPath;
|
196
|
-
}
|
197
|
-
styleLink.href = styleSheetPath;
|
198
|
-
}
|
199
|
-
// DGF You're only going to see this log message if you set defaultLogLevel=debug
|
200
|
-
LOG.debug("styleLink.href="+styleLink.href);
|
201
|
-
head.appendChild(styleLink);
|
202
|
-
},
|
203
|
-
|
204
|
-
_onLoad: function() {
|
205
|
-
},
|
206
|
-
|
207
|
-
scrollToTop : function() {
|
208
|
-
this.frame.contentWindow.scrollTo(0, 0);
|
209
|
-
},
|
210
|
-
|
211
|
-
_setLocation: function(location) {
|
212
|
-
var isChrome = browserVersion.isChrome || false;
|
213
|
-
var isHTA = browserVersion.isHTA || false;
|
214
|
-
// DGF TODO multiWindow
|
215
|
-
location += (location.indexOf("?") == -1 ? "?" : "&");
|
216
|
-
location += "thisIsChrome=" + isChrome + "&thisIsHTA=" + isHTA;
|
217
|
-
if (browserVersion.isSafari) {
|
218
|
-
// safari doesn't reload the page when the location equals to current location.
|
219
|
-
// hence, set the location to blank so that the page will reload automatically.
|
220
|
-
this.frame.src = "about:blank";
|
221
|
-
this.frame.src = location;
|
222
|
-
} else {
|
223
|
-
this.frame.contentWindow.location.replace(location);
|
224
|
-
}
|
225
|
-
},
|
226
|
-
|
227
|
-
load: function(/* url, [callback] */) {
|
228
|
-
if (arguments.length > 1) {
|
229
|
-
this.loadCallback = arguments[1];
|
230
|
-
|
231
|
-
}
|
232
|
-
this._setLocation(arguments[0]);
|
233
|
-
}
|
234
|
-
|
235
|
-
});
|
236
|
-
|
237
|
-
/** HtmlTestSuiteFrame - encapsulates the suite iframe element */
|
238
|
-
var HtmlTestSuiteFrame = classCreate();
|
239
|
-
objectExtend(HtmlTestSuiteFrame.prototype, SeleniumFrame.prototype);
|
240
|
-
objectExtend(HtmlTestSuiteFrame.prototype, {
|
241
|
-
|
242
|
-
getCurrentTestSuite: function() {
|
243
|
-
if (!this.currentTestSuite) {
|
244
|
-
this.currentTestSuite = new HtmlTestSuite(this.getDocument());
|
245
|
-
}
|
246
|
-
return this.currentTestSuite;
|
247
|
-
}
|
248
|
-
|
249
|
-
});
|
250
|
-
|
251
|
-
/** HtmlTestFrame - encapsulates the test-case iframe element */
|
252
|
-
var HtmlTestFrame = classCreate();
|
253
|
-
objectExtend(HtmlTestFrame.prototype, SeleniumFrame.prototype);
|
254
|
-
objectExtend(HtmlTestFrame.prototype, {
|
255
|
-
|
256
|
-
_onLoad: function() {
|
257
|
-
this.currentTestCase = new HtmlTestCase(this.getDocument(), htmlTestRunner.getTestSuite().getCurrentRow());
|
258
|
-
},
|
259
|
-
|
260
|
-
getCurrentTestCase: function() {
|
261
|
-
return this.currentTestCase;
|
262
|
-
}
|
263
|
-
|
264
|
-
});
|
265
|
-
|
266
|
-
function onSeleniumLoad() {
|
267
|
-
suiteFrame = new HtmlTestSuiteFrame(getSuiteFrame());
|
268
|
-
testFrame = new HtmlTestFrame(getTestFrame());
|
269
|
-
htmlTestRunner = new HtmlTestRunner();
|
270
|
-
}
|
271
|
-
|
272
|
-
var suiteFrame;
|
273
|
-
var testFrame;
|
274
|
-
|
275
|
-
function getSuiteFrame() {
|
276
|
-
var f = sel$('testSuiteFrame');
|
277
|
-
if (f == null) {
|
278
|
-
f = top;
|
279
|
-
// proxyInjection mode does not set selenium_myiframe
|
280
|
-
}
|
281
|
-
return f;
|
282
|
-
}
|
283
|
-
|
284
|
-
function getTestFrame() {
|
285
|
-
var f = sel$('testFrame');
|
286
|
-
if (f == null) {
|
287
|
-
f = top;
|
288
|
-
// proxyInjection mode does not set selenium_myiframe
|
289
|
-
}
|
290
|
-
return f;
|
291
|
-
}
|
292
|
-
|
293
|
-
var HtmlTestRunnerControlPanel = classCreate();
|
294
|
-
objectExtend(HtmlTestRunnerControlPanel.prototype, URLConfiguration.prototype);
|
295
|
-
objectExtend(HtmlTestRunnerControlPanel.prototype, {
|
296
|
-
initialize: function() {
|
297
|
-
this._acquireQueryString();
|
298
|
-
|
299
|
-
this.runInterval = 0;
|
300
|
-
|
301
|
-
this.highlightOption = sel$('highlightOption');
|
302
|
-
this.pauseButton = sel$('pauseTest');
|
303
|
-
this.stepButton = sel$('stepTest');
|
304
|
-
|
305
|
-
this.highlightOption.onclick = fnBindAsEventListener((function() {
|
306
|
-
this.setHighlightOption();
|
307
|
-
}), this);
|
308
|
-
this.pauseButton.onclick = fnBindAsEventListener(this.pauseCurrentTest, this);
|
309
|
-
this.stepButton.onclick = fnBindAsEventListener(this.stepCurrentTest, this);
|
310
|
-
|
311
|
-
|
312
|
-
this.speedController = new Control.Slider('speedHandle', 'speedTrack', {
|
313
|
-
range: $R(0, 1000),
|
314
|
-
onSlide: fnBindAsEventListener(this.setRunInterval, this),
|
315
|
-
onChange: fnBindAsEventListener(this.setRunInterval, this)
|
316
|
-
});
|
317
|
-
|
318
|
-
this._parseQueryParameter();
|
319
|
-
},
|
320
|
-
|
321
|
-
setHighlightOption: function () {
|
322
|
-
var isHighlight = this.highlightOption.checked;
|
323
|
-
selenium.browserbot.setShouldHighlightElement(isHighlight);
|
324
|
-
},
|
325
|
-
|
326
|
-
_parseQueryParameter: function() {
|
327
|
-
var tempRunInterval = this._getQueryParameter("runInterval");
|
328
|
-
if (tempRunInterval) {
|
329
|
-
this.setRunInterval(tempRunInterval);
|
330
|
-
}
|
331
|
-
this.highlightOption.checked = this._getQueryParameter("highlight");
|
332
|
-
},
|
333
|
-
|
334
|
-
setRunInterval: function(runInterval) {
|
335
|
-
this.runInterval = runInterval;
|
336
|
-
},
|
337
|
-
|
338
|
-
setToPauseAtNextCommand: function() {
|
339
|
-
this.runInterval = -1;
|
340
|
-
},
|
341
|
-
|
342
|
-
pauseCurrentTest: function () {
|
343
|
-
this.setToPauseAtNextCommand();
|
344
|
-
this._switchPauseButtonToContinue();
|
345
|
-
},
|
346
|
-
|
347
|
-
continueCurrentTest: function () {
|
348
|
-
this.reset();
|
349
|
-
currentTest.resume();
|
350
|
-
},
|
351
|
-
|
352
|
-
reset: function() {
|
353
|
-
this.runInterval = this.speedController.value;
|
354
|
-
this._switchContinueButtonToPause();
|
355
|
-
},
|
356
|
-
|
357
|
-
_switchContinueButtonToPause: function() {
|
358
|
-
this.pauseButton.className = "cssPauseTest";
|
359
|
-
this.pauseButton.onclick = fnBindAsEventListener(this.pauseCurrentTest, this);
|
360
|
-
},
|
361
|
-
|
362
|
-
_switchPauseButtonToContinue: function() {
|
363
|
-
sel$('stepTest').disabled = false;
|
364
|
-
this.pauseButton.className = "cssContinueTest";
|
365
|
-
this.pauseButton.onclick = fnBindAsEventListener(this.continueCurrentTest, this);
|
366
|
-
},
|
367
|
-
|
368
|
-
stepCurrentTest: function () {
|
369
|
-
this.setToPauseAtNextCommand();
|
370
|
-
currentTest.resume();
|
371
|
-
},
|
372
|
-
|
373
|
-
isAutomatedRun: function() {
|
374
|
-
return this._isQueryParameterTrue("auto");
|
375
|
-
},
|
376
|
-
|
377
|
-
shouldSaveResultsToFile: function() {
|
378
|
-
return this._isQueryParameterTrue("save");
|
379
|
-
},
|
380
|
-
|
381
|
-
closeAfterTests: function() {
|
382
|
-
return this._isQueryParameterTrue("close");
|
383
|
-
},
|
384
|
-
|
385
|
-
getTestSuiteName: function() {
|
386
|
-
return this._getQueryParameter("test");
|
387
|
-
},
|
388
|
-
|
389
|
-
getSingleTestName: function() {
|
390
|
-
return this._getQueryParameter("singletest");
|
391
|
-
},
|
392
|
-
|
393
|
-
getAutoUrl: function() {
|
394
|
-
return this._getQueryParameter("autoURL");
|
395
|
-
},
|
396
|
-
|
397
|
-
getDefaultLogLevel: function() {
|
398
|
-
return this._getQueryParameter("defaultLogLevel");
|
399
|
-
},
|
400
|
-
|
401
|
-
getResultsUrl: function() {
|
402
|
-
return this._getQueryParameter("resultsUrl");
|
403
|
-
},
|
404
|
-
|
405
|
-
_acquireQueryString: function() {
|
406
|
-
if (this.queryString) return;
|
407
|
-
if (browserVersion.isHTA) {
|
408
|
-
var args = this._extractArgs();
|
409
|
-
if (args.length < 2) return null;
|
410
|
-
this.queryString = args[1];
|
411
|
-
} else {
|
412
|
-
this.queryString = location.search.substr(1);
|
413
|
-
}
|
414
|
-
}
|
415
|
-
|
416
|
-
});
|
417
|
-
|
418
|
-
var AbstractResultAwareRow = classCreate();
|
419
|
-
objectExtend(AbstractResultAwareRow.prototype, {
|
420
|
-
|
421
|
-
initialize: function(trElement) {
|
422
|
-
this.trElement = trElement;
|
423
|
-
},
|
424
|
-
|
425
|
-
setStatus: function(status) {
|
426
|
-
this.unselect();
|
427
|
-
this.trElement.className = this.trElement.className.replace(/status_[a-z]+/, "");
|
428
|
-
if (status) {
|
429
|
-
addClassName(this.trElement, "status_" + status);
|
430
|
-
}
|
431
|
-
},
|
432
|
-
|
433
|
-
select: function() {
|
434
|
-
addClassName(this.trElement, "selected");
|
435
|
-
safeScrollIntoView(this.trElement);
|
436
|
-
},
|
437
|
-
|
438
|
-
unselect: function() {
|
439
|
-
removeClassName(this.trElement, "selected");
|
440
|
-
},
|
441
|
-
|
442
|
-
markPassed: function() {
|
443
|
-
this.setStatus("passed");
|
444
|
-
},
|
445
|
-
|
446
|
-
markDone: function() {
|
447
|
-
this.setStatus("done");
|
448
|
-
},
|
449
|
-
|
450
|
-
markFailed: function() {
|
451
|
-
this.setStatus("failed");
|
452
|
-
}
|
453
|
-
|
454
|
-
});
|
455
|
-
|
456
|
-
var TitleRow = classCreate();
|
457
|
-
objectExtend(TitleRow.prototype, AbstractResultAwareRow.prototype);
|
458
|
-
objectExtend(TitleRow.prototype, {
|
459
|
-
|
460
|
-
initialize: function(trElement) {
|
461
|
-
this.trElement = trElement;
|
462
|
-
trElement.className = "title";
|
463
|
-
}
|
464
|
-
|
465
|
-
});
|
466
|
-
|
467
|
-
var HtmlTestCaseRow = classCreate();
|
468
|
-
objectExtend(HtmlTestCaseRow.prototype, AbstractResultAwareRow.prototype);
|
469
|
-
objectExtend(HtmlTestCaseRow.prototype, {
|
470
|
-
|
471
|
-
getCommand: function () {
|
472
|
-
return new SeleniumCommand(getText(this.trElement.cells[0]),
|
473
|
-
getText(this.trElement.cells[1]),
|
474
|
-
getText(this.trElement.cells[2]),
|
475
|
-
this.isBreakpoint());
|
476
|
-
},
|
477
|
-
|
478
|
-
markFailed: function(errorMsg) {
|
479
|
-
AbstractResultAwareRow.prototype.markFailed.call(this, errorMsg);
|
480
|
-
this.setMessage(errorMsg);
|
481
|
-
},
|
482
|
-
|
483
|
-
setMessage: function(message) {
|
484
|
-
setText(this.trElement.cells[2], message);
|
485
|
-
},
|
486
|
-
|
487
|
-
reset: function() {
|
488
|
-
this.setStatus(null);
|
489
|
-
var thirdCell = this.trElement.cells[2];
|
490
|
-
if (thirdCell) {
|
491
|
-
if (thirdCell.originalHTML) {
|
492
|
-
thirdCell.innerHTML = thirdCell.originalHTML;
|
493
|
-
} else {
|
494
|
-
thirdCell.originalHTML = thirdCell.innerHTML;
|
495
|
-
}
|
496
|
-
}
|
497
|
-
},
|
498
|
-
|
499
|
-
onClick: function() {
|
500
|
-
if (this.trElement.isBreakpoint == undefined) {
|
501
|
-
this.trElement.isBreakpoint = true;
|
502
|
-
addClassName(this.trElement, "breakpoint");
|
503
|
-
} else {
|
504
|
-
this.trElement.isBreakpoint = undefined;
|
505
|
-
removeClassName(this.trElement, "breakpoint");
|
506
|
-
}
|
507
|
-
},
|
508
|
-
|
509
|
-
addBreakpointSupport: function() {
|
510
|
-
elementSetStyle(this.trElement, {"cursor" : "pointer"});
|
511
|
-
this.trElement.onclick = fnBindAsEventListener(function() {
|
512
|
-
this.onClick();
|
513
|
-
}, this);
|
514
|
-
},
|
515
|
-
|
516
|
-
isBreakpoint: function() {
|
517
|
-
if (this.trElement.isBreakpoint == undefined || this.trElement.isBreakpoint == null) {
|
518
|
-
return false
|
519
|
-
}
|
520
|
-
return this.trElement.isBreakpoint;
|
521
|
-
}
|
522
|
-
});
|
523
|
-
|
524
|
-
var HtmlTestSuiteRow = classCreate();
|
525
|
-
objectExtend(HtmlTestSuiteRow.prototype, AbstractResultAwareRow.prototype);
|
526
|
-
objectExtend(HtmlTestSuiteRow.prototype, {
|
527
|
-
|
528
|
-
initialize: function(trElement, testFrame, htmlTestSuite) {
|
529
|
-
this.trElement = trElement;
|
530
|
-
this.testFrame = testFrame;
|
531
|
-
this.htmlTestSuite = htmlTestSuite;
|
532
|
-
this.link = trElement.getElementsByTagName("a")[0];
|
533
|
-
this.link.onclick = fnBindAsEventListener(this._onClick, this);
|
534
|
-
},
|
535
|
-
|
536
|
-
reset: function() {
|
537
|
-
this.setStatus(null);
|
538
|
-
},
|
539
|
-
|
540
|
-
_onClick: function() {
|
541
|
-
this.loadTestCase(null);
|
542
|
-
return false;
|
543
|
-
},
|
544
|
-
|
545
|
-
loadTestCase: function(onloadFunction) {
|
546
|
-
this.htmlTestSuite.unselectCurrentRow();
|
547
|
-
this.select();
|
548
|
-
this.htmlTestSuite.currentRowInSuite = this.trElement.rowIndex - 1;
|
549
|
-
// If the row has a stored results table, use that
|
550
|
-
var resultsFromPreviousRun = this.trElement.cells[1];
|
551
|
-
if (resultsFromPreviousRun) {
|
552
|
-
// todo: delegate to TestFrame, e.g.
|
553
|
-
// this.testFrame.restoreTestCase(resultsFromPreviousRun.innerHTML);
|
554
|
-
var testBody = this.testFrame.getDocument().body;
|
555
|
-
testBody.innerHTML = resultsFromPreviousRun.innerHTML;
|
556
|
-
this.testFrame._onLoad();
|
557
|
-
if (onloadFunction) {
|
558
|
-
onloadFunction();
|
559
|
-
}
|
560
|
-
} else {
|
561
|
-
this.testFrame.load(this.link.href, onloadFunction);
|
562
|
-
}
|
563
|
-
},
|
564
|
-
|
565
|
-
saveTestResults: function() {
|
566
|
-
// todo: GLOBAL ACCESS!
|
567
|
-
var resultHTML = this.testFrame.getDocument().body.innerHTML;
|
568
|
-
if (!resultHTML) return;
|
569
|
-
|
570
|
-
// todo: why create this div?
|
571
|
-
var divElement = this.trElement.ownerDocument.createElement("div");
|
572
|
-
divElement.innerHTML = resultHTML;
|
573
|
-
|
574
|
-
var hiddenCell = this.trElement.ownerDocument.createElement("td");
|
575
|
-
hiddenCell.appendChild(divElement);
|
576
|
-
hiddenCell.style.display = "none";
|
577
|
-
|
578
|
-
this.trElement.appendChild(hiddenCell);
|
579
|
-
}
|
580
|
-
|
581
|
-
});
|
582
|
-
|
583
|
-
var HtmlTestSuite = classCreate();
|
584
|
-
objectExtend(HtmlTestSuite.prototype, {
|
585
|
-
|
586
|
-
initialize: function(suiteDocument) {
|
587
|
-
this.suiteDocument = suiteDocument;
|
588
|
-
this.suiteRows = this._collectSuiteRows();
|
589
|
-
this.titleRow = new TitleRow(this.getTestTable().rows[0]);
|
590
|
-
this.reset();
|
591
|
-
},
|
592
|
-
|
593
|
-
reset: function() {
|
594
|
-
this.failed = false;
|
595
|
-
this.currentRowInSuite = -1;
|
596
|
-
this.titleRow.setStatus(null);
|
597
|
-
for (var i = 0; i < this.suiteRows.length; i++) {
|
598
|
-
var row = this.suiteRows[i];
|
599
|
-
row.reset();
|
600
|
-
}
|
601
|
-
},
|
602
|
-
|
603
|
-
getSuiteRows: function() {
|
604
|
-
return this.suiteRows;
|
605
|
-
},
|
606
|
-
|
607
|
-
getTestTable: function() {
|
608
|
-
var tables = sel$A(this.suiteDocument.getElementsByTagName("table"));
|
609
|
-
return tables[0];
|
610
|
-
},
|
611
|
-
|
612
|
-
isAvailable: function() {
|
613
|
-
return this.getTestTable() != null;
|
614
|
-
},
|
615
|
-
|
616
|
-
_collectSuiteRows: function () {
|
617
|
-
var result = [];
|
618
|
-
var tables = sel$A(this.suiteDocument.getElementsByTagName("table"));
|
619
|
-
var testTable = tables[0];
|
620
|
-
for (rowNum = 1; rowNum < testTable.rows.length; rowNum++) {
|
621
|
-
var rowElement = testTable.rows[rowNum];
|
622
|
-
result.push(new HtmlTestSuiteRow(rowElement, testFrame, this));
|
623
|
-
}
|
624
|
-
|
625
|
-
// process the unsuited rows as well
|
626
|
-
for (var tableNum = 1; tableNum < sel$A(this.suiteDocument.getElementsByTagName("table")).length; tableNum++) {
|
627
|
-
testTable = tables[tableNum];
|
628
|
-
for (rowNum = 1; rowNum < testTable.rows.length; rowNum++) {
|
629
|
-
var rowElement = testTable.rows[rowNum];
|
630
|
-
new HtmlTestSuiteRow(rowElement, testFrame, this);
|
631
|
-
}
|
632
|
-
}
|
633
|
-
return result;
|
634
|
-
},
|
635
|
-
|
636
|
-
getCurrentRow: function() {
|
637
|
-
if (this.currentRowInSuite == -1) {
|
638
|
-
return null;
|
639
|
-
}
|
640
|
-
return this.suiteRows[this.currentRowInSuite];
|
641
|
-
},
|
642
|
-
|
643
|
-
unselectCurrentRow: function() {
|
644
|
-
var currentRow = this.getCurrentRow()
|
645
|
-
if (currentRow) {
|
646
|
-
currentRow.unselect();
|
647
|
-
}
|
648
|
-
},
|
649
|
-
|
650
|
-
markFailed: function() {
|
651
|
-
this.failed = true;
|
652
|
-
this.titleRow.markFailed();
|
653
|
-
},
|
654
|
-
|
655
|
-
markDone: function() {
|
656
|
-
if (!this.failed) {
|
657
|
-
this.titleRow.markPassed();
|
658
|
-
}
|
659
|
-
},
|
660
|
-
|
661
|
-
_startCurrentTestCase: function() {
|
662
|
-
this.getCurrentRow().loadTestCase(fnBind(htmlTestRunner.startTest, htmlTestRunner));
|
663
|
-
},
|
664
|
-
|
665
|
-
_onTestSuiteComplete: function() {
|
666
|
-
this.markDone();
|
667
|
-
new TestResult(this.failed, this.getTestTable()).post();
|
668
|
-
},
|
669
|
-
|
670
|
-
updateSuiteWithResultOfPreviousTest: function() {
|
671
|
-
if (this.currentRowInSuite >= 0) {
|
672
|
-
this.getCurrentRow().saveTestResults();
|
673
|
-
}
|
674
|
-
},
|
675
|
-
|
676
|
-
runNextTestInSuite: function() {
|
677
|
-
this.currentRowInSuite++;
|
678
|
-
|
679
|
-
// If we are done with all of the tests, set the title bar as pass or fail
|
680
|
-
if (this.currentRowInSuite >= this.suiteRows.length) {
|
681
|
-
this._onTestSuiteComplete();
|
682
|
-
} else {
|
683
|
-
this._startCurrentTestCase();
|
684
|
-
}
|
685
|
-
}
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
});
|
690
|
-
|
691
|
-
var TestResult = classCreate();
|
692
|
-
objectExtend(TestResult.prototype, {
|
693
|
-
|
694
|
-
// Post the results to a servlet, CGI-script, etc. The URL of the
|
695
|
-
// results-handler defaults to "/postResults", but an alternative location
|
696
|
-
// can be specified by providing a "resultsUrl" query parameter.
|
697
|
-
//
|
698
|
-
// Parameters passed to the results-handler are:
|
699
|
-
// result: passed/failed depending on whether the suite passed or failed
|
700
|
-
// totalTime: the total running time in seconds for the suite.
|
701
|
-
//
|
702
|
-
// numTestPasses: the total number of tests which passed.
|
703
|
-
// numTestFailures: the total number of tests which failed.
|
704
|
-
//
|
705
|
-
// numCommandPasses: the total number of commands which passed.
|
706
|
-
// numCommandFailures: the total number of commands which failed.
|
707
|
-
// numCommandErrors: the total number of commands which errored.
|
708
|
-
//
|
709
|
-
// suite: the suite table, including the hidden column of test results
|
710
|
-
// testTable.1 to testTable.N: the individual test tables
|
711
|
-
//
|
712
|
-
initialize: function (suiteFailed, suiteTable) {
|
713
|
-
this.controlPanel = htmlTestRunner.controlPanel;
|
714
|
-
this.metrics = htmlTestRunner.metrics;
|
715
|
-
this.suiteFailed = suiteFailed;
|
716
|
-
this.suiteTable = suiteTable;
|
717
|
-
},
|
718
|
-
|
719
|
-
post: function () {
|
720
|
-
if (!this.controlPanel.isAutomatedRun()) {
|
721
|
-
return;
|
722
|
-
}
|
723
|
-
var form = document.createElement("form");
|
724
|
-
document.body.appendChild(form);
|
725
|
-
|
726
|
-
form.id = "resultsForm";
|
727
|
-
form.method = "post";
|
728
|
-
form.target = "selenium_myiframe";
|
729
|
-
|
730
|
-
var resultsUrl = this.controlPanel.getResultsUrl();
|
731
|
-
if (!resultsUrl) {
|
732
|
-
resultsUrl = "./postResults";
|
733
|
-
}
|
734
|
-
|
735
|
-
var actionAndParameters = resultsUrl.split('?', 2);
|
736
|
-
form.action = actionAndParameters[0];
|
737
|
-
var resultsUrlQueryString = actionAndParameters[1];
|
738
|
-
|
739
|
-
form.createHiddenField = function(name, value) {
|
740
|
-
input = document.createElement("input");
|
741
|
-
input.type = "hidden";
|
742
|
-
input.name = name;
|
743
|
-
input.value = value;
|
744
|
-
this.appendChild(input);
|
745
|
-
};
|
746
|
-
|
747
|
-
if (resultsUrlQueryString) {
|
748
|
-
var clauses = resultsUrlQueryString.split('&');
|
749
|
-
for (var i = 0; i < clauses.length; i++) {
|
750
|
-
var keyValuePair = clauses[i].split('=', 2);
|
751
|
-
var key = unescape(keyValuePair[0]);
|
752
|
-
var value = unescape(keyValuePair[1]);
|
753
|
-
form.createHiddenField(key, value);
|
754
|
-
}
|
755
|
-
}
|
756
|
-
|
757
|
-
form.createHiddenField("selenium.version", Selenium.version);
|
758
|
-
form.createHiddenField("selenium.revision", Selenium.revision);
|
759
|
-
|
760
|
-
form.createHiddenField("result", this.suiteFailed ? "failed" : "passed");
|
761
|
-
|
762
|
-
form.createHiddenField("totalTime", Math.floor((this.metrics.currentTime - this.metrics.startTime) / 1000));
|
763
|
-
form.createHiddenField("numTestPasses", this.metrics.numTestPasses);
|
764
|
-
form.createHiddenField("numTestFailures", this.metrics.numTestFailures);
|
765
|
-
form.createHiddenField("numCommandPasses", this.metrics.numCommandPasses);
|
766
|
-
form.createHiddenField("numCommandFailures", this.metrics.numCommandFailures);
|
767
|
-
form.createHiddenField("numCommandErrors", this.metrics.numCommandErrors);
|
768
|
-
|
769
|
-
// Create an input for each test table. The inputs are named
|
770
|
-
// testTable.1, testTable.2, etc.
|
771
|
-
for (rowNum = 1; rowNum < this.suiteTable.rows.length; rowNum++) {
|
772
|
-
// If there is a second column, then add a new input
|
773
|
-
if (this.suiteTable.rows[rowNum].cells.length > 1) {
|
774
|
-
var resultCell = this.suiteTable.rows[rowNum].cells[1];
|
775
|
-
form.createHiddenField("testTable." + rowNum, resultCell.innerHTML);
|
776
|
-
// remove the resultCell, so it's not included in the suite HTML
|
777
|
-
resultCell.parentNode.removeChild(resultCell);
|
778
|
-
}
|
779
|
-
}
|
780
|
-
|
781
|
-
form.createHiddenField("numTestTotal", rowNum-1);
|
782
|
-
|
783
|
-
// Add HTML for the suite itself
|
784
|
-
form.createHiddenField("suite", this.suiteTable.parentNode.innerHTML);
|
785
|
-
|
786
|
-
var logMessages = [];
|
787
|
-
while (LOG.pendingMessages.length > 0) {
|
788
|
-
var msg = LOG.pendingMessages.shift();
|
789
|
-
logMessages.push(msg.type);
|
790
|
-
logMessages.push(": ");
|
791
|
-
logMessages.push(msg.msg);
|
792
|
-
logMessages.push('\n');
|
793
|
-
}
|
794
|
-
var logOutput = logMessages.join("");
|
795
|
-
form.createHiddenField("log", logOutput);
|
796
|
-
|
797
|
-
if (this.controlPanel.shouldSaveResultsToFile()) {
|
798
|
-
this._saveToFile(resultsUrl, form);
|
799
|
-
} else {
|
800
|
-
form.submit();
|
801
|
-
}
|
802
|
-
document.body.removeChild(form);
|
803
|
-
if (this.controlPanel.closeAfterTests()) {
|
804
|
-
window.top.close();
|
805
|
-
}
|
806
|
-
},
|
807
|
-
|
808
|
-
_saveToFile: function (fileName, form) {
|
809
|
-
// This only works when run as an IE HTA
|
810
|
-
var inputs = new Object();
|
811
|
-
for (var i = 0; i < form.elements.length; i++) {
|
812
|
-
inputs[form.elements[i].name] = form.elements[i].value;
|
813
|
-
}
|
814
|
-
|
815
|
-
var objFSO = new ActiveXObject("Scripting.FileSystemObject")
|
816
|
-
|
817
|
-
// DGF get CSS
|
818
|
-
var styles = "";
|
819
|
-
try {
|
820
|
-
var styleSheetPath = window.location.pathname.replace(/[^\/\\]+$/, "selenium-test.css");
|
821
|
-
if (window.location.protocol == "file:") {
|
822
|
-
var stylesFile = objFSO.OpenTextFile(styleSheetPath, 1);
|
823
|
-
styles = stylesFile.ReadAll();
|
824
|
-
} else {
|
825
|
-
var xhr = XmlHttp.create();
|
826
|
-
xhr.open("GET", styleSheetPath, false);
|
827
|
-
xhr.send("");
|
828
|
-
styles = xhr.responseText;
|
829
|
-
}
|
830
|
-
} catch (e) {}
|
831
|
-
|
832
|
-
var scriptFile = objFSO.CreateTextFile(fileName);
|
833
|
-
|
834
|
-
|
835
|
-
scriptFile.WriteLine("<html><head><title>Test suite results</title><style>");
|
836
|
-
scriptFile.WriteLine(styles);
|
837
|
-
scriptFile.WriteLine("</style>");
|
838
|
-
scriptFile.WriteLine("<body>\n<h1>Test suite results</h1>" +
|
839
|
-
"\n\n<table>\n<tr>\n<td>result:</td>\n<td>" + inputs["result"] + "</td>\n" +
|
840
|
-
"</tr>\n<tr>\n<td>totalTime:</td>\n<td>" + inputs["totalTime"] + "</td>\n</tr>\n" +
|
841
|
-
"<tr>\n<td>numTestTotal:</td>\n<td>" + inputs["numTestTotal"] + "</td>\n</tr>\n" +
|
842
|
-
"<tr>\n<td>numTestPasses:</td>\n<td>" + inputs["numTestPasses"] + "</td>\n</tr>\n" +
|
843
|
-
"<tr>\n<td>numTestFailures:</td>\n<td>" + inputs["numTestFailures"] + "</td>\n</tr>\n" +
|
844
|
-
"<tr>\n<td>numCommandPasses:</td>\n<td>" + inputs["numCommandPasses"] + "</td>\n</tr>\n" +
|
845
|
-
"<tr>\n<td>numCommandFailures:</td>\n<td>" + inputs["numCommandFailures"] + "</td>\n</tr>\n" +
|
846
|
-
"<tr>\n<td>numCommandErrors:</td>\n<td>" + inputs["numCommandErrors"] + "</td>\n</tr>\n" +
|
847
|
-
"<tr>\n<td>" + inputs["suite"] + "</td>\n<td> </td>\n</tr></table><table>");
|
848
|
-
var testNum = inputs["numTestTotal"];
|
849
|
-
|
850
|
-
for (var rowNum = 1; rowNum <= testNum; rowNum++) {
|
851
|
-
scriptFile.WriteLine("<tr>\n<td>" + inputs["testTable." + rowNum] + "</td>\n<td> </td>\n</tr>");
|
852
|
-
}
|
853
|
-
scriptFile.WriteLine("</table><pre>");
|
854
|
-
var log = inputs["log"];
|
855
|
-
log=log.replace(/&/gm,"&").replace(/</gm,"<").replace(/>/gm,">").replace(/"/gm,""").replace(/'/gm,"'");
|
856
|
-
scriptFile.WriteLine(log);
|
857
|
-
scriptFile.WriteLine("</pre></body></html>");
|
858
|
-
scriptFile.Close();
|
859
|
-
}
|
860
|
-
});
|
861
|
-
|
862
|
-
/** HtmlTestCase encapsulates an HTML test document */
|
863
|
-
var HtmlTestCase = classCreate();
|
864
|
-
objectExtend(HtmlTestCase.prototype, {
|
865
|
-
|
866
|
-
initialize: function(testDocument, htmlTestSuiteRow) {
|
867
|
-
if (testDocument == null) {
|
868
|
-
throw "testDocument should not be null";
|
869
|
-
}
|
870
|
-
if (htmlTestSuiteRow == null) {
|
871
|
-
throw "htmlTestSuiteRow should not be null";
|
872
|
-
}
|
873
|
-
this.testDocument = testDocument;
|
874
|
-
this.htmlTestSuiteRow = htmlTestSuiteRow;
|
875
|
-
this.headerRow = new TitleRow(this.testDocument.getElementsByTagName("tr")[0]);
|
876
|
-
this.commandRows = this._collectCommandRows();
|
877
|
-
this.nextCommandRowIndex = 0;
|
878
|
-
this._addBreakpointSupport();
|
879
|
-
},
|
880
|
-
|
881
|
-
_collectCommandRows: function () {
|
882
|
-
var commandRows = [];
|
883
|
-
var tables = sel$A(this.testDocument.getElementsByTagName("table"));
|
884
|
-
var self = this;
|
885
|
-
for (var i = 0; i < tables.length; i++) {
|
886
|
-
var table = tables[i];
|
887
|
-
var tableRows = sel$A(table.rows);
|
888
|
-
for (var j = 0; j < tableRows.length; j++) {
|
889
|
-
var candidateRow = tableRows[j];
|
890
|
-
if (self.isCommandRow(candidateRow)) {
|
891
|
-
commandRows.push(new HtmlTestCaseRow(candidateRow));
|
892
|
-
}
|
893
|
-
}
|
894
|
-
}
|
895
|
-
return commandRows;
|
896
|
-
},
|
897
|
-
|
898
|
-
isCommandRow: function (row) {
|
899
|
-
return row.cells.length >= 3;
|
900
|
-
},
|
901
|
-
|
902
|
-
reset: function() {
|
903
|
-
/**
|
904
|
-
* reset the test to runnable state
|
905
|
-
*/
|
906
|
-
this.nextCommandRowIndex = 0;
|
907
|
-
|
908
|
-
this.setStatus('');
|
909
|
-
for (var i = 0; i < this.commandRows.length; i++) {
|
910
|
-
var row = this.commandRows[i];
|
911
|
-
row.reset();
|
912
|
-
}
|
913
|
-
|
914
|
-
// remove any additional fake "error" row added to the end of the document
|
915
|
-
var errorElement = this.testDocument.getElementById('error');
|
916
|
-
if (errorElement) {
|
917
|
-
errorElement.parentNode.removeChild(errorElement);
|
918
|
-
}
|
919
|
-
},
|
920
|
-
|
921
|
-
getCommandRows: function () {
|
922
|
-
return this.commandRows;
|
923
|
-
},
|
924
|
-
|
925
|
-
setStatus: function(status) {
|
926
|
-
this.headerRow.setStatus(status);
|
927
|
-
},
|
928
|
-
|
929
|
-
markFailed: function() {
|
930
|
-
this.setStatus("failed");
|
931
|
-
this.htmlTestSuiteRow.markFailed();
|
932
|
-
},
|
933
|
-
|
934
|
-
markPassed: function() {
|
935
|
-
this.setStatus("passed");
|
936
|
-
this.htmlTestSuiteRow.markPassed();
|
937
|
-
},
|
938
|
-
|
939
|
-
addErrorMessage: function(errorMsg, currentRow) {
|
940
|
-
errorMsg = errorMsg.replace(/ /g, String.fromCharCode(160)).replace("\n", '\\n');
|
941
|
-
if (currentRow) {
|
942
|
-
currentRow.markFailed(errorMsg);
|
943
|
-
} else {
|
944
|
-
var errorElement = this.testDocument.createElement("p");
|
945
|
-
errorElement.id = "error";
|
946
|
-
setText(errorElement, errorMsg);
|
947
|
-
this.testDocument.body.appendChild(errorElement);
|
948
|
-
errorElement.className = "status_failed";
|
949
|
-
}
|
950
|
-
},
|
951
|
-
|
952
|
-
_addBreakpointSupport: function() {
|
953
|
-
for (var i = 0; i < this.commandRows.length; i++) {
|
954
|
-
var row = this.commandRows[i];
|
955
|
-
row.addBreakpointSupport();
|
956
|
-
}
|
957
|
-
},
|
958
|
-
|
959
|
-
hasMoreCommandRows: function() {
|
960
|
-
return this.nextCommandRowIndex < this.commandRows.length;
|
961
|
-
},
|
962
|
-
|
963
|
-
getNextCommandRow: function() {
|
964
|
-
if (this.hasMoreCommandRows()) {
|
965
|
-
return this.commandRows[this.nextCommandRowIndex++];
|
966
|
-
}
|
967
|
-
return null;
|
968
|
-
}
|
969
|
-
|
970
|
-
});
|
971
|
-
|
972
|
-
|
973
|
-
// TODO: split out an JavascriptTestCase class to handle the "sejs" stuff
|
974
|
-
|
975
|
-
var get_new_rows = function() {
|
976
|
-
var row_array = new Array();
|
977
|
-
for (var i = 0; i < new_block.length; i++) {
|
978
|
-
|
979
|
-
var new_source = (new_block[i][0].tokenizer.source.slice(new_block[i][0].start,
|
980
|
-
new_block[i][0].end));
|
981
|
-
|
982
|
-
var row = '<td style="display:none;" class="js">getEval</td>' +
|
983
|
-
'<td style="display:none;">currentTest.doNextCommand()</td>' +
|
984
|
-
'<td style="white-space: pre;">' + new_source + '</td>' +
|
985
|
-
'<td></td>'
|
986
|
-
|
987
|
-
row_array.push(row);
|
988
|
-
}
|
989
|
-
return row_array;
|
990
|
-
};
|
991
|
-
|
992
|
-
|
993
|
-
var Metrics = classCreate();
|
994
|
-
objectExtend(Metrics.prototype, {
|
995
|
-
initialize: function() {
|
996
|
-
// The number of tests run
|
997
|
-
this.numTestPasses = 0;
|
998
|
-
// The number of tests that have failed
|
999
|
-
this.numTestFailures = 0;
|
1000
|
-
// The number of commands which have passed
|
1001
|
-
this.numCommandPasses = 0;
|
1002
|
-
// The number of commands which have failed
|
1003
|
-
this.numCommandFailures = 0;
|
1004
|
-
// The number of commands which have caused errors (element not found)
|
1005
|
-
this.numCommandErrors = 0;
|
1006
|
-
// The time that the test was started.
|
1007
|
-
this.startTime = null;
|
1008
|
-
// The current time.
|
1009
|
-
this.currentTime = null;
|
1010
|
-
},
|
1011
|
-
|
1012
|
-
printMetrics: function() {
|
1013
|
-
setText(sel$('commandPasses'), this.numCommandPasses);
|
1014
|
-
setText(sel$('commandFailures'), this.numCommandFailures);
|
1015
|
-
setText(sel$('commandErrors'), this.numCommandErrors);
|
1016
|
-
setText(sel$('testRuns'), this.numTestPasses + this.numTestFailures);
|
1017
|
-
setText(sel$('testFailures'), this.numTestFailures);
|
1018
|
-
|
1019
|
-
this.currentTime = new Date().getTime();
|
1020
|
-
|
1021
|
-
var timeDiff = this.currentTime - this.startTime;
|
1022
|
-
var totalSecs = Math.floor(timeDiff / 1000);
|
1023
|
-
|
1024
|
-
var minutes = Math.floor(totalSecs / 60);
|
1025
|
-
var seconds = totalSecs % 60;
|
1026
|
-
|
1027
|
-
setText(sel$('elapsedTime'), this._pad(minutes) + ":" + this._pad(seconds));
|
1028
|
-
},
|
1029
|
-
|
1030
|
-
// Puts a leading 0 on num if it is less than 10
|
1031
|
-
_pad: function(num) {
|
1032
|
-
return (num > 9) ? num : "0" + num;
|
1033
|
-
},
|
1034
|
-
|
1035
|
-
resetMetrics: function() {
|
1036
|
-
this.numTestPasses = 0;
|
1037
|
-
this.numTestFailures = 0;
|
1038
|
-
this.numCommandPasses = 0;
|
1039
|
-
this.numCommandFailures = 0;
|
1040
|
-
this.numCommandErrors = 0;
|
1041
|
-
this.startTime = new Date().getTime();
|
1042
|
-
}
|
1043
|
-
|
1044
|
-
});
|
1045
|
-
|
1046
|
-
var HtmlRunnerCommandFactory = classCreate();
|
1047
|
-
objectExtend(HtmlRunnerCommandFactory.prototype, {
|
1048
|
-
|
1049
|
-
initialize: function(seleniumCommandFactory, testLoop) {
|
1050
|
-
this.seleniumCommandFactory = seleniumCommandFactory;
|
1051
|
-
this.testLoop = testLoop;
|
1052
|
-
this.handlers = {};
|
1053
|
-
//todo: register commands
|
1054
|
-
},
|
1055
|
-
|
1056
|
-
getCommandHandler: function(command) {
|
1057
|
-
if (this.handlers[command]) {
|
1058
|
-
return this.handlers[command];
|
1059
|
-
}
|
1060
|
-
return this.seleniumCommandFactory.getCommandHandler(command);
|
1061
|
-
}
|
1062
|
-
|
1063
|
-
});
|
1064
|
-
|
1065
|
-
var HtmlRunnerTestLoop = classCreate();
|
1066
|
-
objectExtend(HtmlRunnerTestLoop.prototype, new TestLoop());
|
1067
|
-
objectExtend(HtmlRunnerTestLoop.prototype, {
|
1068
|
-
initialize: function(htmlTestCase, metrics, seleniumCommandFactory) {
|
1069
|
-
|
1070
|
-
this.commandFactory = new HtmlRunnerCommandFactory(seleniumCommandFactory, this);
|
1071
|
-
this.metrics = metrics;
|
1072
|
-
|
1073
|
-
this.htmlTestCase = htmlTestCase;
|
1074
|
-
LOG.info("Starting test " + htmlTestCase.testDocument.location.pathname);
|
1075
|
-
|
1076
|
-
se = selenium;
|
1077
|
-
global.se = selenium;
|
1078
|
-
|
1079
|
-
this.currentRow = null;
|
1080
|
-
this.currentRowIndex = 0;
|
1081
|
-
|
1082
|
-
// used for selenium tests in javascript
|
1083
|
-
this.currentItem = null;
|
1084
|
-
this.commandAgenda = new Array();
|
1085
|
-
this.expectedFailure = null;
|
1086
|
-
this.expectedFailureType = null;
|
1087
|
-
|
1088
|
-
this.htmlTestCase.reset();
|
1089
|
-
|
1090
|
-
this.sejsElement = this.htmlTestCase.testDocument.getElementById('sejs');
|
1091
|
-
if (this.sejsElement) {
|
1092
|
-
var fname = 'Selenium JavaScript';
|
1093
|
-
parse_result = parse(this.sejsElement.innerHTML, fname, 0);
|
1094
|
-
|
1095
|
-
var x2 = new ExecutionContext(GLOBAL_CODE);
|
1096
|
-
ExecutionContext.current = x2;
|
1097
|
-
|
1098
|
-
execute(parse_result, x2)
|
1099
|
-
}
|
1100
|
-
},
|
1101
|
-
|
1102
|
-
_advanceToNextRow: function() {
|
1103
|
-
if (this.htmlTestCase.hasMoreCommandRows()) {
|
1104
|
-
this.currentRow = this.htmlTestCase.getNextCommandRow();
|
1105
|
-
if (this.sejsElement) {
|
1106
|
-
this.currentItem = agenda.pop();
|
1107
|
-
this.currentRowIndex++;
|
1108
|
-
}
|
1109
|
-
} else {
|
1110
|
-
this.currentRow = null;
|
1111
|
-
this.currentItem = null;
|
1112
|
-
}
|
1113
|
-
},
|
1114
|
-
|
1115
|
-
nextCommand : function() {
|
1116
|
-
this._advanceToNextRow();
|
1117
|
-
if (this.currentRow == null) {
|
1118
|
-
return null;
|
1119
|
-
}
|
1120
|
-
return this.currentRow.getCommand();
|
1121
|
-
},
|
1122
|
-
|
1123
|
-
commandStarted : function() {
|
1124
|
-
sel$('pauseTest').disabled = false;
|
1125
|
-
this.currentRow.select();
|
1126
|
-
this.metrics.printMetrics();
|
1127
|
-
},
|
1128
|
-
|
1129
|
-
commandComplete : function(result) {
|
1130
|
-
this._checkExpectedFailure(result);
|
1131
|
-
if (result.failed) {
|
1132
|
-
this.metrics.numCommandFailures += 1;
|
1133
|
-
this._recordFailure(result.failureMessage);
|
1134
|
-
} else if (result.passed) {
|
1135
|
-
this.metrics.numCommandPasses += 1;
|
1136
|
-
this.currentRow.markPassed();
|
1137
|
-
} else {
|
1138
|
-
this.currentRow.markDone();
|
1139
|
-
}
|
1140
|
-
},
|
1141
|
-
|
1142
|
-
_checkExpectedFailure : function(result) {
|
1143
|
-
if (this.expectedFailure != null) {
|
1144
|
-
if (this.expectedFailureJustSet) {
|
1145
|
-
this.expectedFailureJustSet = false;
|
1146
|
-
return;
|
1147
|
-
}
|
1148
|
-
if (!result.failed) {
|
1149
|
-
result.passed = false;
|
1150
|
-
result.failed = true;
|
1151
|
-
result.failureMessage = "Expected " + this.expectedFailureType + " did not occur.";
|
1152
|
-
} else {
|
1153
|
-
if (PatternMatcher.matches(this.expectedFailure, result.failureMessage)) {
|
1154
|
-
var failureType = result.error ? "error" : "failure";
|
1155
|
-
if (failureType == this.expectedFailureType) {
|
1156
|
-
result.failed = false;
|
1157
|
-
result.passed = true;
|
1158
|
-
} else {
|
1159
|
-
result.failed = true;
|
1160
|
-
result.failureMessage = "Expected "+this.expectedFailureType+", but "+failureType+" occurred instead";
|
1161
|
-
}
|
1162
|
-
} else {
|
1163
|
-
result.failed = true;
|
1164
|
-
result.failureMessage = "Expected " + this.expectedFailureType + " message '" + this.expectedFailure
|
1165
|
-
+ "' but was '" + result.failureMessage + "'";
|
1166
|
-
}
|
1167
|
-
}
|
1168
|
-
this.expectedFailure = null;
|
1169
|
-
this.expectedFailureType = null;
|
1170
|
-
}
|
1171
|
-
},
|
1172
|
-
|
1173
|
-
commandError : function(errorMessage) {
|
1174
|
-
var tempResult = {};
|
1175
|
-
tempResult.passed = false;
|
1176
|
-
tempResult.failed = true;
|
1177
|
-
tempResult.error = true;
|
1178
|
-
tempResult.failureMessage = errorMessage;
|
1179
|
-
this._checkExpectedFailure(tempResult);
|
1180
|
-
if (tempResult.passed) {
|
1181
|
-
this.currentRow.markDone();
|
1182
|
-
return true;
|
1183
|
-
}
|
1184
|
-
errorMessage = tempResult.failureMessage;
|
1185
|
-
this.metrics.numCommandErrors += 1;
|
1186
|
-
this._recordFailure(errorMessage);
|
1187
|
-
},
|
1188
|
-
|
1189
|
-
_recordFailure : function(errorMsg) {
|
1190
|
-
LOG.warn("currentTest.recordFailure: " + errorMsg);
|
1191
|
-
htmlTestRunner.markFailed();
|
1192
|
-
this.htmlTestCase.addErrorMessage(errorMsg, this.currentRow);
|
1193
|
-
},
|
1194
|
-
|
1195
|
-
testComplete : function() {
|
1196
|
-
sel$('pauseTest').disabled = true;
|
1197
|
-
sel$('stepTest').disabled = true;
|
1198
|
-
if (htmlTestRunner.testFailed) {
|
1199
|
-
this.htmlTestCase.markFailed();
|
1200
|
-
this.metrics.numTestFailures += 1;
|
1201
|
-
} else {
|
1202
|
-
this.htmlTestCase.markPassed();
|
1203
|
-
this.metrics.numTestPasses += 1;
|
1204
|
-
}
|
1205
|
-
|
1206
|
-
this.metrics.printMetrics();
|
1207
|
-
|
1208
|
-
window.setTimeout(function() {
|
1209
|
-
htmlTestRunner.runNextTest();
|
1210
|
-
}, 1);
|
1211
|
-
},
|
1212
|
-
|
1213
|
-
getCommandInterval : function() {
|
1214
|
-
return htmlTestRunner.controlPanel.runInterval;
|
1215
|
-
},
|
1216
|
-
|
1217
|
-
pause : function() {
|
1218
|
-
htmlTestRunner.controlPanel.pauseCurrentTest();
|
1219
|
-
},
|
1220
|
-
|
1221
|
-
doNextCommand: function() {
|
1222
|
-
var _n = this.currentItem[0];
|
1223
|
-
var _x = this.currentItem[1];
|
1224
|
-
|
1225
|
-
new_block = new Array()
|
1226
|
-
execute(_n, _x);
|
1227
|
-
if (new_block.length > 0) {
|
1228
|
-
var the_table = this.htmlTestCase.testDocument.getElementById("se-js-table")
|
1229
|
-
var loc = this.currentRowIndex
|
1230
|
-
var new_rows = get_new_rows()
|
1231
|
-
|
1232
|
-
// make the new statements visible on screen...
|
1233
|
-
for (var i = 0; i < new_rows.length; i++) {
|
1234
|
-
the_table.insertRow(loc + 1);
|
1235
|
-
the_table.rows[loc + 1].innerHTML = new_rows[i];
|
1236
|
-
this.commandRows.unshift(the_table.rows[loc + 1])
|
1237
|
-
}
|
1238
|
-
|
1239
|
-
}
|
1240
|
-
}
|
1241
|
-
|
1242
|
-
});
|
1243
|
-
|
1244
|
-
Selenium.prototype.doPause = function(waitTime) {
|
1245
|
-
/** Wait for the specified amount of time (in milliseconds)
|
1246
|
-
* @param waitTime the amount of time to sleep (in milliseconds)
|
1247
|
-
*/
|
1248
|
-
// todo: should not refer to currentTest directly
|
1249
|
-
currentTest.pauseInterval = waitTime;
|
1250
|
-
};
|
1251
|
-
|
1252
|
-
Selenium.prototype.doBreak = function() {
|
1253
|
-
/** Halt the currently running test, and wait for the user to press the Continue button.
|
1254
|
-
* This command is useful for debugging, but be careful when using it, because it will
|
1255
|
-
* force automated tests to hang until a user intervenes manually.
|
1256
|
-
*/
|
1257
|
-
// todo: should not refer to controlPanel directly
|
1258
|
-
htmlTestRunner.controlPanel.setToPauseAtNextCommand();
|
1259
|
-
};
|
1260
|
-
|
1261
|
-
Selenium.prototype.doStore = function(expression, variableName) {
|
1262
|
-
/** This command is a synonym for storeExpression.
|
1263
|
-
* @param expression the value to store
|
1264
|
-
* @param variableName the name of a <a href="#storedVars">variable</a> in which the result is to be stored.
|
1265
|
-
*/
|
1266
|
-
storedVars[variableName] = expression;
|
1267
|
-
}
|
1268
|
-
|
1269
|
-
/*
|
1270
|
-
* Click on the located element, and attach a callback to notify
|
1271
|
-
* when the page is reloaded.
|
1272
|
-
*/
|
1273
|
-
// DGF TODO this code has been broken for some time... what is it trying to accomplish?
|
1274
|
-
Selenium.prototype.XXXdoModalDialogTest = function(returnValue) {
|
1275
|
-
this.browserbot.doModalDialogTest(returnValue);
|
1276
|
-
};
|
1277
|
-
|
1278
|
-
Selenium.prototype.doEcho = function(message) {
|
1279
|
-
/** Prints the specified message into the third table cell in your Selenese tables.
|
1280
|
-
* Useful for debugging.
|
1281
|
-
* @param message the message to print
|
1282
|
-
*/
|
1283
|
-
currentTest.currentRow.setMessage(message);
|
1284
|
-
}
|
1285
|
-
|
1286
|
-
Selenium.prototype.assertSelected = function(selectLocator, optionLocator) {
|
1287
|
-
/**
|
1288
|
-
* Verifies that the selected option of a drop-down satisfies the optionSpecifier. <i>Note that this command is deprecated; you should use assertSelectedLabel, assertSelectedValue, assertSelectedIndex, or assertSelectedId instead.</i>
|
1289
|
-
*
|
1290
|
-
* <p>See the select command for more information about option locators.</p>
|
1291
|
-
*
|
1292
|
-
* @param selectLocator an <a href="#locators">element locator</a> identifying a drop-down menu
|
1293
|
-
* @param optionLocator an option locator, typically just an option label (e.g. "John Smith")
|
1294
|
-
*/
|
1295
|
-
var element = this.page().findElement(selectLocator);
|
1296
|
-
var locator = this.optionLocatorFactory.fromLocatorString(optionLocator);
|
1297
|
-
if (element.selectedIndex == -1)
|
1298
|
-
{
|
1299
|
-
Assert.fail("No option selected");
|
1300
|
-
}
|
1301
|
-
locator.assertSelected(element);
|
1302
|
-
};
|
1303
|
-
|
1304
|
-
Selenium.prototype.assertFailureOnNext = function(message) {
|
1305
|
-
/**
|
1306
|
-
* Tell Selenium to expect a failure on the next command execution.
|
1307
|
-
* @param message The failure message we should expect. This command will fail if the wrong failure message appears.
|
1308
|
-
*/
|
1309
|
-
if (!message) {
|
1310
|
-
throw new SeleniumError("Message must be provided");
|
1311
|
-
}
|
1312
|
-
|
1313
|
-
currentTest.expectedFailure = message;
|
1314
|
-
currentTest.expectedFailureType = "failure";
|
1315
|
-
currentTest.expectedFailureJustSet = true;
|
1316
|
-
};
|
1317
|
-
|
1318
|
-
Selenium.prototype.assertErrorOnNext = function(message) {
|
1319
|
-
/**
|
1320
|
-
* Tell Selenium to expect an error on the next command execution.
|
1321
|
-
* @param message The error message we should expect. This command will fail if the wrong error message appears.
|
1322
|
-
*/
|
1323
|
-
// This command temporarily installs a CommandFactory that generates
|
1324
|
-
// CommandHandlers that expect an error.
|
1325
|
-
if (!message) {
|
1326
|
-
throw new SeleniumError("Message must be provided");
|
1327
|
-
}
|
1328
|
-
|
1329
|
-
currentTest.expectedFailure = message;
|
1330
|
-
currentTest.expectedFailureType = "error";
|
1331
|
-
currentTest.expectedFailureJustSet = true;
|
1332
|
-
};
|
1333
|
-
|