zena 1.1.3 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,803 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>Selenium UI-Element Reference</title>
|
4
|
+
<style type="text/css">
|
5
|
+
body {
|
6
|
+
margin-left: 5%;
|
7
|
+
margin-right: 5%;
|
8
|
+
}
|
9
|
+
dt {
|
10
|
+
font-weight: bolder;
|
11
|
+
}
|
12
|
+
dd {
|
13
|
+
margin-top: 10px;
|
14
|
+
margin-bottom: 10px;
|
15
|
+
}
|
16
|
+
pre {
|
17
|
+
margin: 10px;
|
18
|
+
padding: 10px;
|
19
|
+
background-color: #eaeaea;
|
20
|
+
}
|
21
|
+
code {
|
22
|
+
padding: 2px;
|
23
|
+
background-color: #dfd;
|
24
|
+
}
|
25
|
+
table {
|
26
|
+
border-collapse: collapse;
|
27
|
+
border: solid 1px black;
|
28
|
+
}
|
29
|
+
th, td {
|
30
|
+
border: solid 1px grey;
|
31
|
+
padding: 5px;
|
32
|
+
}
|
33
|
+
.highlight {
|
34
|
+
background-color: #eea;
|
35
|
+
}
|
36
|
+
.deprecated {
|
37
|
+
font-style: italic;
|
38
|
+
color: #c99;
|
39
|
+
}
|
40
|
+
</style>
|
41
|
+
</head>
|
42
|
+
|
43
|
+
<body>
|
44
|
+
|
45
|
+
<h1>Selenium UI-Element Reference</h1>
|
46
|
+
|
47
|
+
<h2>Introduction</h2>
|
48
|
+
|
49
|
+
<p>UI-Element is a Selenium feature that makes it possible to define a mapping between semantically meaningful names of elements on webpages, and the elements themselves. The mapping is defined using <a href="http://en.wikipedia.org/wiki/JSON">JavaScript Object Notation</a>, and may be shared both by the IDE and tests run via Selenium RC. It also offers a single point of update should the user interface of the application under test change.</p>
|
50
|
+
|
51
|
+
<h2>Terminology</h2>
|
52
|
+
|
53
|
+
<dl>
|
54
|
+
<dt>Page</dt>
|
55
|
+
<dd>A unique URL, and the contents available by accessing that URL. A page typically consists of several interactive page elements. A page may also be considered a DOM document object, complete with URL information.</dd>
|
56
|
+
<dt>Page element</dt>
|
57
|
+
<dd>An element on the actual webpage. Generally speaking, an element is anything the user might interact with, or anything that contains meaningful content. More specifically, an element is realized as a <a href="http://en.wikipedia.org/wiki/Document_Object_Model">Document Object Model (DOM)</a> node and its contents. So when we refer to a page element, we mean both of the following, at the same time:
|
58
|
+
<ul>
|
59
|
+
<li>something on the page</li>
|
60
|
+
<li>its DOM representation, including its relationship with other page elements</li>
|
61
|
+
</ul>
|
62
|
+
</dd>
|
63
|
+
<dt>Pageset</dt>
|
64
|
+
<dd>A set of pages that share some set of common page elements. For example, I might be able to log into my application from several different pages. If certain page elements on each of those pages appear similarly (i.e. their DOM representations are identical), those pages can be grouped into a pageset with respect to these page elements. There is no restriction on how many pagesets a given page can be a member of. Similarly, a UI element belong to multiple pagesets. A pageset is commonly represented by a <a href="http://en.wikipedia.org/wiki/Regular_expression">regular expression</a> which matches the URL's that uniquely identify pages; however, there are cases when the page content must be considered to determine pageset membership. A pageset also has a name.</dd>
|
65
|
+
<dt>UI element</dt>
|
66
|
+
<dd>A mapping between a meaningful name for a page element, and the means to locate that page element's DOM node. The page element is located via a locator. UI elements belong to pagesets.</dd>
|
67
|
+
<dt>UI argument</dt>
|
68
|
+
<dd>An optional piece of logic that determines how the locator is generated by a UI element. Typically used when similar page elements appear multiple times on the same page, and you want to address them all with a single UI element. For example, if a page presents 20 clickable search results, the index of the search result might be a UI argument.</dd>
|
69
|
+
<dt>UI map</dt>
|
70
|
+
<dd>A collection of pagesets, which in turn contain UI elements. The UI map is the medium for translating between UI specifier strings, page elements, and UI elements.</dd>
|
71
|
+
<dt>UI specifier string</dt>
|
72
|
+
<dd>A bit of text containing a pageset name, a UI element name, and optionally arguments that modify the way a locator is constructed by the UI element. UI specifier strings are intended to be the human-readable identifier for page elements.</dd>
|
73
|
+
<dt>Rollup rule</dt>
|
74
|
+
<dd>Logic that describes how one or more Selenium commands can be grouped into a single command, and how that single command may be expanded into its component Selenium commands. The single command is referred to simply as a "rollup".</dd>
|
75
|
+
<dt>Command matcher</dt>
|
76
|
+
<dd>Typically folded into a rollup rule, it matches one or more Selenium commands and optionally sets values for rollup arguments based on the matched commands. A rollup rule usually has one or more command matchers.</dd>
|
77
|
+
<dt>Rollup argument</dt>
|
78
|
+
<dd>An optional piece of logic that modifies the command expansion of a rollup.</dd>
|
79
|
+
</dl>
|
80
|
+
|
81
|
+
<h2>The Basics</h2>
|
82
|
+
|
83
|
+
<h3>Getting Motivated</h3>
|
84
|
+
|
85
|
+
<p>Question: Why use UI-Element? Answer: So your testcases can look like this (boilerplate code omitted):</p>
|
86
|
+
|
87
|
+
<pre>
|
88
|
+
<tr>
|
89
|
+
<td>open</td>
|
90
|
+
<td>/</td>
|
91
|
+
<td></td>
|
92
|
+
</tr>
|
93
|
+
<tr>
|
94
|
+
<td>clickAndWait</td>
|
95
|
+
<td><span class="highlight">ui=allPages::section(section=topics)</span></td>
|
96
|
+
<td></td>
|
97
|
+
</tr>
|
98
|
+
<tr>
|
99
|
+
<td>clickAndWait</td>
|
100
|
+
<td><span class="highlight">ui=topicListingPages::topic(topic=Process)</span></td>
|
101
|
+
<td></td>
|
102
|
+
</tr>
|
103
|
+
<tr>
|
104
|
+
<td>clickAndWait</td>
|
105
|
+
<td><span class="highlight">ui=subtopicListingPages::subtopic(subtopic=Creativity)</span></td>
|
106
|
+
<td></td>
|
107
|
+
</tr>
|
108
|
+
<tr>
|
109
|
+
<td>click</td>
|
110
|
+
<td><span class="highlight">ui=subtopicArticleListingPages::article(index=2)</span></td>
|
111
|
+
<td></td>
|
112
|
+
</tr>
|
113
|
+
</pre>
|
114
|
+
|
115
|
+
<h3>Including the Right Files</h3>
|
116
|
+
|
117
|
+
<p>UI-Element is now fully integrated with Selenium. The only additional file that needs to be specified is your map definitions file. In the IDE, add it to the comma-delimited <em>Selenium Core extensions</em> field of the IDE options. A sample definition file created for the website <a href="http://alistapart.com">alistapart.com</a> is included in the distribution and is available here:</p>
|
118
|
+
|
119
|
+
<pre><a href="chrome://selenium-ide/content/selenium/scripts/ui-map-sample.js">chrome://selenium-ide/content/selenium/scripts/ui-map-sample.js</a></pre>
|
120
|
+
|
121
|
+
<p>You might want to experiment with the sample map to get a feel for UI-Element. For the Selenium RC, you have two options. The map file may be included in the <code>user-extensions.js</code> file specified at startup with the <code>-userExtensions</code> switch. Or, you may load it dynamically with the variant of the <code>setUserExtensionJs</code> command in your driver language, before the browser is started.</p>
|
122
|
+
|
123
|
+
<h3>Map Definitions File Syntax</h3>
|
124
|
+
|
125
|
+
<p>This is the general format of a map file:</p>
|
126
|
+
|
127
|
+
<pre>
|
128
|
+
var map = new UIMap();
|
129
|
+
|
130
|
+
map.addPageset({
|
131
|
+
name: 'aPageset'
|
132
|
+
, ...
|
133
|
+
});
|
134
|
+
map.addElement('aPageset', { ... });
|
135
|
+
map.addElement('aPageset', { ... });
|
136
|
+
...
|
137
|
+
|
138
|
+
map.addPageset({
|
139
|
+
name: 'anotherPageset'
|
140
|
+
, ...
|
141
|
+
});
|
142
|
+
...
|
143
|
+
</pre>
|
144
|
+
|
145
|
+
<p>The map object is initialized by creating a new <code>UIMap</code> object. Next, a pageset is defined. Then one or more UI elements are defined for that pageset. More pagesets are defined, each with corresponding UI elements. That's it!</p>
|
146
|
+
|
147
|
+
<h3>Pageset Shorthand</h3>
|
148
|
+
|
149
|
+
<p>The method signature of <code>addPageset()</code> is <em>(pagesetShorthand)</em>. <em>pagesetShorthand</em> is a JSON description of the pageset. Here's a minimal example:</p>
|
150
|
+
|
151
|
+
<pre>
|
152
|
+
map.addPageset({
|
153
|
+
name: 'allPages'
|
154
|
+
, description: 'contains elements common to all pages'
|
155
|
+
, pathRegexp: '.*'
|
156
|
+
});
|
157
|
+
</pre>
|
158
|
+
|
159
|
+
<p>Here's a table containing information about the attributes of the Pageset object. The conditionally required or unrequired items are for IDE recording support only.</p>
|
160
|
+
|
161
|
+
<table>
|
162
|
+
<tr><th>Name</th>
|
163
|
+
<th>Required?</th>
|
164
|
+
<th>Description</th>
|
165
|
+
<th>Example</th>
|
166
|
+
</tr>
|
167
|
+
<tr><td>name</td>
|
168
|
+
<td>Yes</td>
|
169
|
+
<td>(String) the name of the pageset. This should be unique within the map.</td>
|
170
|
+
<td><pre>name: 'shopPages'</pre></td>
|
171
|
+
</tr>
|
172
|
+
<tr><td>description</td>
|
173
|
+
<td>Yes</td>
|
174
|
+
<td>(String) a description of the pageset. Ideally, this will give the reader an idea of what types of UI elements the pageset will have.</td>
|
175
|
+
<td><pre>description: 'all pages displaying product'</pre></td>
|
176
|
+
</tr>
|
177
|
+
<tr><td>pathPrefix</td>
|
178
|
+
<td>No</td>
|
179
|
+
<td>(String) the path of the URL of all included pages in this pageset will contain this prefix. For example, if all pages are of the form http://www.example.com/<span class="highlight">gallery/</span>light-show/, the page prefix might be <code>gallery/</code> .</td>
|
180
|
+
<td><pre>pathPrefix: 'gallery/'</pre></td>
|
181
|
+
</tr>
|
182
|
+
<tr><td>paths<br />pathRegexp</td>
|
183
|
+
<td>Conditional</td>
|
184
|
+
<td>(Array | String) either a list of path strings, or a string that represents a regular expression. One or the other should be defined, but not both. If an array, it enumerates pages that are included in the pageset. If a regular expression, any pages whose URL paths match the expression are considered part of the pageset. In either case, the part of the URL being matched (called the <em>path</em>) is the part following the domain, less any training slash, and not including the CGI parameters. For example:
|
185
|
+
<ul>
|
186
|
+
<li>http://www.example.com/<span class="highlight">articles/index.php</span></li>
|
187
|
+
<li>http://www.example.com/<span class="highlight">articles/2579</span>?lang=en_US</li>
|
188
|
+
<li>http://www.example.com/<span class="highlight">articles/selenium</span>/</li>
|
189
|
+
</ul>
|
190
|
+
The entire path must match (however, <code>pathPrefix</code> is taken into account if specified). If specified as a regular expression, the two regular expression characters <code>^</code> and <code>$</code> marking the start and end of the matched string are included implicitly, and should not be specified in this string. Please notice too that backslashes must be backslash-escaped in javascript strings.</td>
|
191
|
+
<td><pre>paths: [
|
192
|
+
'gotoHome.do'
|
193
|
+
, 'gotoAbout.do'
|
194
|
+
, 'gotoFaq.do'
|
195
|
+
]</pre>
|
196
|
+
<pre>pathRegexp: 'goto(Home|About|Faq)\\.do'</pre>
|
197
|
+
</tr>
|
198
|
+
<tr><td>paramRegexps</td>
|
199
|
+
<td>No</td>
|
200
|
+
<td>(Object) a mapping from URL parameter names to regular expression strings which must match their values. If specified, the set of pages potentially included in this pageset will be further filtered by URL parameter values. There is no filtering by parameter value by default.</td>
|
201
|
+
<td><pre>paramRegexps: {
|
202
|
+
dept: '^[abcd]$'
|
203
|
+
, team: 'marketing'
|
204
|
+
}</pre></td>
|
205
|
+
</tr>
|
206
|
+
<tr><td>pageContent</td>
|
207
|
+
<td>Conditional</td>
|
208
|
+
<td><p>(Function) a function that tests whether a page, represented by its document object, is contained in the pageset, and returns true if and only if this is the case. If specified, the set of pages potentially included in this pageset will be further filtered by content, after URL and URL parameter filtering.</p>
|
209
|
+
<p>Since the URL is available from the document object (<code>document.location.href</code>), you may encode the logic used for the <code>paths</code> and <code>pathRegexp</code> attributes all into the definition of <code>pageContent</code>. Thus, you may choose to omit the former if and only if using <code>pageContent</code>. Of course, you may continue to use them for clarity.</td>
|
210
|
+
<td><pre>pageContent: function(doc) {
|
211
|
+
var id = 'address-tab';
|
212
|
+
return doc.getElementById(id) != null;
|
213
|
+
}</pre></td>
|
214
|
+
</tr>
|
215
|
+
</table>
|
216
|
+
|
217
|
+
<h3><a name="ui-element-shorthand">UI-Element Shorthand</a></h3>
|
218
|
+
|
219
|
+
<p>The method signature of <code>addElement()</code> is <em>(pagesetName, uiElementShorthand)</em>. <em>pagesetName</em> is the name of the pageset the UI element is being added to. <em>uiElementShorthand</em> is a complete JSON description of the UI element object in shorthand notation.</p>
|
220
|
+
|
221
|
+
<p>In its simplest form, a UI element object looks like this:</p>
|
222
|
+
|
223
|
+
<pre>
|
224
|
+
map.addElement('allPages', {
|
225
|
+
name: 'about_link'
|
226
|
+
, description: 'link to the about page'
|
227
|
+
, locator: "//a[contains(@href, 'about.php')]"
|
228
|
+
});
|
229
|
+
</pre>
|
230
|
+
|
231
|
+
<p>Here's a table containing information about the attributes of the UI element object. The asterisk (<code>*</code>) means any string:</p>
|
232
|
+
|
233
|
+
<table>
|
234
|
+
<tr><th>Name</th>
|
235
|
+
<th>Required?</th>
|
236
|
+
<th>Description</th>
|
237
|
+
<th>Example</th>
|
238
|
+
</tr>
|
239
|
+
<tr><td>name</td>
|
240
|
+
<td>Yes</td>
|
241
|
+
<td>(String) the name of the UI element</td>
|
242
|
+
<td><pre>name: 'article'</pre></td>
|
243
|
+
</tr>
|
244
|
+
<tr><td>description</td>
|
245
|
+
<td>Yes</td>
|
246
|
+
<td>(String) a description of the UI element. This is the main documentation for this UI element, so the more detailed, the better.</td>
|
247
|
+
<td><pre>description: 'front or issue page link to article'</pre></td>
|
248
|
+
</tr>
|
249
|
+
<tr><td>args</td>
|
250
|
+
<td>No</td>
|
251
|
+
<td>(Array) a list of arguments that modify the <code>getLocator()</code> method. If unspecified, it will be treated as an empty list.</td>
|
252
|
+
<td><pre>[
|
253
|
+
{ name: 'index'
|
254
|
+
, description: 'the index of the author, by article'
|
255
|
+
, defaultValues: range(1, 5) }
|
256
|
+
]</pre><em>See section below elaborating on attributes of argument objects.</em></td>
|
257
|
+
</tr>
|
258
|
+
<tr><td>locator<br />getLocator()<br /><span class="deprecated">xpath</span<br /><span class="deprecated">getXPath()</span></td>
|
259
|
+
<td>Yes</td>
|
260
|
+
<td><p>(String | Function) either a fixed locator string, or a function that returns a locator string given a set of arguments. One or the other should be defined, but not both. Under the sheets, the <code>locator</code> attribute eventually gets transcripted as a <code>getLocator()</code> function.</p><p><span class="deprecated">As of ui0.7, <code>xpath</code> and <code>getXPath()</code> have been deprecated. They are still supported for backward compatibility.</span></p></td>
|
261
|
+
<td><pre>locator: 'submit'</pre>
|
262
|
+
<pre>getLocator: function(args) {
|
263
|
+
return 'css=div.item:nth-child(' + args.index + ')'
|
264
|
+
+ ' > h5 > a';
|
265
|
+
}</pre>
|
266
|
+
<pre>getLocator: function(args) {
|
267
|
+
var label = args.label;
|
268
|
+
var id = this._idMap[label];
|
269
|
+
return '//input[@id=' + id.quoteForXPath() + ']';
|
270
|
+
}</pre></td>
|
271
|
+
<tr><td>genericLocator<br />getGenericLocator</td>
|
272
|
+
<td>No</td>
|
273
|
+
<td><p>(String | Function) either a fixed locator string, or a function that returns a locator string. If a function, it should take no arguments.</p><p>You may experience some slowdown when recording on pages where individual UI elements have many default locators (due to many permutations of default values over multiple arguments). This is because each default locator is potentially evaluated and matched against the interacted page element. This becomes especially problematic if several UI elements have this characteristic.</p><p>By specifying a generic locator, you give the matching engine a chance to skip over UI elements that definitely don't match. The default locators for skipped elements will not be evaluated unless the generic locator matches the interacted page element..</p></td>
|
274
|
+
<td><pre>genericLocator: "//table[@class='ctrl']"
|
275
|
+
+ "/descendant::input"</pre>
|
276
|
+
<pre>getGenericLocator: function() {
|
277
|
+
return this._xpathPrefix + '/descendant::a';
|
278
|
+
}</pre>
|
279
|
+
</tr>
|
280
|
+
<tr><td>getOffsetLocator</td>
|
281
|
+
<td>No</td>
|
282
|
+
<td><p>(Function) a function that returns an offset locator. The locator is offset from the element identified by a UI specifier string. The function should take this element, and the interacted page element, as arguments, and have the method signature <code>getOffsetLocator(locatedElement, pageElement)</code>. If an offset locator can't be found, a value that evaluates to <code>false</code> must be returned.</p><p>A convenient default function <code>UIElement.defaultOffsetLocatorStrategy</code> is provided so you don't have to define your own. It uses several typical strategies also employed by the IDE recording when recording normally. See the Advanced Topics section below for more information on offset locators.</p></td>
|
283
|
+
<td><pre>getOffsetLocator: <span class="highlight">UIElement.defaultOffsetLocatorStrategy</span></pre>
|
284
|
+
<pre>getOffsetLocator:
|
285
|
+
function(locatedElement, pageElement) {
|
286
|
+
if (pageElement.parentNode == locatedElement) {
|
287
|
+
return '/child::' + pageElement.nodeName;
|
288
|
+
}
|
289
|
+
return null;
|
290
|
+
}</pre></td>
|
291
|
+
<tr><td>testcase*</td>
|
292
|
+
<td>No</td>
|
293
|
+
<td>(Object) a testcase for testing the implementation of the <code>getLocator()</code> method. As many testcases as desired may be defined for each UI element. They must all start with the string "testcase".</td>
|
294
|
+
<td><pre>testcase1: {
|
295
|
+
xhtml: '<div class="item"><h5>'
|
296
|
+
+ '<a expected-result="1" /></h5></div>'
|
297
|
+
}</pre><em>See section below elaborating on testcases.</em></td>
|
298
|
+
</tr>
|
299
|
+
<tr><td>_*</td>
|
300
|
+
<td>No</td>
|
301
|
+
<td>(Any data type) a "local variable" declared for the UI element. This variable will be available both within the <code>getLocator()</code> method of the UI element, and any <code>getDefaultValues()</code> methods of the arguments via the <code>this</code> keyword. They must all start with an underscore "_".</td>
|
302
|
+
<td><pre>_labelMap: {
|
303
|
+
'Name': 'user'
|
304
|
+
, 'Email': 'em'
|
305
|
+
, 'Phone': 'tel'
|
306
|
+
}</pre></td>
|
307
|
+
</tr>
|
308
|
+
</table>
|
309
|
+
|
310
|
+
<h3>UI-Argument Shorthand</h3>
|
311
|
+
|
312
|
+
<p>UI arguments are defined as part of UI elements, and help determine how an XPath is generated. A list of arguments may be defined within the UI element JSON shorthand. Here's an example of how that might look:</p>
|
313
|
+
|
314
|
+
<pre>
|
315
|
+
map.addElement('searchPages', {
|
316
|
+
name: 'result'
|
317
|
+
, description: 'link to a result page'
|
318
|
+
, args: [
|
319
|
+
{
|
320
|
+
name: 'index'
|
321
|
+
, description: 'the index of the search result'
|
322
|
+
, defaultValues: range(1, 21)
|
323
|
+
}
|
324
|
+
, {
|
325
|
+
name: 'type'
|
326
|
+
, description: 'the type of result page'
|
327
|
+
, defaultValues: [ 'summary', 'detail' ]
|
328
|
+
}
|
329
|
+
]
|
330
|
+
, getLocator: function(args) {
|
331
|
+
var index = args['index'];
|
332
|
+
var type = args['type'];
|
333
|
+
return "//div[@class='result'][" + index + "]"
|
334
|
+
+ "/descendant::a[@class='" + type + "']";
|
335
|
+
}
|
336
|
+
});
|
337
|
+
</pre>
|
338
|
+
|
339
|
+
<p>In the above example, two arguments are defined, <code>index</code> and <code>type</code>. Metadata is provided to describe them, and default values are also specified. FInally, the <code>getLocator()</code> method is defined. The behavior of the method depends on the values of the arguments that are passed in.</p>
|
340
|
+
|
341
|
+
<p>Default values come into play when recording tests using the Selenium IDE. When you interact with a page element in recording mode, the IDE uses all the locator strategies at its disposal to deduce an appropriate locator string for that element. UI-Element introduces a new <code>ui</code> locator strategy. When applying this strategy using a particular UI element, Selenium generates a list of XPaths to try by permuting the arguments of that UI element over all default values. Here, the default values <em>{ 1, 2, 3, 4 .. 20 }</em> are given for the <code>index</code> argument using the special <code>range()</code> function, and the values <em>{ summary, detail }</em> are given for the <code>type</code> argument in standard javascript array notation. If you don't intend to use the IDE, go ahead and set the default values to the empty array <code>[]</code>.</p>
|
342
|
+
|
343
|
+
<p>Here's a table containing information about the attributes of the UI argument object.</p>
|
344
|
+
|
345
|
+
<table>
|
346
|
+
<tr><th>Name</th>
|
347
|
+
<th>Required?</th>
|
348
|
+
<th>Description</th>
|
349
|
+
<th>Example</th>
|
350
|
+
</tr>
|
351
|
+
<tr><td>name</td>
|
352
|
+
<td>Yes</td>
|
353
|
+
<td>(String) the name of the argument. This will be the name of the property of the object passed into the parent UI element's <code>getLocator()</code> method containing the argument value.</td>
|
354
|
+
<td><pre>name: 'index'</pre></td>
|
355
|
+
</tr>
|
356
|
+
<tr><td>description</td>
|
357
|
+
<td>Yes</td>
|
358
|
+
<td>(String) a description for the argument.</td>
|
359
|
+
<td><pre>description: 'the index of the article'</pre></td>
|
360
|
+
</tr>
|
361
|
+
<tr><td>defaultValues<br/>getDefaultValues()</td>
|
362
|
+
<td>Yes</td>
|
363
|
+
<td><p>(Array | Function) either an array of string or numerical values, or a function that returns an array of string or numerical values. One or the other should be defined, but not both. Under the sheets, the <code>defaultValues</code> attribute eventually gets transcripted as a <code>getDefaultValues()</code> function.</p><p>The method signature of the function is <code>getDefaultValues(inDocument)</code>. <code>inDocument</code> is the current document object of the page at time of recording. In cases where the default values are known a priori, <code>inDocument</code> need not be used. If the default values of all arguments of a UI element are known a priori, the list of default locators for the element may be precalculated, resulting in better performance. If <code>inDocument</code> is used, in cases where the current document is inspected for valid values, the element's default locators are calculated once for every recordable event.</p></td>
|
364
|
+
<td><pre>defaultValues: [ 'alpha', 'beta', 'unlimited' ]</pre>
|
365
|
+
<pre>getDefaultValues: function() {
|
366
|
+
return keys(this._idMap);
|
367
|
+
}</pre>
|
368
|
+
<pre>getDefaultValues: function(inDocument) {
|
369
|
+
var defaultValues = [];
|
370
|
+
var links = inDocument
|
371
|
+
.getElementsByTagName('a');
|
372
|
+
for (var i = 0; i < links.length; ++i) {
|
373
|
+
var link = links[i];
|
374
|
+
if (link.className == 'category') {
|
375
|
+
defaultValues.push(link.innerHTML);
|
376
|
+
}
|
377
|
+
}
|
378
|
+
return defaultValues;
|
379
|
+
}</pre></td>
|
380
|
+
</tr>
|
381
|
+
</table>
|
382
|
+
|
383
|
+
<h3>About <code>this</code></h3>
|
384
|
+
|
385
|
+
<p>You may have noticed usage of the <code>this</code> keyword in the examples above, specifically in the <code>getLocator()</code> and <code>getDefaultValues()</code> methods. Well, what exactly is <code>this</code>?</p>
|
386
|
+
|
387
|
+
<p>The answer is: it depends. The object referred to by <code>this</code> changes depending on the context in which it is being evaluated. At the time of object creation using <code>addPageset()</code> or <code>addElement()</code>, it refers to the <code>window</code> object of the Selenium IDE, which isn't useful at all. However, subsequently any time <code>getLocator()</code> is called, its <code>this</code> references the UI element object it's attached too. Thus, using <code>this</code>, any "local variables" defined for the UI element may be accessed. Similarly, when <code>getDefaultValues()</code> is called, its <code>this</code> references the UI argument object it's attached too. But ... what "local variables" are accessible by the from <code>getDefaultValues()</code>?</p>
|
388
|
+
|
389
|
+
<p>There's a little magic here. If you defined your local variables as prescribed in the above <a href="#ui-element-shorthand">UI-Element Shorthand</a> section, starting with an underscore, those variable are automatically made available to the UI argument via its <code>this</code> keyword. Note that this isn't standard javascript behavior. It's implemented this way to clear out clutter in the method definitions and to avoid the use of global variables for lists and maps used within the methods. It is sometimes useful, for example, to define an object that maps human-friendly argument values to DOM element <code>id</code>'s. In such a case, <code>getDefaultValues()</code> can be made to simply return the <code>keys()</code> (or property names) of the map, while the <code>getLocator()</code> method uses the map to retrieve the associated <code>id</code> to involve in the locator.</p>
|
390
|
+
|
391
|
+
<p>Also note that <code>this</code> only behaves this way in the two mentioned methods, <code>getLocator()</code> and <code>getDefaultValues()</code>; in other words you can't reference the UI element's local variables using <code>this</code> outside of methods.</p>
|
392
|
+
|
393
|
+
<p>If you're interested, here's some <a href="http://www.digital-web.com/articles/scope_in_javascript/">additional reading on javascript scope</a>.</p>
|
394
|
+
|
395
|
+
<h2>Advanced Topics</h2>
|
396
|
+
|
397
|
+
<h3>Testcases</h3>
|
398
|
+
|
399
|
+
<p>You can write testcases for your UI element implementations that are run every time the Selenium IDE is started. Any testcases that fail are reported on. The dual purpose of writing testcases is to both validate the <code>getLocator()</code> method against a representation of the real page under test, and to give a visual example of what the DOM context of a page element is expected to be.</p>
|
400
|
+
|
401
|
+
<p>A testcase is an object with a required <code>xhtml</code> property (String), and a required <code>args</code> property (Object). An example is due:</p>
|
402
|
+
|
403
|
+
<pre>
|
404
|
+
testcase1: {
|
405
|
+
args: { line: 2, column: 3 }
|
406
|
+
, xhtml: '<table id="scorecard">'
|
407
|
+
+ '<tr class="line" />'
|
408
|
+
+ '<tr class="line"><td /><td /><td expected-result="1" /></tr>'
|
409
|
+
+ '</table>'
|
410
|
+
}
|
411
|
+
</pre>
|
412
|
+
|
413
|
+
<p>The <code>args</code> property specifies the object to be passed into the UI element's <code>getLocator()</code> method to generate the test locator, which is then applied to the <code>xhtml</code>. If evaluating the locator on the XHTML document returns a DOM node with the <code>expected-result</code> attribute, the testcase is considered to have passed.</p>
|
414
|
+
|
415
|
+
<p>The <code>xhtml</code> property must represent a complete XML document, sans <code><html></code> tags, which are automatically added. The reason this is necessary is that the text is being converted into an XPath evaluable DOM tree via Mozilla's native XML parser. Unfortunately, there is no way to generate a simple HTML document, only XML documents. This means that the content of the <code>xhtml</code> must be well-formed. <span class="highlight">Tags should also be specified in lowercase.</span></p>
|
416
|
+
|
417
|
+
<h3>Fuzzy Matching</h3>
|
418
|
+
|
419
|
+
<p>Here's a real-world example of where fuzzy matching is important:</p>
|
420
|
+
|
421
|
+
<pre>
|
422
|
+
<table>
|
423
|
+
<tr onclick="showDetails(0)">
|
424
|
+
<td>Brahms</td>
|
425
|
+
<td>Viola Quintet</td>
|
426
|
+
</tr>
|
427
|
+
<tr onclick="showDetails(1)">
|
428
|
+
<td>Saegusa</td>
|
429
|
+
<td>Cello 88</td>
|
430
|
+
</tr>
|
431
|
+
</table>
|
432
|
+
</pre>
|
433
|
+
|
434
|
+
<p>Imagine I'm recording in the IDE. Let's say I click on "Cello 88". The IDE would create locator for this action like <code>//table/tr[2]/td[2]</code>. Does that mean that my <code>getLocator()</code> method should return the same XPath?</p>
|
435
|
+
|
436
|
+
<p>Clearly not. Clicking on either of the table cells for the second row has the same result. I would like my UI element generated XPath to be <code>//table/tr[2]</code> . However, when recording, the page element that was identified as being acted upon was the table cell, which doesn't match my UI element XPath, so the <code>ui</code> locator strategy will fail to auto-populate. What to do?</p>
|
437
|
+
|
438
|
+
<p>Fuzzy matching to the rescue! Fuzzy matching is realized as a fuzzy matcher function that returns true if a target DOM element is considered to be equivalent to a reference DOM element. The reference DOM element would be the element specified by the UI element's generated XPath. Currently, the fuzzy matcher considers it a match if:
|
439
|
+
|
440
|
+
<ul>
|
441
|
+
<li>the elements are the same element,</li>
|
442
|
+
<li>the reference element is an anchor (<code><a></code>) element, and the target element is a descendant of it; or</li>
|
443
|
+
<li>the reference element has an <code>onclick</code> attribute, and the target element is a descendant of it.</li>
|
444
|
+
</ul>
|
445
|
+
|
446
|
+
<p>This logic may or may not be sufficient for you. The good news is, it's very easy to modify. Look for the definition of <code>BrowserBot.prototype.locateElementByUIElement.is_fuzzy_match</code> in <code>ui-element.js</code> .</p>
|
447
|
+
|
448
|
+
<h3>Offset Locators</h3>
|
449
|
+
|
450
|
+
<p>Offset locators are locators that are appended to UI specifier strings to form composite locators. They can be automatically deduced by the IDE recorder for UI elements that have specified a <code>getOffsetLocator</code> function. This feature may be useful if your pages contain too many elements to write UI elements for. In this case, offset locators allow you to define UI elements that "anchor" other elements. Given the following markup:</p>
|
451
|
+
|
452
|
+
<pre><form name="contact_info">
|
453
|
+
<input type="text" name="foo" />
|
454
|
+
<textarea name="bar"></textarea>
|
455
|
+
<input type="submit" value="baz" />
|
456
|
+
</form></pre>
|
457
|
+
|
458
|
+
<p>Assume that a UI element has been defined for the form element. Then the following locators containing offset locators and "anchored" off this element would be recorded using the default offset locator function (<code>UIElement.defaultOffsetLocatorStrategy</code>):</p>
|
459
|
+
|
460
|
+
<pre>ui=contactPages::contact_form()<span class="highlight">->//input[@name='foo']</span>
|
461
|
+
ui=contactPages::contact_form()<span class="highlight">->//textarea[@name='bar']</span>
|
462
|
+
ui=contactPages::contact_form()<span class="highlight">->//input[@value='baz']</span></pre>
|
463
|
+
|
464
|
+
<p>The character sequence <code>-></code> serves to delimit the offset locator from the main locator. For this reason, the sequence should not appear in the main locator, or else ambiguity will result.</p>
|
465
|
+
|
466
|
+
<p>When recording with the IDE, no preference is given to matching plain vanilla UI specifier strings over ones that have offset locators. In other words, if a page element could be specified both by a UI specifier string for one UI element, and by one augmented by an offset locator for a different UI element, there is no guarantee that one or the other locator will be recorded.</p>
|
467
|
+
|
468
|
+
<p>Currently, <span class="highlight">only XPath is supported as an offset locator type</span>, as it is the only locator for which a context node can be specified at evaluation time. Other locator strategies may be supported in the future.</p>
|
469
|
+
|
470
|
+
<h3>Rollup Rules</h3>
|
471
|
+
|
472
|
+
<p>Question: Why use rollup rules? Answer: Remember the testcase from the "Getting Motivated" section above? With rollups, that testcase can be condensed into this:</p>
|
473
|
+
|
474
|
+
<pre>
|
475
|
+
<tr>
|
476
|
+
<td>open</td>
|
477
|
+
<td>/</td>
|
478
|
+
<td></td>
|
479
|
+
</tr>
|
480
|
+
<tr>
|
481
|
+
<td>rollup</td>
|
482
|
+
<td><span class="highlight">navigate_to_subtopic_article</span></td>
|
483
|
+
<td><span class="highlight">index=2, subtopic=Creativity</span></td>
|
484
|
+
</tr>
|
485
|
+
</pre>
|
486
|
+
|
487
|
+
<p>It's inevitable that certain sequences of Selenium commands will appear in testcases over and over again. When this happens, you might wish to group several fine-grained commands into a single coarser, more semantically meaningful action. In doing so, you would abstract out the execution details for the action, such that if they were to change at some point, you would have a single point of update. In UI-Element, such actions are given their own command, called <code>rollup</code>. In a sense, rollups are a natural extension of the <code>ui</code> locator.</p>
|
488
|
+
|
489
|
+
<p>UI-Element is designed with the belief that the IDE can be a useful tool for writing testcases, and need not be shunned for lack of functionality. A corollary belief is that you should be able to drive your RC test in the language of your choice. The execution of the <code>rollup</code> command by the Selenium testrunner produces the component commands, which are executed in a new context, like a function call. The logic of the rollup "expansion" is written in javascript. Corresponding logic for inferring a rollup from a list of commands is also written in javascript. Thus, the logic can be incorporated into any of the family of Selenium products as a user extension. Most notably, the IDE is made viable as a testcase creation tool that understands both how rollups expand to commands, and also how rollup rules can be "applied" to commands to reduce them to rollups.</p>
|
490
|
+
|
491
|
+
<p>Rollup rule definitions appear in this general format:</p>
|
492
|
+
|
493
|
+
<pre>
|
494
|
+
var manager = new RollupManager();
|
495
|
+
|
496
|
+
manager.addRollupRule({ ... });
|
497
|
+
manager.addRollupRule({ ... });
|
498
|
+
...
|
499
|
+
</pre>
|
500
|
+
|
501
|
+
<p>In a relatively simple form, a rollup rule looks like this:</p>
|
502
|
+
|
503
|
+
<pre>
|
504
|
+
manager.addRollupRule({
|
505
|
+
name: 'do_search'
|
506
|
+
, description: 'performs a search'
|
507
|
+
, args: [
|
508
|
+
name: 'term'
|
509
|
+
, description: 'the search term'
|
510
|
+
]
|
511
|
+
, commandMatchers: [
|
512
|
+
{
|
513
|
+
command: 'type'
|
514
|
+
, target: 'ui=searchPages::search_box\\(.+'
|
515
|
+
, updateArgs: function(command, args) {
|
516
|
+
var uiSpecifier = new UISpecifier(command.target);
|
517
|
+
args.term = uiSpecifier.args.term;
|
518
|
+
return args;
|
519
|
+
}
|
520
|
+
}
|
521
|
+
, {
|
522
|
+
command: 'click.+'
|
523
|
+
, target: 'ui=searchPages::search_go\\(.+'
|
524
|
+
}
|
525
|
+
]
|
526
|
+
, getExpandedCommands: function(args) {
|
527
|
+
var commands = [];
|
528
|
+
var uiSpecifier = new UISpecifier(
|
529
|
+
'searchPages'
|
530
|
+
, 'search_box'
|
531
|
+
, { term: args.term });
|
532
|
+
commands.push({
|
533
|
+
command: 'type'
|
534
|
+
, target: 'ui=' + uiSpecifier.toString()
|
535
|
+
});
|
536
|
+
commands.push({
|
537
|
+
command: 'clickAndWait'
|
538
|
+
, target: 'ui=searchPages::search_go()'
|
539
|
+
});
|
540
|
+
return commands;
|
541
|
+
}
|
542
|
+
});
|
543
|
+
</pre>
|
544
|
+
|
545
|
+
<p>In the above example, a rollup rule is defined for performing a search. The rule can be "applied" to two consecutive commands that match the <code>commandMatchers</code>. The rollup takes one argument, <code>term</code>, and expands back to the original two commands. One thing to note is that the second command matcher will match all commands starting with <code>click</code>. The rollup will expand that command to a <code>clickAndWait</code>.</p>
|
546
|
+
|
547
|
+
<p>Here's a table containing information about the attributes of the rollup rule object.</p>
|
548
|
+
|
549
|
+
<table>
|
550
|
+
<tr><th>Name</th>
|
551
|
+
<th>Required?</th>
|
552
|
+
<th>Description</th>
|
553
|
+
<th>Example</th>
|
554
|
+
</tr>
|
555
|
+
<tr><td>name</td>
|
556
|
+
<td>Yes</td>
|
557
|
+
<td>(String) the name of the rollup rule. This will be the target of the resulting <code>rollup</code> command.</td>
|
558
|
+
<td><pre>name: 'do_login'</pre></td>
|
559
|
+
</tr>
|
560
|
+
<tr><td>description</td>
|
561
|
+
<td>Yes</td>
|
562
|
+
<td>(String) a description for the rollup rule.</td>
|
563
|
+
<td><pre>description: 'logs into the application'</pre></td>
|
564
|
+
</tr>
|
565
|
+
<tr><td>alternateCommand</td>
|
566
|
+
<td>No</td>
|
567
|
+
<td>(String) specifies an alternate usage of rollup rules to replace commands. This string is used to replace the command name of the first matched command.</td>
|
568
|
+
<td><pre>alternateCommand: 'clickAndWait'</pre></td>
|
569
|
+
</tr>
|
570
|
+
<tr><td>pre</td>
|
571
|
+
<td>No</td>
|
572
|
+
<td>(String) a detailed summary of the preconditions that must be satisfied for the rollup to execute successfully. This metadata is easily viewable in the IDE when the rollup command is selected.</td>
|
573
|
+
<td><pre>pre: 'the page contains login widgets'</pre></td>
|
574
|
+
</tr>
|
575
|
+
<tr><td>post</td>
|
576
|
+
<td>No</td>
|
577
|
+
<td>(String) a detailed summary of the postconditions that will exist after the rollup has been executed.</td>
|
578
|
+
<td><pre>post: 'the user is logged in, or is \
|
579
|
+
directed to a login error page'</pre></td>
|
580
|
+
</tr>
|
581
|
+
<tr><td>args</td>
|
582
|
+
<td>Conditional</td>
|
583
|
+
<td><p>(Array) a list of arguments that are used to modify the rollup expansion. These are similar to UI arguments, with the exception that <code>exampleValues</code> are provided, instead of <code>defaultValues</code>. Here, example values are used for reference purposes only; they are displayed in the rollup pane in the IDE.</p><p>This attribute may be omitted if no <code>updateArgs()</code> functions are defined for any command matchers.</td>
|
584
|
+
<td><pre>args: {
|
585
|
+
name: 'user'
|
586
|
+
, description: 'the username to login as'
|
587
|
+
, exampleValues: [
|
588
|
+
'John Doe'
|
589
|
+
, 'Jane Doe'
|
590
|
+
]
|
591
|
+
}</pre></td>
|
592
|
+
</tr>
|
593
|
+
<tr><td>commandMatchers<br />getRollup()</td>
|
594
|
+
<td>Yes</td>
|
595
|
+
<td><p>(Array | Function) a list of command matcher definitions, or a function that, given a list of commands, returns either 1) a rollup command if the rule is considered to match the commands (starting at the first command); or 2) false. If a function, it should have the method signature <code>getRollup(commands)</code>, and the returned rollup command (if any) must have the <code>replacementIndexes</code> attribute, which is a list of array indexes indicating which commands in the <code>commands</code> parameter are to be replaced.</p>
|
596
|
+
<p>If you don't intend on using the IDE with your rollups, go ahead and set this to the empty array <code>[]</code>.</p></td>
|
597
|
+
<td><pre>commandMatchers: [
|
598
|
+
{
|
599
|
+
command: 'type'
|
600
|
+
, target: 'ui=loginPages::user\\(.+'
|
601
|
+
, value: '.+'
|
602
|
+
, minMatches: 1
|
603
|
+
, maxMatches: 1
|
604
|
+
, updateArgs:
|
605
|
+
function(command, args) {
|
606
|
+
args.user = command.value;
|
607
|
+
return args;
|
608
|
+
}
|
609
|
+
}
|
610
|
+
]</pre>
|
611
|
+
<pre>// this is a simplistic example, roughy
|
612
|
+
// equivalent to the commandMatchers
|
613
|
+
// example above. The <span class="highlight">to_kwargs()</span> function
|
614
|
+
// is used to turn an arguments object into
|
615
|
+
// a keyword-arguments string.
|
616
|
+
getRollup: function(commands) {
|
617
|
+
var command = commands[0];
|
618
|
+
var re = /^ui=loginPages::user\(.+/;
|
619
|
+
if (command.command == 'type' &&
|
620
|
+
re.test(command.target) &&
|
621
|
+
command.value) {
|
622
|
+
var args = { user: command.value };
|
623
|
+
return {
|
624
|
+
command: 'rollup'
|
625
|
+
, target: this.name
|
626
|
+
, value: to_kwargs(args)
|
627
|
+
, replacementIndexes: [ 0 ]
|
628
|
+
};
|
629
|
+
}
|
630
|
+
return false;
|
631
|
+
}</pre><em>See section below elaborating on command matcher objects.</em></td>
|
632
|
+
</tr>
|
633
|
+
<tr><td>expandedCommands<br />getExpandedCommands()</td>
|
634
|
+
<td>Yes</td>
|
635
|
+
<td><p>(Array | Function) a list of commands the rollup command expands into, or a function that, given an argument object mapping argument names to values, returns a list of expanded commands. If a function, it should have the method signature <code>getExpandedCommands(args)</code>.</p><p>Each command in the list of expanded commands should contain a <code>command</code> attribute, which is the name of the command, and optionally <code>target</code> and <code>value</code> attributes, depending on the type of command.</p><p>It is expected that providing a fixed list of expanded commands will be of limited use, as rollups will typically contain commands that have arguments, requiring more sophisticated logic to expand.</td>
|
636
|
+
<td><pre>expandedCommands: [
|
637
|
+
{
|
638
|
+
command: 'check'
|
639
|
+
, target: 'ui=termsPages::agree\\(.+'
|
640
|
+
}
|
641
|
+
, {
|
642
|
+
command: 'clickAndWait'
|
643
|
+
, target: 'ui=termsPages::submit\\(.+'
|
644
|
+
}
|
645
|
+
]</pre>
|
646
|
+
<pre>getExpandedCommands: function(args) {
|
647
|
+
var commands = [];
|
648
|
+
commands.push({
|
649
|
+
command: 'type'
|
650
|
+
, target: 'ui=loginPages::user()'
|
651
|
+
, value: args.user
|
652
|
+
});
|
653
|
+
commands.push({
|
654
|
+
command: 'type'
|
655
|
+
, target: 'ui=loginPages::pass()'
|
656
|
+
, value: args.pass
|
657
|
+
});
|
658
|
+
commands.push({
|
659
|
+
command: 'clickAndWait'
|
660
|
+
, target: 'ui=loginPages::submit()'
|
661
|
+
});
|
662
|
+
commands.push({
|
663
|
+
command: 'verifyLocation'
|
664
|
+
, target: 'regexp:.+/home'
|
665
|
+
});
|
666
|
+
return commands;
|
667
|
+
}</pre>
|
668
|
+
<pre>// if using alternateCommand
|
669
|
+
expandedCommands: []
|
670
|
+
</pre></td>
|
671
|
+
</tr>
|
672
|
+
</table>
|
673
|
+
|
674
|
+
<p>The user should be able to freely record commands in the IDE, which can be collapsed into rollups at any point by applying the defined rollup rules. Healthy usage of the <code>ui</code> locator makes commands easy to match using command matcher definitions. Command matchers simplify the specification of a command match. In basic usage, for a rollup rule, you might specify 3 command matchers: <em>M1</em>, <em>M2</em>, and <em>M3</em>, that you intend to match 3 corresponding commands, <em>C1</em>, <em>C2</em>, and <em>C3</em>. In more complex usage, a single command matcher might match more than one command. For example, <em>M1</em> matches <em>C1</em> and <em>C2</em>, <em>M2</em> matches <em>C3</em>, and <em>M3</em> matches <em>C4</em>, <em>C5</em>, and <em>C6</em>. In the latter case, you would want to track the matches by updating argument values in the command matchers' <code>updateArgs()</code> methods.</p>
|
675
|
+
|
676
|
+
<p>Here are the required and optional fields for command matcher objects:</p>
|
677
|
+
|
678
|
+
<table>
|
679
|
+
<tr><th>Name</th>
|
680
|
+
<th>Required?</th>
|
681
|
+
<th>Description</th>
|
682
|
+
<th>Example</th>
|
683
|
+
</tr>
|
684
|
+
<tr><td>command</td>
|
685
|
+
<td>Yes</td>
|
686
|
+
<td>(String) a simplified regular expression string that matches the command name of a command. The special regexp characters <code>^</code> and <code>$</code> are automatically included at the beginning and end of the string, and therefore should not be explicitly provided.</td>
|
687
|
+
<td><pre>command: 'click.+'</pre>
|
688
|
+
<pre>command: 'rollup'</pre></td>
|
689
|
+
</tr>
|
690
|
+
<tr><td>target</td>
|
691
|
+
<td>Yes</td>
|
692
|
+
<td>(String) a simplified regular expression string that matches the target of a command. Same rules as for the <code>command</code> attribute.</td>
|
693
|
+
<td><pre>target: 'btnG'</pre>
|
694
|
+
<pre>// special regexp characters must be
|
695
|
+
// escaped in regexp strings. Backslashes
|
696
|
+
// always need to be escaped in javascript
|
697
|
+
// strings.
|
698
|
+
target: 'ui=loginPages::user\\(.+'
|
699
|
+
</pre></td>
|
700
|
+
</tr>
|
701
|
+
<tr><td>value</td>
|
702
|
+
<td>No</td>
|
703
|
+
<td>(String) a simplified regular expression string that matches the value of a command. Same rules as for the <code>command</code> attribute.</td>
|
704
|
+
<td><pre>value: '\\d+'</pre>
|
705
|
+
<pre>value: (?:foo|bar)</pre></td>
|
706
|
+
</tr>
|
707
|
+
<tr><td>minMatches</td>
|
708
|
+
<td>No</td>
|
709
|
+
<td>(Number) the minimum number of times this command matcher must match consecutive commands for the rollup rule to match a set of commands. If unspecified, the default is 1. If <code>maxMatches</code> is also specified, <code>minMatches</code> must be less than or equal to it.</td>
|
710
|
+
<td><pre>minMatches: 2</pre></td>
|
711
|
+
</tr>
|
712
|
+
<tr><td>maxMatches</td>
|
713
|
+
<td>No</td>
|
714
|
+
<td>(Number) the maximum number of times this command matcher is allowed to match consecutive commands for the rollup rule. If unspecified, the default is 1.</td>
|
715
|
+
<td><pre>maxMatches: 2</pre></td>
|
716
|
+
</tr>
|
717
|
+
<tr><td>updateArgs()</td>
|
718
|
+
<td>No</td>
|
719
|
+
<td><p>(Function) updates an arguments object when a match has been found, and returns the updated arguments object. This method is used to keep track of the way in which one or more commands were matched. When a rollup rule is successfully applied, any argument name-value pairs are stored as the rollup command's value. At time of expanding the rollup command, the command's value is converted back to an arguments object, which is passed to the rollup rule's <code>getExpandedCommands()</code> method.</p><p>This method must have the following method signature: <code>updateArgs(command, args)</code>, where <code>command</code> is the command object that was just matched, and <code>args</code> is the arguments object for the current trial application of the parent rollup rule.</td>
|
720
|
+
<td><pre>// reused from above
|
721
|
+
updateArgs: function(command, args) {
|
722
|
+
args.user = command.value;
|
723
|
+
return args;
|
724
|
+
}</pre>
|
725
|
+
<pre>// for multiple matches
|
726
|
+
updateArgs: function(command, args) {
|
727
|
+
if (!args.clickCount) {
|
728
|
+
args.clickCount = 0;
|
729
|
+
}
|
730
|
+
++args.clickCount;
|
731
|
+
return args;
|
732
|
+
}</pre>
|
733
|
+
<pre>// another example from above (modified).
|
734
|
+
// If you need to parse a UI specifier,
|
735
|
+
// instantiate a new <span class="highlight">UISpecifier</span> object with the
|
736
|
+
// locator. To do it by the book, you should
|
737
|
+
// first strip off the "ui=" prefix. If you just
|
738
|
+
// want to inspect the UI specifier's args, you
|
739
|
+
// can safely skip this step.
|
740
|
+
updateArgs: function(command, args) {
|
741
|
+
var s = command.target.replace(/^ui=/, '');
|
742
|
+
var uiSpecifier = new UISpecifier(s);
|
743
|
+
args.term = uiSpecifier.args.term;
|
744
|
+
return args;
|
745
|
+
}</pre>
|
746
|
+
<pre>// example from sample map file. If you're
|
747
|
+
// matching a rollup command that has arguments,
|
748
|
+
// you'll want to parse them. The easiest way
|
749
|
+
// to do this is with the <span class="highlight">parse_kwargs()</span>
|
750
|
+
// function, which has its roots in python.
|
751
|
+
updateArgs: function(command, args) {
|
752
|
+
var args1 = parse_kwargs(command.value);
|
753
|
+
args.subtopic = args1.subtopic;
|
754
|
+
return args;
|
755
|
+
}</pre></td>
|
756
|
+
</tr>
|
757
|
+
</table>
|
758
|
+
|
759
|
+
<p>Too much mumbo jumbo?</p>
|
760
|
+
|
761
|
+
<p>To see rollup rules in action in the IDE, use the included sample map with UI-Element (see instructions above in the "Including the Right Files" section), and grab the listing of 4 commands from the "Getting Motivated" section, above. Under the <em>Source</em> tab of the IDE, paste the commands in between the <code><tbody></code> and <code></tbody></code> tags. Now switch back to the <em>Table</em> tab, and click the new <span class="highlight">purple spiral button</span>; this is the "Apply rollup rules" button. If done correctly, you should be prompted when rollup rule matches are found. Go ahead - go to the <a href="http://alistapart.com">alistapart.com</a> site and try executing the rollups!</p>
|
762
|
+
|
763
|
+
<h2>Release Notes</h2>
|
764
|
+
|
765
|
+
<h3>Core-1.0</h3>
|
766
|
+
|
767
|
+
<ul>
|
768
|
+
<li>UI-Element is now completely integrated into Selenium Core.</li>
|
769
|
+
<li>Added offset locators. Modified the delimiter to be <code>-></code>.</li>
|
770
|
+
<li><code>getDefaultValues()</code> can dynamically construct a list of values and assume that a <code>document</code> object is being passed in.</li>
|
771
|
+
<li>Arguments in UI specifier strings are presented in the same order as they are defined in the mapping file (no longer alphabetically).</li>
|
772
|
+
<li>Allow generic locators to be specified, potentially improving recording performance when there are many UI arguments.</li>
|
773
|
+
<li>Updated documentation.</li>
|
774
|
+
<li>Many other fixes.</li>
|
775
|
+
</ul>
|
776
|
+
|
777
|
+
<h3>ui0.7</h3>
|
778
|
+
|
779
|
+
<ul>
|
780
|
+
<li>Changed extensions id and homepage to avoid conflicting with standard Selenium IDE distribution.</li>
|
781
|
+
<li>Added rollup button.</li>
|
782
|
+
<li>Added UI-Element and Rollup panes, with beautiful colors and formatting.</li>
|
783
|
+
<li>Updated referenced version of Selenium Core to 0.8.3, and RC to 0.9.2 .</li>
|
784
|
+
<li>Added <code>quoteForXPath()</code> to <code>String</code> prototype.</li>
|
785
|
+
<li>Made XPath uppercasing much more robust. It is now backed by the ajaxslt library. Uppercasing is no longer required by UI-Element. It is used to demonstrate how XPath transformations may be used to improve XPath evaluation performance when using the javascript engine. See <a href="http://groups.google.com/group/google-ajax-discuss/browse_thread/thread/f7a7a2014a6415d4">this thread on XPath performance</a>.
|
786
|
+
<li>Added new <code>rollup</code> Selenium command and associated functionality with the RollupManager object.</li>
|
787
|
+
<li>Deprecated <code>getXPath()</code> and <code>xpath</code> in favor of <code>getLocator()</code> and <code>locator</code> in the UI-Element shorthand. Testcases now work with locator types other than XPath (implicit, CSS, etc.).</li>
|
788
|
+
<li>UI element testcases are now truly XHTML. All content is considered inner HTML of the html element, which is automatically generated. This supports the use of alternate locator types described in the above bullet.</li>
|
789
|
+
<li>Global variables introduced by UI-Element are now properties of the variable <code>GLOBAL</code>. You can now name your map <code>uiMap</code> if you wish.</li>
|
790
|
+
<li>Updated the sample map, including demonstration of implicit and CSS locators, Rollup Rules, and usage of <code>quoteForXPath()</code>.</li>
|
791
|
+
<li>Improved auto-population of target dropdown with UI element locators and rollup names. The population logic is as follows: when a command is loaded from a file or inserted without having been recorded, all UI element locators are shown. After a command recorded or executed, only UI element locators for pagesets that match the page at time of recording or execution will be shown.</li>
|
792
|
+
<li>Made UI element testcase args mandatory. This reduces the startup time for the IDE, and improves testcase readability.</li>
|
793
|
+
<li>Updated documentation. Added this release notes section.</li>
|
794
|
+
</ul>
|
795
|
+
|
796
|
+
<h2>Final Thoughts</h2>
|
797
|
+
|
798
|
+
<p>Catch UI-Element news in the <a href="http://ttwhy.org/home/blog/category/selenium/">Selenium category of my blog</a>. You can also find me on the <a href="http://clearspace.openqa.org/people/gyrm">OpenQA Forums</a>.</p>
|
799
|
+
|
800
|
+
<p><em>- Haw-Bin Chai</em></p>
|
801
|
+
|
802
|
+
</body>
|
803
|
+
</html>
|