Created
December 14, 2010 14:29
-
-
Save kernow/740495 to your computer and use it in GitHub Desktop.
problem running selenium with capybara/cucumber
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# features/ask_a_question.feature | |
Feature: Asking a question | |
@javascript @wip | |
Scenario Outline: Using the question preview | |
Given that I am a user | |
When I go to the homepage | |
And I fill in "question_title" with "<Question Title>" | |
And I fill in "question_body" with "<Input Body>" | |
When I follow "preview" | |
Then I should see "<Output Body>" | |
Examples: | |
| Question Title | Input Body | Output Body | | |
| Hello | This is cool | This is cool | | |
# config/cucumber.yml | |
<% | |
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : "" | |
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}" | |
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip" | |
%> | |
default: <%= std_opts %> features | |
wip: --tags @wip:3 --wip features | |
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip | |
# config/environments/cucumber.rb | |
config.cache_classes = true | |
config.whiny_nils = true | |
config.action_controller.consider_all_requests_local = true | |
config.action_controller.perform_caching = false | |
config.action_controller.allow_forgery_protection = false | |
config.action_mailer.delivery_method = :test | |
# feature/support/env.rb | |
ENV["RAILS_ENV"] ||= "cucumber" | |
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment') | |
require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support | |
require 'cucumber/rails/rspec' | |
require 'cucumber/rails/world' | |
require 'cucumber/rails/active_record' | |
require 'cucumber/web/tableish' | |
require 'capybara/rails' | |
require 'capybara/cucumber' | |
require 'capybara/session' | |
require 'cucumber/rails/capybara_javascript_emulation' | |
Capybara.default_selector = :css | |
Capybara.javascript_driver = :selenium | |
ActionController::Base.allow_rescue = false | |
Cucumber::Rails::World.use_transactional_fixtures = true | |
Fixtures.reset_cache | |
fixtures_folder = File.join(RAILS_ROOT, "test", "fixtures") | |
fixtures = Dir[File.join(fixtures_folder, '*.yml')].map {|f| File.basename(f, '.yml') } | |
Fixtures.create_fixtures(fixtures_folder, fixtures) | |
if defined?(ActiveRecord::Base) | |
begin | |
require 'database_cleaner' | |
DatabaseCleaner.strategy = :truncation | |
rescue LoadError => ignore_if_database_cleaner_not_present | |
end | |
end | |
require 'shoulda' | |
require 'shoulda/action_mailer/assertions' | |
World(Shoulda::ActionMailer::Assertions) | |
# output | |
bundle exec /Users/JamieD/.rvm/rubies/ruby-1.8.7-p302/bin/ruby -I "/Users/JamieD/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/lib:lib" "/Users/JamieD/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/cucumber" --profile wip | |
Using the wip profile... | |
config.gem: Unpacked gem i18n-0.2.2 in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this. | |
/Users/JamieD/.rvm/gems/ruby-1.8.7-p302/gems/chronic_duration-0.9.2/lib/numerizer.rb:27: warning: already initialized constant DIRECT_NUMS | |
/Users/JamieD/.rvm/gems/ruby-1.8.7-p302/gems/chronic_duration-0.9.2/lib/numerizer.rb:38: warning: already initialized constant TEN_PREFIXES | |
/Users/JamieD/.rvm/gems/ruby-1.8.7-p302/gems/chronic_duration-0.9.2/lib/numerizer.rb:45: warning: already initialized constant BIG_PREFIXES | |
* Starting Solr in cucumber on 8984 | |
* Waiting for port 8984 to open | |
* Waiting for port 8984 to open | |
* Solr started | |
Mocha deprecation warning: Mocha::Standalone has been renamed to Mocha::API | |
Feature: Asking a question | |
In order to ask my question whenever I feel like it | |
As a user or a guest | |
I want to be able to ask my question from a variety of locations | |
Background: # features/ask_a_question.feature:6 | |
Given a subject: "Common Room" exists with name: "Common Room", realtime: false # features/step_definitions/pickle_steps.rb:4 | |
Given a subject: "Online Tutoring" exists with name: "Online Tutoring", realtime: true # features/step_definitions/pickle_steps.rb:4 | |
And a subject exists with parent: subject "Common Room", name: "Maths" # features/step_definitions/pickle_steps.rb:4 | |
And a subject exists with parent: subject "Online Tutoring", name: "Realtime Maths" # features/step_definitions/pickle_steps.rb:4 | |
And a subject exists with parent: subject "Online Tutoring", name: "Realtime English" # features/step_definitions/pickle_steps.rb:4 | |
# Then I should see "Congratulations - your question was successfully created" | |
@javascript @wip | |
Scenario Outline: Using the question preview # features/ask_a_question.feature:159 | |
Given that I am a user # features/step_definitions/authentication_steps.rb:1 | |
When I go to the homepage # features/step_definitions/web_steps.rb:23 | |
And I fill in "question_title" with "<Question Title>" # features/step_definitions/web_steps.rb:39 | |
And I fill in "question_body" with "<Input Body>" # features/step_definitions/web_steps.rb:39 | |
When I follow "preview" # features/step_definitions/web_steps.rb:33 | |
Then I should see "<Output Body>" # features/step_definitions/web_steps.rb:107 | |
Examples: | |
| Question Title | Input Body | Output Body | | |
| Hello | This is cool | This is cool | | |
Capybara::TimeoutError (Capybara::TimeoutError) | |
./features/step_definitions/web_steps.rb:24:in `/^(?:|I )go to (.+)$/' | |
features/ask_a_question.feature:160:in `Given that I am a user' | |
Failing Scenarios: | |
cucumber -p wip features/ask_a_question.feature:159 # Scenario: Using the question preview | |
1 scenario (1 failed) | |
11 steps (1 failed, 5 skipped, 5 passed) | |
0m11.042s | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment