mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-03 14:31:47 +01:00
Added a set of Selenium helper classes and methods, to provide automatic login capabilities, to speed up selenium tests.
git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@482 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
5a878b3e84
commit
cd25d7e278
26 changed files with 62 additions and 39 deletions
18
tracks/test/selenium_helper.rb
Normal file
18
tracks/test/selenium_helper.rb
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
class SeleniumHelperController < ActionController::Base
|
||||
def login
|
||||
if params[:as]
|
||||
session['user_id'] = User.find_by_login(params[:as].to_s)
|
||||
end
|
||||
render :text => "Logged in as #{params[:as]}"
|
||||
end
|
||||
end
|
||||
|
||||
ActionController::Routing::Routes.add_route '/selenium_helper/login', :controller => 'selenium_helper', :action => 'login'
|
||||
|
||||
module SeleniumOnRails::TestBuilderActions
|
||||
def login options = {}
|
||||
options = {options => nil} unless options.is_a? Hash
|
||||
opts = {:controller => 'selenium_helper', :action => 'login'}.merge(options)
|
||||
open opts
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue