| Class | SeleniumController |
| In: |
lib/controllers/selenium_controller.rb
|
| Parent: | ActionController::Base |
# File lib/controllers/selenium_controller.rb, line 50
50: def record
51: dir = record_table
52:
53: @result = {'resultDir' => dir}
54: for p in ['result', 'numTestFailures', 'numTestPasses', 'numCommandFailures', 'numCommandPasses', 'numCommandErrors', 'totalTime']
55: @result[p] = params[p]
56: end
57: File.open(log_path(params[:logFile] || 'default.yml'), 'w') {|f| YAML.dump(@result, f)}
58:
59: render :file => view_path('record.rhtml'), :layout => layout_path
60: end
# File lib/controllers/selenium_controller.rb, line 7
7: def setup
8: unless params.has_key? :keep_session
9: reset_session
10: @session_wiped = true
11: end
12: @cleared_tables = clear_tables params[:clear_tables].to_s
13: @loaded_fixtures = load_fixtures params[:fixtures].to_s
14: render :file => view_path('setup.rhtml'), :layout => layout_path
15: end
# File lib/controllers/selenium_controller.rb, line 34
34: def support_file
35: if params[:filename].empty?
36: redirect_to :filename => 'TestRunner.html', :test => 'tests'
37: return
38: end
39:
40: filename = File.join selenium_path, params[:filename]
41: if File.file? filename
42: type = WEBrick::HTTPUtils::DefaultMimeTypes[$1.downcase] if filename =~ /\.(\w+)$/
43: type ||= 'text/html'
44: send_file filename, :type => type, :disposition => 'inline', :stream => false
45: else
46: render :text => 'Not found', :status => 404
47: end
48: end
# File lib/controllers/selenium_controller.rb, line 17
17: def test_file
18: params[:testname] = '' if params[:testname].to_s == 'TestSuite.html'
19: filename = File.join selenium_tests_path, params[:testname]
20: if File.directory? filename
21: @suite_path = filename
22: render :file => view_path('test_suite.rhtml'), :layout => layout_path
23: elsif File.readable? filename
24: render_test_case filename
25: else
26: if File.directory? selenium_tests_path
27: render :text => 'Not found', :status => 404
28: else
29: render :text => "Did not find the Selenium tests path (#{selenium_tests_path}). Run script/generate selenium", :status => 404
30: end
31: end
32: end