Selenium Testing plugin

Plugin details

This plugin extends the rails testing framework to allow you to write Selenium tests in the same way as unit and functional tests.

Repositoryhttp://svn.viney.net.nz/things/rails/plugins/selenium_testing Author Jonathan Viney Tags Test LicenseMIT

Documentation

Install the plugin:
ruby script/plugin install http://svn.viney.net.nz/things/rails/plugins/selenium_testing

Tests are written in the same way as unit and functional tests. The method calls in the test (click, type, assert_visible etc... ) correspond to Selenium commands/assertions. See the Selenium documentation for a full listing of available commands/assertions. You can NOT use Test::Unit assertions (assert, assert_equal etc...), you must use Selenium assertions.

  class PersonSeleniumTest < Test::Unit::TestCase
    fixtures :people, :households
    
    def setup
      open :controller => 'person', :action => 'view', :id => 1
    end
    
    def test_add_new_person
      click           'add_new_person_link'
      assert_visible  'add_new_person'
      type            'new_person_first_name', 'Pixel'
      type            'new_person_last_name', 'the Cat'
      select          'new_person_gender', 'Male'
      click_and_wait  'submit_add_new_person'
      assert_text     'person_name', 'Pixel the Cat'
    end
    
    def test_household
      people(:jonathan).householders.each do |householder|
        assert_visible "householder_#{householder.id}"
      end
    end
  end

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | (0 older versions) | Last edited by: hardway, 9 months ago