# 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
+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
+ 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
+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
+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
# File lib/selenium_helper.rb, line 5
-5: def test_case_name filename
-6: File.basename(filename).sub(/\..*/,'').humanize
+5: def test_case_name filename
+6: File.basename(filename).sub(/\..*/,'').humanize
7: end
# File lib/selenium_on_rails/fixture_loader.rb, line 7
- 7: def available_fixtures
- 8: fixtures = {}
- 9: path = fixtures_path + '/'
-10: files = Dir["#{path}**/*.{yml,csv}"]
-11: files.each do |file|
-12: rel_path = file.sub(path, '')
-13: next if skip_file? rel_path
-14: fixture_set = File.dirname(rel_path)
-15: fixture_set = '' if fixture_set == '.'
-16: fixture = rel_path.sub /\.[^.]*$/, ''
-17: fixtures[fixture_set] ||= []
-18: fixtures[fixture_set] << fixture
-19: end
-20:
-21: fixtures
+ 7: def available_fixtures
+ 8: fixtures = {}
+ 9: path = fixtures_path + '/'
+10: files = Dir["#{path}**/*.{yml,csv}"]
+11: files.each do |file|
+12: rel_path = file.sub(path, '')
+13: next if skip_file? rel_path
+14: fixture_set = File.dirname(rel_path)
+15: fixture_set = '' if fixture_set == '.'
+16: fixture = rel_path.sub /\.[^.]*$/, ''
+17: fixtures[fixture_set] ||= []
+18: fixtures[fixture_set] << fixture
+19: end
+20:
+21: fixtures
22: end
# File lib/selenium_on_rails/fixture_loader.rb, line 46
-46: def clear_tables tables
-47: table_names = tables.split /\s*,\s*/
-48: connection = ActiveRecord::Base.connection
-49: table_names.each do |table|
-50: connection.execute "DELETE FROM #{table}"
-51: end
-52: table_names
+46: def clear_tables tables
+47: table_names = tables.split /\s*,\s*/
+48: connection = ActiveRecord::Base.connection
+49: table_names.each do |table|
+50: connection.execute "DELETE FROM #{table}"
+51: end
+52: table_names
53: end
# File lib/selenium_on_rails/fixture_loader.rb, line 24
-24: def load_fixtures fixtures_param
-25: available = nil
-26: fixtures = fixtures_param.split(/\s*,\s*/).collect do |f|
-27: fixture_set = File.dirname f
-28: fixture_set = '' if fixture_set == '.'
-29: fixture = File.basename f
-30: if fixture == 'all'
-31: available ||= available_fixtures
-32: available[fixture_set]
-33: else
-34: f
-35: end
-36: end
-37: fixtures.flatten!
-38: fixtures.reject! {|f| f.blank? }
-39:
-40: if fixtures.any?
-41: Fixtures.create_fixtures fixtures_path, fixtures
-42: end
-43: fixtures
+24: def load_fixtures fixtures_param
+25: available = nil
+26: fixtures = fixtures_param.split(/\s*,\s*/).collect do |f|
+27: fixture_set = File.dirname f
+28: fixture_set = '' if fixture_set == '.'
+29: fixture = File.basename f
+30: if fixture == 'all'
+31: available ||= available_fixtures
+32: available[fixture_set]
+33: else
+34: f
+35: end
+36: end
+37: fixtures.flatten!
+38: fixtures.reject! {|f| f.blank? }
+39:
+40: if fixtures.any?
+41: Fixtures.create_fixtures fixtures_path, fixtures
+42: end
+43: fixtures
44: end
# File lib/selenium_on_rails/partials_support.rb, line 19
-19: def extract_commands_from_partial partial
-20: partial = partial.match(/.*<table>.*?<tr>.*?<\/tr>(.*?)<\/table>/im)[1]
-21: raise "Partial '#{name}' doesn't contain any table" unless partial
-22: partial
+19: def extract_commands_from_partial partial
+20: partial = partial.match(/.*<table>.*?<tr>.*?<\/tr>(.*?)<\/table>/im)[1]
+21: raise "Partial '#{name}' doesn't contain any table" unless partial
+22: partial
23: end
# File lib/selenium_on_rails/partials_support.rb, line 9
- 9: def render_partial partial_path = default_template_name, object = nil, local_assigns = nil, status = nil
-10: pattern = partial_pattern partial_path
-11: filename = Dir[pattern].first
-12: raise "Partial '#{partial_path}' cannot be found! (Looking for file: '#{pattern}')" unless filename
-13: partial = render :file => filename, :use_full_path => false, :locals => local_assigns
-14: extract_commands_from_partial partial
+ 9: def render_partial partial_path = default_template_name, object = nil, local_assigns = nil, status = nil
+10: pattern = partial_pattern partial_path
+11: filename = Dir[pattern].first
+12: raise "Partial '#{partial_path}' cannot be found! (Looking for file: '#{pattern}')" unless filename
+13: partial = render :file => filename, :use_full_path => false, :locals => local_assigns
+14: extract_commands_from_partial partial
15: end
# File lib/selenium_on_rails/paths.rb, line 25
-25: def fixtures_path
-26: File.expand_path File.join(RAILS_ROOT, 'test/fixtures')
+25: def fixtures_path
+26: File.expand_path File.join(RAILS_ROOT, 'test/fixtures')
27: end
# File lib/selenium_on_rails/paths.rb, line 19
-19: def layout_path
-20: rails_root = Pathname.new File.expand_path(File.join(RAILS_ROOT, 'app/views'))
-21: view_path = Pathname.new view_path('layout')
-22: view_path.relative_path_from(rails_root).to_s
+19: def layout_path
+20: rails_root = Pathname.new File.expand_path(File.join(RAILS_ROOT, 'app/views'))
+21: view_path = Pathname.new view_path('layout')
+22: view_path.relative_path_from(rails_root).to_s
23: end
# File lib/selenium_on_rails/paths.rb, line 29
-29: def log_path log_file
-30: File.expand_path(File.dirname(__FILE__) + '/../../log/' + File.basename(log_file))
+29: def log_path log_file
+30: File.expand_path(File.dirname(__FILE__) + '/../../log/' + File.basename(log_file))
31: end
# File lib/selenium_on_rails/paths.rb, line 3
-3: def selenium_path
-4: @@selenium_path ||= find_selenium_path
-5: @@selenium_path
+3: def selenium_path
+4: @@selenium_path ||= find_selenium_path
+5: @@selenium_path
6: end
# File lib/selenium_on_rails/paths.rb, line 8
- 8: def selenium_tests_path
- 9: File.expand_path(File.join(RAILS_ROOT, 'test/selenium'))
+ 8: def selenium_tests_path
+ 9: File.expand_path(File.join(RAILS_ROOT, 'test/selenium'))
10: end
# File lib/selenium_on_rails/paths.rb, line 33
-33: def skip_file? file
-34: file.split('/').each do |f|
-35: return true if f.upcase == 'CVS' or f.starts_with?('.') or f.ends_with?('~') or f.starts_with?('_')
-36: end
-37: false
+33: def skip_file? file
+34: file.split('/').each do |f|
+35: return true if f.upcase == 'CVS' or f.starts_with?('.') or f.ends_with?('~') or f.starts_with?('_')
+36: end
+37: false
38: end
# File lib/selenium_on_rails/paths.rb, line 12
-12: def view_path view
-13: File.expand_path(File.dirname(__FILE__) + '/../views/' + view)
+12: def view_path view
+13: File.expand_path(File.dirname(__FILE__) + '/../views/' + view)
14: end
# File lib/selenium_on_rails/renderer.rb, line 5
- 5: def render_test_case filename
- 6: @template.extend SeleniumOnRails::PartialsSupport
- 7: @page_title = test_case_name filename
- 8: output = render_to_string :file => filename
- 9: layout = (output =~ /<html>/i ? false : layout_path)
-10: render :text => output, :layout => layout
-11:
-12: headers['Cache-control'] = 'no-cache'
-13: headers['Pragma'] = 'no-cache'
-14: headers['Expires'] = '-1'
+ 5: def render_test_case filename
+ 6: @template.extend SeleniumOnRails::PartialsSupport
+ 7: @page_title = test_case_name filename
+ 8: output = render_to_string :file => filename
+ 9: layout = (output =~ /<html>/i ? false : layout_path)
+10: render :text => output, :layout => layout
+11:
+12: headers['Cache-control'] = 'no-cache'
+13: headers['Pragma'] = 'no-cache'
+14: headers['Expires'] = '-1'
15: end
# File lib/selenium_on_rails/selenese.rb, line 7
-7: def initialize view
-8: @view = view
+7: def initialize view
+8: @view = view
9: end
# File lib/selenium_on_rails/selenese.rb, line 11
-11: def render template, local_assigns
-12: name = (@view.assigns['page_title'] or local_assigns['page_title'])
-13: lines = template.strip.split "\n"
-14: html = ''
-15: html << extract_comments(lines)
-16: html << extract_commands(lines, name)
-17: html << extract_comments(lines)
-18: raise 'You cannot have comments in the middle of commands!' if next_line lines, :any
-19: html
+11: def render template, local_assigns
+12: name = (@view.assigns['page_title'] or local_assigns['page_title'])
+13: lines = template.strip.split "\n"
+14: html = ''
+15: html << extract_comments(lines)
+16: html << extract_commands(lines, name)
+17: html << extract_comments(lines)
+18: raise 'You cannot have comments in the middle of commands!' if next_line lines, :any
+19: html
20: end
# File lib/selenium_on_rails/test_builder.rb, line 47
-47: def initialize view
-48: @view = view
-49: @output = ''
-50: @xml = Builder::XmlMarkup.new :indent => 2, :target => @output
+47: def initialize view
+48: @view = view
+49: @output = ''
+50: @xml = Builder::XmlMarkup.new :indent => 2, :target => @output
51: end
# File lib/selenium_on_rails/test_builder.rb, line 36
-36: def self.selenize str
-37: str.camelize.gsub(/^[A-Z]/) {|s| s.downcase }
+36: def self.selenize str
+37: str.camelize.gsub(/^[A-Z]/) {|s| s.downcase }
38: end
# File lib/selenium_on_rails/test_builder.rb, line 62
-62: def command cmd, target=nil, value=nil
-63: @xml.tr do
-64: _tdata cmd
-65: _tdata target
-66: _tdata value
-67: end
+62: def command cmd, target=nil, value=nil
+63: @xml.tr do
+64: _tdata cmd
+65: _tdata target
+66: _tdata value
+67: end
68: end
# File lib/selenium_on_rails/test_builder.rb, line 73
-73: def command_and_wait cmd, target=nil, value=nil
-74: command_verbatim cmd.to_s + 'AndWait', target, value
+73: def command_and_wait cmd, target=nil, value=nil
+74: command_verbatim cmd.to_s + 'AndWait', target, value
75: end
# File lib/selenium_on_rails/test_builder.rb, line 42
-42: def exactize pattern
-43: pattern.include?(':') ? "exact:#{pattern}" : pattern
+42: def exactize pattern
+43: pattern.include?(':') ? "exact:#{pattern}" : pattern
44: end
# File lib/selenium_on_rails/test_builder.rb, line 79
-79: def make_command_waiting
-80: self.class.send :alias_method, :command, :command_and_wait
-81: yield
-82: self.class.send :alias_method, :command, :command_verbatim
+79: def make_command_waiting
+80: self.class.send :alias_method, :command, :command_and_wait
+81: yield
+82: self.class.send :alias_method, :command, :command_verbatim
83: end
# File lib/selenium_on_rails/test_builder.rb, line 54
-54: def table title
-55: @xml.table do
-56: @xml.tr do @xml.th(title, :colspan => 3) end
-57: yield self
-58: end
+54: def table title
+55: @xml.table do
+56: @xml.tr do @xml.th(title, :colspan => 3) end
+57: yield self
+58: end
59: end
# File lib/selenium_on_rails/test_builder.rb, line 95
- 95: def collection_arg arg
- 96: if arg.is_a? Array
- 97: arg.collect {|e| e.gsub(/[\\,]/) {|s| "\\#{s}" } }.join(',')
- 98: else
- 99: arg
-100: end
+ 95: def collection_arg arg
+ 96: if arg.is_a? Array
+ 97: arg.collect {|e| e.gsub(/[\\,]/) {|s| "\\#{s}" } }.join(',')
+ 98: else
+ 99: arg
+100: end
101: end
# File lib/selenium_on_rails/test_builder.rb, line 89
-89: def url_arg url
-90: if url.instance_of?(String) then url else exactize(@view.url_for(url)) end
+89: def url_arg url
+90: if url.instance_of?(String) then url else exactize(@view.url_for(url)) end
91: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 246
-246: def store_absolute_location variable_name
-247: command 'storeAbsoluteLocation', variable_name
+246: def store_absolute_location variable_name
+247: command 'storeAbsoluteLocation', variable_name
248: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 183
-183: def store_alert variable_name
-184: command 'storeAlert', variable_name
+183: def store_alert variable_name
+184: command 'storeAlert', variable_name
185: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 89
-89: def store_alert_present variable_name
-90: command 'storeAlertPresent', variable_name
+89: def store_alert_present variable_name
+90: command 'storeAlertPresent', variable_name
91: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 754
-754: def store_all_buttons variable_name
-755: command 'storeAllButtons', variable_name
+754: def store_all_buttons variable_name
+755: command 'storeAllButtons', variable_name
756: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 794
-794: def store_all_fields variable_name
-795: command 'storeAllFields', variable_name
+794: def store_all_fields variable_name
+795: command 'storeAllFields', variable_name
796: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 774
-774: def store_all_links variable_name
-775: command 'storeAllLinks', variable_name
+774: def store_all_links variable_name
+775: command 'storeAllLinks', variable_name
776: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 50
-50: def store_all_window_ids variable_name
-51: command 'storeAllWindowIds', variable_name
+50: def store_all_window_ids variable_name
+51: command 'storeAllWindowIds', variable_name
52: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 63
-63: def store_all_window_names variable_name
-64: command 'storeAllWindowNames', variable_name
+63: def store_all_window_names variable_name
+64: command 'storeAllWindowNames', variable_name
65: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 76
-76: def store_all_window_titles variable_name
-77: command 'storeAllWindowTitles', variable_name
+76: def store_all_window_titles variable_name
+77: command 'storeAllWindowTitles', variable_name
78: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 577
-577: def store_attribute locator, attribute_name, variable_name
-578: command 'storeAttribute', "#{locator}@#{attribute_name}", variable_name
+577: def store_attribute locator, attribute_name, variable_name
+578: command 'storeAttribute', "#{locator}@#{attribute_name}", variable_name
579: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 102
-102: def store_attribute_from_all_windows attribute_name, variable_name
-103: command 'storeAttributeFromAllWindows', attribute_name, variable_name
+102: def store_attribute_from_all_windows attribute_name, variable_name
+103: command 'storeAttributeFromAllWindows', attribute_name, variable_name
104: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 300
-300: def store_body_text variable_name
-301: command 'storeBodyText', variable_name
+300: def store_body_text variable_name
+301: command 'storeBodyText', variable_name
302: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 370
-370: def store_checked locator, variable_name
-371: command 'storeChecked', locator, variable_name
+370: def store_checked locator, variable_name
+371: command 'storeChecked', locator, variable_name
372: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 209
-209: def store_confirmation variable_name
-210: command 'storeConfirmation', variable_name
+209: def store_confirmation variable_name
+210: command 'storeConfirmation', variable_name
211: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 128
-128: def store_confirmation_present variable_name
-129: command 'storeConfirmationPresent', variable_name
+128: def store_confirmation_present variable_name
+129: command 'storeConfirmationPresent', variable_name
130: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 141
-141: def store_cookie variable_name
-142: command 'storeCookie', variable_name
+141: def store_cookie variable_name
+142: command 'storeCookie', variable_name
143: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 158
-158: def store_cursor_position locator, variable_name
-159: command 'storeCursorPosition', locator, variable_name
+158: def store_cursor_position locator, variable_name
+159: command 'storeCursorPosition', locator, variable_name
160: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 734
-734: def store_editable locator, variable_name
-735: command 'storeEditable', locator, variable_name
+734: def store_editable locator, variable_name
+735: command 'storeEditable', locator, variable_name
736: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 650
-650: def store_element_height locator, variable_name
-651: command 'storeElementHeight', locator, variable_name
+650: def store_element_height locator, variable_name
+651: command 'storeElementHeight', locator, variable_name
652: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 664
-664: def store_element_index locator, variable_name
-665: command 'storeElementIndex', locator, variable_name
+664: def store_element_index locator, variable_name
+665: command 'storeElementIndex', locator, variable_name
666: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 692
-692: def store_element_position_left locator, variable_name
-693: command 'storeElementPositionLeft', locator, variable_name
+692: def store_element_position_left locator, variable_name
+693: command 'storeElementPositionLeft', locator, variable_name
694: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 706
-706: def store_element_position_top locator, variable_name
-707: command 'storeElementPositionTop', locator, variable_name
+706: def store_element_position_top locator, variable_name
+707: command 'storeElementPositionTop', locator, variable_name
708: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 620
-620: def store_element_present locator, variable_name
-621: command 'storeElementPresent', locator, variable_name
+620: def store_element_present locator, variable_name
+621: command 'storeElementPresent', locator, variable_name
622: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 678
-678: def store_element_width locator, variable_name
-679: command 'storeElementWidth', locator, variable_name
+678: def store_element_width locator, variable_name
+679: command 'storeElementWidth', locator, variable_name
680: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 20
-20: def store_error_on_next message
-21: raise 'Not supported in Selenium Core at the moment'
+20: def store_error_on_next message
+21: raise 'Not supported in Selenium Core at the moment'
22: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 356
-356: def store_eval script, variable_name
-357: command 'storeEval', script, variable_name
+356: def store_eval script, variable_name
+357: command 'storeEval', script, variable_name
358: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 822
-822: def store_expression expression, variable_name
-823: command 'storeExpression', expression, variable_name
+822: def store_expression expression, variable_name
+823: command 'storeExpression', expression, variable_name
824: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 37
-37: def store_failure_on_next message
-38: raise 'Not supported in Selenium Core at the moment'
+37: def store_failure_on_next message
+38: raise 'Not supported in Selenium Core at the moment'
39: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 807
-807: def store_html_source variable_name
-808: command 'storeHtmlSource', variable_name
+807: def store_html_source variable_name
+808: command 'storeHtmlSource', variable_name
809: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 260
-260: def store_location expected_location, variable_name
-261: command 'storeLocation', expected_location, variable_name
+260: def store_location expected_location, variable_name
+261: command 'storeLocation', expected_location, variable_name
262: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 719
-719: def store_log_messages variable_name
-720: command 'storeLogMessages', variable_name
+719: def store_log_messages variable_name
+720: command 'storeLogMessages', variable_name
721: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 274
-274: def store_mouse_speed variable_name
-275: command 'storeMouseSpeed', variable_name
+274: def store_mouse_speed variable_name
+275: command 'storeMouseSpeed', variable_name
276: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 593
-593: def store_ordered locator_1, locator_2, variable_name
-594: raise 'Not supported in Selenium Core at the moment'
+593: def store_ordered locator_1, locator_2, variable_name
+594: raise 'Not supported in Selenium Core at the moment'
595: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 233
-233: def store_prompt variable_name
-234: command 'storePrompt', variable_name
+233: def store_prompt variable_name
+234: command 'storePrompt', variable_name
235: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 115
-115: def store_prompt_present variable_name
-116: command 'storePromptPresent', variable_name
+115: def store_prompt_present variable_name
+116: command 'storePromptPresent', variable_name
117: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 564
-564: def store_select_options locator, variable_name
-565: command 'storeSelectOptions', locator, variable_name
+564: def store_select_options locator, variable_name
+565: command 'storeSelectOptions', locator, variable_name
566: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 403
-403: def store_selected locator, option_locator, variable_name
-404: raise 'Not supported in Selenium Core at the moment'
+403: def store_selected locator, option_locator, variable_name
+404: raise 'Not supported in Selenium Core at the moment'
405: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 416
-416: def store_selected_id select_locator, variable_name
-417: command 'storeSelectedId', select_locator, variable_name
+416: def store_selected_id select_locator, variable_name
+417: command 'storeSelectedId', select_locator, variable_name
418: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 430
-430: def store_selected_ids select_locator, variable_name
-431: command 'storeSelectedIds', select_locator, variable_name
+430: def store_selected_ids select_locator, variable_name
+431: command 'storeSelectedIds', select_locator, variable_name
432: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 444
-444: def store_selected_index select_locator, variable_name
-445: command 'storeSelectedIndex', select_locator, variable_name
+444: def store_selected_index select_locator, variable_name
+445: command 'storeSelectedIndex', select_locator, variable_name
446: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 458
-458: def store_selected_indexes select_locator, variable_name
-459: command 'storeSelectedIndexes', select_locator, variable_name
+458: def store_selected_indexes select_locator, variable_name
+459: command 'storeSelectedIndexes', select_locator, variable_name
460: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 472
-472: def store_selected_label select_locator, variable_name
-473: command 'storeSelectedLabel', select_locator, variable_name
+472: def store_selected_label select_locator, variable_name
+473: command 'storeSelectedLabel', select_locator, variable_name
474: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 486
-486: def store_selected_labels select_locator, variable_name
-487: command 'storeSelectedLabels', select_locator, variable_name
+486: def store_selected_labels select_locator, variable_name
+487: command 'storeSelectedLabels', select_locator, variable_name
488: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 546
-546: def store_selected_options locator, variable_name
-547: command 'storeSelectedOptions', locator, variable_name
+546: def store_selected_options locator, variable_name
+547: command 'storeSelectedOptions', locator, variable_name
548: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 500
-500: def store_selected_value select_locator, variable_name
-501: command 'storeSelectedValue', select_locator, variable_name
+500: def store_selected_value select_locator, variable_name
+501: command 'storeSelectedValue', select_locator, variable_name
502: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 514
-514: def store_selected_values select_locator, variable_name
-515: command 'storeSelectedValues', select_locator, variable_name
+514: def store_selected_values select_locator, variable_name
+515: command 'storeSelectedValues', select_locator, variable_name
516: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 527
-527: def store_something_selected select_locator, variable_name
-528: command 'storeSomethingSelected', select_locator, variable_name
+527: def store_something_selected select_locator, variable_name
+528: command 'storeSomethingSelected', select_locator, variable_name
529: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 383
-383: def store_table locator, row, column, variable_name
-384: command 'storeTable', "#{locator}.#{row}.#{column}", variable_name
+383: def store_table locator, row, column, variable_name
+384: command 'storeTable', "#{locator}.#{row}.#{column}", variable_name
385: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 331
-331: def store_text locator, variable_name
-332: command 'storeText', locator, variable_name
+331: def store_text locator, variable_name
+332: command 'storeText', locator, variable_name
333: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 607
-607: def store_text_present pattern, variable_name
-608: command 'storeTextPresent', pattern, variable_name
+607: def store_text_present pattern, variable_name
+608: command 'storeTextPresent', pattern, variable_name
609: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 287
-287: def store_title variable_name
-288: command 'storeTitle', variable_name
+287: def store_title variable_name
+288: command 'storeTitle', variable_name
289: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 315
-315: def store_value locator, variable_name
-316: command 'storeValue', locator, variable_name
+315: def store_value locator, variable_name
+316: command 'storeValue', locator, variable_name
317: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 636
-636: def store_visible locator, variable_name
-637: command 'storeVisible', locator, variable_name
+636: def store_visible locator, variable_name
+637: command 'storeVisible', locator, variable_name
638: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 846
-846: def store_whether_this_frame_match_frame_expression current_frame_string, target, variable_name
-847: raise 'Not supported in Selenium Core at the moment'
+846: def store_whether_this_frame_match_frame_expression current_frame_string, target, variable_name
+847: raise 'Not supported in Selenium Core at the moment'
848: end
# File lib/selenium_on_rails/test_builder_accessors.rb, line 869
-869: def store_whether_this_window_match_window_expression current_window_string, target, variable_name
-870: raise 'Not supported in Selenium Core at the moment'
+869: def store_whether_this_window_match_window_expression current_window_string, target, variable_name
+870: raise 'Not supported in Selenium Core at the moment'
871: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 148
-148: def add_selection locator, option_locator
-149: command 'addSelection', locator, option_locator
+148: def add_selection locator, option_locator
+149: command 'addSelection', locator, option_locator
150: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 221
-221: def alt_key_down
-222: command 'altKeyDown'
+221: def alt_key_down
+222: command 'altKeyDown'
223: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 226
-226: def alt_key_up
-227: command 'altKeyUp'
+226: def alt_key_up
+227: command 'altKeyUp'
228: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 199
-199: def answer_on_next_prompt answer
-200: command 'answerOnNextPrompt', answer
+199: def answer_on_next_prompt answer
+200: command 'answerOnNextPrompt', answer
201: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 236
-236: def brake
-237: command 'break'
+236: def brake
+237: command 'break'
238: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 108
-108: def check locator
-109: command 'check', locator
+108: def check locator
+109: command 'check', locator
110: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 193
-193: def choose_cancel_on_next_confirmation
-194: command 'chooseCancelOnNextConfirmation'
+193: def choose_cancel_on_next_confirmation
+194: command 'chooseCancelOnNextConfirmation'
195: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 47
-47: def click locator
-48: command 'click', locator
+47: def click locator
+48: command 'click', locator
49: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 53
-53: def click_at locator, coord_string
-54: command 'clickAt', locator, coord_string
+53: def click_at locator, coord_string
+54: command 'clickAt', locator, coord_string
55: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 215
-215: def close
-216: command 'close'
+215: def close
+216: command 'close'
217: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 242
-242: def control_key_down
-243: command 'controlKeyDown'
+242: def control_key_down
+243: command 'controlKeyDown'
244: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 247
-247: def control_key_up
-248: command 'controlKeyUp'
+247: def control_key_up
+248: command 'controlKeyUp'
249: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 260
-260: def create_cookie name_value_pair, options_string
-261: command 'createCookie', name_value_pair, options_string
+260: def create_cookie name_value_pair, options_string
+261: command 'createCookie', name_value_pair, options_string
262: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 265
-265: def delete_cookie name, path
-266: command 'deleteCookie', name, path
+265: def delete_cookie name, path
+266: command 'deleteCookie', name, path
267: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 271
-271: def double_click locator
-272: command 'doubleClick', locator
+271: def double_click locator
+272: command 'doubleClick', locator
273: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 277
-277: def double_click_at locator, coord_string
-278: command 'doubleClickAt', locator, coord_string
+277: def double_click_at locator, coord_string
+278: command 'doubleClickAt', locator, coord_string
279: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 282
-282: def drag_and_drop locator, movements_string
-283: command 'dragAndDrop', locator, movements_string
+282: def drag_and_drop locator, movements_string
+283: command 'dragAndDrop', locator, movements_string
284: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 287
-287: def drag_and_drop_to_object locator_of_object_to_be_dragged, locator_of_drag_destination_object
-288: command 'dragAndDropToObject', locator_of_object_to_be_dragged, locator_of_drag_destination_object
+287: def drag_and_drop_to_object locator_of_object_to_be_dragged, locator_of_drag_destination_object
+288: command 'dragAndDropToObject', locator_of_object_to_be_dragged, locator_of_drag_destination_object
289: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 294
-294: def echo message
-295: command 'echo', message
+294: def echo message
+295: command 'echo', message
296: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 59
-59: def fire_event locator, event_name
-60: command 'fireEvent', locator, event_name
+59: def fire_event locator, event_name
+60: command 'fireEvent', locator, event_name
61: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 204
-204: def go_back
-205: command 'goBack'
+204: def go_back
+205: command 'goBack'
206: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 300
-300: def highlight locator
-301: command 'highlight', locator
+300: def highlight locator
+301: command 'highlight', locator
302: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 39
-39: def include_partial path, local_assigns = {}
-40: partial = @view.render :partial => path, :locals => local_assigns
-41: @output << partial
+39: def include_partial path, local_assigns = {}
+40: partial = @view.render :partial => path, :locals => local_assigns
+41: @output << partial
42: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 75
-75: def key_down locator, keycode
-76: command 'keyDown', locator, keycode
+75: def key_down locator, keycode
+76: command 'keyDown', locator, keycode
77: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 67
-67: def key_press locator, keycode
-68: command 'keyPress', locator, keycode
+67: def key_press locator, keycode
+68: command 'keyPress', locator, keycode
69: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 83
-83: def key_up locator, keycode
-84: command 'keyUp', locator, keycode
+83: def key_up locator, keycode
+84: command 'keyUp', locator, keycode
85: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 306
-306: def meta_key_down
-307: command 'metaKeyDown'
+306: def meta_key_down
+307: command 'metaKeyDown'
308: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 311
-311: def meta_key_up
-312: command 'metaKeyUp'
+311: def meta_key_up
+312: command 'metaKeyUp'
313: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 94
-94: def mouse_down locator
-95: command 'mouseDown', locator
+94: def mouse_down locator
+95: command 'mouseDown', locator
96: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 317
-317: def mouse_down_at locator, coord_string
-318: command 'mouseDownAt', locator, coord_string
+317: def mouse_down_at locator, coord_string
+318: command 'mouseDownAt', locator, coord_string
319: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 322
-322: def mouse_move locator
-323: command 'mouseMove', locator
+322: def mouse_move locator
+323: command 'mouseMove', locator
324: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 327
-327: def mouse_move_at locator, coord_string
-328: command 'mouseMoveAt', locator, coord_string
+327: def mouse_move_at locator, coord_string
+328: command 'mouseMoveAt', locator, coord_string
329: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 332
-332: def mouse_out locator
-333: command 'mouseOut', locator
+332: def mouse_out locator
+333: command 'mouseOut', locator
334: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 88
-88: def mouse_over locator
-89: command 'mouseOver', locator
+88: def mouse_over locator
+89: command 'mouseOver', locator
90: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 337
-337: def mouse_up locator
-338: command 'mouseUp', locator
+337: def mouse_up locator
+338: command 'mouseUp', locator
339: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 343
-343: def mouse_up_at locator, coord_string
-344: command 'mouseUpAt', locator, coord_string
+343: def mouse_up_at locator, coord_string
+344: command 'mouseUpAt', locator, coord_string
345: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 172
-172: def open url
-173: command 'open', url_arg(url)
+172: def open url
+173: command 'open', url_arg(url)
174: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 355
-355: def open_window url, window_id
-356: command 'openWindow', url, window_id
+355: def open_window url, window_id
+356: command 'openWindow', url, window_id
357: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 360
-360: def pause wait_time
-361: command 'pause', wait_time
+360: def pause wait_time
+361: command 'pause', wait_time
362: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 209
-209: def refresh
-210: command 'refresh'
+209: def refresh
+210: command 'refresh'
211: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 365
-365: def remove_all_selections locator
-366: command 'removeAllSelections', locator
+365: def remove_all_selections locator
+366: command 'removeAllSelections', locator
367: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 156
-156: def remove_selection locator, option_locator
-157: command 'removeSelection', locator, option_locator
+156: def remove_selection locator, option_locator
+157: command 'removeSelection', locator, option_locator
158: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 140
-140: def select locator, option_locator
-141: command 'select', locator, option_locator
+140: def select locator, option_locator
+141: command 'select', locator, option_locator
142: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 375
-375: def select_frame locator
-376: command 'selectFrame', locator
+375: def select_frame locator
+376: command 'selectFrame', locator
377: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 178
-178: def select_window window_id
-179: command 'selectWindow', window_id||'null'
+178: def select_window window_id
+179: command 'selectWindow', window_id||'null'
180: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 448
-448: def set_context context, log_level_threshold = nil
-449: if log_level_threshold
-450: command 'setContext', context, log_level_threshold.to_s
-451: else
-452: command 'setContext', context
-453: end
+448: def set_context context, log_level_threshold = nil
+449: if log_level_threshold
+450: command 'setContext', context, log_level_threshold.to_s
+451: else
+452: command 'setContext', context
+453: end
454: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 381
-381: def set_cursor_position locator, position
-382: command 'setCursorPosition', locator, position
+381: def set_cursor_position locator, position
+382: command 'setCursorPosition', locator, position
383: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 393
-393: def set_mouse_speed pixels
-394: command 'setMouseSpeed', pixels
+393: def set_mouse_speed pixels
+394: command 'setMouseSpeed', pixels
395: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 480
-480: def set_timeout timeout
-481: command 'setTimeout', timeout
+480: def set_timeout timeout
+481: command 'setTimeout', timeout
482: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 14
-14: def setup options = {}
-15: options = {options => nil} unless options.is_a? Hash
-16:
-17: opts = {:controller => 'selenium', :action => 'setup'}
-18: opts[:keep_session] = true if options.has_key? :keep_session
-19:
-20: [:fixtures, :clear_tables].each do |key|
-21: if (f = options[key])
-22: f = [f] unless f.is_a? Array
-23: opts[key] = f.join ','
-24: end
-25: end
-26:
-27: open opts
+14: def setup options = {}
+15: options = {options => nil} unless options.is_a? Hash
+16:
+17: opts = {:controller => 'selenium', :action => 'setup'}
+18: opts[:keep_session] = true if options.has_key? :keep_session
+19:
+20: [:fixtures, :clear_tables].each do |key|
+21: if (f = options[key])
+22: f = [f] unless f.is_a? Array
+23: opts[key] = f.join ','
+24: end
+25: end
+26:
+27: open opts
28: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 399
-399: def shift_key_down
-400: command 'shiftKeyDown'
+399: def shift_key_down
+400: command 'shiftKeyDown'
401: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 404
-404: def shift_key_up
-405: command 'shiftKeyUp'
+404: def shift_key_up
+405: command 'shiftKeyUp'
406: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 409
-409: def store expression, variable_name
-410: command 'store', expression, variable_name
+409: def store expression, variable_name
+410: command 'store', expression, variable_name
411: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 162
-162: def submit locator
-163: command 'submit', locator
+162: def submit locator
+163: command 'submit', locator
164: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 103
-103: def type locator, value
-104: command 'type', locator, value
+103: def type locator, value
+104: command 'type', locator, value
105: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 428
-428: def type_keys locator, value
-429: command 'typeKeys', locator, value
+428: def type_keys locator, value
+429: command 'typeKeys', locator, value
430: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 113
-113: def uncheck locator
-114: command 'uncheck', locator
+113: def uncheck locator
+114: command 'uncheck', locator
115: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 467
-467: def wait_for_condition script, timeout
-468: command 'waitForCondition', script, timeout
+467: def wait_for_condition script, timeout
+468: command 'waitForCondition', script, timeout
469: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 497
-497: def wait_for_page_to_load timeout
-498: command 'waitForPageToLoad', timeout
+497: def wait_for_page_to_load timeout
+498: command 'waitForPageToLoad', timeout
499: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 185
-185: def wait_for_popup window_id, timeout
-186: command 'waitForPopUp', window_id||'null', timeout
+185: def wait_for_popup window_id, timeout
+186: command 'waitForPopUp', window_id||'null', timeout
187: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 433
-433: def window_focus window_name
-434: command 'windowFocus', window_name
+433: def window_focus window_name
+434: command 'windowFocus', window_name
435: end
# File lib/selenium_on_rails/test_builder_actions.rb, line 438
-438: def window_maximize window_name
-439: command 'windowMaximize', window_name
+438: def window_maximize window_name
+439: command 'windowMaximize', window_name
440: end
# File lib/selenium_on_rails_config.rb, line 5
- 5: def self.get var, default = nil
- 6: value = configs[var.to_s]
- 7: value ||= @@defaults[var]
- 8: value ||= default
- 9: value ||= yield if block_given?
-10: value
+ 5: def self.get var, default = nil
+ 6: value = configs[var.to_s]
+ 7: value ||= @@defaults[var]
+ 8: value ||= default
+ 9: value ||= yield if block_given?
+10: value
11: end
-Selenium on Rails provides an easy way to test Rails application with SeleniumCore. -
--This plugin does four things: -
-Welcome to the Selenium on Rails README. Exciting isn’t it?
- -Selenium on Rails provides an easy way to test Rails application with + SeleniumCore[http://www.openqa.org/selenium-core/].
-This plugin does four things:
-Rails periodically changes the way that it renders pages, which unfortunately breaks backwards versions of Selenium on Rails. Therefore there are different + installation locations depending on your version of Rails:
-Rails 2.2 and up:
-http://svn.openqa.org/svn/selenium-on-rails/stable/selenium-on-rails
+
-Rails 2.1:
-http://svn.openqa.org/svn/selenium-on-rails/tags/rails_2_1/selenium-on-rails
+
--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 -script/generate selenium or by creating them manually in your -/test/selenium directory. -
--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 which has support for -Selenese. -
--SeleniumIDE makes it super easy to record test and edit them. -
--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. -
--You can write your tests in HTML/RHTML but that‘s mostly useful if -you have existing tests you want to reuse. -
--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} %>
-
--There are a number of settings available. You make them by renaming -config.yml.example to config.yml and make your changes in -that file. -
--Per default this plugin is only available in test environment. You can -change this by setting environments, such as: -
-- #config.yml - environments: - - test - - development --
-If you don‘t want to use the bundled Selenium Core version you can -set selenium_path to the directory where Selenium Core is stored. -
-- #config.yml - selenium_path: 'c:\selenium' --
-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! -
--If you want to store the results from a test:acceptance you just -need to set in which directory they should be stored: -
-- #config.yml - result_dir: 'c:\result' --
-So when you run rake test:acceptance the tables with the results -will be stored as .html files in that directory. -
--This can be useful especially for continous integration. -
--Selenium has support for user_extension.js which is a way to -extend the functionality of Selenium Core. Selenium on Rails now provides -the means for you to extend it‘s functionality to match. -
--To get you started, we‘ve included the example files -lib/test_builder_user_accessors.rb.example and -lib/test_builder_user_actions.rb.example that replicate the sample -extensions in Selenium Core‘s user-extensions.js.sample -
--To get these examples running, simply remove the .example and .sample -extensions from the files and restart your server. -
--More work is needed on test:acceptance on Windows to be able to -start the server when needed. -
--Currently there is only support to load fixtures and to wipe the session in -/selenium/setup. Is there a need for more kinds of setups or -teardowns? -
--Creating an editor for the test cases is currently considered out of scope -for this plugin. SeleniumIDE does such a good -job and has support for -the Selenese format. -
-Before Rails 2.1:
-http://svn.openqa.org/svn/selenium-on-rails/tags/pre-rails-2-1/selenium-on-rails
+
--For more information, check out the website. -
+The latest release is always kept on GitHub at
-git clone git://github.com/paytonrules/selenium-on-rails.git
+
+ To install:
+ +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 script/generate selenium or by creating them manually in your /test/selenium directory.
+ +RSelenese lets you write your tests in Ruby. This is my favorite format.
+ +setup :fixtures => :all
+ open '/'
+ assert_title 'Home'
+ ('a'..'z').each {|c| open :controller => 'user', :action => 'create', :name => c }
+
+
+ See SeleniumOnRails::TestBuilder for available commands. IMPORTANT NOTE: RSelenese generates the HTML tables for Selenium behind the scenes when the page is loaded - ONCE. That means code like this:
+ +(1..10).each do |index|
+ do something
+ end
+
+
+ Will only be executed when the test is loaded, not when the test is run. This is a common error and leads to tests that work the first time and fail the second time.
+ +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 which has support for Selenese.
+ +You can write your tests in HTML/RHTML but that‘s mostly useful if you have existing tests you want to reuse.
+ +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. This is highly recommended, just as small functions would be recommended in structured programming.
+ +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 in a RSelenese test case:
+ +include_partial 'login', :name => 'Jane Doe', :password => 'Jane Doe'.reverse
+
+
+ in a Selenese test case:
+ +|includePartial|login|name=John Doe|password=eoD nhoJ|
+
+
+ and in a RHTML test case:
+ +<%= render :partial => 'login', :locals => {:name = 'Joe Schmo', :password => 'Joe Schmo'.reverse} %>
+
+
+ There are a number of settings available. You make them by renaming selenium.yml.example to selenium.yml and placing it in your rails app’s config + file. Make your changes in that file.
+ +Per default this plugin is only available in test environment. You can change this by setting environments, such as:
+ +#selenium.yml
+ environments:
+ - test
+ - development
+
+
+ If you don‘t want to use the bundled Selenium Core version you can set selenium_path to the directory where Selenium Core is stored.
+ +#config.yml
+ selenium_path: 'c:\selenium'
+
+
+ You can run all your Selenium tests as a Rake task. If you’re using a continuous builder this is a great way to integrate selenium into your build process. 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!
+ +If you want to store the results from a test:acceptance you just need to set in which directory they should be stored:
+ +#config.yml
+ result_dir: 'c:\result'
+
+
+ So when you run rake test:acceptance the tables with the results will be stored as .html files in that directory.
+ +Selenium has support for user_extension.js which is a way to extend the functionality of Selenium Core. Selenium on Rails now provides the means for you to extend it’s functionality to match.
+ +To get you started, we’ve included the example files lib/test_builder_user_accessors.rb.example and lib/test_builder_user_actions.rb.example that replicate the sample extensions in Selenium Core’s user-extensions.js.sample.
+ +To get these examples running, simply remove the .example and .sample extensions + from the files and restart your server.
+ +Standalone mode + More work is needed on test:acceptance< on Windows to be able to start the server when needed.
Documentation update
Contributing is simple. Fork this repo, make your changes, then issue a pull request. IMPORTANT I will not take forks that do not have associated unit tests. There must be tests, and they must pass, so I can bring the changes in.
+ +For more information, check out the website.
-It's often a good idea to start the test with opening /selenium/setup (see <%%= link_to 'here', :controller => 'selenium', :action => 'setup' %> for more info).
- -| <%%= @page_title %> | ||
|---|---|---|
| open | /selenium/setup | |
| open | <%%= page %> | |
| assertTitle | Home | |
More information about the commands is available here.
- -You can write comments above and below the commands, but you can only have one set of commands, i.e. one table, per test.
- -Point the browser to <%= testcase_link %> to see how this test is rendered, or to <%= suite_link %> to run the suite.
+It's often a good idea to start the test with opening /selenium/setup (see <%%= link_to 'here', :controller => 'selenium', :action => 'setup' %> for more info).
+ +| <%%= @page_title %> | ||
|---|---|---|
| open | /selenium/setup | |
| open | <%%= page %> | |
| assertTitle | Home | |
More information about the commands is available here.
+ +You can write comments above and below the commands, but you can only have one set of commands, i.e. one table, per test.
+ +Point the browser to <%= testcase_link %> to see how this test is rendered, or to <%= suite_link %> to run the suite.
diff --git a/vendor/plugins/selenium-on-rails/generators/selenium/templates/rselenese.rhtml b/vendor/plugins/selenium-on-rails/generators/selenium/templates/rselenese.rhtml index 72cbc9f3..419eb368 100644 --- a/vendor/plugins/selenium-on-rails/generators/selenium/templates/rselenese.rhtml +++ b/vendor/plugins/selenium-on-rails/generators/selenium/templates/rselenese.rhtml @@ -1,14 +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. +# 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. diff --git a/vendor/plugins/selenium-on-rails/generators/selenium/templates/selenese.rhtml b/vendor/plugins/selenium-on-rails/generators/selenium/templates/selenese.rhtml index 23c43458..f4ccb8a9 100644 --- a/vendor/plugins/selenium-on-rails/generators/selenium/templates/selenese.rhtml +++ b/vendor/plugins/selenium-on-rails/generators/selenium/templates/selenese.rhtml @@ -1,11 +1,11 @@ -It's often a good idea to start the test with opening /selenium/setup (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. +It's often a good idea to start the test with opening /selenium/setup (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. diff --git a/vendor/plugins/selenium-on-rails/init.rb b/vendor/plugins/selenium-on-rails/init.rb index 9d355a4a..185b5847 100644 --- a/vendor/plugins/selenium-on-rails/init.rb +++ b/vendor/plugins/selenium-on-rails/init.rb @@ -1,15 +1,15 @@ -require 'selenium_on_rails_config' -envs = SeleniumOnRailsConfig.new.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' - - SeleniumController.prepend_view_path File.expand_path(File.dirname(__FILE__) + '/lib/views') -else - #erase all traces - $LOAD_PATH.delete lib_path -end - +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' + + SeleniumController.prepend_view_path File.expand_path(File.dirname(__FILE__) + '/lib/views') +else + #erase all traces + $LOAD_PATH.delete lib_path +end + diff --git a/vendor/plugins/selenium-on-rails/lib/controllers/selenium_controller.rb b/vendor/plugins/selenium-on-rails/lib/controllers/selenium_controller.rb index 710c70f3..02e3df8b 100644 --- a/vendor/plugins/selenium-on-rails/lib/controllers/selenium_controller.rb +++ b/vendor/plugins/selenium-on-rails/lib/controllers/selenium_controller.rb @@ -1,122 +1,122 @@ -require 'webrick/httputils' - -class SeleniumController < ActionController::Base - include SeleniumOnRails::FixtureLoader - include SeleniumOnRails::Renderer - - def initialize - @config = SeleniumOnRailsConfig.new - end - - 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} - ['result', 'numTestFailures', 'numTestPasses', 'numCommandFailures', 'numCommandPasses', 'numCommandErrors', 'totalTime'].each do |item| - @result[item] = params[item] - 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 = @config.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 <