zena 1.1.3 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +23 -1
- data/MIT-LICENSE +2 -2
- data/README.rdoc +2 -15
- data/app/controllers/acls_controller.rb +1 -1
- data/app/controllers/documents_controller.rb +12 -3
- data/app/controllers/nodes_controller.rb +1 -3
- data/app/controllers/sites_controller.rb +7 -0
- data/app/controllers/versions_controller.rb +1 -1
- data/app/controllers/virtual_classes_controller.rb +7 -8
- data/app/models/acl.rb +3 -2
- data/app/models/relation_proxy.rb +2 -1
- data/app/models/role.rb +16 -0
- data/app/models/site.rb +48 -0
- data/app/models/text_document.rb +2 -1
- data/app/models/user.rb +2 -1
- data/app/models/zip.rb +2 -1
- data/app/views/acls/index.rhtml +11 -1
- data/app/views/documents/show.rhtml +1 -1
- data/app/views/relations/_add.erb +2 -2
- data/app/views/relations/_form.erb +5 -2
- data/app/views/relations/_li.erb +4 -1
- data/app/views/relations/index.erb +3 -3
- data/app/views/sites/_form.erb +1 -1
- data/app/views/sites/_job.erb +4 -0
- data/app/views/sites/index.erb +1 -1
- data/app/views/sites/jobs.erb +10 -0
- data/app/views/templates/document_create_tabs/_file.rhtml +3 -0
- data/app/views/zafu/default/Node-+search.zafu +2 -2
- data/bricks/acls/zena/init.rb +2 -1
- data/bricks/acls/zena/test/integration/acl_integration_test.rb +5 -5
- data/bricks/acls/zena/test/sites/erebus/acls.yml +2 -2
- data/bricks/acls/zena/test/unit/acl_test.rb +2 -2
- data/bricks/grid/lib/bricks/grid.rb +110 -0
- data/bricks/grid/zena/init.rb +4 -0
- data/bricks/math/lib/bricks/math.rb +1 -0
- data/bricks/pdf/lib/bricks/pdf.rb +10 -1
- data/bricks/sphinx/zena/tasks.rb +8 -40
- data/bricks/spreadsheet/README +31 -0
- data/bricks/spreadsheet/lib/bricks/spreadsheet.rb +293 -0
- data/bricks/spreadsheet/zena/init.rb +3 -0
- data/bricks/spreadsheet/zena/test/sites/zena/links.yml +11 -0
- data/bricks/spreadsheet/zena/test/unit/xlsx_test.rb +5 -0
- data/bricks/spreadsheet/zena/test/zafu/README +27 -0
- data/bricks/spreadsheet/zena/test/zafu/spreadsheet.yml +19 -0
- data/bricks/worker/lib/bricks/worker.rb +11 -5
- data/bricks/worker/zena/init.rb +8 -0
- data/bricks/worker/zena/migrate/20120501091514_add_site_id_to_jobs.rb +9 -0
- data/bricks/zena/zena/migrate/01_base.rb +0 -7
- data/bricks/zena/zena/migrate/20111214112233_add_comment_to_relations.rb +9 -0
- data/config/bricks.yml +15 -1
- data/config/environments/production.rb +2 -2
- data/config/gems.yml +6 -1
- data/doc/zafu_changes.yml +1 -1
- data/lib/tasks/zena.rake +6 -2
- data/lib/zena/app.rb +1 -1
- data/lib/zena/code/default_syntax.rb +5 -1
- data/lib/zena/db_helper/mysql.rb +5 -1
- data/lib/zena/deploy/app_init.rhtml +11 -7
- data/lib/zena/deploy/awstats.conf.rhtml +1 -1
- data/lib/zena/deploy/start_stop.rhtml +5 -5
- data/lib/zena/deploy/vhost.rhtml +16 -2
- data/lib/zena/deploy.rb +5 -3
- data/lib/zena/info.rb +1 -1
- data/lib/zena/parser/zazen_rules.rb +7 -7
- data/lib/zena/remote/node.rb +7 -0
- data/lib/zena/routes.rb +4 -5
- data/lib/zena/test_controller.rb +18 -1
- data/lib/zena/use/action.rb +13 -4
- data/lib/zena/use/ajax.rb +10 -4
- data/lib/zena/use/authlogic.rb +1 -1
- data/lib/zena/use/calendar.rb +4 -0
- data/lib/zena/use/conditional.rb +3 -0
- data/lib/zena/use/dates.rb +44 -4
- data/lib/zena/use/display.rb +45 -15
- data/lib/zena/use/forms.rb +59 -30
- data/lib/zena/use/query_builder.rb +12 -12
- data/lib/zena/use/recursion.rb +1 -1
- data/lib/zena/use/rendering.rb +18 -17
- data/lib/zena/use/urls.rb +2 -1
- data/lib/zena/use/zafu_safe_definitions.rb +0 -9
- data/lib/zena/use/zafu_templates.rb +2 -2
- data/lib/zena/use/zazen.rb +1 -3
- data/lib/zena/use.rb +13 -2
- data/lib/zena.rb +8 -2
- data/public/images/bullet_back.png +0 -0
- data/public/javascripts/grid.js +535 -0
- data/public/javascripts/tablekit.js +0 -0
- data/public/javascripts/window.js +0 -0
- data/public/javascripts/zena.js +17 -7
- data/public/stylesheets/admin.css +5 -1
- data/public/stylesheets/grid.css +19 -0
- data/test/fixtures/files/TestNode.zafu +123 -311
- data/test/fixtures/files/translations_fr.yml +6 -1
- data/test/functional/acls_controller_test.rb +2 -2
- data/test/functional/nodes_controller_test.rb +17 -11
- data/test/functional/virtual_classes_controller_test.rb +1 -1
- data/test/integration/query_node/basic.yml +9 -0
- data/test/integration/query_node/dates.yml +1 -1
- data/test/integration/zafu_compiler/ajax.yml +9 -9
- data/test/integration/zafu_compiler/basic.yml +0 -24
- data/test/integration/zafu_compiler/dates.yml +24 -7
- data/test/integration/zafu_compiler/display.yml +45 -2
- data/test/integration/zafu_compiler/errors.yml +0 -6
- data/test/integration/zafu_compiler/forms.yml +41 -3
- data/test/integration/zafu_compiler/query.yml +29 -3
- data/test/integration/zafu_compiler/roles.yml +0 -4
- data/test/integration/zafu_compiler/safe_definitions.yml +1 -1
- data/test/integration/zafu_compiler_test.rb +11 -3
- data/test/selenium/Add/add3.rsel +8 -8
- data/test/selenium/Drop/drop1.rsel +12 -12
- data/test/selenium/Drop/drop2.rsel +14 -14
- data/test/selenium/Drop/drop3.rsel +21 -21
- data/test/selenium/Drop/drop4.rsel +1 -1
- data/test/selenium/Edit/edit2.rsel +9 -9
- data/test/selenium/Edit/edit4.rsel +55 -0
- data/test/selenium/Edit/edit5.rsel +41 -0
- data/test/selenium/Edit/edit6.rsel +53 -0
- data/test/selenium/Filter/0setup.rsel +12 -0
- data/test/selenium/Filter/filter1.rsel +9 -0
- data/test/selenium/Filter/filter2.rsel +9 -0
- data/test/selenium/Form/form1.rsel +1 -1
- data/test/selenium/Form/form2.rsel +1 -1
- data/test/selenium/Form/form3.rsel +15 -0
- data/test/selenium/Grid/0setup.rsel +13 -0
- data/test/selenium/Grid/grid1.rsel +11 -0
- data/test/selenium/Swap/0setup.rsel +12 -0
- data/test/selenium/Swap/swap1.rsel +13 -0
- data/test/selenium/Swap/swap2.rsel +11 -0
- data/test/selenium/Toggle/toggle1.rsel +6 -6
- data/test/sites/zena/versions.yml +1 -1
- data/test/unit/relation_proxy_test.rb +36 -0
- data/test/unit/site_test.rb +10 -2
- data/test/unit/zena/use/rendering_test.rb +7 -6
- data/test/unit/zena/use/zazen_test.rb +1 -2
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/Run 2.tmCommand +24 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/Run Context.tmCommand +58 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/Run Focused Should.tmCommand +88 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/Run.tmCommand +27 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/YAML to Shoulda.tmCommand +23 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Preferences/Symbol List: Context.tmPreferences +19 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Preferences/Symbol List: Should.tmPreferences +19 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory attributes for.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory build.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory_define with class.tmSnippet +18 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory_define.tmSnippet +18 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory_next.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory_sequence.tmSnippet +18 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_bad_value.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_contains.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_does_not_contain.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_good_value.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_same_elements.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_save.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_sent_email.tmSnippet +18 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_valid.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/association.tmSnippet +17 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/attribute.tmSnippet +17 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/before_should block.tmSnippet +18 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/context block get.tmSnippet +22 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/context block post.tmSnippet +23 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/context block with setup.tmSnippet +25 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/setup.tmSnippet +18 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should block with before proc.tmSnippet +18 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should block.tmSnippet +18 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_allow_values_for.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_assign_to.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_be_restful denied.tmSnippet +20 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_be_restful.tmSnippet +20 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_belong_to.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_change by.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_change from to.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_ensure_length_at_least.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_ensure_length_in_range.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_ensure_length_is.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_ensure_value_in_range.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_eventually.tmSnippet +18 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_filter_params.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_and_belong_to_many.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_class_methods.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_db_column.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_db_columns.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_index.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_indices.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_instance_methods.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_many.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_named_scope.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_one.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_readonly_attributes.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_allow_mass_assignment_of.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_allow_values_for.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_assign_to.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_change.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_set_the_flash.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_redirect_to.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_render_a_form.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_render_template.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_render_with_layout.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_render_without_layout.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_respond_with.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_respond_with_content_type.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_return_from_session.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_route.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_set_the_flash_to.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_acceptance_of.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_numericality_of.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_presence_of.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_uniqueness_of with scope.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_uniqueness_of.tmSnippet +16 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/catch_exception.rb +39 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/run_script.rb +104 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/stdin_dialog.rb +14 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/test.rb +17 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/todo.txt +13 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/bin/yaml_to_shoulda.rb +25 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/Syntaxes/Ruby on Rails (Shoulda).tmLanguage +166 -0
- data/vendor/TextMate/Ruby Shoulda.tmbundle/info.plist +304 -0
- data/vendor/TextMate/Zena.tmbundle/Commands/Run all yaml tests.tmCommand +37 -0
- data/vendor/TextMate/Zena.tmbundle/Commands/Run focused yaml test.tmCommand +52 -0
- data/vendor/TextMate/Zena.tmbundle/Support/RubyMate/catch_exception.rb +39 -0
- data/vendor/TextMate/Zena.tmbundle/Support/RubyMate/run_script.rb +118 -0
- data/vendor/TextMate/Zena.tmbundle/Support/RubyMate/stdin_dialog.rb +14 -0
- data/vendor/TextMate/Zena.tmbundle/info.plist +17 -0
- data/vendor/plugins/selenium-on-rails/CHANGELOG +125 -0
- data/vendor/plugins/selenium-on-rails/LICENSE-2.0.txt +202 -0
- data/vendor/plugins/selenium-on-rails/README.md +202 -0
- data/vendor/plugins/selenium-on-rails/Rakefile +38 -0
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumController.html +265 -0
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumHelper.html +148 -0
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/FixtureLoader.html +231 -0
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/PartialsSupport.html +195 -0
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/Paths.html +295 -0
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/RSelenese.html +219 -0
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/Renderer.html +156 -0
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/Selenese.html +179 -0
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/SuiteRenderer.html +223 -0
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilder.html +441 -0
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilderAccessors.html +3098 -0
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilderActions.html +2080 -0
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilderUserAccessors.html +116 -0
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilderUserActions.html +116 -0
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails.html +126 -0
- data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRailsConfig.html +150 -0
- data/vendor/plugins/selenium-on-rails/doc/files/CHANGELOG.html +422 -0
- data/vendor/plugins/selenium-on-rails/doc/files/README.html +321 -0
- data/vendor/plugins/selenium-on-rails/doc/files/lib/controllers/selenium_controller_rb.html +108 -0
- data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_helper_rb.html +101 -0
- data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/acceptance_test_runner_rb.html +222 -0
- data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/fixture_loader_rb.html +109 -0
- data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/partials_support_rb.html +111 -0
- data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/paths_rb.html +101 -0
- data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/renderer_rb.html +101 -0
- data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/rselenese_rb.html +118 -0
- data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/selenese_rb.html +101 -0
- data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/suite_renderer_rb.html +101 -0
- data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/test_builder_accessors_rb.html +114 -0
- data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/test_builder_actions_rb.html +113 -0
- data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/test_builder_rb.html +120 -0
- data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails_config_rb.html +108 -0
- data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails_rb.html +115 -0
- data/vendor/plugins/selenium-on-rails/doc/fr_class_index.html +42 -0
- data/vendor/plugins/selenium-on-rails/doc/fr_file_index.html +43 -0
- data/vendor/plugins/selenium-on-rails/doc/fr_method_index.html +182 -0
- data/vendor/plugins/selenium-on-rails/doc/index.html +24 -0
- data/vendor/plugins/selenium-on-rails/doc/rdoc-style.css +208 -0
- data/vendor/plugins/selenium-on-rails/generators/selenium/USAGE +19 -0
- data/vendor/plugins/selenium-on-rails/generators/selenium/selenium_generator.rb +50 -0
- data/vendor/plugins/selenium-on-rails/generators/selenium/templates/rhtml.rhtml +16 -0
- data/vendor/plugins/selenium-on-rails/generators/selenium/templates/rselenese.rhtml +14 -0
- data/vendor/plugins/selenium-on-rails/generators/selenium/templates/selenese.rhtml +11 -0
- data/vendor/plugins/selenium-on-rails/init.rb +15 -0
- data/vendor/plugins/selenium-on-rails/lib/controllers/selenium_controller.rb +122 -0
- data/vendor/plugins/selenium-on-rails/lib/controllers/switch_environment_controller.rb +16 -0
- data/vendor/plugins/selenium-on-rails/lib/selenium_helper.rb +8 -0
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/acceptance_test_runner.rb +215 -0
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/fixture_loader.rb +57 -0
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/partials_support.rb +36 -0
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/paths.rb +61 -0
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/renderer.rb +20 -0
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/rselenese.rb +44 -0
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/selenese.rb +87 -0
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/suite_renderer.rb +56 -0
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder.rb +116 -0
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder_accessors.rb +1002 -0
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder_actions.rb +514 -0
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder_user_accessors.rb.example +91 -0
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder_user_actions.rb.example +24 -0
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails.rb +11 -0
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails_config.rb +30 -0
- data/vendor/plugins/selenium-on-rails/lib/views/layouts/layout.rhtml +18 -0
- data/vendor/plugins/selenium-on-rails/lib/views/record.rhtml +5 -0
- data/vendor/plugins/selenium-on-rails/lib/views/selenium_helper.rb +9 -0
- data/vendor/plugins/selenium-on-rails/lib/views/setup.rhtml +67 -0
- data/vendor/plugins/selenium-on-rails/lib/views/test_suite.rhtml +26 -0
- data/vendor/plugins/selenium-on-rails/routes.rb +24 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/Blank.html +7 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/InjectedRemoteRunner.html +8 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/RemoteRunner.html +110 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/SeleniumLog.html +109 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/TestPrompt.html +145 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/TestRunner-splash.html +55 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/TestRunner.hta +177 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/TestRunner.html +177 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/domviewer/butmin.gif +0 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/domviewer/butplus.gif +0 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/domviewer/domviewer.css +298 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/domviewer/domviewer.html +16 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/domviewer/selenium-domviewer.js +205 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/icons/all.png +0 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/icons/continue.png +0 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/icons/continue_disabled.png +0 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/icons/pause.png +0 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/icons/pause_disabled.png +0 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/icons/selected.png +0 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/icons/step.png +0 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/icons/step_disabled.png +0 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/iedoc-core.xml +1759 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/iedoc.xml +1800 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/cssQuery-p.js +6 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/src/cssQuery-level2.js +142 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/src/cssQuery-level3.js +150 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/src/cssQuery-standard.js +53 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/src/cssQuery.js +356 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/lib/prototype.js +2006 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/builder.js +101 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/controls.js +815 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/dragdrop.js +915 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/effects.js +958 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/scriptaculous.js +47 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/slider.js +283 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/unittest.js +383 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/lib/snapsie.js +91 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/find_matching_child.js +69 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/htmlutils.js +1616 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/injection.html +72 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-api.js +3184 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-browserbot.js +2300 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-browserdetect.js +153 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-commandhandlers.js +377 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-executionloop.js +175 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-logging.js +148 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-remoterunner.js +695 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-testrunner.js +1362 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-version.js +5 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/ui-doc.html +803 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/ui-element.js +1537 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/ui-map-sample.js +979 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/user-extensions.js +3 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/user-extensions.js.sample +75 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/scripts/xmlextras.js +153 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/selenium-logo.png +0 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/selenium-test.css +43 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/selenium.css +316 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/xpath/dom.js +566 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/xpath/javascript-xpath-0.1.11.js +2816 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/xpath/util.js +549 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/xpath/xmltoken.js +149 -0
- data/vendor/plugins/selenium-on-rails/selenium-core/xpath/xpath.js +2450 -0
- data/vendor/plugins/selenium-on-rails/tasks/test_acceptance.rake +8 -0
- data/vendor/plugins/selenium-on-rails/test/fixtures/config.yml +37 -0
- data/vendor/plugins/selenium-on-rails/test/fixtures/selenium.yml +27 -0
- data/vendor/plugins/selenium-on-rails/test/paths_test.rb +72 -0
- data/vendor/plugins/selenium-on-rails/test/renderer_test.rb +157 -0
- data/vendor/plugins/selenium-on-rails/test/rselenese_test.rb +708 -0
- data/vendor/plugins/selenium-on-rails/test/selenese_test.rb +242 -0
- data/vendor/plugins/selenium-on-rails/test/selenium_controller_test.rb +67 -0
- data/vendor/plugins/selenium-on-rails/test/selenium_on_rails_config_test.rb +43 -0
- data/vendor/plugins/selenium-on-rails/test/selenium_support_test.rb +35 -0
- data/vendor/plugins/selenium-on-rails/test/setup_test.rb +31 -0
- data/vendor/plugins/selenium-on-rails/test/suite_renderer_test.rb +109 -0
- data/vendor/plugins/selenium-on-rails/test/switch_environment_controller_test.rb +17 -0
- data/vendor/plugins/selenium-on-rails/test/test_builder_functions_authortest.rb +51 -0
- data/vendor/plugins/selenium-on-rails/test/test_helper.rb +101 -0
- data/vendor/plugins/selenium-on-rails/test_data/_partial.rsel +1 -0
- data/vendor/plugins/selenium-on-rails/test_data/own_layout.html +12 -0
- data/vendor/plugins/selenium-on-rails/test_data/partials/_html.html +6 -0
- data/vendor/plugins/selenium-on-rails/test_data/partials/_nesting.rsel +2 -0
- data/vendor/plugins/selenium-on-rails/test_data/partials/_rhtml.rhtml +6 -0
- data/vendor/plugins/selenium-on-rails/test_data/partials/_rsel.rsel +1 -0
- data/vendor/plugins/selenium-on-rails/test_data/partials/_sel.sel +5 -0
- data/vendor/plugins/selenium-on-rails/test_data/partials/all_partials.rsel +5 -0
- data/vendor/plugins/selenium-on-rails/test_data/rhtml.rhtml +7 -0
- data/vendor/plugins/selenium-on-rails/test_data/rselenese.rsel +8 -0
- data/vendor/plugins/selenium-on-rails/test_data/selenese.sel +7 -0
- data/vendor/plugins/selenium-on-rails/test_data/suite_one/subsuite/suite_one_subsuite_testcase.sel +1 -0
- data/vendor/plugins/selenium-on-rails/test_data/suite_one/suite_one_testcase1.sel +1 -0
- data/vendor/plugins/selenium-on-rails/test_data/suite_one/suite_one_testcase2.sel +1 -0
- data/vendor/plugins/selenium-on-rails/test_data/suite_two/suite_two_testcase.sel +1 -0
- data/zena.gemspec +290 -7
- metadata +346 -52
- data/app/views/nodes/_table.rhtml +0 -14
- data/lib/zena/use/grid.rb +0 -154
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
$: << File.expand_path(File.dirname(__FILE__) + "/")
|
|
2
|
+
$: << File.expand_path(File.dirname(__FILE__) + "/../")
|
|
3
|
+
require 'paths'
|
|
4
|
+
require 'net/http'
|
|
5
|
+
require 'tempfile'
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def c(var, default = nil) SeleniumOnRailsConfig.get var, default end
|
|
9
|
+
def c_b(var, default = nil) SeleniumOnRailsConfig.get(var, default) { yield } end
|
|
10
|
+
|
|
11
|
+
BROWSERS = c :browsers, {}
|
|
12
|
+
REUSE_EXISTING_SERVER = c :reuse_existing_server, true
|
|
13
|
+
START_SERVER = c :start_server, false #TODO can't get it to work reliably on Windows, perhaps it's just on my computer, but I leave it off by default for now
|
|
14
|
+
HOST = c :host, 'localhost'
|
|
15
|
+
PORTS = c(:port_start, 3000)..c(:port_end, 3005)
|
|
16
|
+
BASE_URL_PATH = c :base_url_path, '/'
|
|
17
|
+
TEST_RUNNER_URL = c :test_runner_url, '/selenium/TestRunner.html'
|
|
18
|
+
MAX_BROWSER_DURATION = c :max_browser_duration, 2*60
|
|
19
|
+
MULTI_WINDOW = c :multi_window, false
|
|
20
|
+
SERVER_COMMAND = c_b :server_command do
|
|
21
|
+
server_path = File.expand_path(File.dirname(__FILE__) + '/../../../../../script/server')
|
|
22
|
+
if RUBY_PLATFORM =~ /mswin/
|
|
23
|
+
"ruby #{server_path} webrick -p %d -e test > NUL 2>&1"
|
|
24
|
+
else
|
|
25
|
+
# don't use redirects to /dev/nul since it makes the fork return wrong pid
|
|
26
|
+
# see UnixSubProcess
|
|
27
|
+
"#{server_path} webrick -p %d -e test"
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
module SeleniumOnRails
|
|
32
|
+
class AcceptanceTestRunner
|
|
33
|
+
include SeleniumOnRails::Paths
|
|
34
|
+
|
|
35
|
+
def run
|
|
36
|
+
raise 'no browser specified, edit/create config.yml' if BROWSERS.empty?
|
|
37
|
+
start_server
|
|
38
|
+
has_error = false
|
|
39
|
+
begin
|
|
40
|
+
BROWSERS.each_pair do |browser, path|
|
|
41
|
+
log_file = start_browser browser, path
|
|
42
|
+
wait_for_completion log_file
|
|
43
|
+
stop_browser
|
|
44
|
+
result = YAML::load_file log_file
|
|
45
|
+
print_result result
|
|
46
|
+
has_error ||= result['numTestFailures'].to_i > 0
|
|
47
|
+
# File.delete log_file unless has_error
|
|
48
|
+
end
|
|
49
|
+
rescue
|
|
50
|
+
stop_server
|
|
51
|
+
raise
|
|
52
|
+
end
|
|
53
|
+
stop_server
|
|
54
|
+
raise 'Test failures' if has_error
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
private
|
|
58
|
+
def start_server
|
|
59
|
+
PORTS.each do |p|
|
|
60
|
+
@port = p
|
|
61
|
+
case server_check
|
|
62
|
+
when :success
|
|
63
|
+
return if REUSE_EXISTING_SERVER
|
|
64
|
+
next
|
|
65
|
+
when Fixnum
|
|
66
|
+
next
|
|
67
|
+
when :no_response
|
|
68
|
+
next unless START_SERVER
|
|
69
|
+
do_start_server
|
|
70
|
+
return
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
raise START_SERVER ? 'failed to start server': 'failed to find existing server, run script/server -e test'
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def do_start_server
|
|
77
|
+
puts 'Starting server'
|
|
78
|
+
@server = start_subprocess(format(SERVER_COMMAND, @port))
|
|
79
|
+
while true
|
|
80
|
+
print '.'
|
|
81
|
+
r = server_check
|
|
82
|
+
if r == :success
|
|
83
|
+
puts
|
|
84
|
+
return
|
|
85
|
+
end
|
|
86
|
+
raise "server returned error: #{r}" if r.instance_of? Fixnum
|
|
87
|
+
sleep 3
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def server_check
|
|
92
|
+
begin
|
|
93
|
+
res = Net::HTTP.get_response HOST, TEST_RUNNER_URL, @port
|
|
94
|
+
return :success if (200..399).include? res.code.to_i
|
|
95
|
+
return res.code.to_i
|
|
96
|
+
rescue Errno::ECONNREFUSED
|
|
97
|
+
return :no_response
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def stop_server
|
|
102
|
+
return unless defined? @server
|
|
103
|
+
puts
|
|
104
|
+
@server.stop 'server'
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def start_browser browser, path
|
|
108
|
+
puts
|
|
109
|
+
puts "Starting #{browser}"
|
|
110
|
+
base_url = "http://#{HOST}:#{@port}#{BASE_URL_PATH}"
|
|
111
|
+
log = log_file browser
|
|
112
|
+
command = "\"#{path}\" \"http://#{HOST}:#{@port}#{TEST_RUNNER_URL}?test=tests&auto=true&baseUrl=#{base_url}&resultsUrl=postResults/#{log}&multiWindow=#{MULTI_WINDOW}\""
|
|
113
|
+
@browser = start_subprocess command
|
|
114
|
+
log_path log
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def stop_browser
|
|
118
|
+
@browser.stop 'browser'
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def start_subprocess command
|
|
122
|
+
if RUBY_PLATFORM =~ /mswin/
|
|
123
|
+
SeleniumOnRails::AcceptanceTestRunner::Win32SubProcess.new command
|
|
124
|
+
elsif RUBY_PLATFORM =~ /darwin/i && command =~ /safari/i
|
|
125
|
+
SeleniumOnRails::AcceptanceTestRunner::SafariSubProcess.new command
|
|
126
|
+
else
|
|
127
|
+
SeleniumOnRails::AcceptanceTestRunner::UnixSubProcess.new command
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def log_file browser
|
|
132
|
+
FileUtils.mkdir_p(log_path(''))
|
|
133
|
+
(0..100).each do |i|
|
|
134
|
+
name = browser + (i==0 ? '' : "(#{i})") + '.yml'
|
|
135
|
+
return name unless File.exist?(log_path(name))
|
|
136
|
+
end
|
|
137
|
+
raise 'there are way too many files in the log directory...'
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def wait_for_completion log_file
|
|
141
|
+
duration = 0
|
|
142
|
+
while true
|
|
143
|
+
raise 'browser takes too long' if duration > MAX_BROWSER_DURATION
|
|
144
|
+
print '.'
|
|
145
|
+
break if File.exist? log_file
|
|
146
|
+
sleep 5
|
|
147
|
+
duration += 5
|
|
148
|
+
end
|
|
149
|
+
puts
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
def print_result result
|
|
153
|
+
puts "Finished in #{result['totalTime']} seconds."
|
|
154
|
+
puts
|
|
155
|
+
puts "#{result['numTestPasses']} tests passed, #{result['numTestFailures']} tests failed"
|
|
156
|
+
puts "(Results stored in '#{result['resultDir']}')" if result['resultDir']
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
class SeleniumOnRails::AcceptanceTestRunner::SubProcess
|
|
163
|
+
def stop what
|
|
164
|
+
begin
|
|
165
|
+
puts "Stopping #{what} (pid=#{@pid}) ..."
|
|
166
|
+
Process.kill 9, @pid
|
|
167
|
+
rescue Errno::EPERM #such as the process is already closed (tabbed browser)
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
class SeleniumOnRails::AcceptanceTestRunner::Win32SubProcess < SeleniumOnRails::AcceptanceTestRunner::SubProcess
|
|
173
|
+
def initialize command
|
|
174
|
+
require 'win32/open3' #win32-open3 http://raa.ruby-lang.org/project/win32-open3/
|
|
175
|
+
|
|
176
|
+
puts command
|
|
177
|
+
input, output, error, @pid = Open4.popen4 command, 't', true
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
class SeleniumOnRails::AcceptanceTestRunner::UnixSubProcess < SeleniumOnRails::AcceptanceTestRunner::SubProcess
|
|
182
|
+
def initialize command
|
|
183
|
+
puts command
|
|
184
|
+
@pid = fork do
|
|
185
|
+
# Since we can't use shell redirects without screwing
|
|
186
|
+
# up the pid, we'll reopen stdin and stdout instead
|
|
187
|
+
# to get the same effect.
|
|
188
|
+
[STDOUT,STDERR].each {|f| f.reopen '/dev/null', 'w' }
|
|
189
|
+
exec command
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# The path to Safari should look like this: /Applications/Safari.app/Contents/MacOS/Safari
|
|
195
|
+
class SeleniumOnRails::AcceptanceTestRunner::SafariSubProcess < SeleniumOnRails::AcceptanceTestRunner::UnixSubProcess
|
|
196
|
+
def initialize command
|
|
197
|
+
path = Tempfile.new('selenium-on-rails').path
|
|
198
|
+
f = File.open(path + '.html', 'w')
|
|
199
|
+
f.puts <<-HTML
|
|
200
|
+
<html>
|
|
201
|
+
<head>
|
|
202
|
+
<script type="text/javascript" charset="utf-8">
|
|
203
|
+
window.location.href = #{command.split.last};
|
|
204
|
+
</script>
|
|
205
|
+
</head>
|
|
206
|
+
<body></body>
|
|
207
|
+
</html>
|
|
208
|
+
HTML
|
|
209
|
+
f.close
|
|
210
|
+
|
|
211
|
+
super "#{command.split.first} #{f.path}"
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
end
|
|
215
|
+
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
require 'test/unit'
|
|
2
|
+
require 'active_record'
|
|
3
|
+
require 'active_record/fixtures'
|
|
4
|
+
|
|
5
|
+
module SeleniumOnRails::FixtureLoader
|
|
6
|
+
include SeleniumOnRails::Paths
|
|
7
|
+
|
|
8
|
+
def available_fixtures
|
|
9
|
+
fixtures = {}
|
|
10
|
+
path = fixtures_path + '/'
|
|
11
|
+
files = Dir["#{path}**/*.{yml,csv}"]
|
|
12
|
+
files.each do |file|
|
|
13
|
+
rel_path = file.sub(path, '')
|
|
14
|
+
next if skip_file? rel_path
|
|
15
|
+
fixture_set = File.dirname(rel_path)
|
|
16
|
+
fixture_set = '' if fixture_set == '.'
|
|
17
|
+
fixture = rel_path.sub /\.[^.]*$/, ''
|
|
18
|
+
fixtures[fixture_set] ||= []
|
|
19
|
+
fixtures[fixture_set] << fixture
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
fixtures
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def load_fixtures fixtures_param
|
|
26
|
+
available = nil
|
|
27
|
+
fixtures = fixtures_param.split(/\s*,\s*/).collect do |f|
|
|
28
|
+
fixture_set = File.dirname f
|
|
29
|
+
fixture_set = '' if fixture_set == '.'
|
|
30
|
+
fixture = File.basename f
|
|
31
|
+
if fixture == 'all'
|
|
32
|
+
available ||= available_fixtures
|
|
33
|
+
available[fixture_set]
|
|
34
|
+
else
|
|
35
|
+
f
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
fixtures.flatten!
|
|
39
|
+
fixtures.reject! {|f| f.blank? }
|
|
40
|
+
|
|
41
|
+
if fixtures.any?
|
|
42
|
+
Fixtures.reset_cache # in case they've already been loaded and things have changed
|
|
43
|
+
Fixtures.create_fixtures fixtures_path, fixtures
|
|
44
|
+
end
|
|
45
|
+
fixtures
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def clear_tables tables
|
|
49
|
+
table_names = tables.split /\s*,\s*/
|
|
50
|
+
connection = ActiveRecord::Base.connection
|
|
51
|
+
table_names.each do |table|
|
|
52
|
+
connection.execute "DELETE FROM #{table}"
|
|
53
|
+
end
|
|
54
|
+
table_names
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require 'selenium_on_rails/paths'
|
|
2
|
+
|
|
3
|
+
module SeleniumOnRails::PartialsSupport
|
|
4
|
+
include SeleniumOnRails::Paths
|
|
5
|
+
|
|
6
|
+
# Overrides where the partial is searched for, and returns only the command table rows.
|
|
7
|
+
def render_partial(options)
|
|
8
|
+
pattern = partial_pattern options[:partial]
|
|
9
|
+
filename = Dir[pattern].first
|
|
10
|
+
raise "Partial '#{partial_path}' cannot be found! (Looking for file: '#{pattern}')" unless filename
|
|
11
|
+
partial = render :file => filename, :use_full_path => false, :locals => options[:locals]
|
|
12
|
+
extract_commands_from_partial partial
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Extracts the commands from a partial. The partial must contain a html table
|
|
16
|
+
# and the first row is ignored since it cannot contain a command.
|
|
17
|
+
def extract_commands_from_partial partial
|
|
18
|
+
partial = partial.match(/.*<table>.*?<tr>.*?<\/tr>(.*?)<\/table>/im)[1]
|
|
19
|
+
raise "Partial '#{name}' doesn't contain any table" unless partial
|
|
20
|
+
partial
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
# Generates the file pattern from the provided partial path.
|
|
25
|
+
# The starting _ and file extension don't have too be provided.
|
|
26
|
+
def partial_pattern partial_path
|
|
27
|
+
path = partial_path.split '/'
|
|
28
|
+
filename = path.delete_at(-1)
|
|
29
|
+
filename = '_' + filename unless filename.starts_with? '_'
|
|
30
|
+
filename << '.*' unless filename.include? '.'
|
|
31
|
+
pattern = selenium_tests_path + '/'
|
|
32
|
+
pattern << path.join('/') + '/' if path
|
|
33
|
+
pattern << filename
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
require 'selenium_on_rails_config'
|
|
2
|
+
|
|
3
|
+
module SeleniumOnRails
|
|
4
|
+
module Paths
|
|
5
|
+
|
|
6
|
+
def selenium_path
|
|
7
|
+
@@selenium_path ||= find_selenium_path
|
|
8
|
+
@@selenium_path
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def selenium_tests_path
|
|
12
|
+
return SeleniumOnRailsConfig.get("selenium_tests_path") if SeleniumOnRailsConfig.get("selenium_tests_path")
|
|
13
|
+
File.expand_path(File.join(RAILS_ROOT, 'test/selenium'))
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def view_path view
|
|
17
|
+
File.expand_path(File.dirname(__FILE__) + '/../views/' + view)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Returns the path to the layout template. The path is relative in relation
|
|
21
|
+
# to the app/views/ directory since Rails doesn't support absolute paths
|
|
22
|
+
# to layout templates.
|
|
23
|
+
def layout_path
|
|
24
|
+
'layout.rhtml'
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def fixtures_path
|
|
28
|
+
return SeleniumOnRailsConfig.get("fixtures_path") if SeleniumOnRailsConfig.get("fixtures_path")
|
|
29
|
+
File.expand_path File.join(RAILS_ROOT, 'test/fixtures')
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def log_path log_file
|
|
33
|
+
File.expand_path(File.dirname(__FILE__) + '/../../log/' + File.basename(log_file))
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def skip_file? file
|
|
37
|
+
file.split('/').each do |f|
|
|
38
|
+
return true if f.upcase == 'CVS' or f.starts_with?('.') or f.ends_with?('~') or f.starts_with?('_')
|
|
39
|
+
end
|
|
40
|
+
false
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
private ###############################################
|
|
44
|
+
|
|
45
|
+
def find_selenium_path
|
|
46
|
+
sel_dirs = SeleniumOnRailsConfig.get :selenium_path do
|
|
47
|
+
File.expand_path(File.dirname(__FILE__) + '/../../selenium-core')
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
sel_dirs.to_a.each do |seleniumdir|
|
|
51
|
+
['', 'core', 'selenium', 'javascript'].each do |subdir|
|
|
52
|
+
path = File.join seleniumdir, subdir
|
|
53
|
+
return path if File.exist?(File.join(path, 'TestRunner.html'))
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
raise 'Could not find Selenium Core installation'
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module SeleniumOnRails::Renderer
|
|
2
|
+
include SeleniumOnRails::Paths
|
|
3
|
+
|
|
4
|
+
def render_test_case filename
|
|
5
|
+
@template.extend SeleniumOnRails::PartialsSupport
|
|
6
|
+
@page_title = test_case_name filename
|
|
7
|
+
output = render_to_string :file => filename, :locals => {"page_title" => @page_title}
|
|
8
|
+
layout = (output =~ /<html>/i ? false : layout_path)
|
|
9
|
+
render :text => output, :layout => layout
|
|
10
|
+
|
|
11
|
+
headers['Cache-control'] = 'no-cache'
|
|
12
|
+
headers['Pragma'] = 'no-cache'
|
|
13
|
+
headers['Expires'] = '-1'
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def test_case_name filename
|
|
17
|
+
File.basename(filename).sub(/\..*/,'').humanize
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Renders Selenium test templates in a fashion analogous to +rxml+ and
|
|
2
|
+
# +rjs+ templates.
|
|
3
|
+
#
|
|
4
|
+
# setup
|
|
5
|
+
# open :controller => 'customer', :action => 'list'
|
|
6
|
+
# assert_title 'Customers'
|
|
7
|
+
#
|
|
8
|
+
# See SeleniumOnRails::TestBuilder for a list of available commands.
|
|
9
|
+
class SeleniumOnRails::RSelenese < SeleniumOnRails::TestBuilder
|
|
10
|
+
end
|
|
11
|
+
ActionView::Template.register_template_handler 'rsel', SeleniumOnRails::RSelenese
|
|
12
|
+
|
|
13
|
+
class SeleniumOnRails::RSelenese
|
|
14
|
+
attr_accessor :view
|
|
15
|
+
|
|
16
|
+
def initialize view
|
|
17
|
+
super view
|
|
18
|
+
@view = view
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def render template, local_assigns = {}
|
|
22
|
+
title = (@view.assigns['page_title'] or local_assigns['page_title'])
|
|
23
|
+
|
|
24
|
+
evaluator = Evaluator.new(@view)
|
|
25
|
+
evaluator.run_script title, assign_locals_code_from(local_assigns) + "\n" + template.source, local_assigns
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def assign_locals_code_from(local_assigns)
|
|
29
|
+
return local_assigns.keys.collect {|key| "#{key} = local_assigns[#{key.inspect}];"}.join
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def self.call(template)
|
|
33
|
+
"#{name}.new(self).render(template, local_assigns)"
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
class Evaluator < SeleniumOnRails::TestBuilder
|
|
37
|
+
def run_script(title, script, local_assigns)
|
|
38
|
+
table(title) do
|
|
39
|
+
test = self #to enable test.command
|
|
40
|
+
eval script
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
require 'selenium_on_rails/partials_support'
|
|
2
|
+
|
|
3
|
+
class SeleniumOnRails::Selenese
|
|
4
|
+
end
|
|
5
|
+
ActionView::Template.register_template_handler 'sel', SeleniumOnRails::Selenese
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class SeleniumOnRails::Selenese
|
|
9
|
+
def initialize view
|
|
10
|
+
@view = view
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def render template, local_assigns = {}
|
|
14
|
+
name = (@view.assigns['page_title'] or local_assigns['page_title'])
|
|
15
|
+
lines = template.source.strip.split "\n"
|
|
16
|
+
html = ''
|
|
17
|
+
html << extract_comments(lines)
|
|
18
|
+
html << extract_commands(lines, name)
|
|
19
|
+
html << extract_comments(lines)
|
|
20
|
+
raise 'You cannot have comments in the middle of commands!' if next_line lines, :any
|
|
21
|
+
html
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
def next_line lines, expects
|
|
26
|
+
while lines.any?
|
|
27
|
+
l = lines.shift.strip
|
|
28
|
+
next if (l.empty? and expects != :comment)
|
|
29
|
+
comment = (l =~ /^\|.*\|$/).nil?
|
|
30
|
+
if (comment and expects == :command) or (!comment and expects == :comment)
|
|
31
|
+
lines.unshift l
|
|
32
|
+
return nil
|
|
33
|
+
end
|
|
34
|
+
return l
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def self.call(template)
|
|
39
|
+
"#{name}.new(self).render(template, local_assigns)"
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def extract_comments lines
|
|
43
|
+
comments = ''
|
|
44
|
+
while (line = next_line lines, :comment)
|
|
45
|
+
comments << line + "\n"
|
|
46
|
+
end
|
|
47
|
+
if defined? RedCloth
|
|
48
|
+
comments = RedCloth.new(comments).to_html
|
|
49
|
+
end
|
|
50
|
+
comments += "\n" unless comments.empty?
|
|
51
|
+
comments
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def extract_commands lines, name
|
|
55
|
+
html = "<table>\n<tr><th colspan=\"3\">#{name}</th></tr>\n"
|
|
56
|
+
while (line = next_line lines, :command)
|
|
57
|
+
line = line[1..-2] #remove starting and ending |
|
|
58
|
+
cells = line.split '|'
|
|
59
|
+
if cells.first == 'includePartial'
|
|
60
|
+
html << include_partial(cells[1..-1])
|
|
61
|
+
next
|
|
62
|
+
end
|
|
63
|
+
raise 'There might only be a maximum of three cells!' if cells.length > 3
|
|
64
|
+
html << '<tr>'
|
|
65
|
+
(1..3).each do
|
|
66
|
+
cell = cells.shift
|
|
67
|
+
cell = (cell ? CGI.escapeHTML(cell.strip) : ' ')
|
|
68
|
+
html << "<td>#{cell}</td>"
|
|
69
|
+
end
|
|
70
|
+
html << "</tr>\n"
|
|
71
|
+
end
|
|
72
|
+
html << "</table>\n"
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def include_partial params
|
|
76
|
+
partial = params.shift
|
|
77
|
+
locals = {}
|
|
78
|
+
params.each do |assignment|
|
|
79
|
+
next if assignment.empty?
|
|
80
|
+
_, var, value = assignment.split(/^([a-z_][a-zA-Z0-9_]*)\s*=\s*(.*)$/)
|
|
81
|
+
raise "Invalid format '#{assignment}'. Should be '|includePartial|partial|var1=value|var2=value|." unless var
|
|
82
|
+
locals[var.to_sym] = value or ''
|
|
83
|
+
end
|
|
84
|
+
@view.render :partial => partial, :locals => locals
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
require 'selenium_on_rails'
|
|
2
|
+
|
|
3
|
+
module SeleniumOnRails
|
|
4
|
+
module SuiteRenderer
|
|
5
|
+
def test_suite_name path
|
|
6
|
+
return 'All test cases' if [nil, '/'].include? path_to_relative_url(path)
|
|
7
|
+
File.split(path)[-1].humanize
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def test_suites path
|
|
11
|
+
suites = []
|
|
12
|
+
|
|
13
|
+
parent_path = File.join(File.split(path).slice(0..-2)) #all but last
|
|
14
|
+
parent_path = path_to_relative_url parent_path
|
|
15
|
+
suites << ['..', parent_path] unless parent_path.nil?
|
|
16
|
+
|
|
17
|
+
visit_all_tests path, '', Proc.new {|n, p| suites << [n,path_to_relative_url(p)]}, nil
|
|
18
|
+
suites
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_cases path
|
|
22
|
+
tests = []
|
|
23
|
+
visit_all_tests path, '', nil, Proc.new {|n, p| tests << [n,p]}
|
|
24
|
+
tests
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def link_to_test_case suite_name, filename
|
|
28
|
+
name = suite_name + test_case_name(filename)
|
|
29
|
+
link_to name, :action => :test_file, :testname => path_to_relative_url(filename).sub(/^\//,'')
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
private ###############################################
|
|
33
|
+
|
|
34
|
+
def path_to_relative_url path
|
|
35
|
+
slt = @controller.selenium_tests_path
|
|
36
|
+
return nil unless path.index slt
|
|
37
|
+
path.sub slt, ''
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def visit_all_tests path, suite_name, suite_consumer, test_consumer
|
|
41
|
+
dirs = [] #add dirs to an array in order for files to be processed before dirs
|
|
42
|
+
Dir.entries(path).sort.each do |e|
|
|
43
|
+
next if skip_file?(e) or ['.','..'].include?(e)
|
|
44
|
+
filename = File.join path, e
|
|
45
|
+
if File.directory? filename
|
|
46
|
+
dirs << [filename, "#{suite_name}#{e.humanize}."]
|
|
47
|
+
suite_consumer.call("#{suite_name}#{e.humanize}", filename) if suite_consumer
|
|
48
|
+
else
|
|
49
|
+
test_consumer.call(suite_name, filename) if test_consumer
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
#recurse through dirs
|
|
53
|
+
dirs.each {|p, n| visit_all_tests p, n, suite_consumer, test_consumer }
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
require 'selenium_on_rails/test_builder_actions'
|
|
2
|
+
require 'selenium_on_rails/test_builder_accessors'
|
|
3
|
+
|
|
4
|
+
# Create test_builder_user_actions.rb to support actions included
|
|
5
|
+
# in selenium-core's user-extensions.js
|
|
6
|
+
#
|
|
7
|
+
# See test_builder_user_actions.rb.example for examples matching
|
|
8
|
+
# selenium-core's user-extensions.js.sample
|
|
9
|
+
module SeleniumOnRails::TestBuilderUserActions
|
|
10
|
+
end
|
|
11
|
+
require 'selenium_on_rails/test_builder_user_actions' if File.exist?(File.expand_path(File.join(File.dirname(__FILE__), 'test_builder_user_actions.rb')))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# Create test_builder_user_accessors.rb to support accessors
|
|
15
|
+
# included in selenium-core's user-extensions.js
|
|
16
|
+
#
|
|
17
|
+
# See test_builder_user_accessors.rb.example for examples matching
|
|
18
|
+
# selenium-core's user-extensions.js.sample
|
|
19
|
+
module SeleniumOnRails::TestBuilderUserAccessors
|
|
20
|
+
end
|
|
21
|
+
require 'selenium_on_rails/test_builder_user_accessors' if File.exist?(File.expand_path(File.join(File.dirname(__FILE__), 'test_builder_user_accessors.rb')))
|
|
22
|
+
|
|
23
|
+
# Builds Selenium test table using a high-level Ruby interface. Normally
|
|
24
|
+
# invoked through SeleniumOnRails::RSelenese.
|
|
25
|
+
#
|
|
26
|
+
# See SeleniumOnRails::TestBuilderActions for the available actions and
|
|
27
|
+
# SeleniumOnRails::TestBuilderAccessors for the available checks.
|
|
28
|
+
#
|
|
29
|
+
# For more information on the commands supported by TestBuilder, see the
|
|
30
|
+
# Selenium Commands Documentation at
|
|
31
|
+
# http://release.openqa.org/selenium-core/nightly/reference.html.
|
|
32
|
+
class SeleniumOnRails::TestBuilder
|
|
33
|
+
include SeleniumOnRails::TestBuilderActions
|
|
34
|
+
include SeleniumOnRails::TestBuilderAccessors
|
|
35
|
+
include SeleniumOnRails::TestBuilderUserActions
|
|
36
|
+
include SeleniumOnRails::TestBuilderUserAccessors
|
|
37
|
+
|
|
38
|
+
# Convert _str_ to a Selenium command name.
|
|
39
|
+
def self.selenize str
|
|
40
|
+
str.camelize.gsub(/^[A-Z]/) {|s| s.downcase }
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Prepends _pattern_ with 'exact:' if it would be considered containing
|
|
44
|
+
# string-match pattern otherwise.
|
|
45
|
+
def exactize pattern
|
|
46
|
+
pattern.include?(':') ? "exact:#{pattern}" : pattern
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Create a new TestBuilder for _view_.
|
|
50
|
+
def initialize view
|
|
51
|
+
@view = view
|
|
52
|
+
@output = ''
|
|
53
|
+
@xml = Builder::XmlMarkup.new :indent => 2, :target => @output
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Add a new table of tests, and return the HTML.
|
|
57
|
+
def table title
|
|
58
|
+
@xml.table do
|
|
59
|
+
@xml.tr do @xml.th(title, :colspan => 3) end
|
|
60
|
+
yield self
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Add a new test command using _cmd_, _target_ and _value_.
|
|
65
|
+
def command cmd, target=nil, value=nil
|
|
66
|
+
@xml.tr do
|
|
67
|
+
_tdata cmd
|
|
68
|
+
_tdata target
|
|
69
|
+
_tdata value
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
# :nodoc
|
|
73
|
+
alias_method :command_verbatim, :command
|
|
74
|
+
|
|
75
|
+
# Same as _command_ but add _AndWait_ to the name of _cmd_.
|
|
76
|
+
def command_and_wait cmd, target=nil, value=nil
|
|
77
|
+
command_verbatim cmd.to_s + 'AndWait', target, value
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Re routes commands in the provided block to #command_and_wait instead of
|
|
81
|
+
# #command.
|
|
82
|
+
def make_command_waiting
|
|
83
|
+
self.class.send :alias_method, :command, :command_and_wait
|
|
84
|
+
yield
|
|
85
|
+
self.class.send :alias_method, :command, :command_verbatim
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
protected
|
|
89
|
+
|
|
90
|
+
# If _url_ is a string, return unchanged. Otherwise, pass it to
|
|
91
|
+
# ActionView#UrlHelper#url_for.
|
|
92
|
+
def url_arg url
|
|
93
|
+
if url.instance_of?(String) then url else exactize(@view.url_for(url)) end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# If _arg_ is an array formats _arg_ to a textual representation.
|
|
97
|
+
# Otherwise return unchanged.
|
|
98
|
+
def collection_arg arg
|
|
99
|
+
if arg.is_a? Array
|
|
100
|
+
arg.collect {|e| e.gsub(/[\\,]/) {|s| "\\#{s}" } }.join(',')
|
|
101
|
+
else
|
|
102
|
+
arg
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
private
|
|
107
|
+
|
|
108
|
+
# Output a single TD element.
|
|
109
|
+
def _tdata value
|
|
110
|
+
if value
|
|
111
|
+
@xml.td(value.to_s)
|
|
112
|
+
else
|
|
113
|
+
@xml.td do @xml.target! << ' ' end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|