Я предпочитаю использовать сервер selenium, IDE selenium в Firefox для записи и клиент Selen для rspec.
selenium_helper.rb
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path(File.join(File.dirname(__FILE__),'../..','config','environment'))
require 'spec/autorun'
require 'spec/rails'
require 'factory_girl'
require 'rspec/instafail'
require "selenium/client"
Spec::Runner.configure do |config|
end
rspec_tester_file_spec.rb
require "selenium/selenium_helper"
require "selenium/modules/loginator"
describe "tester" do
attr_reader :selenium_driver
alias :page :selenium_driver
before(:all) do
@verification_errors = []
@selenium_driver = Selenium::Client::Driver.new \
:host => "localhost",
:port => 4444,
:browser => "*firefox",
:url => "http://localhost:3000",
:timeout_in_second => 60
end
before(:each) do
@selenium_driver.start_new_browser_session
end
append_after(:each) do
@selenium_driver.close_current_browser_session
end
it "login and then try to search for stuff" do
@login.run_login(page)
page.click "link=CSR"
page.wait_for_page_to_load "30000"
page.type "id=isq_Name", "john smith"
page.click "css=input[type=\"submit\"]"
page.wait_for_page_to_load "30000"
page.is_text_present("Update")
page.is_text_present("Date")
page.is_text_present("PIN")
page.is_text_present("Name")
end