Introduce selenium tests to help get the ajax interactions correct and maintainable.

Start to improve the ajax interactions around the new deferred actions section on the project detail page
Add a README for developers describing how to run the selenium tests.


git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@387 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lukemelia 2007-01-02 00:19:57 +00:00
parent 71df0f1061
commit bde8a0bde0
170 changed files with 35512 additions and 25 deletions

11
tracks/README_DEVELOPERS Normal file
View file

@ -0,0 +1,11 @@
To run selenium tests, start Tracks in test mode using
script/server -e test
Then open a browser to
http://localhost:3000/selenium/
and interact with the test runner.
For more information about Selenium on Rails, see vendor/plugins/selenium-on-rails/README

View file

@ -100,13 +100,16 @@ class TodoController < ApplicationController
@item = check_user_return_item
@item.toggle_completion()
@saved = @item.save
respond_to do |format|
format.js do
if @saved
@remaining_undone_in_context = @user.contexts.find(@item.context_id).not_done_todo_count
determine_down_count
determine_completed_count
end
return if request.xhr?
render
end
format.html do
if @saved
# TODO: I think this will work, but can't figure out how to test it
notify :notice, "The action <strong>'#{@item.description}'</strong> was marked as <strong>#{@item.completed? ? 'complete' : 'incomplete' }</strong>"
@ -116,6 +119,8 @@ class TodoController < ApplicationController
redirect_to :action => "index"
end
end
end
end
def update
@item = check_user_return_item

View file

@ -96,10 +96,21 @@ module TodoHelper
def item_container_id
return "tickler-items" if source_view_is :deferred
return "p#{@item.project_id}" if source_view_is :project
if source_view_is :project
return "p#{@item.project_id}" if @item.active?
return "tickler" if @item.deferred?
end
return "c#{@item.context_id}"
end
def should_show_new_item
return true if source_view_is(:deferred) && @item.deferred?
return true if source_view_is(:project) && @item.project.hidden? && @item.project_hidden?
return true if source_view_is(:project) && @item.deferred?
return true if !source_view_is(:deferred) && @item.active?
return false
end
def parent_container_type
return 'tickler' if source_view_is :deferred
return 'project' if source_view_is :project
@ -107,10 +118,10 @@ module TodoHelper
end
def empty_container_msg_div_id
return "tickler-empty-nd" if source_view_is(:project) && @item.deferred?
return "p#{@item.project_id}empty-nd" if source_view_is :project
return "c#{@item.context_id}empty-nd" if source_view_is :context
return "tickler-empty-nd" if source_view_is :deferred
nil
return "c#{@item.context_id}empty-nd"
end
def project_names_for_autocomplete

View file

@ -9,11 +9,7 @@ if @saved
page.send :record, "Form.reset('todo-form-new-action');Form.focusFirstElement('todo-form-new-action')"
page << "contextAutoCompleter.options.array = #{context_names_for_autocomplete}" if @new_context_created
page << "projectAutoCompleter.options.array = #{project_names_for_autocomplete}" if @new_project_created
show_new_item = false
show_new_item = true if source_view_is(:deferred) && @item.deferred?
show_new_item = true if source_view_is(:project) && @item.project.hidden? && @item.project_hidden?
show_new_item = true if !source_view_is(:deferred) && @item.active?
if show_new_item
if should_show_new_item()
if @new_context_created
page.insert_html :top, 'display_box', :partial => 'context/context', :locals => { :context => @item.context, :collapsible => true }
else

View file

@ -6,7 +6,8 @@ if @saved
page.insert_html :top, "completed", :partial => 'todo/item', :locals => { :parent_container_type => "completed" }
page.visual_effect :highlight, dom_id(@item, 'line'), {'startcolor' => "'#99ff99'"}
page[empty_container_msg_div_id].show if @down_count == 0 && !empty_container_msg_div_id.nil?
page.hide "empty-d" # If we've checked something as done, completed items can't be empty
page.show 'tickler-empty-nd' if source_view_is(:project)
page.hide 'empty-d' # If we've checked something as done, completed items can't be empty
end
if @remaining_undone_in_context == 0 && source_view_is(:todo)
page.visual_effect :fade, item_container_id, :duration => 0.4

View file

@ -33,10 +33,16 @@ if @saved
page.visual_effect :highlight, dom_id(@item), :duration => 3
end
elsif source_view_is :project
if @project_changed || @item.deferred?
if @project_changed
page[@item].remove
page.show("p#{@original_item_project_id}empty-nd") if (@remaining_undone_in_project == 0)
page.replace_html "badge_count", @remaining_undone_in_project
elsif @item.deferred?
page[@item].remove
page.show("p#{@original_item_project_id}empty-nd") if (@remaining_undone_in_project == 0)
page.insert_html :bottom, "tickler", :partial => 'todo/item', :locals => { :parent_container_type => parent_container_type }
page['tickler-empty-nd'].hide
page.replace_html "badge_count", @remaining_undone_in_project
else
page.replace dom_id(@item), :partial => 'todo/item', :locals => { :parent_container_type => parent_container_type }
page.visual_effect :highlight, dom_id(@item), :duration => 3

View file

@ -0,0 +1,5 @@
open :controller => 'login', :action => 'logout'
open :controller => 'login'
type "user_login", username
type "user_password", password
click_and_wait "login"

View file

@ -0,0 +1,8 @@
setup :fixtures => :all
include_partial 'login', :username => 'admin', :password => 'abracadabra'
open "/project/Build_a_working_time_machine"
type "todo_description", "choose era"
type "todo_show_from", "1/1/2030"
click "//input[@value='Add item']"
wait_for_element_present "xpath=//div[@id='tickler'] //div[@class='item-container']"
assert_not_visible "tickler-empty-nd"

View file

@ -0,0 +1,9 @@
setup :fixtures => :all
include_partial 'login', :username => 'admin', :password => 'abracadabra'
open "/project/Build_a_working_time_machine"
click "edit_icon_todo_5"
wait_for_element_present "show_from_todo_5"
type "show_from_todo_5", "1/1/2030"
click "//input[@value='Update']"
wait_for_element_present "xpath=//div[@id='tickler'] //div[@id='todo_5']"
assert_not_visible "tickler-empty-nd"

View file

@ -0,0 +1,8 @@
open :controller => 'login', :action => 'logout'
open :controller => 'login'
assert_title 'exact:TRACKS::Login'
type "user_login", "admin"
type "user_password", "incorrect_password"
click_and_wait "login"
assert_title 'exact:TRACKS::Login'
verify_text_present 'Login unsuccessful'

View file

@ -0,0 +1,8 @@
open :controller => 'login', :action => 'logout'
open :controller => 'login'
assert_title 'exact:TRACKS::Login'
type "user_login", "admin"
type "user_password", "abracadabra"
click_and_wait "login"
assert_title 'exact:TRACKS::List tasks'

View file

@ -0,0 +1,10 @@
setup :fixtures => :all
include_partial 'login', :username => 'admin', :password => 'abracadabra'
open "/project/Build_a_working_time_machine"
type "todo_description", "choose era"
type "todo_show_from", "1/1/2030"
click "//input[@value='Add item']"
wait_for_element_present "xpath=//div[@id='tickler'] //div[@class='item-container']"
open "/project/Build_a_working_time_machine"
click "xpath=//div[@id='tickler'] //input[@class='item-checkbox']"
wait_for_visible "tickler-empty-nd"

View file

@ -0,0 +1,4 @@
setup :fixtures => :all
include_partial 'login', :username => 'admin', :password => 'abracadabra'
click "xpath=//div[@id='c1'] //div[@id='todo_9'] //input[@class='item-checkbox']"
wait_for_element_present "xpath=//div[@id='completed'] //div[@id='todo_9']"

View file

@ -0,0 +1,5 @@
setup :fixtures => :all
include_partial 'login', :username => 'admin', :password => 'abracadabra'
click "xpath=//div[@id='c5'] //div[@id='todo_5'] //input[@class='item-checkbox']"
wait_for_element_present "xpath=//div[@id='completed'] //div[@id='todo_5']"
wait_for_not_visible 'c5'

View file

@ -0,0 +1,5 @@
setup :fixtures => :all
include_partial 'login', :username => 'admin', :password => 'abracadabra'
click "xpath=//div[@id='completed'] //div[@id='todo_3'] //input[@class='item-checkbox']"
wait_for_element_present "xpath=//div[@id='c4'] //div[@id='todo_3']"
assert_not_visible "c4empty-nd"

View file

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View file

@ -0,0 +1,192 @@
= Selenium on Rails
== Overview
Selenium on Rails provides an easy way to test Rails application with
SeleniumCore[http://www.openqa.org/selenium-core/].
This plugin does four things:
1. The Selenium Core files don't have to pollute <tt>/public</tt>, they can stay in the Selenium gem or in <tt>/vendor/selenium</tt>.
2. No need to create suite files, they are generated on the fly -- one suite per directory in <tt>/test/selenium</tt> (suites can be nested).
3. Instead of writing the test cases in HTML you can use a number of better formats (see <tt>Formats</tt>).
4. Loading of fixtures and wiping of session (<tt>/selenium/setup</tt>).
== Installation
1. Selenium Core needs to be available. It could either be installed as a gem (<tt>gem install selenium</tt>) or in <tt>/vendor/selenium/</tt>.
2. Install Selenium on Rails: <tt>script/plugin install http://svn.openqa.org/svn/selenium-on-rails/selenium-on-rails</tt>
3. <i>If RedCloth is available the Selenese test cases can use it for better markup.</i>
4. Run the Rakefile in the plugin's directory to run the tests in order to see that everything works. (If RedCloth isn't installed a few tests will fail since they assume RedCloth is installed.)
5. Create a test case: <tt>script/generate selenium login</tt>
6. Start the server: <tt>script/server -e test</tt>
7. Point your browser to <tt>http://localhost:3000/selenium</tt>
8. If everything works as expected you should see the Selenium test runner. The north east frame contains all your test cases (just one for now), and the north frame contains your test case.
=== win32-open3
win32-open3[http://raa.ruby-lang.org/project/win32-open3/] is needed if you're
on Windows and want to run your tests as a Rake task
(see <tt>test:acceptance</tt>), i.e. you don't have to install it but it's
recommended.
You can build it from source or install the binary:
1. Download the latest version of win32-open3, open3-0.2.2.so[http://rubyforge.org/frs/download.php/8515/open3-0.2.2.so] at the time of this writing.
2. Open up irb and run this snippet: <tt>require 'rbconfig'; include Config; puts CONFIG['sitearchdir']</tt>
3. Create a <tt>win32</tt> directory under the directory you got, e.g. <tt>c:\ruby\lib\ruby\site_ruby\1.8\i386-msvcrt</tt>
4. Rename the .so file to <tt>open3.so</tt> and put it in the <tt>win32</tt> directory.
5. Profit! (unless you get an error when doing <tt>require 'win32/open3'</tt>)
== Formats
The test cases can be written in a number of formats. Which one you choose is a
matter of taste. You can generate your test files by running
<tt>script/generate selenium</tt> or by creating them manually in your
<tt>/test/selenium</tt> directory.
=== Selenese, .sel
Selenese is the dumbest format (in a good way). You just write your commands
delimited by | characters.
|open|/selenium/setup|
|open|/|
|goBack|
If you don't want to write Selenese tests by hand you can use
SeleniumIDE[http://www.openqa.org/selenium-ide/] which has
support[http://wiki.openqa.org/display/SIDE/SeleniumOnRails] for Selenese.
SeleniumIDE makes it super easy to record test and edit them.
=== RSelenese, .rsel
RSelenese enable you to write your tests in Ruby.
setup :fixtures => :all
open '/'
assert_title 'Home'
('a'..'z').each {|c| open :controller => 'user', :action => 'create', :name => c }
See SeleniumOnRails::TestBuilder for available commands.
=== HTML/RHTML
You can write your tests in HTML/RHTML but that's mostly useful if you have
existing tests you want to reuse.
=== Partial test cases
If you have some common actions you want to do in several test cases you can put
them in a separate partial test case and include them in your other test cases.
A partial test case is just like a normal test case besides that its filename
has to start with _:
#_login.rsel
open '/login'
type 'name', name
type 'password', password
click 'submit', :wait=>true
To include a partial test case you write like this in a Selenese test case:
|includePartial|login|name=John Doe|password=eoD nhoJ|
in a RSelenese test case:
include_partial 'login', :name => 'Jane Doe', :password => 'Jane Doe'.reverse
and in a RHTML test case:
<%= render :partial => 'login', :locals => {:name = 'Joe Schmo', :password => 'Joe Schmo'.reverse} %>
== Configuration
There are a number of settings available. You make them by renaming
<tt>config.yml.example</tt> to <tt>config.yml</tt> and make your changes in that
file.
=== Environments
Per default this plugin is only available in test environment. You can change
this by setting <tt>environments</tt>, such as:
#config.yml
environments:
- test
- development
== <tt>test:acceptance</tt>
You can run all your Selenium tests as a Rake task.
First, if you're on Windows, you have to make sure win32-open3 is installed.
Then you have to configure which browsers you want to run, like this:
#config.yml
browsers:
firefox: 'c:\Program Files\Mozilla Firefox\firefox.exe'
ie: 'c:\Program Files\Internet Explorer\iexplore.exe'
Now you're all set. First start a server:
script/server -e test
Then run the tests:
rake test:acceptance
Now it should work, otherwise let me know!
=== Store results
If you want to store the results from a <tt>test:acceptance</tt> you just need
to set in which directory they should be stored:
#config.yml
result_dir: 'c:\result'
So when you run <tt>rake test:acceptance</tt> the tables with the results will
be stored as <tt>.html</tt> files in that directory.
This can be useful especially for continous integration.
== Todo
=== Standalone mode
More work is needed on <tt>test:acceptance</tt> on Windows to be able to start
the server when needed.
=== user_extension.js
Selenium has support for <tt>user_extension.js</tt> which is a way to extend the
functionality of Selenium Core. However there is currently no easy way to add
such a file in Selenium on Rails.
=== More setup/teardown support?
Currently there is only support to load fixtures and to wipe the session in
<tt>/selenium/setup</tt>. Is there a need for more kinds of setups or teardowns?
=== More documentation
== Not todo
=== Editor
Creating an editor for the test cases is currently considered out of scope for
this plugin. SeleniumIDE[http://www.openqa.org/selenium-ide/] does such a good
job and has support[http://wiki.openqa.org/display/SIDE/SeleniumOnRails] for
the Selenese format.
== Credits
* Jon Tirsen, http://jutopia.tirsen.com -- initial inspiration[http://wiki.rubyonrails.com/rails/pages/SeleniumIntegration]
* Eric Kidd, http://www.randomhacks.net -- contribution of RSelenese
== Information
For more information, check out the website[http://www.openqa.org/selenium-on-rails/].

View file

@ -0,0 +1,27 @@
require 'rake'
require 'rake/testtask'
require 'rdoc/rdoc'
desc 'Default: run unit tests.'
task :default => :test
desc 'Test the Selenium on Rails plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
desc 'Generate documentation for the Selenium on Rails plugin.'
task :rdoc do
rm_rf 'doc'
RDoc::RDoc.new.document(%w(--line-numbers --inline-source --title SeleniumOnRails README lib))
end
begin
require 'rcov/rcovtask'
Rcov::RcovTask.new do |t|
t.test_files = FileList['test/*_test.rb']
end
rescue LoadError #if rcov isn't available, ignore
end

View file

@ -0,0 +1,27 @@
# Rename this file to config.yml in order to configure the plugin
#
# General settings
#
environments:
- test
# - development # Uncomment this line to enable in development environment. N.B. your development database will likely be altered/destroyed/abducted
#selenium_path: 'c:\selenium' #path to selenium installation. only needed when selenium isn't installed in /vendor/selenium or as a gem
#
# rake test:acceptance settings
#
browsers:
firefox: 'c:\Program Files\Mozilla Firefox\firefox.exe'
ie: 'c:\Program Files\Internet Explorer\iexplore.exe'
#host: 'localhost'
#port_start: 3000
#port_end: 3005
#max_browser_duration: 120
#multi_window: false
#result_dir: 'c:\result' # the directory where the results will be stored after a test:acceptance run

View file

@ -0,0 +1,27 @@
# Rename this file to config.yml in order to configure the plugin
#
# General settings
#
environments:
- test
# - development # Uncomment this line to enable in development environment. N.B. your development database will likely be altered/destroyed/abducted
#selenium_path: 'c:\selenium' #path to selenium installation. only needed when selenium isn't installed in /vendor/selenium or as a gem
#
# rake test:acceptance settings
#
browsers:
firefox: 'c:\Program Files\Mozilla Firefox\firefox.exe'
ie: 'c:\Program Files\Internet Explorer\iexplore.exe'
#host: 'localhost'
#port_start: 3000
#port_end: 3005
#max_browser_duration: 120
#multi_window: false
#result_dir: 'c:\result' # the directory where the results will be stored after a test:acceptance run

View file

@ -0,0 +1,265 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: SeleniumController</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">SeleniumController</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../files/lib/controllers/selenium_controller_rb.html">
lib/controllers/selenium_controller.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
ActionController::Base
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000006">record</a>&nbsp;&nbsp;
<a href="#M000003">setup</a>&nbsp;&nbsp;
<a href="#M000005">support_file</a>&nbsp;&nbsp;
<a href="#M000004">test_file</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="SeleniumOnRails/FixtureLoader.html">SeleniumOnRails::FixtureLoader</a></span>
<span class="include-name"><a href="SeleniumOnRails/Renderer.html">SeleniumOnRails::Renderer</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000006" class="method-detail">
<a name="M000006"></a>
<div class="method-heading">
<a href="#M000006" class="method-signature">
<span class="method-name">record</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000006-source">
<pre>
<span class="ruby-comment cmt"># File lib/controllers/selenium_controller.rb, line 50</span>
50: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">record</span>
51: <span class="ruby-identifier">dir</span> = <span class="ruby-identifier">record_table</span>
52:
53: <span class="ruby-ivar">@result</span> = {<span class="ruby-value str">'resultDir'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">dir</span>}
54: <span class="ruby-keyword kw">for</span> <span class="ruby-identifier">p</span> <span class="ruby-keyword kw">in</span> [<span class="ruby-value str">'result'</span>, <span class="ruby-value str">'numTestFailures'</span>, <span class="ruby-value str">'numTestPasses'</span>, <span class="ruby-value str">'numCommandFailures'</span>, <span class="ruby-value str">'numCommandPasses'</span>, <span class="ruby-value str">'numCommandErrors'</span>, <span class="ruby-value str">'totalTime'</span>]
55: <span class="ruby-ivar">@result</span>[<span class="ruby-identifier">p</span>] = <span class="ruby-identifier">params</span>[<span class="ruby-identifier">p</span>]
56: <span class="ruby-keyword kw">end</span>
57: <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">log_path</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:logFile</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">'default.yml'</span>), <span class="ruby-value str">'w'</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-ivar">@result</span>, <span class="ruby-identifier">f</span>)}
58:
59: <span class="ruby-identifier">render</span> <span class="ruby-identifier">:file</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">view_path</span>(<span class="ruby-value str">'record.rhtml'</span>), <span class="ruby-identifier">:layout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">layout_path</span>
60: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000003" class="method-detail">
<a name="M000003"></a>
<div class="method-heading">
<a href="#M000003" class="method-signature">
<span class="method-name">setup</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000003-source">
<pre>
<span class="ruby-comment cmt"># File lib/controllers/selenium_controller.rb, line 7</span>
7: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setup</span>
8: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">params</span>.<span class="ruby-identifier">has_key?</span> <span class="ruby-identifier">:keep_session</span>
9: <span class="ruby-identifier">reset_session</span>
10: <span class="ruby-ivar">@session_wiped</span> = <span class="ruby-keyword kw">true</span>
11: <span class="ruby-keyword kw">end</span>
12: <span class="ruby-ivar">@cleared_tables</span> = <span class="ruby-identifier">clear_tables</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:clear_tables</span>].<span class="ruby-identifier">to_s</span>
13: <span class="ruby-ivar">@loaded_fixtures</span> = <span class="ruby-identifier">load_fixtures</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:fixtures</span>].<span class="ruby-identifier">to_s</span>
14: <span class="ruby-identifier">render</span> <span class="ruby-identifier">:file</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">view_path</span>(<span class="ruby-value str">'setup.rhtml'</span>), <span class="ruby-identifier">:layout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">layout_path</span>
15: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000005" class="method-detail">
<a name="M000005"></a>
<div class="method-heading">
<a href="#M000005" class="method-signature">
<span class="method-name">support_file</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000005-source">
<pre>
<span class="ruby-comment cmt"># File lib/controllers/selenium_controller.rb, line 34</span>
34: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">support_file</span>
35: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:filename</span>].<span class="ruby-identifier">empty?</span>
36: <span class="ruby-identifier">redirect_to</span> <span class="ruby-identifier">:filename</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'TestRunner.html'</span>, <span class="ruby-identifier">:test</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'tests'</span>
37: <span class="ruby-keyword kw">return</span>
38: <span class="ruby-keyword kw">end</span>
39:
40: <span class="ruby-identifier">filename</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-identifier">selenium_path</span>, <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:filename</span>]
41: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">file?</span> <span class="ruby-identifier">filename</span>
42: <span class="ruby-identifier">type</span> = <span class="ruby-constant">WEBrick</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTPUtils</span><span class="ruby-operator">::</span><span class="ruby-constant">DefaultMimeTypes</span>[<span class="ruby-identifier">$1</span>.<span class="ruby-identifier">downcase</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">filename</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\.(\w+)$/</span>
43: <span class="ruby-identifier">type</span> <span class="ruby-operator">||=</span> <span class="ruby-value str">'text/html'</span>
44: <span class="ruby-identifier">send_file</span> <span class="ruby-identifier">filename</span>, <span class="ruby-identifier">:type</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">type</span>, <span class="ruby-identifier">:disposition</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'inline'</span>, <span class="ruby-identifier">:stream</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>
45: <span class="ruby-keyword kw">else</span>
46: <span class="ruby-identifier">render</span> <span class="ruby-identifier">:text</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'Not found'</span>, <span class="ruby-identifier">:status</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">404</span>
47: <span class="ruby-keyword kw">end</span>
48: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000004" class="method-detail">
<a name="M000004"></a>
<div class="method-heading">
<a href="#M000004" class="method-signature">
<span class="method-name">test_file</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000004-source">
<pre>
<span class="ruby-comment cmt"># File lib/controllers/selenium_controller.rb, line 17</span>
17: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_file</span>
18: <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:testname</span>] = <span class="ruby-value str">''</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:testname</span>].<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'TestSuite.html'</span>
19: <span class="ruby-identifier">filename</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-identifier">selenium_tests_path</span>, <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:testname</span>]
20: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span> <span class="ruby-identifier">filename</span>
21: <span class="ruby-ivar">@suite_path</span> = <span class="ruby-identifier">filename</span>
22: <span class="ruby-identifier">render</span> <span class="ruby-identifier">:file</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">view_path</span>(<span class="ruby-value str">'test_suite.rhtml'</span>), <span class="ruby-identifier">:layout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">layout_path</span>
23: <span class="ruby-keyword kw">elsif</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">readable?</span> <span class="ruby-identifier">filename</span>
24: <span class="ruby-identifier">render_test_case</span> <span class="ruby-identifier">filename</span>
25: <span class="ruby-keyword kw">else</span>
26: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span> <span class="ruby-identifier">selenium_tests_path</span>
27: <span class="ruby-identifier">render</span> <span class="ruby-identifier">:text</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'Not found'</span>, <span class="ruby-identifier">:status</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">404</span>
28: <span class="ruby-keyword kw">else</span>
29: <span class="ruby-identifier">render</span> <span class="ruby-identifier">:text</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-node">&quot;Did not find the Selenium tests path (#{selenium_tests_path}). Run script/generate selenium&quot;</span>, <span class="ruby-identifier">:status</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">404</span>
30: <span class="ruby-keyword kw">end</span>
31: <span class="ruby-keyword kw">end</span>
32: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: SeleniumHelper</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">SeleniumHelper</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../files/lib/selenium_helper_rb.html">
lib/selenium_helper.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000008">test_case_name</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="SeleniumOnRails/SuiteRenderer.html">SeleniumOnRails::SuiteRenderer</a></span>
<span class="include-name"><a href="SeleniumOnRails/FixtureLoader.html">SeleniumOnRails::FixtureLoader</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000008" class="method-detail">
<a name="M000008"></a>
<div class="method-heading">
<a href="#M000008" class="method-signature">
<span class="method-name">test_case_name</span><span class="method-args">(filename)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000008-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_helper.rb, line 5</span>
5: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_case_name</span> <span class="ruby-identifier">filename</span>
6: <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">filename</span>).<span class="ruby-identifier">sub</span>(<span class="ruby-regexp re">/\..*/</span>,<span class="ruby-value str">''</span>).<span class="ruby-identifier">humanize</span>
7: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: SeleniumOnRails</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">SeleniumOnRails</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../files/lib/selenium_on_rails/paths_rb.html">
lib/selenium_on_rails/paths.rb
</a>
<br />
<a href="../files/lib/selenium_on_rails_rb.html">
lib/selenium_on_rails.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="class-list">
<h3 class="section-bar">Classes and Modules</h3>
Module <a href="SeleniumOnRails/FixtureLoader.html" class="link">SeleniumOnRails::FixtureLoader</a><br />
Module <a href="SeleniumOnRails/PartialsSupport.html" class="link">SeleniumOnRails::PartialsSupport</a><br />
Module <a href="SeleniumOnRails/Paths.html" class="link">SeleniumOnRails::Paths</a><br />
Module <a href="SeleniumOnRails/Renderer.html" class="link">SeleniumOnRails::Renderer</a><br />
Module <a href="SeleniumOnRails/SuiteRenderer.html" class="link">SeleniumOnRails::SuiteRenderer</a><br />
Module <a href="SeleniumOnRails/TestBuilderAccessors.html" class="link">SeleniumOnRails::TestBuilderAccessors</a><br />
Module <a href="SeleniumOnRails/TestBuilderActions.html" class="link">SeleniumOnRails::TestBuilderActions</a><br />
Class <a href="SeleniumOnRails/RSelenese.html" class="link">SeleniumOnRails::RSelenese</a><br />
Class <a href="SeleniumOnRails/Selenese.html" class="link">SeleniumOnRails::Selenese</a><br />
Class <a href="SeleniumOnRails/TestBuilder.html" class="link">SeleniumOnRails::TestBuilder</a><br />
</div>
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,231 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: SeleniumOnRails::FixtureLoader</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">SeleniumOnRails::FixtureLoader</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/selenium_on_rails/fixture_loader_rb.html">
lib/selenium_on_rails/fixture_loader.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000049">available_fixtures</a>&nbsp;&nbsp;
<a href="#M000051">clear_tables</a>&nbsp;&nbsp;
<a href="#M000050">load_fixtures</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="Paths.html">SeleniumOnRails::Paths</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000049" class="method-detail">
<a name="M000049"></a>
<div class="method-heading">
<a href="#M000049" class="method-signature">
<span class="method-name">available_fixtures</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000049-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000049-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/fixture_loader.rb, line 6</span>
6: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">available_fixtures</span>
7: <span class="ruby-identifier">fixtures</span> = {}
8: <span class="ruby-identifier">path</span> = <span class="ruby-identifier">fixtures_path</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'/'</span>
9: <span class="ruby-identifier">files</span> = <span class="ruby-constant">Dir</span>[<span class="ruby-node">&quot;#{path}**/*.{yml,csv}&quot;</span>]
10: <span class="ruby-identifier">files</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
11: <span class="ruby-identifier">rel_path</span> = <span class="ruby-identifier">file</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-identifier">path</span>, <span class="ruby-value str">''</span>)
12: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">skip_file?</span> <span class="ruby-identifier">rel_path</span>
13: <span class="ruby-identifier">fixture_set</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">rel_path</span>)
14: <span class="ruby-identifier">fixture_set</span> = <span class="ruby-value str">''</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">fixture_set</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'.'</span>
15: <span class="ruby-identifier">fixture</span> = <span class="ruby-identifier">rel_path</span>.<span class="ruby-identifier">sub</span> <span class="ruby-regexp re">/\.[^.]*$/</span>, <span class="ruby-value str">''</span>
16: <span class="ruby-identifier">fixtures</span>[<span class="ruby-identifier">fixture_set</span>] <span class="ruby-operator">||=</span> []
17: <span class="ruby-identifier">fixtures</span>[<span class="ruby-identifier">fixture_set</span>] <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">fixture</span>
18: <span class="ruby-keyword kw">end</span>
19:
20: <span class="ruby-identifier">fixtures</span>
21: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000051" class="method-detail">
<a name="M000051"></a>
<div class="method-heading">
<a href="#M000051" class="method-signature">
<span class="method-name">clear_tables</span><span class="method-args">(tables)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000051-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000051-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/fixture_loader.rb, line 45</span>
45: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clear_tables</span> <span class="ruby-identifier">tables</span>
46: <span class="ruby-identifier">table_names</span> = <span class="ruby-identifier">tables</span>.<span class="ruby-identifier">split</span> <span class="ruby-regexp re">/\s*,\s*/</span>
47: <span class="ruby-identifier">connection</span> = <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">connection</span>
48: <span class="ruby-identifier">table_names</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">table</span><span class="ruby-operator">|</span>
49: <span class="ruby-identifier">connection</span>.<span class="ruby-identifier">execute</span> <span class="ruby-node">&quot;DELETE FROM #{table}&quot;</span>
50: <span class="ruby-keyword kw">end</span>
51: <span class="ruby-identifier">table_names</span>
52: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000050" class="method-detail">
<a name="M000050"></a>
<div class="method-heading">
<a href="#M000050" class="method-signature">
<span class="method-name">load_fixtures</span><span class="method-args">(fixtures_param)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000050-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000050-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/fixture_loader.rb, line 23</span>
23: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_fixtures</span> <span class="ruby-identifier">fixtures_param</span>
24: <span class="ruby-identifier">available</span> = <span class="ruby-keyword kw">nil</span>
25: <span class="ruby-identifier">fixtures</span> = <span class="ruby-identifier">fixtures_param</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/\s*,\s*/</span>).<span class="ruby-identifier">collect</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
26: <span class="ruby-identifier">fixture_set</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span> <span class="ruby-identifier">f</span>
27: <span class="ruby-identifier">fixture_set</span> = <span class="ruby-value str">''</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">fixture_set</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'.'</span>
28: <span class="ruby-identifier">fixture</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span> <span class="ruby-identifier">f</span>
29: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">fixture</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'all'</span>
30: <span class="ruby-identifier">available</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">available_fixtures</span>
31: <span class="ruby-identifier">available</span>[<span class="ruby-identifier">fixture_set</span>]
32: <span class="ruby-keyword kw">else</span>
33: <span class="ruby-identifier">f</span>
34: <span class="ruby-keyword kw">end</span>
35: <span class="ruby-keyword kw">end</span>
36: <span class="ruby-identifier">fixtures</span>.<span class="ruby-identifier">flatten!</span>
37: <span class="ruby-identifier">fixtures</span>.<span class="ruby-identifier">reject!</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">blank?</span> }
38:
39: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">fixtures</span>.<span class="ruby-identifier">any?</span>
40: <span class="ruby-constant">Fixtures</span>.<span class="ruby-identifier">create_fixtures</span> <span class="ruby-identifier">fixtures_path</span>, <span class="ruby-identifier">fixtures</span>
41: <span class="ruby-keyword kw">end</span>
42: <span class="ruby-identifier">fixtures</span>
43: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,195 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: SeleniumOnRails::PartialsSupport</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">SeleniumOnRails::PartialsSupport</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/selenium_on_rails/partials_support_rb.html">
lib/selenium_on_rails/partials_support.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
Provides partials support to test cases so they can include other partial
test cases.
</p>
<p>
The partial&#8217;s commands are returned as html table rows.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000081">extract_commands_from_partial</a>&nbsp;&nbsp;
<a href="#M000080">render_partial</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="Paths.html">SeleniumOnRails::Paths</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000081" class="method-detail">
<a name="M000081"></a>
<div class="method-heading">
<a href="#M000081" class="method-signature">
<span class="method-name">extract_commands_from_partial</span><span class="method-args">(partial)</span>
</a>
</div>
<div class="method-description">
<p>
Extracts the commands from a partial. The partial must contain a html table
and the first row is ignored since it cannot contain a command.
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000081-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000081-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/partials_support.rb, line 19</span>
19: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">extract_commands_from_partial</span> <span class="ruby-identifier">partial</span>
20: <span class="ruby-identifier">partial</span> = <span class="ruby-identifier">partial</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/.*&lt;table&gt;.*?&lt;tr&gt;.*?&lt;\/tr&gt;(.*?)&lt;\/table&gt;/i</span><span class="ruby-identifier">m</span>)[<span class="ruby-value">1</span>]
21: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Partial '#{name}' doesn't contain any table&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">partial</span>
22: <span class="ruby-identifier">partial</span>
23: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000080" class="method-detail">
<a name="M000080"></a>
<div class="method-heading">
<a href="#M000080" class="method-signature">
<span class="method-name">render_partial</span><span class="method-args">(partial_path = default_template_name, object = nil, local_assigns = nil, status = nil)</span>
</a>
</div>
<div class="method-description">
<p>
Overrides where the partial is searched for, and returns only the command
table rows.
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000080-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000080-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/partials_support.rb, line 9</span>
9: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render_partial</span> <span class="ruby-identifier">partial_path</span> = <span class="ruby-identifier">default_template_name</span>, <span class="ruby-identifier">object</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">local_assigns</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">status</span> = <span class="ruby-keyword kw">nil</span>
10: <span class="ruby-identifier">pattern</span> = <span class="ruby-identifier">partial_pattern</span> <span class="ruby-identifier">partial_path</span>
11: <span class="ruby-identifier">filename</span> = <span class="ruby-constant">Dir</span>[<span class="ruby-identifier">pattern</span>].<span class="ruby-identifier">first</span>
12: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Partial '#{partial_path}' cannot be found! (Looking for file: '#{pattern}')&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">filename</span>
13: <span class="ruby-identifier">partial</span> = <span class="ruby-identifier">render</span> <span class="ruby-identifier">:file</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">filename</span>, <span class="ruby-identifier">:use_full_path</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>, <span class="ruby-identifier">:locals</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">local_assigns</span>
14: <span class="ruby-identifier">extract_commands_from_partial</span> <span class="ruby-identifier">partial</span>
15: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,295 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: SeleniumOnRails::Paths</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">SeleniumOnRails::Paths</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/selenium_on_rails/paths_rb.html">
lib/selenium_on_rails/paths.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000042">fixtures_path</a>&nbsp;&nbsp;
<a href="#M000041">layout_path</a>&nbsp;&nbsp;
<a href="#M000043">log_path</a>&nbsp;&nbsp;
<a href="#M000038">selenium_path</a>&nbsp;&nbsp;
<a href="#M000039">selenium_tests_path</a>&nbsp;&nbsp;
<a href="#M000044">skip_file?</a>&nbsp;&nbsp;
<a href="#M000040">view_path</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000042" class="method-detail">
<a name="M000042"></a>
<div class="method-heading">
<a href="#M000042" class="method-signature">
<span class="method-name">fixtures_path</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000042-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000042-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/paths.rb, line 25</span>
25: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fixtures_path</span>
26: <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">RAILS_ROOT</span>, <span class="ruby-value str">'test/fixtures'</span>)
27: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000041" class="method-detail">
<a name="M000041"></a>
<div class="method-heading">
<a href="#M000041" class="method-signature">
<span class="method-name">layout_path</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p>
Returns the path to the layout template. The path is relative in relation
to the app/views/ directory since Rails doesn&#8217;t support absolute
paths to layout templates.
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000041-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000041-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/paths.rb, line 19</span>
19: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">layout_path</span>
20: <span class="ruby-identifier">rails_root</span> = <span class="ruby-constant">Pathname</span>.<span class="ruby-identifier">new</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">RAILS_ROOT</span>, <span class="ruby-value str">'app/views'</span>))
21: <span class="ruby-identifier">view_path</span> = <span class="ruby-constant">Pathname</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">view_path</span>(<span class="ruby-value str">'layout'</span>)
22: <span class="ruby-identifier">view_path</span>.<span class="ruby-identifier">relative_path_from</span>(<span class="ruby-identifier">rails_root</span>).<span class="ruby-identifier">to_s</span>
23: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000043" class="method-detail">
<a name="M000043"></a>
<div class="method-heading">
<a href="#M000043" class="method-signature">
<span class="method-name">log_path</span><span class="method-args">(log_file)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000043-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000043-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/paths.rb, line 29</span>
29: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">log_path</span> <span class="ruby-identifier">log_file</span>
30: <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword kw">__FILE__</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">'/../../log/'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">log_file</span>)
31: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000038" class="method-detail">
<a name="M000038"></a>
<div class="method-heading">
<a href="#M000038" class="method-signature">
<span class="method-name">selenium_path</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000038-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000038-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/paths.rb, line 3</span>
3: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">selenium_path</span>
4: <span class="ruby-ivar">@@selenium_path</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">find_selenium_path</span>
5: <span class="ruby-ivar">@@selenium_path</span>
6: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000039" class="method-detail">
<a name="M000039"></a>
<div class="method-heading">
<a href="#M000039" class="method-signature">
<span class="method-name">selenium_tests_path</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000039-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000039-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/paths.rb, line 8</span>
8: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">selenium_tests_path</span>
9: <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">RAILS_ROOT</span>, <span class="ruby-value str">'test/selenium'</span>))
10: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000044" class="method-detail">
<a name="M000044"></a>
<div class="method-heading">
<a href="#M000044" class="method-signature">
<span class="method-name">skip_file?</span><span class="method-args">(file)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000044-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000044-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/paths.rb, line 33</span>
33: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">skip_file?</span> <span class="ruby-identifier">file</span>
34: <span class="ruby-identifier">file</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">'/'</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
35: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">upcase</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'CVS'</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">starts_with?</span>(<span class="ruby-value str">'.'</span>) <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">ends_with?</span>(<span class="ruby-value str">'~'</span>) <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">starts_with?</span>(<span class="ruby-value str">'_'</span>)
36: <span class="ruby-keyword kw">end</span>
37: <span class="ruby-keyword kw">false</span>
38: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000040" class="method-detail">
<a name="M000040"></a>
<div class="method-heading">
<a href="#M000040" class="method-signature">
<span class="method-name">view_path</span><span class="method-args">(view)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000040-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000040-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/paths.rb, line 12</span>
12: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">view_path</span> <span class="ruby-identifier">view</span>
13: <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword kw">__FILE__</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">'/../views/'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">view</span>)
14: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,219 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: SeleniumOnRails::RSelenese</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">SeleniumOnRails::RSelenese</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/selenium_on_rails/rselenese_rb.html">
lib/selenium_on_rails/rselenese.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
<a href="TestBuilder.html">
SeleniumOnRails::TestBuilder
</a>
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
Renders Selenium test templates in a fashion analogous to <tt>rxml</tt> and
<tt>rjs</tt> templates.
</p>
<pre>
setup
open :controller =&gt; 'customer', :action =&gt; 'list'
assert_title 'Customers'
</pre>
<p>
See <a href="TestBuilder.html">SeleniumOnRails::TestBuilder</a> for a list
of available commands.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000084">new</a>&nbsp;&nbsp;
<a href="#M000085">render</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="attribute-list">
<h3 class="section-bar">Attributes</h3>
<div class="name-list">
<table>
<tr class="top-aligned-row context-row">
<td class="context-item-name">view</td>
<td class="context-item-value">&nbsp;[RW]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000084" class="method-detail">
<a name="M000084"></a>
<div class="method-heading">
<a href="#M000084" class="method-signature">
<span class="method-name">new</span><span class="method-args">(view)</span>
</a>
</div>
<div class="method-description">
<p>
Create a new <a href="RSelenese.html">RSelenese</a> renderer bound to
<em>view</em>.
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000084-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000084-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/rselenese.rb, line 17</span>
17: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">view</span>
18: <span class="ruby-keyword kw">super</span> <span class="ruby-identifier">view</span>
19: <span class="ruby-ivar">@view</span> = <span class="ruby-identifier">view</span>
20: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000085" class="method-detail">
<a name="M000085"></a>
<div class="method-heading">
<a href="#M000085" class="method-signature">
<span class="method-name">render</span><span class="method-args">(template, local_assigns)</span>
</a>
</div>
<div class="method-description">
<p>
Render <em>template</em> using <em>local_assigns</em>.
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000085-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000085-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/rselenese.rb, line 23</span>
23: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render</span> <span class="ruby-identifier">template</span>, <span class="ruby-identifier">local_assigns</span>
24: <span class="ruby-identifier">title</span> = (<span class="ruby-ivar">@view</span>.<span class="ruby-identifier">assigns</span>[<span class="ruby-value str">'page_title'</span>] <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">local_assigns</span>[<span class="ruby-value str">'page_title'</span>])
25: <span class="ruby-identifier">table</span>(<span class="ruby-identifier">title</span>) <span class="ruby-keyword kw">do</span>
26: <span class="ruby-identifier">test</span> = <span class="ruby-keyword kw">self</span> <span class="ruby-comment cmt">#to enable test.command</span>
27:
28: <span class="ruby-identifier">assign_locals_code</span> = <span class="ruby-value str">''</span>
29: <span class="ruby-identifier">local_assigns</span>.<span class="ruby-identifier">each_key</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span> <span class="ruby-identifier">assign_locals_code</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{key} = local_assigns[#{key.inspect}];&quot;</span>}
30:
31: <span class="ruby-identifier">eval</span> <span class="ruby-identifier">assign_locals_code</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;\n&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">template</span>
32: <span class="ruby-keyword kw">end</span>
33: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,156 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: SeleniumOnRails::Renderer</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">SeleniumOnRails::Renderer</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/selenium_on_rails/renderer_rb.html">
lib/selenium_on_rails/renderer.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000037">render_test_case</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="Paths.html">SeleniumOnRails::Paths</a></span>
<span class="include-name"><a href="../SeleniumHelper.html">SeleniumHelper</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000037" class="method-detail">
<a name="M000037"></a>
<div class="method-heading">
<a href="#M000037" class="method-signature">
<span class="method-name">render_test_case</span><span class="method-args">(filename)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000037-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000037-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/renderer.rb, line 5</span>
5: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render_test_case</span> <span class="ruby-identifier">filename</span>
6: <span class="ruby-ivar">@template</span>.<span class="ruby-identifier">extend</span> <span class="ruby-constant">SeleniumOnRails</span><span class="ruby-operator">::</span><span class="ruby-constant">PartialsSupport</span>
7: <span class="ruby-ivar">@page_title</span> = <span class="ruby-identifier">test_case_name</span> <span class="ruby-identifier">filename</span>
8: <span class="ruby-identifier">output</span> = <span class="ruby-identifier">render_to_string</span> <span class="ruby-identifier">:file</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">filename</span>
9: <span class="ruby-identifier">layout</span> = (<span class="ruby-identifier">output</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/&lt;html&gt;/i</span> <span class="ruby-operator">?</span> <span class="ruby-keyword kw">false</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">layout_path</span>)
10: <span class="ruby-identifier">render</span> <span class="ruby-identifier">:text</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">output</span>, <span class="ruby-identifier">:layout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">layout</span>
11:
12: <span class="ruby-identifier">headers</span>[<span class="ruby-value str">'Cache-control'</span>] = <span class="ruby-value str">'no-cache'</span>
13: <span class="ruby-identifier">headers</span>[<span class="ruby-value str">'Pragma'</span>] = <span class="ruby-value str">'no-cache'</span>
14: <span class="ruby-identifier">headers</span>[<span class="ruby-value str">'Expires'</span>] = <span class="ruby-value str">'-1'</span>
15: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,179 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: SeleniumOnRails::Selenese</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">SeleniumOnRails::Selenese</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/selenium_on_rails/selenese_rb.html">
lib/selenium_on_rails/selenese.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000082">new</a>&nbsp;&nbsp;
<a href="#M000083">render</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000082" class="method-detail">
<a name="M000082"></a>
<div class="method-heading">
<a href="#M000082" class="method-signature">
<span class="method-name">new</span><span class="method-args">(view)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000082-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000082-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/selenese.rb, line 7</span>
7: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">view</span>
8: <span class="ruby-ivar">@view</span> = <span class="ruby-identifier">view</span>
9: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000083" class="method-detail">
<a name="M000083"></a>
<div class="method-heading">
<a href="#M000083" class="method-signature">
<span class="method-name">render</span><span class="method-args">(template, local_assigns)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000083-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000083-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/selenese.rb, line 11</span>
11: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render</span> <span class="ruby-identifier">template</span>, <span class="ruby-identifier">local_assigns</span>
12: <span class="ruby-identifier">name</span> = (<span class="ruby-ivar">@view</span>.<span class="ruby-identifier">assigns</span>[<span class="ruby-value str">'page_title'</span>] <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">local_assigns</span>[<span class="ruby-value str">'page_title'</span>])
13: <span class="ruby-identifier">lines</span> = <span class="ruby-identifier">template</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">split</span> <span class="ruby-value str">&quot;\n&quot;</span>
14: <span class="ruby-identifier">html</span> = <span class="ruby-value str">''</span>
15: <span class="ruby-identifier">html</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">extract_comments</span>(<span class="ruby-identifier">lines</span>)
16: <span class="ruby-identifier">html</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">extract_commands</span>(<span class="ruby-identifier">lines</span>, <span class="ruby-identifier">name</span>)
17: <span class="ruby-identifier">html</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">extract_comments</span>(<span class="ruby-identifier">lines</span>)
18: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'You cannot have comments in the middle of commands!'</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">next_line</span> <span class="ruby-identifier">lines</span>, <span class="ruby-identifier">:any</span>
19: <span class="ruby-identifier">html</span>
20: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,223 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: SeleniumOnRails::SuiteRenderer</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">SeleniumOnRails::SuiteRenderer</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/selenium_on_rails/suite_renderer_rb.html">
lib/selenium_on_rails/suite_renderer.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000048">link_to_test_case</a>&nbsp;&nbsp;
<a href="#M000047">test_cases</a>&nbsp;&nbsp;
<a href="#M000045">test_suite_name</a>&nbsp;&nbsp;
<a href="#M000046">test_suites</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000048" class="method-detail">
<a name="M000048"></a>
<div class="method-heading">
<a href="#M000048" class="method-signature">
<span class="method-name">link_to_test_case</span><span class="method-args">(suite_name, filename)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000048-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000048-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/suite_renderer.rb, line 24</span>
24: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">link_to_test_case</span> <span class="ruby-identifier">suite_name</span>, <span class="ruby-identifier">filename</span>
25: <span class="ruby-identifier">name</span> = <span class="ruby-identifier">suite_name</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">test_case_name</span>(<span class="ruby-identifier">filename</span>)
26: <span class="ruby-identifier">link_to</span> <span class="ruby-identifier">name</span>, <span class="ruby-identifier">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:test_file</span>, <span class="ruby-identifier">:testname</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">path_to_relative_url</span>(<span class="ruby-identifier">filename</span>).<span class="ruby-identifier">sub</span>(<span class="ruby-regexp re">/^\//</span>,<span class="ruby-value str">''</span>)
27: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000047" class="method-detail">
<a name="M000047"></a>
<div class="method-heading">
<a href="#M000047" class="method-signature">
<span class="method-name">test_cases</span><span class="method-args">(path)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000047-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000047-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/suite_renderer.rb, line 18</span>
18: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_cases</span> <span class="ruby-identifier">path</span>
19: <span class="ruby-identifier">tests</span> = []
20: <span class="ruby-identifier">visit_all_tests</span> <span class="ruby-identifier">path</span>, <span class="ruby-value str">''</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">n</span>, <span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">tests</span> <span class="ruby-operator">&lt;&lt;</span> [<span class="ruby-identifier">n</span>,<span class="ruby-identifier">p</span>]}
21: <span class="ruby-identifier">tests</span>
22: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000045" class="method-detail">
<a name="M000045"></a>
<div class="method-heading">
<a href="#M000045" class="method-signature">
<span class="method-name">test_suite_name</span><span class="method-args">(path)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000045-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000045-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/suite_renderer.rb, line 2</span>
2: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_suite_name</span> <span class="ruby-identifier">path</span>
3: <span class="ruby-keyword kw">return</span> <span class="ruby-value str">'All test cases'</span> <span class="ruby-keyword kw">if</span> [<span class="ruby-keyword kw">nil</span>, <span class="ruby-value str">'/'</span>].<span class="ruby-identifier">include?</span> <span class="ruby-identifier">path_to_relative_url</span>(<span class="ruby-identifier">path</span>)
4: <span class="ruby-constant">File</span>.<span class="ruby-identifier">split</span>(<span class="ruby-identifier">path</span>)[<span class="ruby-value">-1</span>].<span class="ruby-identifier">humanize</span>
5: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000046" class="method-detail">
<a name="M000046"></a>
<div class="method-heading">
<a href="#M000046" class="method-signature">
<span class="method-name">test_suites</span><span class="method-args">(path)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000046-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000046-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/suite_renderer.rb, line 7</span>
7: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_suites</span> <span class="ruby-identifier">path</span>
8: <span class="ruby-identifier">suites</span> = []
9:
10: <span class="ruby-identifier">parent_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">split</span>(<span class="ruby-identifier">path</span>).<span class="ruby-identifier">slice</span>(<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">-2</span>)) <span class="ruby-comment cmt">#all but last</span>
11: <span class="ruby-identifier">parent_path</span> = <span class="ruby-identifier">path_to_relative_url</span> <span class="ruby-identifier">parent_path</span>
12: <span class="ruby-identifier">suites</span> <span class="ruby-operator">&lt;&lt;</span> [<span class="ruby-value str">'..'</span>, <span class="ruby-identifier">parent_path</span>] <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">parent_path</span>.<span class="ruby-identifier">nil?</span>
13:
14: <span class="ruby-identifier">visit_all_tests</span> <span class="ruby-identifier">path</span>, <span class="ruby-value str">''</span>, <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">n</span>, <span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">suites</span> <span class="ruby-operator">&lt;&lt;</span> [<span class="ruby-identifier">n</span>,<span class="ruby-identifier">path_to_relative_url</span>(<span class="ruby-identifier">p</span>)]}, <span class="ruby-keyword kw">nil</span>
15: <span class="ruby-identifier">suites</span>
16: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,372 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: SeleniumOnRails::TestBuilder</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">SeleniumOnRails::TestBuilder</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/selenium_on_rails/test_builder_rb.html">
lib/selenium_on_rails/test_builder.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
Builds Selenium test table using a high-level Ruby interface. Normally
invoked through <a href="RSelenese.html">SeleniumOnRails::RSelenese</a>.
</p>
<p>
See <a
href="TestBuilderActions.html">SeleniumOnRails::TestBuilderActions</a> for
the available actions and <a
href="TestBuilderAccessors.html">SeleniumOnRails::TestBuilderAccessors</a>
for the available checks.
</p>
<p>
For more information on the commands supported by <a
href="TestBuilder.html">TestBuilder</a>, see the Selenium Commands
Documentation at <a
href="http://release.openqa.org/selenium-core/nightly/reference.html">release.openqa.org/selenium-core/nightly/reference.html</a>.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000090">command</a>&nbsp;&nbsp;
<a href="#M000092">command_and_wait</a>&nbsp;&nbsp;
<a href="#M000091">command_verbatim</a>&nbsp;&nbsp;
<a href="#M000087">exactize</a>&nbsp;&nbsp;
<a href="#M000093">make_command_waiting</a>&nbsp;&nbsp;
<a href="#M000088">new</a>&nbsp;&nbsp;
<a href="#M000086">selenize</a>&nbsp;&nbsp;
<a href="#M000089">table</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="TestBuilderActions.html">SeleniumOnRails::TestBuilderActions</a></span>
<span class="include-name"><a href="TestBuilderAccessors.html">SeleniumOnRails::TestBuilderAccessors</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000088" class="method-detail">
<a name="M000088"></a>
<div class="method-heading">
<a href="#M000088" class="method-signature">
<span class="method-name">new</span><span class="method-args">(view)</span>
</a>
</div>
<div class="method-description">
<p>
Create a new <a href="TestBuilder.html">TestBuilder</a> for <em>view</em>.
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000088-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000088-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder.rb, line 26</span>
26: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">view</span>
27: <span class="ruby-ivar">@view</span> = <span class="ruby-identifier">view</span>
28: <span class="ruby-ivar">@output</span> = <span class="ruby-value str">''</span>
29: <span class="ruby-ivar">@xml</span> = <span class="ruby-constant">Builder</span><span class="ruby-operator">::</span><span class="ruby-constant">XmlMarkup</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">:indent</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">2</span>, <span class="ruby-identifier">:target</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@output</span>
30: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000086" class="method-detail">
<a name="M000086"></a>
<div class="method-heading">
<a href="#M000086" class="method-signature">
<span class="method-name">selenize</span><span class="method-args">(str)</span>
</a>
</div>
<div class="method-description">
<p>
Convert <em>str</em> to a Selenium command name.
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000086-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000086-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder.rb, line 15</span>
15: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">selenize</span> <span class="ruby-identifier">str</span>
16: <span class="ruby-identifier">str</span>.<span class="ruby-identifier">camelize</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/^[A-Z]/</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">downcase</span> }
17: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000090" class="method-detail">
<a name="M000090"></a>
<div class="method-heading">
<a href="#M000090" class="method-signature">
<span class="method-name">command</span><span class="method-args">(cmd, target=nil, value=nil)</span>
</a>
</div>
<div class="method-description">
<p>
Add a new test command using <em>cmd</em>, <em>target</em> and
<em>value</em>.
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000090-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000090-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder.rb, line 41</span>
41: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">command</span> <span class="ruby-identifier">cmd</span>, <span class="ruby-identifier">target</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">value</span>=<span class="ruby-keyword kw">nil</span>
42: <span class="ruby-ivar">@xml</span>.<span class="ruby-identifier">tr</span> <span class="ruby-keyword kw">do</span>
43: <span class="ruby-identifier">_tdata</span> <span class="ruby-identifier">cmd</span>
44: <span class="ruby-identifier">_tdata</span> <span class="ruby-identifier">target</span>
45: <span class="ruby-identifier">_tdata</span> <span class="ruby-identifier">value</span>
46: <span class="ruby-keyword kw">end</span>
47: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000092" class="method-detail">
<a name="M000092"></a>
<div class="method-heading">
<a href="#M000092" class="method-signature">
<span class="method-name">command_and_wait</span><span class="method-args">(cmd, target=nil, value=nil)</span>
</a>
</div>
<div class="method-description">
<p>
Same as <em>command</em> but add <em>AndWait</em> to the name of
<em>cmd</em>.
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000092-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000092-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder.rb, line 52</span>
52: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">command_and_wait</span> <span class="ruby-identifier">cmd</span>, <span class="ruby-identifier">target</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">value</span>=<span class="ruby-keyword kw">nil</span>
53: <span class="ruby-identifier">command_verbatim</span> <span class="ruby-identifier">cmd</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'AndWait'</span>, <span class="ruby-identifier">target</span>, <span class="ruby-identifier">value</span>
54: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000091" class="method-detail">
<a name="M000091"></a>
<div class="method-heading">
<span class="method-name">command_verbatim</span><span class="method-args">(cmd, target=nil, value=nil)</span>
</div>
<div class="method-description">
<p>
Alias for <a href="TestBuilder.html#M000090">command</a>
</p>
</div>
</div>
<div id="method-M000087" class="method-detail">
<a name="M000087"></a>
<div class="method-heading">
<a href="#M000087" class="method-signature">
<span class="method-name">exactize</span><span class="method-args">(pattern)</span>
</a>
</div>
<div class="method-description">
<p>
Prepends <em>pattern</em> with &#8216;exact:&#8217; if it would be
considered containing string-match pattern otherwise.
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000087-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000087-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder.rb, line 21</span>
21: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">exactize</span> <span class="ruby-identifier">pattern</span>
22: <span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value str">':'</span>) <span class="ruby-operator">?</span> <span class="ruby-node">&quot;exact:#{pattern}&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">pattern</span>
23: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000093" class="method-detail">
<a name="M000093"></a>
<div class="method-heading">
<a href="#M000093" class="method-signature">
<span class="method-name">make_command_waiting</span><span class="method-args">() {|| ...}</span>
</a>
</div>
<div class="method-description">
<p>
Re routes commands in the provided block to <a
href="TestBuilder.html#M000092">command_and_wait</a> instead of <a
href="TestBuilder.html#M000090">command</a>.
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000093-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000093-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder.rb, line 58</span>
58: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">make_command_waiting</span>
59: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">send</span> <span class="ruby-identifier">:alias_method</span>, <span class="ruby-identifier">:command</span>, <span class="ruby-identifier">:command_and_wait</span>
60: <span class="ruby-keyword kw">yield</span>
61: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">send</span> <span class="ruby-identifier">:alias_method</span>, <span class="ruby-identifier">:command</span>, <span class="ruby-identifier">:command_verbatim</span>
62: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000089" class="method-detail">
<a name="M000089"></a>
<div class="method-heading">
<a href="#M000089" class="method-signature">
<span class="method-name">table</span><span class="method-args">(title) {|self| ...}</span>
</a>
</div>
<div class="method-description">
<p>
Add a new table of tests, and return the HTML.
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000089-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000089-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/test_builder.rb, line 33</span>
33: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">table</span> <span class="ruby-identifier">title</span>
34: <span class="ruby-ivar">@xml</span>.<span class="ruby-identifier">table</span> <span class="ruby-keyword kw">do</span>
35: <span class="ruby-ivar">@xml</span>.<span class="ruby-identifier">tr</span> <span class="ruby-keyword kw">do</span> <span class="ruby-ivar">@xml</span>.<span class="ruby-identifier">th</span>(<span class="ruby-identifier">title</span>, <span class="ruby-identifier">:colspan</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">3</span>) <span class="ruby-keyword kw">end</span>
36: <span class="ruby-keyword kw">yield</span> <span class="ruby-keyword kw">self</span>
37: <span class="ruby-keyword kw">end</span>
38: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,150 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: SeleniumOnRailsConfig</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">SeleniumOnRailsConfig</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../files/lib/selenium_on_rails_config_rb.html">
lib/selenium_on_rails_config.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000007">get</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000007" class="method-detail">
<a name="M000007"></a>
<div class="method-heading">
<a href="#M000007" class="method-signature">
<span class="method-name">get</span><span class="method-args">(var, default = nil) {|if block_given?| ...}</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000007-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails_config.rb, line 5</span>
5: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get</span> <span class="ruby-identifier">var</span>, <span class="ruby-identifier">default</span> = <span class="ruby-keyword kw">nil</span>
6: <span class="ruby-identifier">value</span> = <span class="ruby-identifier">configs</span>[<span class="ruby-identifier">var</span>.<span class="ruby-identifier">to_s</span>]
7: <span class="ruby-identifier">value</span> <span class="ruby-operator">||=</span> <span class="ruby-ivar">@@defaults</span>[<span class="ruby-identifier">var</span>]
8: <span class="ruby-identifier">value</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">default</span>
9: <span class="ruby-identifier">value</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword kw">yield</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
10: <span class="ruby-identifier">value</span>
11: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,388 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: README</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>README</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>README
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Fri Dec 08 00:50:30 GMT Standard Time 2006</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<h1>Selenium on Rails</h1>
<h2>Overview</h2>
<p>
Selenium on Rails provides an easy way to test Rails application with <a
href="http://www.openqa.org/selenium-core/">Selenium Core</a>.
</p>
<p>
This plugin does four things:
</p>
<ol>
<li>The Selenium Core files don&#8217;t have to pollute <tt>/public</tt>, they
can stay in the Selenium gem or in <tt>/vendor/selenium</tt>.
</li>
<li>No need to create suite files, they are generated on the fly &#8212; one
suite per directory in <tt>/test/selenium</tt> (suites can be nested).
</li>
<li>Instead of writing the test cases in HTML you can use a number of better
formats (see <tt>Formats</tt>).
</li>
<li>Loading of fixtures and wiping of session (<tt>/selenium/setup</tt>).
</li>
</ol>
<h2>Installation</h2>
<ol>
<li>Selenium Core needs to be available. It could either be installed as a gem
(<tt>gem install selenium</tt>) or in <tt>/vendor/selenium/</tt>.
</li>
<li>Install Selenium on Rails: <tt>script/plugin install <a
href="http://svn.openqa.org/svn/selenium-on-rails/selenium-on-rails">http://svn.openqa.org/svn/selenium-on-rails/selenium-on-rails</a>/</tt>
</li>
<li><em>If RedCloth is available the Selenese test cases can use it for better
markup.</em>
</li>
<li>Run the Rakefile in the plugin&#8217;s directory to run the tests in order
to see that everything works. (If RedCloth isn&#8217;t installed a few
tests will fail since they assume RedCloth is installed.)
</li>
<li>Create a test case: <tt>script/generate selenium login</tt>
</li>
<li>Start the server: <tt>script/server -e test</tt>
</li>
<li>Point your browser to <tt><a
href="http://localhost:3000/selenium">http://localhost:3000/selenium</a></tt>
</li>
<li>If everything works as expected you should see the Selenium test runner.
The north east frame contains all your test cases (just one for now), and
the north frame contains your test case.
</li>
</ol>
<h3>win32-open3</h3>
<p>
<a href="http://raa.ruby-lang.org/project/win32-open3/">win32-open3</a> is
needed if you&#8217;re on Windows and want to run your tests as a Rake task
(see <tt>test:acceptance</tt>), i.e. you don&#8217;t have to install it but
it&#8217;s recommended.
</p>
<p>
You can build it from source or install the binary:
</p>
<ol>
<li>Download the latest version of win32-open3, <a
href="http://rubyforge.org/frs/download.php/8515/open3-0.2.2.so">open3-0.2.2.so</a>
at the time of this writing.
</li>
<li>Open up irb and run this snippet: <tt>require &#8216;rbconfig&#8217;;
include Config; puts CONFIG[&#8216;sitearchdir&#8217;]</tt>
</li>
<li>Create a <tt>win32</tt> directory under the directory you got, e.g.
<tt>c:\ruby\lib\ruby\site_ruby\1.8\i386-msvcrt</tt>
</li>
<li>Rename the .so file to <tt>open3.so</tt> and put it in the <tt>win32</tt>
directory.
</li>
<li>Profit! (unless you get an error when doing <tt>require
&#8216;win32/open3&#8216;</tt>)
</li>
</ol>
<h2>Formats</h2>
<p>
The test cases can be written in a number of formats. Which one you choose
is a matter of taste. You can generate your test files by running
<tt>script/generate selenium</tt> or by creating them manually in your
<tt>/test/selenium</tt> directory.
</p>
<h3>Selenese, .sel</h3>
<p>
Selenese is the dumbest format (in a good way). You just write your
commands delimited by | characters.
</p>
<pre>
|open|/selenium/setup|
|open|/|
|goBack|
</pre>
<p>
If you don&#8217;t want to write Selenese tests by hand you can use <a
href="http://www.openqa.org/selenium-ide/">SeleniumIDE</a> which has <a
href="http://wiki.openqa.org/display/SIDE/SeleniumOnRails">support</a> for
Selenese.
</p>
<p>
SeleniumIDE makes it super easy to record test and edit them.
</p>
<h3>RSelenese, .rsel</h3>
<p>
RSelenese enable you to write your tests in Ruby.
</p>
<pre>
setup :fixtures =&gt; :all
open '/'
assert_title 'Home'
('a'..'z').each {|c| open :controller =&gt; 'user', :action =&gt; 'create', :name =&gt; c }
</pre>
<p>
See <a
href="../classes/SeleniumOnRails/TestBuilder.html">SeleniumOnRails::TestBuilder</a>
for available commands.
</p>
<h3>HTML/RHTML</h3>
<p>
You can write your tests in HTML/RHTML but that&#8217;s mostly useful if
you have existing tests you want to reuse.
</p>
<h3>Partial test cases</h3>
<p>
If you have some common actions you want to do in several test cases you
can put them in a separate partial test case and include them in your other
test cases.
</p>
<p>
A partial test case is just like a normal test case besides that its
filename has to start with _:
</p>
<pre>
#_login.rsel
open '/login'
type 'name', name
type 'password', password
click 'submit', :wait=&gt;true
</pre>
<p>
To include a partial test case you write like this in a Selenese test case:
</p>
<pre>
|includePartial|login|name=John Doe|password=eoD nhoJ|
</pre>
<p>
in a RSelenese test case:
</p>
<pre>
include_partial 'login', :name =&gt; 'Jane Doe', :password =&gt; 'Jane Doe'.reverse
</pre>
<p>
and in a RHTML test case:
</p>
<pre>
&lt;%= render :partial =&gt; 'login', :locals =&gt; {:name = 'Joe Schmo', :password =&gt; 'Joe Schmo'.reverse} %&gt;
</pre>
<h2>Configuration</h2>
<p>
There are a number of settings available. You make them by renaming
<tt>config.yml.example</tt> to <tt>config.yml</tt> and make your changes in
that file.
</p>
<h3>Environments</h3>
<p>
Per default this plugin is only available in test environment. You can
change this by setting <tt>environments</tt>, such as:
</p>
<pre>
#config.yml
environments:
- test
- development
</pre>
<h2><tt>test:acceptance</tt></h2>
<p>
You can run all your Selenium tests as a Rake task.
</p>
<p>
First, if you&#8217;re on Windows, you have to make sure win32-open3 is
installed. Then you have to configure which browsers you want to run, like
this:
</p>
<pre>
#config.yml
browsers:
firefox: 'c:\Program Files\Mozilla Firefox\firefox.exe'
ie: 'c:\Program Files\Internet Explorer\iexplore.exe'
</pre>
<p>
Now you&#8217;re all set. First start a server:
</p>
<pre>
script/server -e test
</pre>
<p>
Then run the tests:
</p>
<pre>
rake test:acceptance
</pre>
<p>
Now it should work, otherwise let me know!
</p>
<h3>Store results</h3>
<p>
If you want to store the results from a <tt>test:acceptance</tt> you just
need to set in which directory they should be stored:
</p>
<pre>
#config.yml
result_dir: 'c:\result'
</pre>
<p>
So when you run <tt>rake test:acceptance</tt> the tables with the results
will be stored as <tt>.html</tt> files in that directory.
</p>
<p>
This can be useful especially for continous integration.
</p>
<h2>Todo</h2>
<h3>Standalone mode</h3>
<p>
More work is needed on <tt>test:acceptance</tt> on Windows to be able to
start the server when needed.
</p>
<h3>user_extension.js</h3>
<p>
Selenium has support for <tt>user_extension.js</tt> which is a way to
extend the functionality of Selenium Core. However there is currently no
easy way to add such a file in Selenium on Rails.
</p>
<h3>More setup/teardown support?</h3>
<p>
Currently there is only support to load fixtures and to wipe the session in
<tt>/selenium/setup</tt>. Is there a need for more kinds of setups or
teardowns?
</p>
<h3>More documentation</h3>
<h2>Not todo</h2>
<h3>Editor</h3>
<p>
Creating an editor for the test cases is currently considered out of scope
for this plugin. <a
href="http://www.openqa.org/selenium-ide/">SeleniumIDE</a> does such a good
job and has <a
href="http://wiki.openqa.org/display/SIDE/SeleniumOnRails">support</a> for
the Selenese format.
</p>
<h2>Credits</h2>
<ul>
<li>Jon Tirsen, <a href="http://jutopia.tirsen.com">jutopia.tirsen.com</a>
&#8212; initial <a
href="http://wiki.rubyonrails.com/rails/pages/SeleniumIntegration">inspiration</a>
</li>
<li>Eric Kidd, <a href="http://www.randomhacks.net">www.randomhacks.net</a>
&#8212; contribution of RSelenese
</li>
</ul>
<h2>Information</h2>
<p>
For more information, check out the <a
href="http://www.openqa.org/selenium-on-rails/">website</a>.
</p>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: selenium_controller.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>selenium_controller.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/controllers/selenium_controller.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Fri Dec 08 00:52:51 GMT Standard Time 2006</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="requires-list">
<h3 class="section-bar">Required files</h3>
<div class="name-list">
webrick/httputils&nbsp;&nbsp;
</div>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: selenium_helper.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>selenium_helper.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/selenium_helper.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Sun Feb 05 01:02:10 W. Europe Standard Time 2006</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,207 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: acceptance_test_runner.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>acceptance_test_runner.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/selenium_on_rails/acceptance_test_runner.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Fri Dec 08 00:16:44 GMT Standard Time 2006</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="requires-list">
<h3 class="section-bar">Required files</h3>
<div class="name-list">
net/http&nbsp;&nbsp;
tempfile&nbsp;&nbsp;
</div>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000001">c</a>&nbsp;&nbsp;
<a href="#M000002">c_b</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="constants-list">
<h3 class="section-bar">Constants</h3>
<div class="name-list">
<table summary="Constants">
<tr class="top-aligned-row context-row">
<td class="context-item-name">BROWSERS</td>
<td>=</td>
<td class="context-item-value">c :browsers, {}</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">REUSE_EXISTING_SERVER</td>
<td>=</td>
<td class="context-item-value">c :reuse_existing_server, true</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">START_SERVER</td>
<td>=</td>
<td class="context-item-value">c :start_server, false</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">PORTS</td>
<td>=</td>
<td class="context-item-value">c(:port_start, 3000)..c(:port_end, 3005)</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">TEST_RUNNER_URL</td>
<td>=</td>
<td class="context-item-value">c :test_runner_url, '/selenium/TestRunner.html'</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">MAX_BROWSER_DURATION</td>
<td>=</td>
<td class="context-item-value">c :max_browser_duration, 2*60</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">SERVER_COMMAND</td>
<td>=</td>
<td class="context-item-value">c_b :server_command do server_path = File.expand_path(File.dirname(__FILE__) + '/../../../../../script/server')</td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000001" class="method-detail">
<a name="M000001"></a>
<div class="method-heading">
<a href="#M000001" class="method-signature">
<span class="method-name">c</span><span class="method-args">(var, default = nil)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000001-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/acceptance_test_runner.rb, line 7</span>
7: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">c</span>(<span class="ruby-identifier">var</span>, <span class="ruby-identifier">default</span> = <span class="ruby-keyword kw">nil</span>) <span class="ruby-constant">SeleniumOnRailsConfig</span>.<span class="ruby-identifier">get</span> <span class="ruby-identifier">var</span>, <span class="ruby-identifier">default</span> <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000002" class="method-detail">
<a name="M000002"></a>
<div class="method-heading">
<a href="#M000002" class="method-signature">
<span class="method-name">c_b</span><span class="method-args">(var, default = nil) {|| ...}</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000002-source">
<pre>
<span class="ruby-comment cmt"># File lib/selenium_on_rails/acceptance_test_runner.rb, line 8</span>
8: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">c_b</span>(<span class="ruby-identifier">var</span>, <span class="ruby-identifier">default</span> = <span class="ruby-keyword kw">nil</span>) <span class="ruby-constant">SeleniumOnRailsConfig</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">var</span>, <span class="ruby-identifier">default</span>) { <span class="ruby-keyword kw">yield</span> } <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: fixture_loader.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>fixture_loader.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/selenium_on_rails/fixture_loader.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Sun Feb 05 00:59:28 W. Europe Standard Time 2006</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="requires-list">
<h3 class="section-bar">Required files</h3>
<div class="name-list">
active_record/fixtures&nbsp;&nbsp;
</div>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: partials_support.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>partials_support.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/selenium_on_rails/partials_support.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Tue May 02 00:43:37 W. Europe Daylight Time 2006</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
Provides partials support to test cases so they can include other partial
test cases.
</p>
<p>
The partial&#8217;s commands are returned as html table rows.
</p>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: paths.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>paths.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/selenium_on_rails/paths.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Sun Feb 05 00:59:28 W. Europe Standard Time 2006</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: renderer.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>renderer.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/selenium_on_rails/renderer.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Sun Feb 05 00:59:29 W. Europe Standard Time 2006</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: rselenese.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>rselenese.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/selenium_on_rails/rselenese.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Sun Feb 19 12:59:40 W. Europe Standard Time 2006</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
Renders Selenium test templates in a fashion analogous to <tt>rxml</tt> and
<tt>rjs</tt> templates.
</p>
<pre>
setup
open :controller =&gt; 'customer', :action =&gt; 'list'
assert_title 'Customers'
</pre>
<p>
See <a
href="../../../classes/SeleniumOnRails/TestBuilder.html">SeleniumOnRails::TestBuilder</a>
for a list of available commands.
</p>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: selenese.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>selenese.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/selenium_on_rails/selenese.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Sun Feb 05 00:56:55 W. Europe Standard Time 2006</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: suite_renderer.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>suite_renderer.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/selenium_on_rails/suite_renderer.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Sun Feb 05 04:12:56 W. Europe Standard Time 2006</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: test_builder_accessors.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>test_builder_accessors.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/selenium_on_rails/test_builder_accessors.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Tue Jun 06 03:01:29 W. Europe Daylight Time 2006</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
The accessors available for <a
href="../../../classes/SeleniumOnRails/TestBuilder.html">SeleniumOnRails::TestBuilder</a>
tests.
</p>
<p>
For each <tt>store_foo</tt> there&#8217;s <tt>assert_foo</tt>,
<tt>assert_not_foo</tt>, <tt>verify_foo</tt>, <tt>verify_not_foo</tt>,
<tt>wait_for_foo</tt>, <tt>wait_for_not_foo</tt>.
</p>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: test_builder_actions.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>test_builder_actions.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/selenium_on_rails/test_builder_actions.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Tue Jun 06 03:12:04 W. Europe Daylight Time 2006</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
The actions available for <a
href="../../../classes/SeleniumOnRails/TestBuilder.html">SeleniumOnRails::TestBuilder</a>
tests.
</p>
<p>
For each action <tt>foo</tt> there&#8217;s also an action
<tt>foo_and_wait</tt>.
</p>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,121 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: test_builder.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>test_builder.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/selenium_on_rails/test_builder.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Tue Jun 06 02:47:24 W. Europe Daylight Time 2006</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
Builds Selenium test table using a high-level Ruby interface. Normally
invoked through <a
href="../../../classes/SeleniumOnRails/RSelenese.html">SeleniumOnRails::RSelenese</a>.
</p>
<p>
See <a
href="../../../classes/SeleniumOnRails/TestBuilderActions.html">SeleniumOnRails::TestBuilderActions</a>
for the available actions and <a
href="../../../classes/SeleniumOnRails/TestBuilderAccessors.html">SeleniumOnRails::TestBuilderAccessors</a>
for the available checks.
</p>
<p>
For more information on the commands supported by TestBuilder, see the
Selenium Commands Documentation at <a
href="http://release.openqa.org/selenium-core/nightly/reference.html">release.openqa.org/selenium-core/nightly/reference.html</a>.
</p>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: selenium_on_rails_config.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>selenium_on_rails_config.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/selenium_on_rails_config.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Mon Feb 20 21:58:17 W. Europe Standard Time 2006</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="requires-list">
<h3 class="section-bar">Required files</h3>
<div class="name-list">
yaml&nbsp;&nbsp;
</div>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,115 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: selenium_on_rails.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>selenium_on_rails.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/selenium_on_rails.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Thu May 04 01:18:20 W. Europe Daylight Time 2006</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="requires-list">
<h3 class="section-bar">Required files</h3>
<div class="name-list">
selenium_on_rails/selenese&nbsp;&nbsp;
selenium_on_rails/test_builder&nbsp;&nbsp;
selenium_on_rails/rselenese&nbsp;&nbsp;
selenium_on_rails/suite_renderer&nbsp;&nbsp;
selenium_on_rails/paths&nbsp;&nbsp;
selenium_on_rails/fixture_loader&nbsp;&nbsp;
selenium_on_rails/partials_support&nbsp;&nbsp;
selenium_on_rails/renderer&nbsp;&nbsp;
</div>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Classes
-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Classes</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
<base target="docwin" />
</head>
<body>
<div id="index">
<h1 class="section-bar">Classes</h1>
<div id="index-entries">
<a href="classes/SeleniumController.html">SeleniumController</a><br />
<a href="classes/SeleniumHelper.html">SeleniumHelper</a><br />
<a href="classes/SeleniumOnRails.html">SeleniumOnRails</a><br />
<a href="classes/SeleniumOnRails/FixtureLoader.html">SeleniumOnRails::FixtureLoader</a><br />
<a href="classes/SeleniumOnRails/PartialsSupport.html">SeleniumOnRails::PartialsSupport</a><br />
<a href="classes/SeleniumOnRails/Paths.html">SeleniumOnRails::Paths</a><br />
<a href="classes/SeleniumOnRails/RSelenese.html">SeleniumOnRails::RSelenese</a><br />
<a href="classes/SeleniumOnRails/Renderer.html">SeleniumOnRails::Renderer</a><br />
<a href="classes/SeleniumOnRails/Selenese.html">SeleniumOnRails::Selenese</a><br />
<a href="classes/SeleniumOnRails/SuiteRenderer.html">SeleniumOnRails::SuiteRenderer</a><br />
<a href="classes/SeleniumOnRails/TestBuilder.html">SeleniumOnRails::TestBuilder</a><br />
<a href="classes/SeleniumOnRails/TestBuilderAccessors.html">SeleniumOnRails::TestBuilderAccessors</a><br />
<a href="classes/SeleniumOnRails/TestBuilderActions.html">SeleniumOnRails::TestBuilderActions</a><br />
<a href="classes/SeleniumOnRailsConfig.html">SeleniumOnRailsConfig</a><br />
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Files
-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Files</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
<base target="docwin" />
</head>
<body>
<div id="index">
<h1 class="section-bar">Files</h1>
<div id="index-entries">
<a href="files/README.html">README</a><br />
<a href="files/lib/controllers/selenium_controller_rb.html">lib/controllers/selenium_controller.rb</a><br />
<a href="files/lib/selenium_helper_rb.html">lib/selenium_helper.rb</a><br />
<a href="files/lib/selenium_on_rails_rb.html">lib/selenium_on_rails.rb</a><br />
<a href="files/lib/selenium_on_rails/acceptance_test_runner_rb.html">lib/selenium_on_rails/acceptance_test_runner.rb</a><br />
<a href="files/lib/selenium_on_rails/fixture_loader_rb.html">lib/selenium_on_rails/fixture_loader.rb</a><br />
<a href="files/lib/selenium_on_rails/partials_support_rb.html">lib/selenium_on_rails/partials_support.rb</a><br />
<a href="files/lib/selenium_on_rails/paths_rb.html">lib/selenium_on_rails/paths.rb</a><br />
<a href="files/lib/selenium_on_rails/renderer_rb.html">lib/selenium_on_rails/renderer.rb</a><br />
<a href="files/lib/selenium_on_rails/rselenese_rb.html">lib/selenium_on_rails/rselenese.rb</a><br />
<a href="files/lib/selenium_on_rails/selenese_rb.html">lib/selenium_on_rails/selenese.rb</a><br />
<a href="files/lib/selenium_on_rails/suite_renderer_rb.html">lib/selenium_on_rails/suite_renderer.rb</a><br />
<a href="files/lib/selenium_on_rails/test_builder_rb.html">lib/selenium_on_rails/test_builder.rb</a><br />
<a href="files/lib/selenium_on_rails/test_builder_accessors_rb.html">lib/selenium_on_rails/test_builder_accessors.rb</a><br />
<a href="files/lib/selenium_on_rails/test_builder_actions_rb.html">lib/selenium_on_rails/test_builder_actions.rb</a><br />
<a href="files/lib/selenium_on_rails_config_rb.html">lib/selenium_on_rails_config.rb</a><br />
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Methods
-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Methods</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
<base target="docwin" />
</head>
<body>
<div id="index">
<h1 class="section-bar">Methods</h1>
<div id="index-entries">
<a href="classes/SeleniumOnRails/TestBuilderActions.html#M000022">add_selection (SeleniumOnRails::TestBuilderActions)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderActions.html#M000029">answer_on_next_prompt (SeleniumOnRails::TestBuilderActions)</a><br />
<a href="classes/SeleniumOnRails/FixtureLoader.html#M000049">available_fixtures (SeleniumOnRails::FixtureLoader)</a><br />
<a href="files/lib/selenium_on_rails/acceptance_test_runner_rb.html#M000001">c (lib/selenium_on_rails/acceptance_test_runner.rb)</a><br />
<a href="files/lib/selenium_on_rails/acceptance_test_runner_rb.html#M000002">c_b (lib/selenium_on_rails/acceptance_test_runner.rb)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderActions.html#M000019">check (SeleniumOnRails::TestBuilderActions)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderActions.html#M000028">choose_cancel_on_next_confirmation (SeleniumOnRails::TestBuilderActions)</a><br />
<a href="classes/SeleniumOnRails/FixtureLoader.html#M000051">clear_tables (SeleniumOnRails::FixtureLoader)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderActions.html#M000011">click (SeleniumOnRails::TestBuilderActions)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderActions.html#M000032">close (SeleniumOnRails::TestBuilderActions)</a><br />
<a href="classes/SeleniumOnRails/TestBuilder.html#M000090">command (SeleniumOnRails::TestBuilder)</a><br />
<a href="classes/SeleniumOnRails/TestBuilder.html#M000092">command_and_wait (SeleniumOnRails::TestBuilder)</a><br />
<a href="classes/SeleniumOnRails/TestBuilder.html#M000091">command_verbatim (SeleniumOnRails::TestBuilder)</a><br />
<a href="classes/SeleniumOnRails/TestBuilder.html#M000087">exactize (SeleniumOnRails::TestBuilder)</a><br />
<a href="classes/SeleniumOnRails/PartialsSupport.html#M000081">extract_commands_from_partial (SeleniumOnRails::PartialsSupport)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderActions.html#M000012">fire_event (SeleniumOnRails::TestBuilderActions)</a><br />
<a href="classes/SeleniumOnRails/Paths.html#M000042">fixtures_path (SeleniumOnRails::Paths)</a><br />
<a href="classes/SeleniumOnRailsConfig.html#M000007">get (SeleniumOnRailsConfig)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderActions.html#M000030">go_back (SeleniumOnRails::TestBuilderActions)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderActions.html#M000010">include_partial (SeleniumOnRails::TestBuilderActions)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderActions.html#M000014">key_down (SeleniumOnRails::TestBuilderActions)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderActions.html#M000013">key_press (SeleniumOnRails::TestBuilderActions)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderActions.html#M000015">key_up (SeleniumOnRails::TestBuilderActions)</a><br />
<a href="classes/SeleniumOnRails/Paths.html#M000041">layout_path (SeleniumOnRails::Paths)</a><br />
<a href="classes/SeleniumOnRails/SuiteRenderer.html#M000048">link_to_test_case (SeleniumOnRails::SuiteRenderer)</a><br />
<a href="classes/SeleniumOnRails/FixtureLoader.html#M000050">load_fixtures (SeleniumOnRails::FixtureLoader)</a><br />
<a href="classes/SeleniumOnRails/Paths.html#M000043">log_path (SeleniumOnRails::Paths)</a><br />
<a href="classes/SeleniumOnRails/TestBuilder.html#M000093">make_command_waiting (SeleniumOnRails::TestBuilder)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderActions.html#M000017">mouse_down (SeleniumOnRails::TestBuilderActions)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderActions.html#M000016">mouse_over (SeleniumOnRails::TestBuilderActions)</a><br />
<a href="classes/SeleniumOnRails/Selenese.html#M000082">new (SeleniumOnRails::Selenese)</a><br />
<a href="classes/SeleniumOnRails/TestBuilder.html#M000088">new (SeleniumOnRails::TestBuilder)</a><br />
<a href="classes/SeleniumOnRails/RSelenese.html#M000084">new (SeleniumOnRails::RSelenese)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderActions.html#M000025">open (SeleniumOnRails::TestBuilderActions)</a><br />
<a href="classes/SeleniumController.html#M000006">record (SeleniumController)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderActions.html#M000031">refresh (SeleniumOnRails::TestBuilderActions)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderActions.html#M000023">remove_selection (SeleniumOnRails::TestBuilderActions)</a><br />
<a href="classes/SeleniumOnRails/Selenese.html#M000083">render (SeleniumOnRails::Selenese)</a><br />
<a href="classes/SeleniumOnRails/RSelenese.html#M000085">render (SeleniumOnRails::RSelenese)</a><br />
<a href="classes/SeleniumOnRails/PartialsSupport.html#M000080">render_partial (SeleniumOnRails::PartialsSupport)</a><br />
<a href="classes/SeleniumOnRails/Renderer.html#M000037">render_test_case (SeleniumOnRails::Renderer)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderActions.html#M000021">select (SeleniumOnRails::TestBuilderActions)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderActions.html#M000026">select_window (SeleniumOnRails::TestBuilderActions)</a><br />
<a href="classes/SeleniumOnRails/Paths.html#M000038">selenium_path (SeleniumOnRails::Paths)</a><br />
<a href="classes/SeleniumOnRails/Paths.html#M000039">selenium_tests_path (SeleniumOnRails::Paths)</a><br />
<a href="classes/SeleniumOnRails/TestBuilder.html#M000086">selenize (SeleniumOnRails::TestBuilder)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderActions.html#M000033">set_context (SeleniumOnRails::TestBuilderActions)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderActions.html#M000035">set_timeout (SeleniumOnRails::TestBuilderActions)</a><br />
<a href="classes/SeleniumController.html#M000003">setup (SeleniumController)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderActions.html#M000009">setup (SeleniumOnRails::TestBuilderActions)</a><br />
<a href="classes/SeleniumOnRails/Paths.html#M000044">skip_file? (SeleniumOnRails::Paths)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderAccessors.html#M000058">store_absolute_location (SeleniumOnRails::TestBuilderAccessors)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderAccessors.html#M000055">store_alert (SeleniumOnRails::TestBuilderAccessors)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderAccessors.html#M000052">store_alert_present (SeleniumOnRails::TestBuilderAccessors)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderAccessors.html#M000075">store_all_buttons (SeleniumOnRails::TestBuilderAccessors)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderAccessors.html#M000077">store_all_fields (SeleniumOnRails::TestBuilderAccessors)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderAccessors.html#M000076">store_all_links (SeleniumOnRails::TestBuilderAccessors)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderAccessors.html#M000070">store_attribute (SeleniumOnRails::TestBuilderAccessors)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderAccessors.html#M000061">store_body_text (SeleniumOnRails::TestBuilderAccessors)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderAccessors.html#M000065">store_checked (SeleniumOnRails::TestBuilderAccessors)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderAccessors.html#M000056">store_confirmation (SeleniumOnRails::TestBuilderAccessors)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderAccessors.html#M000054">store_confirmation_present (SeleniumOnRails::TestBuilderAccessors)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderAccessors.html#M000074">store_editable (SeleniumOnRails::TestBuilderAccessors)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderAccessors.html#M000072">store_element_present (SeleniumOnRails::TestBuilderAccessors)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderAccessors.html#M000064">store_eval (SeleniumOnRails::TestBuilderAccessors)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderAccessors.html#M000079">store_expression (SeleniumOnRails::TestBuilderAccessors)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderAccessors.html#M000078">store_html_source (SeleniumOnRails::TestBuilderAccessors)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderAccessors.html#M000059">store_location (SeleniumOnRails::TestBuilderAccessors)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderAccessors.html#M000057">store_prompt (SeleniumOnRails::TestBuilderAccessors)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderAccessors.html#M000053">store_prompt_present (SeleniumOnRails::TestBuilderAccessors)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderAccessors.html#M000069">store_select_options (SeleniumOnRails::TestBuilderAccessors)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderAccessors.html#M000067">store_selected (SeleniumOnRails::TestBuilderAccessors)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderAccessors.html#M000068">store_selected_options (SeleniumOnRails::TestBuilderAccessors)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderAccessors.html#M000066">store_table (SeleniumOnRails::TestBuilderAccessors)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderAccessors.html#M000063">store_text (SeleniumOnRails::TestBuilderAccessors)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderAccessors.html#M000071">store_text_present (SeleniumOnRails::TestBuilderAccessors)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderAccessors.html#M000060">store_title (SeleniumOnRails::TestBuilderAccessors)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderAccessors.html#M000062">store_value (SeleniumOnRails::TestBuilderAccessors)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderAccessors.html#M000073">store_visible (SeleniumOnRails::TestBuilderAccessors)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderActions.html#M000024">submit (SeleniumOnRails::TestBuilderActions)</a><br />
<a href="classes/SeleniumController.html#M000005">support_file (SeleniumController)</a><br />
<a href="classes/SeleniumOnRails/TestBuilder.html#M000089">table (SeleniumOnRails::TestBuilder)</a><br />
<a href="classes/SeleniumHelper.html#M000008">test_case_name (SeleniumHelper)</a><br />
<a href="classes/SeleniumOnRails/SuiteRenderer.html#M000047">test_cases (SeleniumOnRails::SuiteRenderer)</a><br />
<a href="classes/SeleniumController.html#M000004">test_file (SeleniumController)</a><br />
<a href="classes/SeleniumOnRails/SuiteRenderer.html#M000045">test_suite_name (SeleniumOnRails::SuiteRenderer)</a><br />
<a href="classes/SeleniumOnRails/SuiteRenderer.html#M000046">test_suites (SeleniumOnRails::SuiteRenderer)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderActions.html#M000018">type (SeleniumOnRails::TestBuilderActions)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderActions.html#M000020">uncheck (SeleniumOnRails::TestBuilderActions)</a><br />
<a href="classes/SeleniumOnRails/Paths.html#M000040">view_path (SeleniumOnRails::Paths)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderActions.html#M000034">wait_for_condition (SeleniumOnRails::TestBuilderActions)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderActions.html#M000036">wait_for_page_to_load (SeleniumOnRails::TestBuilderActions)</a><br />
<a href="classes/SeleniumOnRails/TestBuilderActions.html#M000027">wait_for_popup (SeleniumOnRails::TestBuilderActions)</a><br />
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<!--
SeleniumOnRails
-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>SeleniumOnRails</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<frameset rows="20%, 80%">
<frameset cols="25%,35%,45%">
<frame src="fr_file_index.html" title="Files" name="Files" />
<frame src="fr_class_index.html" name="Classes" />
<frame src="fr_method_index.html" name="Methods" />
</frameset>
<frame src="files/README.html" name="docwin" />
</frameset>
</html>

View file

@ -0,0 +1,208 @@
body {
font-family: Verdana,Arial,Helvetica,sans-serif;
font-size: 90%;
margin: 0;
margin-left: 40px;
padding: 0;
background: white;
}
h1,h2,h3,h4 { margin: 0; color: #efefef; background: transparent; }
h1 { font-size: 150%; }
h2,h3,h4 { margin-top: 1em; }
a { background: #eef; color: #039; text-decoration: none; }
a:hover { background: #039; color: #eef; }
/* Override the base stylesheet's Anchor inside a table cell */
td > a {
background: transparent;
color: #039;
text-decoration: none;
}
/* and inside a section title */
.section-title > a {
background: transparent;
color: #eee;
text-decoration: none;
}
/* === Structural elements =================================== */
div#index {
margin: 0;
margin-left: -40px;
padding: 0;
font-size: 90%;
}
div#index a {
margin-left: 0.7em;
}
div#index .section-bar {
margin-left: 0px;
padding-left: 0.7em;
background: #ccc;
font-size: small;
}
div#classHeader, div#fileHeader {
width: auto;
color: white;
padding: 0.5em 1.5em 0.5em 1.5em;
margin: 0;
margin-left: -40px;
border-bottom: 3px solid #006;
}
div#classHeader a, div#fileHeader a {
background: inherit;
color: white;
}
div#classHeader td, div#fileHeader td {
background: inherit;
color: white;
}
div#fileHeader {
background: #057;
}
div#classHeader {
background: #048;
}
.class-name-in-header {
font-size: 180%;
font-weight: bold;
}
div#bodyContent {
padding: 0 1.5em 0 1.5em;
}
div#description {
padding: 0.5em 1.5em;
background: #efefef;
border: 1px dotted #999;
}
div#description h1,h2,h3,h4,h5,h6 {
color: #125;;
background: transparent;
}
div#validator-badges {
text-align: center;
}
div#validator-badges img { border: 0; }
div#copyright {
color: #333;
background: #efefef;
font: 0.75em sans-serif;
margin-top: 5em;
margin-bottom: 0;
padding: 0.5em 2em;
}
/* === Classes =================================== */
table.header-table {
color: white;
font-size: small;
}
.type-note {
font-size: small;
color: #DEDEDE;
}
.xxsection-bar {
background: #eee;
color: #333;
padding: 3px;
}
.section-bar {
color: #333;
border-bottom: 1px solid #999;
margin-left: -20px;
}
.section-title {
background: #79a;
color: #eee;
padding: 3px;
margin-top: 2em;
margin-left: -30px;
border: 1px solid #999;
}
.top-aligned-row { vertical-align: top }
.bottom-aligned-row { vertical-align: bottom }
/* --- Context section classes ----------------------- */
.context-row { }
.context-item-name { font-family: monospace; font-weight: bold; color: black; }
.context-item-value { font-size: small; color: #448; }
.context-item-desc { color: #333; padding-left: 2em; }
/* --- Method classes -------------------------- */
.method-detail {
background: #efefef;
padding: 0;
margin-top: 0.5em;
margin-bottom: 1em;
border: 1px dotted #ccc;
}
.method-heading {
color: black;
background: #ccc;
border-bottom: 1px solid #666;
padding: 0.2em 0.5em 0 0.5em;
}
.method-signature { color: black; background: inherit; }
.method-name { font-weight: bold; }
.method-args { font-style: italic; }
.method-description { padding: 0 0.5em 0 0.5em; }
/* --- Source code sections -------------------- */
a.source-toggle { font-size: 90%; }
div.method-source-code {
background: #262626;
color: #ffdead;
margin: 1em;
padding: 0.5em;
border: 1px dashed #999;
overflow: hidden;
}
div.method-source-code pre { color: #ffdead; overflow: hidden; }
/* --- Ruby keyword styles --------------------- */
.standalone-code { background: #221111; color: #ffdead; overflow: hidden; }
.ruby-constant { color: #7fffd4; background: transparent; }
.ruby-keyword { color: #00ffff; background: transparent; }
.ruby-ivar { color: #eedd82; background: transparent; }
.ruby-operator { color: #00ffee; background: transparent; }
.ruby-identifier { color: #ffdead; background: transparent; }
.ruby-node { color: #ffa07a; background: transparent; }
.ruby-comment { color: #b22222; font-weight: bold; background: transparent; }
.ruby-regexp { color: #ffa07a; background: transparent; }
.ruby-value { color: #7fffd4; background: transparent; }

View file

@ -0,0 +1,19 @@
Description:
Generates a stub Selenium test case.
Examples:
./script/generate selenium login
will create:
/test/selenium/login.sel
./script/generate selenium user/create
will create:
/test/selenium/user/create.sel
./script/generate selenium login.rsel
will create:
/test/selenium/login.rsel
./script/generate selenium logout.rhtml
will create:
/test/selenium/logout.rhtml

View file

@ -0,0 +1,50 @@
class SeleniumGenerator < Rails::Generator::Base
def initialize runtime_args, runtime_options = {}
super
usage if @args.empty?
end
def banner
"Usage: #{$0} #{spec.name} testname [options]"
end
def manifest
record do |m|
path = 'test/selenium'
path = File.join(path, suite_path) unless suite_path.empty?
m.directory path
template = case File.extname(filename)
when '.rhtml' then 'rhtml.rhtml'
when '.rsel' then 'rselenese.rhtml'
else 'selenese.rhtml'
end
m.template template, File.join(path, filename)
end
end
def filename
name = File.basename args[0]
extensions = ['.sel', '.rhtml', '.rsel']
name = "#{name}.sel" unless extensions.include? File.extname(name)
name
end
def suite_path
sp = File.dirname args[0]
sp = '' if sp == '.'
sp
end
def testcase_link
l = "http://localhost:3000/selenium/tests/"
l = "#{l}#{suite_path}/" unless suite_path.empty?
l + filename
end
def suite_link
l = "http://localhost:3000/selenium"
l = "#{l}/TestRunner.html?test=tests/#{suite_path}" unless suite_path.empty?
l
end
end

View file

@ -0,0 +1,16 @@
<p>It's often a good idea to start the test with opening <tt>/selenium/setup</tt> (see <%%= link_to 'here', :controller => 'selenium', :action => 'setup' %> for more info).</p>
<table>
<tr><th colspan="3"><%%= @page_title %></th></tr>
<tr><td>open</td><td>/selenium/setup</td><td>&nbsp;</td></tr>
<%% for page in ['/', '/home'] -%>
<tr><td>open</td><td><%%= page %></td><td>&nbsp;</td></tr>
<tr><td>assertTitle</td><td>Home</td><td>&nbsp;</td></tr>
<%% end -%>
</table>
<p>More information about the commands is available <a href="http://release.openqa.org/selenium-core/nightly/reference.html">here</a>.</p>
<p>You can write comments above and below the commands, but you can only have one set of commands, i.e. one table, per test.</p>
<p>Point the browser to <a href="<%= testcase_link %>"><%= testcase_link %></a> to see how this test is rendered, or to <a href="<%= suite_link %>"><%= suite_link %></a> to run the suite.</p>

View file

@ -0,0 +1,14 @@
# It's often a good idea to start the test with 'setup'.
# See /selenium/setup for more info.
setup
open '/'
assert_title 'Home'
# More information about the commands is available at:
# http://release.openqa.org/selenium-core/nightly/reference.html
# See also the RDoc for SeleniumOnRails::TestBuilder.
#
# Point the browser to <%= testcase_link %> to see
# how this test is rendered, or to <%= suite_link %> to
# run the suite.

View file

@ -0,0 +1,11 @@
It's often a good idea to start the test with opening <tt>/selenium/setup</tt> (see "here":/selenium/setup for more info).
|open|/selenium/setup|
|open|/|
|assertTitle|Home|
More information about the commands is available "here":http://release.openqa.org/selenium-core/nightly/reference.html.
You can write comments above and below the commands, but you can only have one set of commands, i.e. one table, per test. "RedCloth":http://www.whytheluckystiff.net/ruby/redcloth/ is used for formatting if installed.
Point the browser to "<%= testcase_link %>":<%= testcase_link %> to see how this test is rendered, or to "<%= suite_link %>":<%= suite_link %> to run the suite.

View file

@ -0,0 +1,19 @@
require 'selenium_on_rails_config'
envs = SeleniumOnRailsConfig.get :environments
if envs.include? RAILS_ENV
#initialize the plugin
$LOAD_PATH << File.dirname(__FILE__) + "/lib/controllers"
require 'selenium_controller'
require File.dirname(__FILE__) + '/routes'
else
#erase all traces
$LOAD_PATH.delete lib_path
#but help user figure out what to do
unless RAILS_ENV == 'production' # don't pollute production
require File.dirname(__FILE__) + '/switch_environment/init'
end
end

View file

@ -0,0 +1,119 @@
require 'webrick/httputils'
class SeleniumController < ActionController::Base
include SeleniumOnRails::FixtureLoader
include SeleniumOnRails::Renderer
def setup
unless params.has_key? :keep_session
reset_session
@session_wiped = true
end
@cleared_tables = clear_tables params[:clear_tables].to_s
@loaded_fixtures = load_fixtures params[:fixtures].to_s
render :file => view_path('setup.rhtml'), :layout => layout_path
end
def test_file
params[:testname] = '' if params[:testname].to_s == 'TestSuite.html'
filename = File.join selenium_tests_path, params[:testname]
if File.directory? filename
@suite_path = filename
render :file => view_path('test_suite.rhtml'), :layout => layout_path
elsif File.readable? filename
render_test_case filename
else
if File.directory? selenium_tests_path
render :text => 'Not found', :status => 404
else
render :text => "Did not find the Selenium tests path (#{selenium_tests_path}). Run script/generate selenium", :status => 404
end
end
end
def support_file
if params[:filename].empty?
redirect_to :filename => 'TestRunner.html', :test => 'tests'
return
end
filename = File.join selenium_path, params[:filename]
if File.file? filename
type = WEBrick::HTTPUtils::DefaultMimeTypes[$1.downcase] if filename =~ /\.(\w+)$/
type ||= 'text/html'
send_file filename, :type => type, :disposition => 'inline', :stream => false
else
render :text => 'Not found', :status => 404
end
end
def record
dir = record_table
@result = {'resultDir' => dir}
for p in ['result', 'numTestFailures', 'numTestPasses', 'numCommandFailures', 'numCommandPasses', 'numCommandErrors', 'totalTime']
@result[p] = params[p]
end
File.open(log_path(params[:logFile] || 'default.yml'), 'w') {|f| YAML.dump(@result, f)}
render :file => view_path('record.rhtml'), :layout => layout_path
end
def record_table
return nil unless result_dir = SeleniumOnRailsConfig.get(:result_dir)
cur_result_dir = File.join(result_dir, (params[:logFile] || "default").sub(/\.yml$/, ''))
FileUtils.mkdir_p(cur_result_dir)
File.open("#{cur_result_dir}/index.html", "wb") do |f|
f.write <<EOS
<html>
<head><title>Selenium Test Result</title></head>
<frameset cols="30%,*">
<frame name="suite" src="suite.html">
<frame name="testcase" src="blank.html">
</frameset>
</html>
EOS
end
html_header = <<EOS
<html>
<head>
<link rel="stylesheet" type="text/css" href="selenium-test.css">
</head>
<body>
EOS
html_footer = "</body></html>\n"
if selenium_path
css_file = File.join selenium_path, "selenium-test.css"
if File.exist?(css_file)
FileUtils.cp css_file, cur_result_dir
end
end
File.open("#{cur_result_dir}/blank.html", "wb") do |f|
f.write "<html><body></body></html>"
end
File.open("#{cur_result_dir}/suite.html", "wb") do |f|
suite = params[:suite]
suite.sub!(/^.*(<table[\s>])/im, '\1')
i = 1
suite.gsub!(/(\shref=)"[^"]*"/i) do |m|
link = "#{$1}\"test#{i}.html\" target=\"testcase\""
File.open("#{cur_result_dir}/test#{i}.html", "wb") do |testcase|
testcase.write html_header
testcase.write(params["testTable.#{i}"])
testcase.write html_footer
end
i += 1
link
end
f.write html_header
f.write suite
f.write html_footer
end
cur_result_dir
end
private :record_table
end

View file

@ -0,0 +1,9 @@
module SeleniumHelper
include SeleniumOnRails::SuiteRenderer
include SeleniumOnRails::FixtureLoader
def test_case_name filename
File.basename(filename).sub(/\..*/,'').humanize
end
end

View file

@ -0,0 +1,11 @@
module SeleniumOnRails # :nodoc
end
require 'selenium_on_rails/selenese'
require 'selenium_on_rails/test_builder'
require 'selenium_on_rails/rselenese'
require 'selenium_on_rails/suite_renderer'
require 'selenium_on_rails/paths'
require 'selenium_on_rails/fixture_loader'
require 'selenium_on_rails/partials_support'
require 'selenium_on_rails/renderer'

View file

@ -0,0 +1,210 @@
require File.dirname(__FILE__) + '/paths'
require File.dirname(__FILE__) + '/../selenium_on_rails_config'
require 'net/http'
require 'tempfile'
def c(var, default = nil) SeleniumOnRailsConfig.get var, default end
def c_b(var, default = nil) SeleniumOnRailsConfig.get(var, default) { yield } end
BROWSERS = c :browsers, {}
REUSE_EXISTING_SERVER = c :reuse_existing_server, true
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
HOST = c :host, 'localhost'
PORTS = c(:port_start, 3000)..c(:port_end, 3005)
TEST_RUNNER_URL = c :test_runner_url, '/selenium/TestRunner.html'
MAX_BROWSER_DURATION = c :max_browser_duration, 2*60
MULTI_WINDOW = c :multi_window, false
SERVER_COMMAND = c_b :server_command do
server_path = File.expand_path(File.dirname(__FILE__) + '/../../../../../script/server')
if RUBY_PLATFORM =~ /mswin/
"ruby #{server_path} -p %d -e test > NUL 2>&1"
else
# don't use redirects to /dev/nul since it makes the fork return wrong pid
# see UnixSubProcess
"#{server_path} -p %d -e test"
end
end
module SeleniumOnRails
class AcceptanceTestRunner
include SeleniumOnRails::Paths
def run
raise 'no browser specified, edit/create config.yml' if BROWSERS.empty?
start_server
has_error = false
begin
BROWSERS.each_pair do |browser, path|
log_file = start_browser browser, path
wait_for_completion log_file
stop_browser
result = YAML::load_file log_file
print_result result
has_error ||= result['numTestFailures'].to_i > 0
File.delete log_file unless has_error
end
rescue
stop_server
raise
end
stop_server
raise 'Test failures' if has_error
end
private
def start_server
PORTS.each do |p|
@port = p
case server_check
when :success
return if REUSE_EXISTING_SERVER
next
when Fixnum
next
when :no_response
next unless START_SERVER
do_start_server
return
end
end
raise START_SERVER ? 'failed to start server': 'failed to find existing server, run script/server -e test'
end
def do_start_server
puts 'Starting server'
@server = start_subprocess(format(SERVER_COMMAND, @port))
while true
print '.'
r = server_check
if r == :success
puts
return
end
raise "server returned error: #{r}" if r.instance_of? Fixnum
sleep 3
end
end
def server_check
begin
res = Net::HTTP.get_response HOST, TEST_RUNNER_URL, @port
return :success if (200..399).include? res.code.to_i
return res.code.to_i
rescue Errno::ECONNREFUSED
return :no_response
end
end
def stop_server
return unless defined? @server
puts
@server.stop 'server'
end
def start_browser browser, path
puts
puts "Starting #{browser}"
log = log_file browser
command = "\"#{path}\" \"http://#{HOST}:#{@port}#{TEST_RUNNER_URL}?test=tests&auto=true&resultsUrl=postResults/#{log}&multiWindow=#{MULTI_WINDOW}\""
@browser = start_subprocess command
log_path log
end
def stop_browser
@browser.stop 'browser'
end
def start_subprocess command
if RUBY_PLATFORM =~ /mswin/
SeleniumOnRails::AcceptanceTestRunner::Win32SubProcess.new command
elsif RUBY_PLATFORM =~ /darwin/i && command =~ /safari/i
SeleniumOnRails::AcceptanceTestRunner::SafariSubProcess.new command
else
SeleniumOnRails::AcceptanceTestRunner::UnixSubProcess.new command
end
end
def log_file browser
(0..100).each do |i|
name = browser + (i==0 ? '' : "(#{i})") + '.yml'
return name unless File.exist?(log_path(name))
end
raise 'there are way too many files in the log directory...'
end
def wait_for_completion log_file
duration = 0
while true
raise 'browser takes too long' if duration > MAX_BROWSER_DURATION
print '.'
break if File.exist? log_file
sleep 5
duration += 5
end
puts
end
def print_result result
puts "Finished in #{result['totalTime']} seconds."
puts
puts "#{result['numTestPasses']} tests passed, #{result['numTestFailures']} tests failed"
puts "(Results stored in '#{result['resultDir']}')" if result['resultDir']
end
end
end
class SeleniumOnRails::AcceptanceTestRunner::SubProcess
def stop what
begin
puts "Stopping #{what} (pid=#{@pid}) ..."
Process.kill 9, @pid
rescue Errno::EPERM #such as the process is already closed (tabbed browser)
end
end
end
class SeleniumOnRails::AcceptanceTestRunner::Win32SubProcess < SeleniumOnRails::AcceptanceTestRunner::SubProcess
def initialize command
require 'win32/open3' #win32-open3 http://raa.ruby-lang.org/project/win32-open3/
puts command
input, output, error, @pid = Open4.popen4 command, 't', true
end
end
class SeleniumOnRails::AcceptanceTestRunner::UnixSubProcess < SeleniumOnRails::AcceptanceTestRunner::SubProcess
def initialize command
puts command
@pid = fork do
# Since we can't use shell redirects without screwing
# up the pid, we'll reopen stdin and stdout instead
# to get the same effect.
[STDOUT,STDERR].each {|f| f.reopen '/dev/null', 'w' }
exec command
end
end
end
# The path to Safari should look like this: /Applications/Safari.app/Contents/MacOS/Safari
class SeleniumOnRails::AcceptanceTestRunner::SafariSubProcess < SeleniumOnRails::AcceptanceTestRunner::UnixSubProcess
def initialize command
f = File.open(Tempfile.new('selenium-on-rails').path, 'w')
f.puts <<-HTML
<html>
<head>
<script type="text/javascript" charset="utf-8">
window.location.href = #{command.split.last};
</script>
</head>
<body></body>
</html>
HTML
f.close
super "#{command.split.first} #{f.path}"
end
end

View file

@ -0,0 +1,54 @@
require 'active_record/fixtures'
module SeleniumOnRails::FixtureLoader
include SeleniumOnRails::Paths
def available_fixtures
fixtures = {}
path = fixtures_path + '/'
files = Dir["#{path}**/*.{yml,csv}"]
files.each do |file|
rel_path = file.sub(path, '')
next if skip_file? rel_path
fixture_set = File.dirname(rel_path)
fixture_set = '' if fixture_set == '.'
fixture = rel_path.sub /\.[^.]*$/, ''
fixtures[fixture_set] ||= []
fixtures[fixture_set] << fixture
end
fixtures
end
def load_fixtures fixtures_param
available = nil
fixtures = fixtures_param.split(/\s*,\s*/).collect do |f|
fixture_set = File.dirname f
fixture_set = '' if fixture_set == '.'
fixture = File.basename f
if fixture == 'all'
available ||= available_fixtures
available[fixture_set]
else
f
end
end
fixtures.flatten!
fixtures.reject! {|f| f.blank? }
if fixtures.any?
Fixtures.create_fixtures fixtures_path, fixtures
end
fixtures
end
def clear_tables tables
table_names = tables.split /\s*,\s*/
connection = ActiveRecord::Base.connection
table_names.each do |table|
connection.execute "DELETE FROM #{table}"
end
table_names
end
end

View file

@ -0,0 +1,38 @@
# Provides partials support to test cases so they can include other partial test
# cases.
#
# The partial's commands are returned as html table rows.
module SeleniumOnRails::PartialsSupport
include SeleniumOnRails::Paths
# Overrides where the partial is searched for, and returns only the command table rows.
def render_partial partial_path = default_template_name, object = nil, local_assigns = nil, status = nil
pattern = partial_pattern partial_path
filename = Dir[pattern].first
raise "Partial '#{partial_path}' cannot be found! (Looking for file: '#{pattern}')" unless filename
partial = render :file => filename, :use_full_path => false, :locals => local_assigns
extract_commands_from_partial partial
end
# Extracts the commands from a partial. The partial must contain a html table
# and the first row is ignored since it cannot contain a command.
def extract_commands_from_partial partial
partial = partial.match(/.*<table>.*?<tr>.*?<\/tr>(.*?)<\/table>/im)[1]
raise "Partial '#{name}' doesn't contain any table" unless partial
partial
end
private
# Generates the file pattern from the provided partial path.
# The starting _ and file extension don't have too be provided.
def partial_pattern partial_path
path = partial_path.split '/'
filename = path.delete_at(-1)
filename = '_' + filename unless filename.starts_with? '_'
filename << '.*' unless filename.include? '.'
pattern = selenium_tests_path + '/'
pattern << path.join('/') + '/' if path
pattern << filename
end
end

View file

@ -0,0 +1,61 @@
module SeleniumOnRails
module Paths
def selenium_path
@@selenium_path ||= find_selenium_path
@@selenium_path
end
def selenium_tests_path
File.expand_path(File.join(RAILS_ROOT, 'test/selenium'))
end
def view_path view
File.expand_path(File.dirname(__FILE__) + '/../views/' + view)
end
# Returns the path to the layout template. The path is relative in relation
# to the app/views/ directory since Rails doesn't support absolute paths
# to layout templates.
def layout_path
rails_root = Pathname.new File.expand_path(File.join(RAILS_ROOT, 'app/views'))
view_path = Pathname.new view_path('layout')
view_path.relative_path_from(rails_root).to_s
end
def fixtures_path
File.expand_path File.join(RAILS_ROOT, 'test/fixtures')
end
def log_path log_file
File.expand_path(File.dirname(__FILE__) + '/../../log/' + File.basename(log_file))
end
def skip_file? file
file.split('/').each do |f|
return true if f.upcase == 'CVS' or f.starts_with?('.') or f.ends_with?('~') or f.starts_with?('_')
end
false
end
private
def find_selenium_path
sel_dirs = SeleniumOnRailsConfig.get :selenium_path do
ds = [File.expand_path(File.join(RAILS_ROOT, 'vendor/selenium')),
File.expand_path(File.join(RAILS_ROOT, 'vendor/selenium-core'))]
gems = Gem.source_index.find_name 'selenium', nil
ds << gems.last.full_gem_path unless gems.empty?
ds
end
sel_dirs.to_a.each do |seleniumdir|
['', 'core', 'selenium', 'javascript'].each do |subdir|
path = File.join seleniumdir, subdir
return path if File.exist?(File.join(path, 'TestRunner.html'))
end
end
raise 'Could not find Selenium Core installation'
end
end
end

View file

@ -0,0 +1,17 @@
module SeleniumOnRails::Renderer
include SeleniumOnRails::Paths
include SeleniumHelper
def render_test_case filename
@template.extend SeleniumOnRails::PartialsSupport
@page_title = test_case_name filename
output = render_to_string :file => filename
layout = (output =~ /<html>/i ? false : layout_path)
render :text => output, :layout => layout
headers['Cache-control'] = 'no-cache'
headers['Pragma'] = 'no-cache'
headers['Expires'] = '-1'
end
end

View file

@ -0,0 +1,35 @@
# Renders Selenium test templates in a fashion analogous to +rxml+ and
# +rjs+ templates.
#
# setup
# open :controller => 'customer', :action => 'list'
# assert_title 'Customers'
#
# See SeleniumOnRails::TestBuilder for a list of available commands.
class SeleniumOnRails::RSelenese < SeleniumOnRails::TestBuilder
end
ActionView::Base.register_template_handler 'rsel', SeleniumOnRails::RSelenese
class SeleniumOnRails::RSelenese < SeleniumOnRails::TestBuilder
attr_accessor :view
# Create a new RSelenese renderer bound to _view_.
def initialize view
super view
@view = view
end
# Render _template_ using _local_assigns_.
def render template, local_assigns
title = (@view.assigns['page_title'] or local_assigns['page_title'])
table(title) do
test = self #to enable test.command
assign_locals_code = ''
local_assigns.each_key {|key| assign_locals_code << "#{key} = local_assigns[#{key.inspect}];"}
eval assign_locals_code + "\n" + template
end
end
end

View file

@ -0,0 +1,81 @@
class SeleniumOnRails::Selenese
end
ActionView::Base.register_template_handler 'sel', SeleniumOnRails::Selenese
class SeleniumOnRails::Selenese
def initialize view
@view = view
end
def render template, local_assigns
name = (@view.assigns['page_title'] or local_assigns['page_title'])
lines = template.strip.split "\n"
html = ''
html << extract_comments(lines)
html << extract_commands(lines, name)
html << extract_comments(lines)
raise 'You cannot have comments in the middle of commands!' if next_line lines, :any
html
end
private
def next_line lines, expects
while lines.any?
l = lines.shift.strip
next if (l.empty? and expects != :comment)
comment = (l =~ /^\|.*\|$/).nil?
if (comment and expects == :command) or (!comment and expects == :comment)
lines.unshift l
return nil
end
return l
end
end
def extract_comments lines
comments = ''
while (line = next_line lines, :comment)
comments << line + "\n"
end
if defined? RedCloth
comments = RedCloth.new(comments).to_html
end
comments += "\n" unless comments.empty?
comments
end
def extract_commands lines, name
html = "<table>\n<tr><th colspan=\"3\">#{name}</th></tr>\n"
while (line = next_line lines, :command)
line = line[1..-2] #remove starting and ending |
cells = line.split '|'
if cells.first == 'includePartial'
html << include_partial(cells[1..-1])
next
end
raise 'There might only be a maximum of three cells!' if cells.length > 3
html << '<tr>'
(1..3).each do
cell = cells.shift
cell = (cell ? CGI.escapeHTML(cell.strip) : '&nbsp;')
html << "<td>#{cell}</td>"
end
html << "</tr>\n"
end
html << "</table>\n"
end
def include_partial params
partial = params.shift
locals = {}
params.each do |assignment|
next if assignment.empty?
_, var, value = assignment.split(/^([a-z_][a-zA-Z0-9_]*)\s*=\s*(.*)$/)
raise "Invalid format '#{assignment}'. Should be '|includePartial|partial|var1=value|var2=value|." unless var
locals[var.to_sym] = value or ''
end
@view.render :partial => partial, :locals => locals
end
end

View file

@ -0,0 +1,51 @@
module SeleniumOnRails::SuiteRenderer
def test_suite_name path
return 'All test cases' if [nil, '/'].include? path_to_relative_url(path)
File.split(path)[-1].humanize
end
def test_suites path
suites = []
parent_path = File.join(File.split(path).slice(0..-2)) #all but last
parent_path = path_to_relative_url parent_path
suites << ['..', parent_path] unless parent_path.nil?
visit_all_tests path, '', Proc.new {|n, p| suites << [n,path_to_relative_url(p)]}, nil
suites
end
def test_cases path
tests = []
visit_all_tests path, '', nil, Proc.new {|n, p| tests << [n,p]}
tests
end
def link_to_test_case suite_name, filename
name = suite_name + test_case_name(filename)
link_to name, :action => :test_file, :testname => path_to_relative_url(filename).sub(/^\//,'')
end
private
def path_to_relative_url path
slt = @controller.selenium_tests_path
return nil unless path.index slt
path.sub slt, ''
end
def visit_all_tests path, suite_name, suite_consumer, test_consumer
dirs = [] #add dirs to an array in order for files to be processed before dirs
Dir.entries(path).sort.each do |e|
next if skip_file?(e) or ['.','..'].include?(e)
filename = File.join path, e
if File.directory? filename
dirs << [filename, "#{suite_name}#{e.humanize}."]
suite_consumer.call("#{suite_name}#{e.humanize}", filename) if suite_consumer
else
test_consumer.call(suite_name, filename) if test_consumer
end
end
#recurse through dirs
dirs.each {|p, n| visit_all_tests p, n, suite_consumer, test_consumer }
end
end

View file

@ -0,0 +1,92 @@
# Builds Selenium test table using a high-level Ruby interface. Normally
# invoked through SeleniumOnRails::RSelenese.
#
# See SeleniumOnRails::TestBuilderActions for the available actions and
# SeleniumOnRails::TestBuilderAccessors for the available checks.
#
# For more information on the commands supported by TestBuilder, see the
# Selenium Commands Documentation at
# http://release.openqa.org/selenium-core/nightly/reference.html.
class SeleniumOnRails::TestBuilder
include SeleniumOnRails::TestBuilderActions
include SeleniumOnRails::TestBuilderAccessors
# Convert _str_ to a Selenium command name.
def self.selenize str
str.camelize.gsub(/^[A-Z]/) {|s| s.downcase }
end
# Prepends _pattern_ with 'exact:' if it would be considered containing
# string-match pattern otherwise.
def exactize pattern
pattern.include?(':') ? "exact:#{pattern}" : pattern
end
# Create a new TestBuilder for _view_.
def initialize view
@view = view
@output = ''
@xml = Builder::XmlMarkup.new :indent => 2, :target => @output
end
# Add a new table of tests, and return the HTML.
def table title
@xml.table do
@xml.tr do @xml.th(title, :colspan => 3) end
yield self
end
end
# Add a new test command using _cmd_, _target_ and _value_.
def command cmd, target=nil, value=nil
@xml.tr do
_tdata cmd
_tdata target
_tdata value
end
end
# :nodoc
alias_method :command_verbatim, :command
# Same as _command_ but add _AndWait_ to the name of _cmd_.
def command_and_wait cmd, target=nil, value=nil
command_verbatim cmd.to_s + 'AndWait', target, value
end
# Re routes commands in the provided block to #command_and_wait instead of
# #command.
def make_command_waiting
self.class.send :alias_method, :command, :command_and_wait
yield
self.class.send :alias_method, :command, :command_verbatim
end
protected
# If _url_ is a string, return unchanged. Otherwise, pass it to
# ActionView#UrlHelper#url_for.
def url_arg url
if url.instance_of?(String) then url else exactize(@view.url_for(url)) end
end
# If _arg_ is an array formats _arg_ to a textual representation.
# Otherwise return unchanged.
def collection_arg arg
if arg.is_a? Array
arg.collect {|e| e.gsub(/[\\,]/) {|s| "\\#{s}" } }.join(',')
else
arg
end
end
private
# Output a single TD element.
def _tdata value
if value
@xml.td(value.to_s)
else
@xml.td do @xml.target! << '&nbsp;' end
end
end
end

View file

@ -0,0 +1,575 @@
# The accessors available for SeleniumOnRails::TestBuilder tests.
#
# For each +store_foo+ there's +assert_foo+, +assert_not_foo+, +verify_foo+,
# +verify_not_foo+, +wait_for_foo+, +wait_for_not_foo+.
module SeleniumOnRails::TestBuilderAccessors
# Has an alert occurred?
#
# Related Assertions, automatically generated:
# * +assert_alert_present+
# * +assert_alert_not_present+
# * +verify_alert_present+
# * +verify_alert_not_present+
# * +wait_for_alert_present+
# * +wait_for_alert_not_present+
def store_alert_present variable_name
command 'storeAlertPresent', variable_name
end
# Has a prompt occurred?
#
# Related Assertions, automatically generated:
# * +assert_prompt_present+
# * +assert_prompt_not_present+
# * +verify_prompt_present+
# * +verify_prompt_not_present+
# * +wait_for_prompt_present+
# * +wait_for_prompt_not_present+
def store_prompt_present variable_name
command 'storePromptPresent', variable_name
end
# Has <tt>confirm()</tt> been called?
#
# Related Assertions, automatically generated:
# * +assert_confirmation_present+
# * +assert_confirmation_not_present+
# * +verify_confirmation_present+
# * +verify_confirmation_not_present+
# * +wait_for_confirmation_present+
# * +wait_for_confirmation_not_present+
def store_confirmation_present variable_name
command 'storeConfirmationPresent', variable_name
end
# Retrieves the message of a JavaScript alert generated during the previous
# action, or fail if there were no alerts.
#
# Getting an alert has the same effect as manually clicking OK. If an alert
# is generated but you do not get/verify it, the next Selenium action will
# fail.
#
# NOTE: under Selenium, JavaScript alerts will NOT pop up a visible alert
# dialog.
#
# NOTE: Selenium does NOT support JavaScript alerts that are generated in a
# page's <tt>onload()</tt> event handler. In this case a visible dialog WILL be
# generated and Selenium will hang until someone manually clicks OK.
#
# Related Assertions, automatically generated:
# * <tt>assert_alert(pattern)</tt>
# * <tt>assert_not_alert(pattern)</tt>
# * <tt>verify_alert_present(pattern)</tt>
# * <tt>verify_not_alert(pattern)</tt>
# * <tt>wait_for_alert(pattern)</tt>
# * <tt>wait_for_not_alert(pattern)</tt>
def store_alert variable_name
command 'storeAlert', variable_name
end
# Retrieves the message of a JavaScript confirmation dialog generated during
# the previous action.
#
# By default, the confirm function will return +true+, having the same effect
# as manually clicking OK. This can be changed by prior execution of the
# +choose_cancel_on_next_confirmation+ command. If a confirmation is
# generated but you do not get/verify it, the next Selenium action will fail.
#
# NOTE: under Selenium, JavaScript confirmations will NOT pop up a visible
# dialog.
#
# NOTE: Selenium does NOT support JavaScript confirmations that are generated
# in a page's <tt>onload()</tt> event handler. In this case a visible dialog WILL be
# generated and Selenium will hang until you manually click OK.
#
# Related Assertions, automatically generated:
# * <tt>assert_confirmation(pattern)</tt>
# * <tt>assert_not_confirmation(pattern)</tt>
# * <tt>verify_confirmation_present(pattern)</tt>
# * <tt>verify_not_confirmation(pattern)</tt>
# * <tt>wait_for_confirmation(pattern)</tt>
# * <tt>wait_for_not_confirmation(pattern)</tt>
def store_confirmation variable_name
command 'storeConfirmation', variable_name
end
# Retrieves the message of a JavaScript question prompt dialog generated
# during the previous action.
#
# Successful handling of the prompt requires prior execution of the
# +answer_on_next_prompt+ command. If a prompt is generated but you do not
# get/verify it, the next Selenium action will fail.
#
# NOTE: under Selenium, JavaScript prompts will NOT pop up a visible dialog.
#
# NOTE: Selenium does NOT support JavaScript prompts that are generated in a
# page's <tt>onload()</tt> event handler. In this case a visible dialog WILL be
# generated and Selenium will hang until someone manually clicks OK.
#
# Related Assertions, automatically generated:
# * <tt>assert_prompt(pattern)</tt>
# * <tt>assert_not_prompt(pattern)</tt>
# * <tt>verify_prompt_present(pattern)</tt>
# * <tt>verify_not_prompt(pattern)</tt>
# * <tt>wait_for_prompt(pattern)</tt>
# * <tt>wait_for_not_prompt(pattern)</tt>
def store_prompt variable_name
command 'storePrompt', variable_name
end
# Gets the absolute URL of the current page.
#
# Related Assertions, automatically generated:
# * <tt>assert_absolute_location(pattern)</tt>
# * <tt>assert_not_absolute_location(pattern)</tt>
# * <tt>verify_absolute_location_present(pattern)</tt>
# * <tt>verify_not_absolute_location(pattern)</tt>
# * <tt>wait_for_absolute_location(pattern)</tt>
# * <tt>wait_for_not_absolute_location(pattern)</tt>
def store_absolute_location variable_name
command 'storeAbsoluteLocation', variable_name
end
# Verify the location of the current page ends with the expected location.
# If an URL querystring is provided, this is checked as well.
#
# Related Assertions, automatically generated:
# * <tt>assert_location(pattern)</tt>
# * <tt>assert_not_location(pattern)</tt>
# * <tt>verify_location_present(pattern)</tt>
# * <tt>verify_not_location(pattern)</tt>
# * <tt>wait_for_location(pattern)</tt>
# * <tt>wait_for_not_location(pattern)</tt>
def store_location expected_location, variable_name
command 'storeLocation', expected_location, variable_name
end
# Gets the title of the current page.
#
# Related Assertions, automatically generated:
# * <tt>assert_title(pattern)</tt>
# * <tt>assert_not_title(pattern)</tt>
# * <tt>verify_title_present(pattern)</tt>
# * <tt>verify_not_title(pattern)</tt>
# * <tt>wait_for_title(pattern)</tt>
# * <tt>wait_for_not_title(pattern)</tt>
def store_title variable_name
command 'storeTitle', variable_name
end
# Gets the entire text of the page.
#
# Related Assertions, automatically generated:
# * <tt>assert_body_text(pattern)</tt>
# * <tt>assert_not_body_text(pattern)</tt>
# * <tt>verify_body_text_present(pattern)</tt>
# * <tt>verify_not_body_text(pattern)</tt>
# * <tt>wait_for_body_text(pattern)</tt>
# * <tt>wait_for_not_body_text(pattern)</tt>
def store_body_text variable_name
command 'storeBodyText', variable_name
end
# Gets the (whitespace-trimmed) value of an input field (or anything else
# with a value parameter). For checkbox/radio elements, the value will be
# "on" or "off" depending on whether the element is checked or not.
#
# Related Assertions, automatically generated:
# * <tt>assert_value(locator, pattern)</tt>
# * <tt>assert_not_value(locator, pattern)</tt>
# * <tt>verify_value_present(locator, pattern)</tt>
# * <tt>verify_not_value(locator, pattern)</tt>
# * <tt>wait_for_value(locator, pattern)</tt>
# * <tt>wait_for_not_value(locator, pattern)</tt>
def store_value locator, variable_name
command 'storeValue', locator, variable_name
end
# Gets the text of an element. This works for any element that contains text.
# This command uses either the +textContent+ (Mozilla-like browsers) or the
# +innerText+ (IE-like browsers) of the element, which is the rendered text
# shown to the user.
#
# Related Assertions, automatically generated:
# * <tt>assert_text(locator, pattern)</tt>
# * <tt>assert_not_text(locator, pattern)</tt>
# * <tt>verify_text_present(locator, pattern)</tt>
# * <tt>verify_not_text(locator, pattern)</tt>
# * <tt>wait_for_text(locator, pattern)</tt>
# * <tt>wait_for_not_text(locator, pattern)</tt>
def store_text locator, variable_name
command 'storeText', locator, variable_name
end
# Gets the result of evaluating the specified JavaScript snippet. The snippet
# may have multiple lines, but only the result of the last line will be
# returned.
#
# Note that, by default, the snippet will run in the context of the
# "selenium" object itself, so +this+ will refer to the Selenium object, and
# +window+ will refer to the top-level runner test window, not the window of
# your application.
#
# If you need a reference to the window of your application, you can refer to
# <tt>this.browserbot.getCurrentWindow()</tt> and if you need to use a locator to
# refer to a single element in your application page, you can use
# <tt>this.page().findElement("foo")</tt> where <tt>"foo"</tt> is your locator.
#
# Related Assertions, automatically generated:
# * <tt>assert_eval(script, pattern)</tt>
# * <tt>assert_not_eval(script, pattern)</tt>
# * <tt>verify_eval_present(script, pattern)</tt>
# * <tt>verify_not_eval(script, pattern)</tt>
# * <tt>wait_for_eval(script, pattern)</tt>
# * <tt>wait_for_not_eval(script, pattern)</tt>
def store_eval script, variable_name
command 'storeEval', script, variable_name
end
# Gets whether a toggle-button (checkbox/radio) is checked. Fails if the
# specified element doesn't exist or isn't a toggle-button.
#
# Related Assertions, automatically generated:
# * <tt>assert_checked(locator, pattern)</tt>
# * <tt>assert_not_checked(locator, pattern)</tt>
# * <tt>verify_checked_present(locator, pattern)</tt>
# * <tt>verify_not_checked(locator, pattern)</tt>
# * <tt>wait_for_checked(locator, pattern)</tt>
# * <tt>wait_for_not_checked(locator, pattern)</tt>
def store_checked locator, variable_name
command 'storeChecked', locator, variable_name
end
# Gets the text from a cell of a table.
#
# Related Assertions, automatically generated:
# * <tt>assert_table(locator, row, column, pattern)</tt>
# * <tt>assert_not_table(locator, row, column, pattern)</tt>
# * <tt>verify_table_present(locator, row, column, pattern)</tt>
# * <tt>verify_not_table(locator, row, column, pattern)</tt>
# * <tt>wait_for_table(locator, row, column, pattern)</tt>
# * <tt>wait_for_not_table(locator, row, column, pattern)</tt>
def store_table locator, row, column, variable_name
command 'storeTable', "#{locator}.#{row}.#{column}", variable_name
end
# Verifies that the selected option of a drop-down satisfies the
# +option_locator+.
#
# +option_locator+ is typically just an option label (e.g. "John Smith").
#
# See the +select+ command for more information about option locators.
#
# NOTE: +store_selected+ is currently not supported by Selenium Core.
#
# Related Assertions, automatically generated:
# * <tt>assert_selected(locator, option_locator)</tt>
# * <tt>assert_not_selected(locator, option_locator)</tt>
# * <tt>verify_selected_present(locator, option_locator)</tt>
# * <tt>verify_not_selected(locator, option_locator)</tt>
# * <tt>wait_for_selected(locator, option_locator)</tt>
# * <tt>wait_for_not_selected(locator, option_locator)</tt>
def store_selected locator, option_locator, variable_name
raise 'Not supported in Selenium Core at the moment'
end
# Gets all option labels for selected options in the specified select or
# multi-select element.
#
# The +pattern+ for the automatically generated assertions can either take an
# array or a pattern.
# assert_selected_options 'fruits', ['apple', 'pear']
# assert_selected_options 'fruits', 'a*,p*'
#
# Related Assertions, automatically generated:
# * <tt>assert_selected_options(locator, pattern)</tt>
# * <tt>assert_not_selected_options(locator, pattern)</tt>
# * <tt>verify_selected_options_present(locator, pattern)</tt>
# * <tt>verify_not_selected_options(locator, pattern)</tt>
# * <tt>wait_for_selected_options(locator, pattern)</tt>
# * <tt>wait_for_not_selected_options(locator, pattern)</tt>
def store_selected_options locator, variable_name
command 'storeSelectedOptions', locator, variable_name
end
# Gets all option labels in the specified select drop-down.
#
# The +pattern+ for the automatically generated assertions can either take an
# array or a pattern.
# assert_select_options 'fruits', ['apple', 'pear']
# assert_select_options 'fruits', 'a*,p*'
#
# Related Assertions, automatically generated:
# * <tt>assert_select_options(locator, pattern)</tt>
# * <tt>assert_not_select_options(locator, pattern)</tt>
# * <tt>verify_select_options_present(locator, pattern)</tt>
# * <tt>verify_not_select_options(locator, pattern)</tt>
# * <tt>wait_for_select_options(locator, pattern)</tt>
# * <tt>wait_for_not_select_options(locator, pattern)</tt>
def store_select_options locator, variable_name
command 'storeSelectOptions', locator, variable_name
end
# Gets the value of an element attribute.
#
# Related Assertions, automatically generated:
# * <tt>assert_attribute(locator, attribute_name, pattern)</tt>
# * <tt>assert_not_attribute(locator, attribute_name, pattern)</tt>
# * <tt>verify_attribute_present(locator, attribute_name, pattern)</tt>
# * <tt>verify_not_attribute(locator, attribute_name, pattern)</tt>
# * <tt>wait_for_attribute(locator, attribute_name, pattern)</tt>
# * <tt>wait_for_not_attribute(locator, attribute_name, pattern)</tt>
def store_attribute locator, attribute_name, variable_name
command 'storeAttribute', "#{locator}@#{attribute_name}", variable_name
end
# Verifies that the specified text pattern appears somewhere on the rendered
# page shown to the user.
#
# Related Assertions, automatically generated:
# * <tt>assert_text_present(pattern)</tt>
# * <tt>assert_text_not_present(pattern)</tt>
# * <tt>verify_text_present(pattern)</tt>
# * <tt>verify_text_not_present(pattern)</tt>
# * <tt>wait_for_text_present(pattern)</tt>
# * <tt>wait_for_text_not_present(pattern)</tt>
def store_text_present pattern, variable_name
command 'storeTextPresent', pattern, variable_name
end
# Verifies that the specified element is somewhere on the page.
#
# Related Assertions, automatically generated:
# * <tt>assert_element_present(locator)</tt>
# * <tt>assert_element_not_present(locator)</tt>
# * <tt>verify_element_present(locator)</tt>
# * <tt>verify_element_not_present(locator)</tt>
# * <tt>wait_for_element_present(locator)</tt>
# * <tt>wait_for_element_not_present(locator)</tt>
def store_element_present locator, variable_name
command 'storeElementPresent', locator, variable_name
end
# Determines if the specified element is visible. An element can be rendered
# invisible by setting the CSS "visibility" property to "hidden", or the
# "display" property to "none", either for the element itself or one if its
# ancestors. This method will fail if the element is not present.
#
# Related Assertions, automatically generated:
# * <tt>assert_visible(locator)</tt>
# * <tt>assert_not_visible(locator)</tt>
# * <tt>verify_visible(locator)</tt>
# * <tt>verify_not_visible(locator)</tt>
# * <tt>wait_for_visible(locator)</tt>
# * <tt>wait_for_not_visible(locator)</tt>
def store_visible locator, variable_name
command 'storeVisible', locator, variable_name
end
# Determines whether the specified input element is editable, i.e. hasn't
# been disabled. This method will fail if the specified element isn't an
# input element.
#
# Related Assertions, automatically generated:
# * <tt>assert_editable(locator)</tt>
# * <tt>assert_not_editable(locator)</tt>
# * <tt>verify_editable(locator)</tt>
# * <tt>verify_not_editable(locator)</tt>
# * <tt>wait_for_editable(locator)</tt>
# * <tt>wait_for_not_editable(locator)</tt>
def store_editable locator, variable_name
command 'storeEditable', locator, variable_name
end
# Returns the IDs of all buttons on the page.
#
# If a given button has no ID, it will appear as "" in this array.
#
# The +pattern+ for the automatically generated assertions can either take an
# array or a pattern.
# assert_all_buttons ['but1', 'but2']
# assert_all_buttons 'but?,but?*'
#
# Related Assertions, automatically generated:
# * <tt>assert_all_buttons(pattern)</tt>
# * <tt>assert_not_all_buttons(pattern)</tt>
# * <tt>verify_all_buttons(pattern)</tt>
# * <tt>verify_not_all_buttons(pattern)</tt>
# * <tt>wait_for_all_buttons(pattern)</tt>
# * <tt>wait_for_not_all_buttons(pattern)</tt>
def store_all_buttons variable_name
command 'storeAllButtons', variable_name
end
# Returns the IDs of all links on the page.
#
# If a given link has no ID, it will appear as "" in this array.
#
# The +pattern+ for the automatically generated assertions can either take an
# array or a pattern.
# assert_all_links ['link1', 'link2']
# assert_all_links 'link?,link?*'
#
# Related Assertions, automatically generated:
# * <tt>assert_all_links(pattern)</tt>
# * <tt>assert_not_all_links(pattern)</tt>
# * <tt>verify_all_links(pattern)</tt>
# * <tt>verify_not_all_links(pattern)</tt>
# * <tt>wait_for_all_links(pattern)</tt>
# * <tt>wait_for_not_all_links(pattern)</tt>
def store_all_links variable_name
command 'storeAllLinks', variable_name
end
# Returns the IDs of all input fields on the page.
#
# If a given field has no ID, it will appear as "" in this array.
#
# The +pattern+ for the automatically generated assertions can either take an
# array or a pattern.
# assert_all_fields ['field1', 'field2']
# assert_all_fields 'field?,field?*'
#
# Related Assertions, automatically generated:
# * <tt>assert_all_fields(pattern)</tt>
# * <tt>assert_not_all_fields(pattern)</tt>
# * <tt>verify_all_fields(pattern)</tt>
# * <tt>verify_not_all_fields(pattern)</tt>
# * <tt>wait_for_all_fields(pattern)</tt>
# * <tt>wait_for_not_all_fields(pattern)</tt>
def store_all_fields variable_name
command 'storeAllFields', variable_name
end
# Returns the entire HTML source between the opening and closing "html" tags.
#
# Related Assertions, automatically generated:
# * <tt>assert_html_source(pattern)</tt>
# * <tt>assert_not_html_source(pattern)</tt>
# * <tt>verify_html_source(pattern)</tt>
# * <tt>verify_not_html_source(pattern)</tt>
# * <tt>wait_for_html_source(pattern)</tt>
# * <tt>wait_for_not_html_source(pattern)</tt>
def store_html_source variable_name
command 'storeHtmlSource', variable_name
end
# Returns the specified expression.
#
# This is useful because of JavaScript preprocessing.
#
# Related Assertions, automatically generated:
# * <tt>assert_expression(expression, pattern)</tt>
# * <tt>assert_not_expression(expression, pattern)</tt>
# * <tt>verify_expression(expression, pattern)</tt>
# * <tt>verify_not_expression(expression, pattern)</tt>
# * <tt>wait_for_expression(expression, pattern)</tt>
# * <tt>wait_for_not_expression(expression, pattern)</tt>
def store_expression expression, variable_name
command 'storeExpression', expression, variable_name
end
private
# Generates all assertions for the accessors.
def self.generate_methods
public_instance_methods.each do |method|
case method
when 'store_alert_present',
'store_prompt_present',
'store_confirmation_present'
each_assertion method do |assertion_method, command_name|
define_method assertion_method do
command command_name
end
end
when 'store_alert',
'store_confirmation',
'store_prompt',
'store_title',
'store_body_text',
'store_text_present',
'store_element_present',
'store_visible',
'store_editable',
'store_html_source'
each_assertion method do |assertion_method, command_name|
define_method assertion_method do |pattern|
command command_name, pattern
end
end
when 'store_value',
'store_text',
'store_eval',
'store_checked',
'store_selected',
'store_expression'
each_assertion method do |assertion_method, command_name|
define_method assertion_method do |arg1, arg2|
command command_name, arg1, arg2
end
end
when 'store_all_buttons',
'store_all_links',
'store_all_fields'
each_assertion method do |assertion_method, command_name|
define_method assertion_method do |pattern|
command command_name, collection_arg(pattern)
end
end
when 'store_select_options',
'store_selected_options'
each_assertion method do |assertion_method, command_name|
define_method assertion_method do |locator, pattern|
command command_name, locator, collection_arg(pattern)
end
end
when 'store_attribute'
each_assertion method do |assertion_method, command_name|
define_method assertion_method do |locator, attribute_name, pattern|
command command_name, "#{locator}@#{attribute_name}", pattern
end
end
when 'store_table'
each_assertion method do |assertion_method, command_name|
define_method assertion_method do |locator, row, column, pattern|
command command_name, "#{locator}.#{row}.#{column}", pattern
end
end
when 'store_absolute_location',
'store_location'
each_assertion method do |assertion_method, command_name|
define_method assertion_method do |pattern|
if method == 'store_absolute_location' and pattern.is_a? Hash
pattern[:only_path] = false
end
command command_name, url_arg(pattern)
end
end
when /^store_/
raise 'internal error'
end
end
end
# Generates all the assertions needed given a +store_method+.
def self.each_assertion store_method
before_negation = nil
after_negation = store_method.split('_')[1..-1] #throw away 'store'
if after_negation.last == 'present'
before_negation, after_negation = after_negation, after_negation.pop
end
['assert', 'verify', ['wait','for']].each do |action|
[nil, 'not'].each do |negation|
name = [action, before_negation, negation, after_negation].flatten.reject{|a|a.nil?}
method_name = name.join '_'
command = name.inject(name.shift.clone) {|n, p| n << p.capitalize}
yield method_name, command
end
end
end
generate_methods
end

View file

@ -0,0 +1,286 @@
# The actions available for SeleniumOnRails::TestBuilder tests.
#
# For each action +foo+ there's also an action +foo_and_wait+.
module SeleniumOnRails::TestBuilderActions
# Tell Selenium on Rails to clear the session and load any fixtures. DO
# NOT CALL THIS AGAINST NON-TEST DATABASES.
# The supported +options+ are <code>:keep_session</code>,
# <code>:fixtures</code> and <code>:clear_tables</code>
# setup
# setup :keep_session
# setup :fixtures => :all
# setup :keep_session, :fixtures => [:foo, :bar]
# setup :clear_tables => [:foo, :bar]
def setup options = {}
options = {options => nil} unless options.is_a? Hash
opts = {:controller => 'selenium', :action => 'setup'}
opts[:keep_session] = true if options.has_key? :keep_session
[:fixtures, :clear_tables].each do |key|
if (f = options[key])
f = [f] unless f.is_a? Array
opts[key] = f.join ','
end
end
open opts
end
# Includes a partial.
# The path is relative to the Selenium tests root. The starting _ and the file
# extension don't have to be specified.
# #include test/selenium/_partial.*
# include_partial 'partial'
# #include test/selenium/suite/_partial.*
# include_partial 'suite/partial'
# #include test/selenium/suite/_partial.* and provide local assigns
# include_partial 'suite/partial', :foo => bar
def include_partial path, local_assigns = {}
partial = @view.render :partial => path, :locals => local_assigns
@output << partial
end
# Clicks on a link, button, checkbox or radio button. If the click action
# causes a new page to load (like a link usually does), call
# +wait_for_page_to_load+.
def click locator
command 'click', locator
end
# Explicitly simulate an event (e.g. <tt>"focus"</tt>, <tt>"blur"</tt>), to
# trigger the corresponding <tt>"on_event_"</tt> handler.
def fire_event locator, event_name
command 'fireEvent', locator, event_name
end
# Simulates a user pressing and releasing a key.
#
# +keycode+ is the numeric keycode of the key to be pressed, normally the
# ASCII value of that key.
def key_press locator, keycode
command 'keyPress', locator, keycode
end
# Simulates a user pressing a key (without releasing it yet).
#
# +keycode+ is the numeric keycode of the key to be pressed, normally the
# ASCII value of that key.
def key_down locator, keycode
command 'keyDown', locator, keycode
end
# Simulates a user releasing a key.
#
# +keycode+ is the numeric keycode of the key to be released, normally the
# ASCII value of that key.
def key_up locator, keycode
command 'keyUp', locator, keycode
end
# Simulates a user hovering a mouse over the specified element.
def mouse_over locator
command 'mouseOver', locator
end
# Simulates a user pressing the mouse button (without releasing it yet) on the
# specified element.
def mouse_down locator
command 'mouseDown', locator
end
# Sets the value of an input field, as though you typed it in.
#
# Can also be used to set the value of combo boxes, check boxes, etc. In these
# cases, +value+ should be the value of the option selected, not the visible
# text.
def type locator, value
command 'type', locator, value
end
# Check a toggle-button (checkbox/radio).
def check locator
command 'check', locator
end
# Uncheck a toggle-button (checkbox/radio).
def uncheck locator
command 'uncheck', locator
end
# Select an option from a drop-down using an option locator.
#
# Option locators provide different ways of specifying options of an HTML
# Select element (e.g. for selecting a specific option, or for asserting that
# the selected option satisfies a specification). There are several forms of
# Select Option Locator.
#
# * label=labelPattern
# matches options based on their labels, i.e. the visible text. (This is the
# default.)
# label=regexp:^[Oo]ther
# * value=valuePattern
# matches options based on their values.
# value=other
# * id=id
# matches options based on their ids.
# id=option1
# * index=index
# matches an option based on its index (offset from zero).
# index=2
#
# If no option locator prefix is provided, the default behaviour is to match
# on label.
def select locator, option_locator
command 'select', locator, option_locator
end
# Add a selection to the set of selected options in a multi-select element
# using an option locator.
#
# See the <tt>#select</tt> command for more information about option locators.
def add_selection locator, option_locator
command 'addSelection', locator, option_locator
end
# Remove a selection from the set of selected options in a multi-select
# element using an option locator.
#
# See the +select+ command for more information about option locators.
def remove_selection locator, option_locator
command 'removeSelection', locator, option_locator
end
# Submit the specified form. This is particularly useful for forms without
# submit buttons, e.g. single-input "Search" forms.
def submit locator
command 'submit', locator
end
# Opens an URL in the test frame. This accepts both relative and absolute
# URLs. The <tt>open</tt> command waits for the page to load before
# proceeding, i.e. you don't have to call +wait_for_page_to_load+.
#
# Note: The URL must be on the same domain as the runner HTML due to security
# restrictions in the browser (Same Origin Policy).
def open url
command 'open', url_arg(url)
end
# Selects a popup window; once a popup window has been selected, all commands
# go to that window. To select the main window again, use +nil+ as the target.
def select_window window_id
command 'selectWindow', window_id||'null'
end
# Waits for a popup window to appear and load up.
#
# The +timeout+ is specified in milliseconds.
def wait_for_popup window_id, timeout
command 'waitForPopUp', window_id||'null', timeout
end
# By default, Selenium's overridden <tt>window.confirm()</tt> function will return
# +true+, as if the user had manually clicked OK. After running this command,
# the next call to <tt>confirm()</tt> will return +false+, as if the user had clicked
# Cancel.
def choose_cancel_on_next_confirmation
command 'chooseCancelOnNextConfirmation'
end
# Instructs Selenium to return the specified answer string in response to the
# next JavaScript prompt (<tt>window.prompt()</tt>).
def answer_on_next_prompt answer
command 'answerOnNextPrompt', answer
end
# Simulates the user clicking the "back" button on their browser.
def go_back
command 'goBack'
end
# Simulates the user clicking the "Refresh" button on their browser.
def refresh
command 'refresh'
end
# Simulates the user clicking the "close" button in the titlebar of a popup
# window or tab.
def close
command 'close'
end
# Writes a message to the status bar and adds a note to the browser-side log.
#
# +context+ is the message sent to the browser.
#
# +log_level_threshold+ can be +nil+, <tt>:debug</tt>, <tt>:info</tt>,
# <tt>:warn</tt> or <tt>:error</tt>.
def set_context context, log_level_threshold = nil
if log_level_threshold
command 'setContext', context, log_level_threshold.to_s
else
command 'setContext', context
end
end
# Runs the specified JavaScript snippet repeatedly until it evaluates to
# +true+. The snippet may have multiple lines, but only the result of the last
# line will be considered.
#
# Note that, by default, the snippet will be run in the runner's test window,
# not in the window of your application. To get the window of your
# application, you can use the JavaScript snippet
# <tt>selenium.browserbot.getCurrentWindow()</tt>, and then run your
# JavaScript in there.
#
# +timeout+ is specified in milliseconds.
def wait_for_condition script, timeout
command 'waitForCondition', script, timeout
end
# Specifies the amount of time that Selenium will wait for actions to
# complete.
#
# Actions that require waiting include +open+ and the <tt>wait_for*</tt>
# actions.
#
# The default timeout is 30 seconds.
#
# +timeout+ is specified in milliseconds.
def set_timeout timeout
command 'setTimeout', timeout
end
# Waits for a new page to load.
#
# You can use this command instead of the +and_wait+ suffixes,
# +click_and_wait+, +select_and_wait+, +type_and_wait+ etc. (which are only
# available in the JS API).
#
# Selenium constantly keeps track of new pages loading, and sets a
# +newPageLoaded+ flag when it first notices a page load. Running any other
# Selenium command after turns the flag to +false+. Hence, if you want to wait
# for a page to load, you must wait immediately after a Selenium command that
# caused a page-load.
#
# +timeout+ is specified in milliseconds.
def wait_for_page_to_load timeout
command 'waitForPageToLoad', timeout
end
private
# Generates the corresponding +_and_wait+ for each action.
def self.generate_and_wait_actions
public_instance_methods.each do |method|
define_method method + '_and_wait' do |*args|
make_command_waiting do
send method, *args
end
end
end
end
generate_and_wait_actions
end

View file

@ -0,0 +1,22 @@
require 'yaml'
class SeleniumOnRailsConfig
@@defaults = {:environments => ['test']}
def self.get var, default = nil
value = configs[var.to_s]
value ||= @@defaults[var]
value ||= default
value ||= yield if block_given?
value
end
private
def self.configs
unless defined? @@configs
file = File.expand_path(File.dirname(__FILE__) + '/../config.yml')
@@configs = File.exist?(file) ? YAML.load_file(file) : {}
end
@@configs
end
end

View file

@ -0,0 +1,18 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Selenium on Rails<%= defined?(@page_title) ? ": #{@page_title}" : '' %></title>
</head>
<style type="text/css">
body, html { font-family: Verdana, Arial, sans-serif; }
table { border-collapse: collapse; margin: 10px 0px; }
td, th { border: 2px solid black; }
#notice { text-align: center; color: darkgreen; background-color: lightgreen; padding: 5px 15px; width: 400px; margin-left: auto; margin-right: auto; }
#notice * { text-align: left; }
#usagedescription { margin: 15px 30px; }
</style>
<body>
<%= @content_for_layout %>
</body>
</html>

View file

@ -0,0 +1,5 @@
<table>
<% @result.each_pair do |key, value| -%>
<tr><td><%= key %></td><td><%= value %></td></tr>
<% end -%>
</table>

View file

@ -0,0 +1,67 @@
<% @page_title = 'Setup' -%>
<% if defined?(@session_wiped) or @cleared_tables.any? or @loaded_fixtures.any? -%>
<div id="notice">
<% if defined?(@session_wiped) -%>
<p>The session is wiped clean.</p>
<% end-%>
<% if @cleared_tables.any? -%>
<p>The following database tables are cleared:</p>
<ul>
<% for table in @cleared_tables -%>
<li><%= table %></li>
<% end-%>
</ul>
<% end -%>
<% if @loaded_fixtures.any? -%>
<p>The following fixtures are loaded:</p>
<ul>
<% for fixture in @loaded_fixtures -%>
<li><%= fixture %></li>
<% end-%>
</ul>
<% end -%>
</div>
<% end -%>
<div id="usagedescription">
<p>This page can be used to setup your Selenium tests. The following options can be used:</p>
<dl>
<dt><tt>keep_session</tt></dt>
<dd>
Per default the session is reset, so add <tt>keep_session</tt> in order to keep the current session.
<table>
<tr><td>open</td><td><%= url_for %>?keep_session</td><td>&nbsp;</td></tr>
</table>
</dd>
<dt><tt>fixtures</tt></dt>
<dd>
Loads one or many fixtures into the database. <strong>This will destroy the current data you have in your database!</strong> Use <tt>all</tt> as name in order to load all fixtures, or specify which fixtures that should be loaded (delimited by commas).<br />
If a test needs different data than you have in your fixtures, you can add another <em>fixture set</em>. A fixture set is just a sub directory in <tt>/test/fixtures/</tt> where you can add alternate fixtures (e.g. <tt>/test/fixtures/blank/users.yml</tt>).
<table>
<tr><td>open</td><td><%= url_for :fixtures => 'all' %></td><td>&nbsp;</td></tr>
<tr><td>open</td><td><%= url_for :fixtures => 'fixture' %></td><td>&nbsp;</td></tr>
<tr><td>open</td><td><%= url_for :fixtures => 'fixture_one' %>,fixture_two</td><td>&nbsp;</td></tr>
</table>
<b>Available fixtures</b><br />
<% fixtures = available_fixtures -%>
<% for fixture_set in fixtures.keys.sort -%>
In the <%= fixture_set.blank? ? 'default' : "<tt>#{fixture_set}</tt>" %> fixture set:
<ul>
<% fixtures[fixture_set].unshift fixture_set.blank? ? 'all' : "#{fixture_set}/all" -%>
<% for fixture in fixtures[fixture_set] -%>
<li><tt><%= fixture %></tt></li>
<% end -%>
</ul>
<% end -%>
</dd>
<dt><tt>clear_tables</tt></dt>
<dd>
Clears one or many database tables. Another way to do the same thing is to create an empty fixture in a new fixture set (see <tt>fixtures</tt> above).
<table>
<tr><td>open</td><td><%= url_for :clear_tables => 'sessions' %></td><td>&nbsp;</td></tr>
<tr><td>open</td><td><%= url_for :clear_tables => 'sessions' %>,outgoing_messages</td><td>&nbsp;</td></tr>
</table>
</dd>
</dl>
</div>

View file

@ -0,0 +1,26 @@
<% @page_title = test_suite_name @suite_path -%>
<script type="text/javascript">
<!--
function openSuite(selector) {
var suite = selector.options[selector.selectedIndex].value;
if(suite == "header") return;
if(top.location.href != location.href) //inside a frame
top.location = "<%= url_for :action => :support_file %>/TestRunner.html?test=tests" + suite
else
window.location = "<%= url_for :action => :test_file, :testname => '' %>" + suite
}
//-->
</script>
<select onchange="openSuite(this)">
<option value="header">Suites:</option>
<% for name, path in test_suites @suite_path -%>
<option value="<%= path %>"><%= name%></option>
<% end -%>
</select>
<table>
<tr><th><%= @page_title %></th></tr>
<% for name, path in test_cases @suite_path -%>
<tr><td><%= link_to_test_case name, path %></td></tr>
<% end -%>
</table>

View file

@ -0,0 +1,23 @@
module ActionController
module Routing #:nodoc:
class RouteSet #:nodoc:
alias_method :draw_without_selenium_routes, :draw
def draw
draw_without_selenium_routes do |map|
map.connect 'selenium/setup',
:controller => 'selenium', :action => 'setup'
map.connect 'selenium/tests/*testname',
:controller => 'selenium', :action => 'test_file'
map.connect 'selenium/postResults',
:controller => 'selenium', :action => 'record'
map.connect 'selenium/postResults/:logFile',
:controller => 'selenium', :action => 'record', :requirements => { :logFile => /.*/ }
map.connect 'selenium/*filename',
:controller => 'selenium', :action => 'support_file'
yield map
end
end
end
end
end

View file

@ -0,0 +1,20 @@
#make sure the controller is accessible
$LOAD_PATH << File.dirname(__FILE__)
require 'switch_environment_controller'
#hijack /selenium
module ActionController
module Routing #:nodoc:
class RouteSet #:nodoc:
alias_method :draw_without_selenium_routes, :draw
def draw
draw_without_selenium_routes do |map|
map.connect 'selenium/*filename',
:controller => 'switch_environment', :action => 'index'
yield map
end
end
end
end
end

View file

@ -0,0 +1,16 @@
class SwitchEnvironmentController < ActionController::Base
def index
readme_path = File.expand_path File.join(File.dirname(__FILE__), '..', 'README')
render :status => 500, :locals => {:readme_path => readme_path }, :inline => <<END
<p>
Selenium on Rails is only activated for <%= SeleniumOnRailsConfig.get(:environments).join ', ' %>
environment<%= SeleniumOnRailsConfig.get(:environments).size > 1 ? 's' : '' %> (you're running
<%= RAILS_ENV %>).
</p>
<p>
Start your server in a different environment or see <tt><%= readme_path %></tt>
for information regarding how to change this behavior.
</p>
END
end
end

View file

@ -0,0 +1,8 @@
task :test_acceptance => 'test:acceptance'
namespace :test do
desc 'Run Selenium tests in all browsers'
task :acceptance do
require File.dirname(__FILE__) + '/../lib/selenium_on_rails/acceptance_test_runner'
SeleniumOnRails::AcceptanceTestRunner.new.run
end
end

View file

@ -0,0 +1,147 @@
require File.dirname(__FILE__) + '/test_helper'
class RendererTest < Test::Unit::TestCase
def setup
@controller = SeleniumController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
@controller.layout_override =<<END
<html><head><title>test layout</title></head><body>
@content_for_layout
</body></html>
END
end
def test_route
get :test_file, :testname => 'html.html' #initialize the controller
assert_equal 'http://test.host/selenium/tests/suite/test_case.sel',
@controller.url_for(:controller => 'selenium', :action => 'test_file', :testname => 'suite/test_case.sel')
end
def test_html
get :test_file, :testname => 'html.html'
assert_headers
expected =<<END
<html><head><title>test layout</title></head><body>
<p>Testing plain HTML</p>
<table>
<tr><th colspan="3">Test HTML</th></tr>
<tr><td>open</td><td>/selenium/setup</td><td>&nbsp;</td></tr>
</table>
<p>and it works...</p>
</body></html>
END
assert_text_equal expected, @response.body
end
def test_rhtml
get :test_file, :testname => 'rhtml.rhtml'
assert_headers
expected =<<END
<html><head><title>test layout</title></head><body>
<table>
<tr><th colspan="3">Rhtml</th></tr>
<tr><td>open</td><td>/fi</td><td>&nbsp;</td></tr>
<tr><td>open</td><td>/fo</td><td>&nbsp;</td></tr>
<tr><td>open</td><td>/fum</td><td>&nbsp;</td></tr>
<tr><td>assertTitle</td><td>Partial from RHTML</td><td>&nbsp;</td></tr>
</table>
</body></html>
END
assert_text_equal expected, @response.body
end
def test_selenese
get :test_file, :testname => 'selenese.sel'
assert_headers
expected =<<END
<html><head><title>test layout</title></head><body>
<p>Selenese <strong>support</strong></p>
<table>
<tr><th colspan="3">Selenese</th></tr>
<tr><td>open</td><td>/selenium/setup</td><td>&nbsp;</td></tr>
<tr><td>goBack</td><td>&nbsp;</td><td>&nbsp;</td></tr>
<tr><td>assertTitle</td><td>Partial from Selenese</td><td>&nbsp;</td></tr>
</table>
<p>works.</p>
</body></html>
END
assert_text_equal expected, @response.body
end
def test_rselenese
get :test_file, :testname => 'rselenese.rsel'
assert_headers
expected = <<END
<html><head><title>test layout</title></head><body>
<table>
<tr><th colspan="3">Rselenese</th></tr>
<tr><td>open</td><td>/selenium/setup</td><td>&nbsp;</td></tr>
<tr><td>open</td><td>/selenium/setup?keep_session=true</td><td>&nbsp;</td></tr>
<tr><td>open</td><td>/selenium/setup?fixtures=all</td><td>&nbsp;</td></tr>
<tr><td>open</td><td>/selenium/setup?fixtures=foo%2Cbar</td><td>&nbsp;</td></tr>
<tr><td>open</td><td>/selenium/setup?fixtures=all&amp;amp;clear_tables=foo%2Cbar</td><td>&nbsp;</td></tr>
<tr><td>assertAbsoluteLocation</td><td>exact:http://test.host/selenium/setup</td><td>&nbsp;</td></tr>
<tr><td>assertTitle</td><td>selenium</td><td>&nbsp;</td></tr>
<tr><td>assertTitle</td><td>Partial from RSelenese</td><td>&nbsp;</td></tr>
</table>
</body></html>
END
assert_text_equal expected, @response.body
end
def test_partial_support
get :test_file, :testname => 'partials/all_partials.rsel'
assert_headers
expected = <<END
<html><head><title>test layout</title></head><body>
<table>
<tr><th colspan="3">All partials</th></tr>
<tr><td>assertTitle</td><td>Partial from All partials</td><td>&nbsp;</td></tr>
<tr><td>type</td><td>partial</td><td>HTML partial</td></tr>
<tr><td>type</td><td>world</td><td>RHTML partial</td></tr>
<tr><td>type</td><td>partial</td><td>Selenese partial</td></tr>
<tr><td>type</td><td>world</td><td>RSelenese partial</td></tr>
<tr><td>type</td><td>nesting</td><td>Nesting partial</td></tr>
<tr><td>type</td><td>dlrow</td><td>RSelenese partial</td></tr>
</table>
</body></html>
END
assert_text_equal expected, @response.body
end
def test_own_layout
get :test_file, :testname => 'own_layout.html'
assert_headers
expected =<<END
<html>
<head>
<title>Test case with own layout</title>
<style type="text/css"> body { background-color: #ccc; } </style>
</head>
<body>
<table>
<tr><th colspan="3">Test own layout</th></tr>
<tr><td>open</td><td>/selenium/setup</td><td>&nbsp;</td></tr>
</table>
</body>
</html>
END
assert_text_equal expected, @response.body
end
def test_not_found
get :test_file, :testname => 'missing'
assert_response 404
assert_equal 'Not found', @response.body
end
def assert_headers
assert_response :success
assert_equal 'no-cache', @response.headers['Cache-control']
assert_equal 'no-cache', @response.headers['Pragma']
assert_equal '-1', @response.headers['Expires']
end
end

View file

@ -0,0 +1,403 @@
require File.dirname(__FILE__) + '/test_helper'
class RSeleneseTest < Test::Unit::TestCase
include ERB::Util
def rselenese name, input, partial = nil, type = nil
view = TestView.new
view.override_partial partial, type do
view.assigns['page_title'] = name
view.render_template 'rsel', input
end
end
def assert_rselenese expected, name, input, partial = nil, type = nil
assert_text_equal(expected, rselenese(name, input, partial, type))
end
def test_empty
expected = <<END
<table>
<tr><th colspan="3">Empty</th></tr>
</table>
END
input = ''
assert_rselenese expected, 'Empty', input
end
def assert_generates_command expected, name, *args
expected = expected.map {|v| h(v) }
expected << '&nbsp;' while expected.length < 3
expected = expected.map {|v| "<td>#{v}</td>" }.join
expected_html = <<END
<table>
<tr><th colspan="3">Selenese Commands</th></tr>
<tr>#{expected}</tr>
</table>
END
args_str = args.map {|a| a.inspect }.join(',')
input = "#{name}(#{args_str})"
assert_rselenese expected_html, 'Selenese Commands', input
end
def test_element_locators
assert_generates_command %w{click aCheckbox}, :click, 'aCheckbox'
assert_generates_command %w{click document.foo}, :click, 'document.foo'
assert_generates_command %w{click //a}, :click, '//a'
end
def test_collection_arguments
assert_generates_command ['assertAllLinks', 'link1,link2,link3'], :assert_all_links, ['link1', 'link2','link3']
assert_generates_command ['assertAllLinks', 'link?,link?,link?'], :assert_all_links, 'link?,link?,link?'
end
ARG_VALUE_MAP = {
# We can't test url_for style arguments here, because we don't have
# a valid controller to interpret them. See RendererTest.
:url => '/relative/url',
:string => '1234',
:pattern => 'glob:J* Smith', # Also: many other formats.
:variable => 'varname',
:locator => 'foo',
:script => 'script',
:locator_and_attribute_name => [['foo', 'attribute'], 'foo@attribute'],
:table_locator => [['table', 2, 4], 'table.2.4'],
:coll_pattern => [[['a', "b\\", 'c,']], "a,b\\\\,c\\,"],
:event_name => 'eventName',
:keycode => 123,
:option_locator => 'label=hello',
:window_id => [[nil], 'null'],
:timeout => 123,
:log_level => :debug
}
# Call _command_ with _args_ and make sure it produces a good table.
# If the input command doesn't 'selenize' cleanly (e.g. if the input command
# is :do_foo and the expected result is +dofoo+ and not +doFoo+) +command+
# can be specified as an array (e.g. +[:input_command, 'expectedResult']).
def assert_command_works command, *args
expected_values = args.inject([]) do |c, arg|
v = ARG_VALUE_MAP[arg]
if v.is_a? Array
c << v[1]
else
c << v
end
end
input_values = args.inject([]) do |c, arg|
v = ARG_VALUE_MAP[arg]
if v.is_a? Array
c.concat v[0]
else
c << v
end
end
input_name, expected_name = (command.is_a?(Array) ? command : [command, SeleniumOnRails::TestBuilder.selenize(command.to_s)])
assert_generates_command [expected_name]+expected_values, input_name.to_s, *input_values
end
def test_action_commands
assert_command_works :click, :locator
assert_command_works :click_and_wait, :locator
assert_command_works :fire_event, :locator, :event_name
assert_command_works :fire_event_and_wait, :locator, :event_name
assert_command_works :key_press, :locator, :keycode
assert_command_works :key_press_and_wait, :locator, :keycode
assert_command_works :key_down, :locator, :keycode
assert_command_works :key_down_and_wait, :locator, :keycode
assert_command_works :key_up, :locator, :keycode
assert_command_works :key_up_and_wait, :locator, :keycode
assert_command_works :mouse_over, :locator
assert_command_works :mouse_over_and_wait, :locator
assert_command_works :mouse_down, :locator
assert_command_works :mouse_down_and_wait, :locator
assert_command_works :type, :locator, :string
assert_command_works :type_and_wait, :locator, :string
assert_command_works :check, :locator
assert_command_works :check_and_wait, :locator
assert_command_works :uncheck, :locator
assert_command_works :uncheck_and_wait, :locator
assert_command_works :select, :locator, :option_locator
assert_command_works :select_and_wait, :locator, :option_locator
assert_command_works :add_selection, :locator, :option_locator
assert_command_works :add_selection_and_wait, :locator, :option_locator
assert_command_works :remove_selection, :locator, :option_locator
assert_command_works :remove_selection_and_wait, :locator, :option_locator
assert_command_works :submit, :locator
assert_command_works :open, :url
assert_command_works :select_window, :window_id
assert_command_works [:wait_for_popup, 'waitForPopUp'], :window_id, :timeout
assert_command_works :choose_cancel_on_next_confirmation
assert_command_works :choose_cancel_on_next_confirmation_and_wait
assert_command_works :answer_on_next_prompt, :string
assert_command_works :answer_on_next_prompt_and_wait, :string
assert_command_works :go_back
assert_command_works :refresh
assert_command_works :close
assert_command_works :set_context, :string
assert_command_works :set_context, :string, :log_level
assert_command_works :wait_for_condition, :script, :timeout
assert_command_works :set_timeout, :timeout
assert_command_works :wait_for_page_to_load, :timeout
end
def test_accessor_commands
assert_command_works :store_alert_present, :variable
assert_command_works :assert_alert_present
assert_command_works :assert_alert_not_present
assert_command_works :verify_alert_present
assert_command_works :verify_alert_not_present
assert_command_works :wait_for_alert_present
assert_command_works :wait_for_alert_not_present
assert_command_works :store_prompt_present, :variable
assert_command_works :assert_prompt_present
assert_command_works :assert_prompt_not_present
assert_command_works :verify_prompt_present
assert_command_works :verify_prompt_not_present
assert_command_works :wait_for_prompt_present
assert_command_works :wait_for_prompt_not_present
assert_command_works :store_confirmation_present, :variable
assert_command_works :assert_confirmation_present
assert_command_works :assert_confirmation_not_present
assert_command_works :verify_confirmation_present
assert_command_works :verify_confirmation_not_present
assert_command_works :wait_for_confirmation_present
assert_command_works :wait_for_confirmation_not_present
assert_command_works :store_alert, :variable
assert_command_works :assert_alert, :pattern
assert_command_works :assert_not_alert, :pattern
assert_command_works :verify_alert, :pattern
assert_command_works :verify_not_alert, :pattern
assert_command_works :wait_for_alert, :pattern
assert_command_works :wait_for_not_alert, :pattern
assert_command_works :store_confirmation, :variable
assert_command_works :assert_confirmation, :pattern
assert_command_works :assert_not_confirmation, :pattern
assert_command_works :verify_confirmation, :pattern
assert_command_works :verify_not_confirmation, :pattern
assert_command_works :wait_for_confirmation, :pattern
assert_command_works :wait_for_not_confirmation, :pattern
assert_command_works :store_prompt, :variable
assert_command_works :assert_prompt, :pattern
assert_command_works :assert_not_prompt, :pattern
assert_command_works :verify_prompt, :pattern
assert_command_works :verify_not_prompt, :pattern
assert_command_works :wait_for_prompt, :pattern
assert_command_works :wait_for_not_prompt, :pattern
assert_command_works :store_absolute_location, :variable
assert_command_works :assert_absolute_location, :url
assert_command_works :assert_not_absolute_location, :url
assert_command_works :verify_absolute_location, :url
assert_command_works :verify_not_absolute_location, :url
assert_command_works :wait_for_absolute_location, :url
assert_command_works :wait_for_not_absolute_location, :url
assert_command_works :store_location, :pattern, :variable
assert_command_works :assert_location, :url
assert_command_works :assert_not_location, :url
assert_command_works :verify_location, :url
assert_command_works :verify_not_location, :url
assert_command_works :wait_for_location, :url
assert_command_works :wait_for_not_location, :url
assert_command_works :store_title, :variable
assert_command_works :assert_title, :pattern
assert_command_works :assert_not_title, :pattern
assert_command_works :verify_title, :pattern
assert_command_works :verify_not_title, :pattern
assert_command_works :wait_for_title, :pattern
assert_command_works :wait_for_not_title, :pattern
assert_command_works :store_body_text, :variable
assert_command_works :assert_body_text, :pattern
assert_command_works :assert_not_body_text, :pattern
assert_command_works :verify_body_text, :pattern
assert_command_works :verify_not_body_text, :pattern
assert_command_works :wait_for_body_text, :pattern
assert_command_works :wait_for_not_body_text, :pattern
assert_command_works :store_value, :locator, :variable
assert_command_works :assert_value, :locator, :pattern
assert_command_works :assert_not_value, :locator, :pattern
assert_command_works :verify_value, :locator, :pattern
assert_command_works :verify_not_value, :locator, :pattern
assert_command_works :wait_for_value, :locator, :pattern
assert_command_works :wait_for_not_value, :locator, :pattern
assert_command_works :store_text, :locator, :variable
assert_command_works :assert_text, :locator, :pattern
assert_command_works :assert_not_text, :locator, :pattern
assert_command_works :verify_text, :locator, :pattern
assert_command_works :verify_not_text, :locator, :pattern
assert_command_works :wait_for_text, :locator, :pattern
assert_command_works :wait_for_not_text, :locator, :pattern
assert_command_works :store_eval, :script, :variable
assert_command_works :assert_eval, :script, :pattern
assert_command_works :assert_not_eval, :script, :pattern
assert_command_works :verify_eval, :script, :pattern
assert_command_works :verify_not_eval, :script, :pattern
assert_command_works :wait_for_eval, :script, :pattern
assert_command_works :wait_for_not_eval, :script, :pattern
assert_command_works :store_checked, :locator, :variable
assert_command_works :assert_checked, :locator, :pattern
assert_command_works :assert_not_checked, :locator, :pattern
assert_command_works :verify_checked, :locator, :pattern
assert_command_works :verify_not_checked, :locator, :pattern
assert_command_works :wait_for_checked, :locator, :pattern
assert_command_works :wait_for_not_checked, :locator, :pattern
assert_command_works :store_table, :table_locator, :variable
assert_command_works :assert_table, :table_locator, :pattern
assert_command_works :assert_not_table, :table_locator, :pattern
assert_command_works :verify_table, :table_locator, :pattern
assert_command_works :verify_not_table, :table_locator, :pattern
assert_command_works :wait_for_table, :table_locator, :pattern
assert_command_works :wait_for_not_table, :table_locator, :pattern
assert_raise RuntimeError do
assert_command_works :store_selected, :locator, :option_locator, :variable
end
assert_command_works :assert_selected, :locator, :option_locator
assert_command_works :assert_not_selected, :locator, :option_locator
assert_command_works :verify_selected, :locator, :option_locator
assert_command_works :verify_not_selected, :locator, :option_locator
assert_command_works :wait_for_selected, :locator, :option_locator
assert_command_works :wait_for_not_selected, :locator, :option_locator
assert_command_works :store_selected_options, :locator, :variable
assert_command_works :assert_selected_options, :locator, :coll_pattern
assert_command_works :assert_not_selected_options, :locator, :coll_pattern
assert_command_works :verify_selected_options, :locator, :coll_pattern
assert_command_works :verify_not_selected_options, :locator, :coll_pattern
assert_command_works :wait_for_selected_options, :locator, :coll_pattern
assert_command_works :wait_for_not_selected_options, :locator, :coll_pattern
assert_command_works :store_select_options, :locator, :variable
assert_command_works :assert_select_options, :locator, :coll_pattern
assert_command_works :assert_not_select_options, :locator, :coll_pattern
assert_command_works :verify_select_options, :locator, :coll_pattern
assert_command_works :verify_not_select_options, :locator, :coll_pattern
assert_command_works :wait_for_select_options, :locator, :coll_pattern
assert_command_works :wait_for_not_select_options, :locator, :coll_pattern
assert_command_works :store_attribute, :locator_and_attribute_name, :variable
assert_command_works :assert_attribute, :locator_and_attribute_name, :pattern
assert_command_works :assert_not_attribute, :locator_and_attribute_name, :pattern
assert_command_works :verify_attribute, :locator_and_attribute_name, :pattern
assert_command_works :verify_not_attribute, :locator_and_attribute_name, :pattern
assert_command_works :wait_for_attribute, :locator_and_attribute_name, :pattern
assert_command_works :wait_for_not_attribute, :locator_and_attribute_name, :pattern
assert_command_works :store_text_present, :pattern, :variable
assert_command_works :assert_text_present, :pattern
assert_command_works :assert_text_not_present, :pattern
assert_command_works :verify_text_present, :pattern
assert_command_works :verify_text_not_present, :pattern
assert_command_works :wait_for_text_present, :pattern
assert_command_works :wait_for_text_not_present, :pattern
assert_command_works :store_element_present, :locator, :variable
assert_command_works :assert_element_present, :locator
assert_command_works :assert_element_not_present, :locator
assert_command_works :verify_element_present, :locator
assert_command_works :verify_element_not_present, :locator
assert_command_works :wait_for_element_present, :locator
assert_command_works :wait_for_element_not_present, :locator
assert_command_works :store_visible, :locator, :variable
assert_command_works :assert_visible, :locator
assert_command_works :assert_not_visible, :locator
assert_command_works :verify_visible, :locator
assert_command_works :verify_not_visible, :locator
assert_command_works :wait_for_visible, :locator
assert_command_works :wait_for_not_visible, :locator
assert_command_works :store_editable, :locator, :variable
assert_command_works :assert_editable, :locator
assert_command_works :assert_not_editable, :locator
assert_command_works :verify_editable, :locator
assert_command_works :verify_not_editable, :locator
assert_command_works :wait_for_editable, :locator
assert_command_works :wait_for_not_editable, :locator
assert_command_works :store_all_buttons, :variable
assert_command_works :assert_all_buttons, :coll_pattern
assert_command_works :assert_not_all_buttons, :coll_pattern
assert_command_works :verify_all_buttons, :coll_pattern
assert_command_works :verify_not_all_buttons, :coll_pattern
assert_command_works :wait_for_all_buttons, :coll_pattern
assert_command_works :wait_for_not_all_buttons, :coll_pattern
assert_command_works :store_all_links, :variable
assert_command_works :assert_all_links, :coll_pattern
assert_command_works :assert_not_all_links, :coll_pattern
assert_command_works :verify_all_links, :coll_pattern
assert_command_works :verify_not_all_links, :coll_pattern
assert_command_works :wait_for_all_links, :coll_pattern
assert_command_works :wait_for_not_all_links, :coll_pattern
assert_command_works :store_all_fields, :variable
assert_command_works :assert_all_fields, :coll_pattern
assert_command_works :assert_not_all_fields, :coll_pattern
assert_command_works :verify_all_fields, :coll_pattern
assert_command_works :verify_not_all_fields, :coll_pattern
assert_command_works :wait_for_all_fields, :coll_pattern
assert_command_works :wait_for_not_all_fields, :coll_pattern
assert_command_works :store_html_source, :variable
assert_command_works :assert_html_source, :pattern
assert_command_works :assert_not_html_source, :pattern
assert_command_works :verify_html_source, :pattern
assert_command_works :verify_not_html_source, :pattern
assert_command_works :wait_for_html_source, :pattern
assert_command_works :wait_for_not_html_source, :pattern
assert_command_works :store_expression, :script, :variable
assert_command_works :assert_expression, :script, :pattern
assert_command_works :assert_not_expression, :script, :pattern
assert_command_works :verify_expression, :script, :pattern
assert_command_works :verify_not_expression, :script, :pattern
assert_command_works :wait_for_expression, :script, :pattern
assert_command_works :wait_for_not_expression, :script, :pattern
end
def test_partial_support
expected = <<END
<table>
<tr><th colspan="3">Partial support</th></tr>
<tr><td>type</td><td>partial</td><td>RSelenese partial</td></tr>
</table>
END
input = "include_partial 'override'"
partial = "type 'partial', 'RSelenese partial'"
assert_rselenese expected, 'Partial support', input, partial, 'rsel'
end
def test_partial_support_with_local_assigns
expected = <<END_EXPECTED
<table>
<tr><th colspan="3">Partial support with local variables</th></tr>
<tr><td>type</td><td>partial</td><td>RSelenese partial</td></tr>
<tr><td>type</td><td>local</td><td>par</td></tr>
<tr><td>type</td><td>local</td><td>tial</td></tr>
</table>
END_EXPECTED
input = "include_partial 'override', :locator => 'local', :input => ['par', 'tial']"
partial = <<END_PARTIAL
type 'partial', 'RSelenese partial'
input.each do |i|
type locator, i
end
END_PARTIAL
assert_rselenese expected, 'Partial support with local variables', input, partial, 'rsel'
end
end

View file

@ -0,0 +1,229 @@
require File.dirname(__FILE__) + '/test_helper'
class SeleneseTest < Test::Unit::TestCase
def selenese name, input, partial = nil, type = nil
view = TestView.new
view.override_partial partial, type do
view.assigns['page_title'] = name
view.render_template 'sel', input
end
end
def assert_selenese expected, name, input, partial = nil, type = nil
assert_text_equal expected, selenese(name, input, partial, type)
end
def test_empty
expected = <<END
<table>
<tr><th colspan="3">Empty</th></tr>
</table>
END
input = ''
assert_selenese expected, 'Empty', ''
end
def test_one_line
expected = <<END
<table>
<tr><th colspan="3">One line</th></tr>
<tr><td>open</td><td>/</td><td>&nbsp;</td></tr>
</table>
END
input = '|open|/|'
assert_selenese expected, 'One line', input
end
def test_comments_only
expected = <<END
<p>Comment <strong>1</strong></p>
<p>Comment 2</p>
<table>
<tr><th colspan="3">Only comments</th></tr>
</table>
END
input = <<END
Comment *1*
Comment 2
END
assert_selenese expected, 'Only comments', input
end
def test_commands_only
expected = <<END
<table>
<tr><th colspan="3">Only commands</th></tr>
<tr><td>goBack</td><td>&nbsp;</td><td>&nbsp;</td></tr>
<tr><td>open</td><td>/foo</td><td>&nbsp;</td></tr>
<tr><td>fireEvent</td><td>textField</td><td>focus</td></tr>
</table>
END
input = <<END
|goBack |
|open| /foo |
| fireEvent | textField | focus |
END
assert_selenese expected, 'Only commands', input
end
def test_commands_and_comments
expected = <<END
<table>
<tr><th colspan="3">Commands and comments</th></tr>
<tr><td>goBack</td><td>&nbsp;</td><td>&nbsp;</td></tr>
<tr><td>fireEvent</td><td>textField</td><td>focus</td></tr>
</table>
<p>Comment 1</p>
<p>Comment <strong>2</strong></p>
END
input = <<END
|goBack |
| fireEvent | textField| focus|
Comment 1
Comment *2*
END
assert_selenese expected, 'Commands and comments', input
end
def test_comments_and_commands
expected = <<END
<p>Comment 1</p>
<p>Comment <strong>2</strong></p>
<table>
<tr><th colspan="3">Comments and commands</th></tr>
<tr><td>goBack</td><td>&nbsp;</td><td>&nbsp;</td></tr>
<tr><td>fireEvent</td><td>textField</td><td>focus</td></tr>
</table>
END
input = <<END
Comment 1
Comment *2*
|goBack |
| fireEvent | textField|focus|
END
assert_selenese expected, 'Comments and commands', input
end
def test_comments_commands_comments
expected = <<END
<p>Comment 1</p>
<p>Comment <strong>2</strong></p>
<table>
<tr><th colspan="3">Comments, commands and comments</th></tr>
<tr><td>goBack</td><td>&nbsp;</td><td>&nbsp;</td></tr>
<tr><td>fireEvent</td><td>textField</td><td>focus</td></tr>
</table>
<p>Comment 3</p>
END
input = <<END
Comment 1
Comment *2*
|goBack |
| fireEvent | textField| focus|
Comment 3
END
assert_selenese expected, 'Comments, commands and comments', input
end
def test_command_html_entity_escaping
expected = <<END
<table>
<tr><th colspan="3">HTML escaping</th></tr>
<tr><td>type</td><td>nameField</td><td>&lt;&gt;&amp;</td></tr>
</table>
END
input = '|type|nameField|<>&|'
assert_selenese expected, 'HTML escaping', input
end
def test_partial_support
expected = <<END
<table>
<tr><th colspan="3">Partial support</th></tr>
<tr><td>type</td><td>partial</td><td>Selenese partial</td></tr>
</table>
END
input = '|includePartial|override|'
partial = '|type|partial|Selenese partial|'
assert_selenese expected, 'Partial support', input, partial, 'sel'
end
def test_partial_support_with_local_assigns
expected = <<END_EXPECTED
<table>
<tr><th colspan="3">Partial support with local assigns</th></tr>
<tr><td>type</td><td>assigns</td><td>a=hello,b=world!,c_123ABC=</td></tr>
<tr><td>type</td><td>assigns</td><td>a=a b c d,b=,c_123ABC=hello</td></tr>
</table>
END_EXPECTED
input = <<END_INPUT
|includePartial|override|a=hello|b=world!|
|includePartial|override|a = a b c d|b=|c_123ABC= hello |
END_INPUT
partial = <<END_PARTIAL
<table><tr><th>whatever</th></tr>
<tr><td>type</td><td>assigns</td><td>
a=<%= a if defined? a%>,
b=<%= b if defined? b%>,
c_123ABC=<%= c_123ABC if defined? c_123ABC%>
</td></tr>
</table>
END_PARTIAL
assert_selenese expected, 'Partial support with local assigns', input, partial, 'rhtml'
end
def test_raised_when_more_than_three_columns
assert_raise RuntimeError, 'There might only be a maximum of three cells!' do
selenese 'name', '|col1|col2|col3|col4|'
end
end
def test_raised_when_more_than_one_set_of_commands
assert_raise RuntimeError, 'You cannot have comments in the middle of commands!' do
input = <<END
comment
|command|
comment
|command|
END
selenese 'name', input
end
end
def test_raised_when_incorrect_partial_format
assert_raise RuntimeError, "Invalid format 'invalid'. Should be '|includePartial|partial|var1=value|var2=value|." do
selenese 'name', '|includePartial|partial|a=valid|invalid|'
end
end
end

View file

@ -0,0 +1,48 @@
require File.dirname(__FILE__) + '/test_helper'
require "selenium_controller"
class SeleniumControllerTest < Test::Unit::TestCase
def setup
@controller = SeleniumController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
@result_dir = File.join(File.dirname(__FILE__), "..", "test_result")
end
def teardown
FileUtils.rm_rf @result_dir
end
def test_record_with_result
SeleniumOnRailsConfig.configs["result_dir"] = @result_dir
suite = <<EOS
<script>
</script>
<table>
<tr><td bgcolor="#ccffcc"><a href="/selenium/tests/foo.sel">Foo</a></td></tr>
<tr><td bgcolor="#ccffcc"><a href="/selenium/tests/bar.sel">Bar</a></td></tr>
</table>
EOS
post :record, :suite => suite,
"testTable.1" => "<table></table>",
"testTable.2" => "<table></table>"
cur_result_dir = File.join(@result_dir, "default")
assert File.directory?(cur_result_dir)
assert_equal ["blank.html", "index.html", "suite.html", "test1.html", "test2.html"],
Dir.glob("#{cur_result_dir}/*.html").map{|path| File.basename(path)}.sort
expected = <<EOS
<html>
<head>
<link rel="stylesheet" type="text/css" href="selenium-test.css">
</head>
<body>
<table>
<tr><td bgcolor="#ccffcc"><a href="test1.html" target="testcase">Foo</a></td></tr>
<tr><td bgcolor="#ccffcc"><a href="test2.html" target="testcase">Bar</a></td></tr>
</table>
</body></html>
EOS
assert_equal expected, File.read("#{cur_result_dir}/suite.html")
end
end

View file

@ -0,0 +1,33 @@
require File.dirname(__FILE__) + '/test_helper'
class SeleniumSupportTest < Test::Unit::TestCase
def setup
@controller = SeleniumController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
end
def test_route
get :support_file, :filename => 'TestRunner.html' #initialize the controller
assert_equal 'http://test.host/selenium/TestRunner.html',
@controller.url_for(:controller => 'selenium', :action => 'support_file', :filename => 'TestRunner.html')
end
def test_test_runner_existance
get :support_file, :filename => 'TestRunner.html'
assert_response :success
assert @response.body.include?('Selenium')
end
def test_default_file
get :support_file, :filename => ''
assert_redirected_to :filename => 'TestRunner.html', :test => 'tests'
end
def test_missing_file
get :support_file, :filename => 'missing.html'
assert_response 404
assert_equal 'Not found', @response.body
end
end

View file

@ -0,0 +1,29 @@
require File.dirname(__FILE__) + '/test_helper'
class SetupTest < Test::Unit::TestCase
def setup
@controller = SeleniumController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
end
def test_session_reset
@request.session['key'] = 'value'
get :setup
assert_nil session['key']
assert_response :success
assert_tag :content => 'The session is wiped clean.'
end
def test_session_no_reset
@request.session['key'] = 'value'
get :setup, :keep_session => true
assert_equal 'value', session['key']
assert_response :success
assert_no_tag :content => 'The session is wiped clean.'
end
#
# Don't have the nerve to test fixtures since this is a plugin
#
end

View file

@ -0,0 +1,173 @@
require File.dirname(__FILE__) + '/test_helper'
class SuiteRendererTest < Test::Unit::TestCase
def setup
@controller = SeleniumController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
@controller.layout_override =<<END
<html><head><title>test layout</title></head><body>
@content_for_layout
</body></html>
END
end
def test_empty_suite
get :test_file, :testname => 'empty_suite'
assert_response :success
expected =<<END
<html><head><title>test layout</title></head><body>
<script type="text/javascript">
<!--
function openSuite(selector) {
var suite = selector.options[selector.selectedIndex].value;
if(suite == "header") return;
if(top.location.href != location.href) //inside a frame
top.location = "/selenium/TestRunner.html?test=tests" + suite
else
window.location = "/selenium/tests" + suite
}
//-->
</script>
<select onchange="openSuite(this)">
<option value="header">Suites:</option>
<option value="">..</option>
</select>
<table>
<tr><th>Empty suite</th></tr>
</table>
</body></html>
END
assert_text_equal expected, @response.body
end
def test_root_suite
_test_root_suite ''
end
def test_test_suite_html
#TestSuite.html is the default name the Selenium Runner tries to run
_test_root_suite 'TestSuite.html'
end
def _test_root_suite testname
get :test_file, :testname => testname
assert_response :success
expected =<<END
<html><head><title>test layout</title></head><body>
<script type="text/javascript">
<!--
function openSuite(selector) {
var suite = selector.options[selector.selectedIndex].value;
if(suite == "header") return;
if(top.location.href != location.href) //inside a frame
top.location = "/selenium/TestRunner.html?test=tests" + suite
else
window.location = "/selenium/tests" + suite
}
//-->
</script>
<select onchange="openSuite(this)">
<option value="header">Suites:</option>
<option value="/empty_suite">Empty suite</option>
<option value="/partials">Partials</option>
<option value="/suite_one">Suite one</option>
<option value="/suite_two">Suite two</option>
<option value="/suite_one/subsuite">Suite one.Subsuite</option>
</select>
<table>
<tr><th>All test cases</th></tr>
<tr><td><a href="/selenium/tests/html.html">Html</a></td></tr>
<tr><td><a href="/selenium/tests/own_layout.html">Own layout</a></td></tr>
<tr><td><a href="/selenium/tests/rhtml.rhtml">Rhtml</a></td></tr>
<tr><td><a href="/selenium/tests/rselenese.rsel">Rselenese</a></td></tr>
<tr><td><a href="/selenium/tests/selenese.sel">Selenese</a></td></tr>
<tr><td><a href="/selenium/tests/partials/all_partials.rsel">Partials.All partials</a></td></tr>
<tr><td><a href="/selenium/tests/suite_one/suite_one_testcase1.sel">Suite one.Suite one testcase1</a></td></tr>
<tr><td><a href="/selenium/tests/suite_one/suite_one_testcase2.sel">Suite one.Suite one testcase2</a></td></tr>
<tr><td><a href="/selenium/tests/suite_one/subsuite/suite_one_subsuite_testcase.sel">Suite one.Subsuite.Suite one subsuite testcase</a></td></tr>
<tr><td><a href="/selenium/tests/suite_two/suite_two_testcase.sel">Suite two.Suite two testcase</a></td></tr>
</table>
</body></html>
END
assert_text_equal expected, @response.body
end
def test_suite_one
get :test_file, :testname => 'suite_one'
assert_response :success
expected =<<END
<html><head><title>test layout</title></head><body>
<script type="text/javascript">
<!--
function openSuite(selector) {
var suite = selector.options[selector.selectedIndex].value;
if(suite == "header") return;
if(top.location.href != location.href) //inside a frame
top.location = "/selenium/TestRunner.html?test=tests" + suite
else
window.location = "/selenium/tests" + suite
}
//-->
</script>
<select onchange="openSuite(this)">
<option value="header">Suites:</option>
<option value="">..</option>
<option value="/suite_one/subsuite">Subsuite</option>
</select>
<table>
<tr><th>Suite one</th></tr>
<tr><td><a href="/selenium/tests/suite_one/suite_one_testcase1.sel">Suite one testcase1</a></td></tr>
<tr><td><a href="/selenium/tests/suite_one/suite_one_testcase2.sel">Suite one testcase2</a></td></tr>
<tr><td><a href="/selenium/tests/suite_one/subsuite/suite_one_subsuite_testcase.sel">Subsuite.Suite one subsuite testcase</a></td></tr>
</table>
</body></html>
END
assert_text_equal expected, @response.body
end
def test_sub_suite
get :test_file, :testname => 'suite_one/subsuite'
assert_response :success
expected =<<END
<html><head><title>test layout</title></head><body>
<script type="text/javascript">
<!--
function openSuite(selector) {
var suite = selector.options[selector.selectedIndex].value;
if(suite == "header") return;
if(top.location.href != location.href) //inside a frame
top.location = "/selenium/TestRunner.html?test=tests" + suite
else
window.location = "/selenium/tests" + suite
}
//-->
</script>
<select onchange="openSuite(this)">
<option value="header">Suites:</option>
<option value="/suite_one">..</option>
</select>
<table>
<tr><th>Subsuite</th></tr>
<tr><td><a href="/selenium/tests/suite_one/subsuite/suite_one_subsuite_testcase.sel">Suite one subsuite testcase</a></td></tr>
</table>
</body></html>
END
assert_text_equal expected, @response.body
end
def test_missing_tests_directory
def @controller.selenium_tests_path
File.join(File.dirname(__FILE__), 'invalid')
end
get :test_file, :testname => ''
assert_response 404
assert_equal "Did not find the Selenium tests path (#{File.join(File.dirname(__FILE__), 'invalid')}). Run script/generate selenium", @response.body
end
end

View file

@ -0,0 +1,70 @@
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../../../../config/environment")
require 'test_help'
require 'controllers/selenium_controller'
module SeleniumOnRails::Paths
def selenium_tests_path
File.expand_path(File.dirname(__FILE__) + '/../test_data')
end
end
class SeleniumController
attr_accessor :layout_override
# Re-raise errors caught by the controller.
def rescue_action e
raise e
end
def render options = nil, deprecated_status = nil
if override_layout? options
options[:layout] = false
super options, deprecated_status
return response.body = @layout_override.gsub('@content_for_layout', response.body)
end
super options, deprecated_status
end
private
def override_layout? options
return false unless @layout_override
if options[:action] or options[:template]
options[:layout] != false #for action and template the default layout is used if not explicitly disabled
else
not [nil, false].include? options[:layout] #otherwise a layout has to be specified
end
end
end
class Test::Unit::TestCase
def assert_text_equal expected, actual
assert_equal clean_text(expected), clean_text(actual)
end
def clean_text text
text.gsub("\t", ' ').gsub("\r", '').gsub("\n", '').gsub(/ *</, '<')
end
end
class TestView < ActionView::Base
include SeleniumOnRails::PartialsSupport
alias_method :render_partial_without_override, :render_partial
def render_partial partial_path = default_template_name, object = nil, local_assigns = nil, status = nil
if @override
partial = render :inline => @override, :type => @override_type, :locals => local_assigns
extract_commands_from_partial partial
else
render_partial_without_override partial_path, object, local_assigns, status
end
end
def override_partial partial, type
@override, @override_type = partial, type
result = yield
@override, @override_type = nil, nil
result
end
end

View file

@ -0,0 +1 @@
assert_title "Partial from #{source}"

View file

@ -0,0 +1,6 @@
<p>Testing plain HTML</p>
<table>
<tr><th colspan="3">Test HTML</th></tr>
<tr><td>open</td><td>/selenium/setup</td><td>&nbsp;</td></tr>
</table>
<p>and it works...</p>

View file

@ -0,0 +1,12 @@
<html>
<head>
<title>Test case with own layout</title>
<style type="text/css"> body { background-color: #ccc; } </style>
</head>
<body>
<table>
<tr><th colspan="3">Test own layout</th></tr>
<tr><td>open</td><td>/selenium/setup</td><td>&nbsp;</td></tr>
</table>
</body>
</html>

View file

@ -0,0 +1,6 @@
<h1>This should never be visible!</h1>
<table>
<tr><th colspan="3">HTML partial</th></tr>
<tr><td>type</td><td>partial</td><td>HTML partial</td></tr>
</table>
<p>Neither should this!</p>

View file

@ -0,0 +1,2 @@
type 'nesting', 'Nesting partial'
include_partial 'partials/rsel', :hello => hello.reverse

View file

@ -0,0 +1,6 @@
<h1>This should never be visible!</h1>
<table>
<tr><th colspan="3">RHTML partial</th></tr>
<tr><td>type</td><td><%= hello %></td><td>RHTML partial</td></tr>
</table>
<p>Neither should this!</p>

View file

@ -0,0 +1 @@
type hello, 'RSelenese partial'

View file

@ -0,0 +1,5 @@
h1. This should not be visible!
|type|partial|Selenese partial|
p. Neither should this!

Some files were not shown because too many files have changed in this diff Show more