Hi,
This is what I did, not necessary being correct, also the comments may
be erroneous :
Patches for Windows XP + Firefox 3.5
1. Go to ruby/lib/ruby/gems/1.8/gems/webrat-0.4.4/vendor
2. Backup the selenium-server.jar
3. Rename selenium-server.jar to selenium-server.rar
4. Open selenium-server.rar
5. Go to customProfileDirCUSTFF/extensions/{538F0036-F358-4f84-
A764-89FB437166B4}, edit install.rdf and change to
<em:maxVersion>4.0.*</em:maxVersion>
6. Go to customProfileDirCUSTFF\extensions\
ready...@openqa.org, edit
install.rdf and change to <em:maxVersion>4.0.*</em:maxVersion>
7. Go to customProfileDirCUSTFFCHROME\extensions\{503A0CD4-
EDC8-489b-853B-19E0BAA8F0A4}, edit install.rdf and change to
<em:maxVersion>4.0.*</em:maxVersion>
8. Go to customProfileDirCUSTFFCHROME\extensions\{538F0036-F358-4f84-
A764-89FB437166B4}, edit install.rdf and change to
<em:maxVersion>4.0.*</em:maxVersion>
9. Go to customProfileDirCUSTFFCHROME\extensions
\
ready...@openqa.org, edit install.rdf and change to
<em:maxVersion>4.0.*</em:maxVersion>
10. Save selenium-server.rar and rename to selenium-server.jar
11. Edit ruby/lib/ruby/gems/1.8/gems/webrat-0.4.4/lib/webrat/selenium/
selenium_rc_server.rb and change to :
@remote_control = ::Selenium::RemoteControl::RemoteControl.new
("127.0.0.1", Webrat.configuration.selenium_server_port, :timeout =>
60) in def remote_control
:host => (Webrat.configuration.selenium_server_address ||
"127.0.0.1"),
in def wait_for_socket
::Selenium::RemoteControl::RemoteControl.new("127.0.0.1",
Webrat.configuration.selenium_server_port, :timeout =>
60).stop in def stop
In Windows 0.0.0.0 host is already used (and tested in Ununtu and also
had problems with 0.0.0.0) and timeout was increased in order to give
us time to tell Firefox to trust the site (on localhost the SSL
Certificate may not be a trusted one)
12. Edit ruby/lib/ruby/gems/1.8/gems/webrat-0.4.4/lib/webrat/selenium/
selenium_session.rb and add
def attach_file(field_locator, path, content_type = nil)
fill_in(field_locator, :with => path)
end
after webrat_deprecate :fills_in, :fill_in (or elsewhere)
Webrat 0.4.4 forgot to add this method to it's selenium
implementation.
Run the tests
First start the application in test environment
>ruby script/server -e test
Then run the tests in a separate command line
>cucumber features
cucumber/support/env.rb is :
# Sets up the Rails environment for Cucumber
ENV["RAILS_ENV"] ||= "cucumber"
require File.expand_path(File.dirname(__FILE__) + '/../../config/
environment')
require 'cucumber/rails/world'
require 'cucumber/formatter/unicode'
# Comment out the next line if you want Rails' own error handling
# (e.g. rescue_action_in_public / rescue_responses / rescue_from)
Cucumber::Rails.bypass_rescue
# When using webrat/selenium we can't use transactional fixtures
#Cucumber::Rails::World.use_transactional_fixtures
require 'webrat'
Webrat.configure do |config|
config.mode = :selenium
config.application_environment = :test # Selenium runs in it's own
ENV['Selenium'], ensure we keep the ENV['test']
config.application_framework = :rails # Inform cucumber we use
Rails Framework (could be Merb, etc)
config.application_port = 3000 # By default this should be
3001, but we want 3000
config.selenium_server_port = 4444 # By default this is 4444
config.selenium_browser_key = "*chrome D:/Program Files/Mozilla
Firefox 3/firefox.exe" # Because of cross site scripting issue with
file input we use the Chrome profile of Firefox which leverage the
security
end
require 'cucumber/rails/rspec'
require 'webrat/core/matchers'
require 'database_cleaner'
require 'database_cleaner/cucumber'
#require 'factory_girl'
#require File.join(Rails.root, 'spec/factories')
# Ensure that the steps of the feature have access to selenium
matchers
World(Webrat::Selenium::Matchers)
# selenium can't handle database transactions, we need to truncate the
test database after each run of a feature
DatabaseCleaner.strategy = :truncation, {:except => %w[plans
roles ...]}
That input file I could not solve. And I also tested on an Ubuntu
machine and it's worse, selenium is requesting not the Test
environment started application but the Staging environment (it's a
staging server). And I could not started Selenium and application with
the same cuumber features command (same as locally).