I have feature like this:
Feature: Searching chats
In order to find chats
As an user
I want to find different chats by username or ad name
Background:
Given System prepares for chats
And There is a few machines with names:
| machine_1 |
| machine_2 |
| machine_3 |
And There is a few services with names:
| service_1 |
| service_2 |
| service_3 |
And I have chats with ads owners
Scenario: Searching chats
When I am logged in as a "user"
And I go to chats page # <- stops here
Then I should see search results when I fill form with:
| input | results |
| ma | machine_1, machine_2, machine_3 |
| se | service_1, service_2, service_3 |
When I start cucumber feature (or scenario), it suddenly stops at step "And I go to chats page" without any error message. Result looks like:
[alex@MacBookPro ~/my_project | master]$ cucumber features/chat/search.feature
Using the default profile...
@javascript
Feature: Searching chats
In order to find chats
As an user
I want to find different chats by username or ad name
Background: # features/chat/search.feature:8
Given System prepares for chats # features/step_definitions/chats.steps.rb:11
And There is a few machines with names: # features/step_definitions/machine.steps.rb:10
| machine_1 |
| machine_2 |
| machine_3 |
And There is a few services with names: # features/step_definitions/service.steps.rb:144
| service_1 |
| service_2 |
| service_3 |
And I have chats with ads owners # features/step_definitions/chats.steps.rb:5
Scenario: Searching chats # features/chat/search.feature:20
When I am logged in as a "user" # features/step_definitions/user.steps.rb:68
And I go to chats page # features/step_definitions/chats.steps.rb:17
[alex@MacBookPro~/my_project | master]$
That's my "falling" steps:
When /^I go to chats page$/ do
visit root_path
within('.global-menu') do
click_on username(@current_user)
click_on I18n.t('views.menu.profile.links.dashboard')
end
click_on I18n.t('views.menu.profile.links.chats')
end
Then(/^I should see search results when I fill form with:$/) do |table|
table.hashes.each do |search_data|
### searching ###
@page.query.set search_data['input']
# for AJAX search
sleep 1
### show results ###
search_data['results'].split(', ').each do |res|
page.should have_content res.mb_chars.upcase
end
within('#chats') do
page.all('.chat').length.should == search_data['results'].split(', ').size
end
end
end
I'm using capybara-webkit with cucumber. That's my env.rb:
require 'rubygems'
require 'spork'
require 'capybara'
require 'capybara/rspec'
require 'selenium-webdriver'
require 'site_prism'
require 'capybara-screenshot/cucumber'
# require 'cucumber/rails'
# 1) Tag your scenario (or feature) with @allow-rescue
#
# 2) Set the value below to true. Beware that doing this globally is not
# recommended as it will mask a lot of errors for you!
#
# ActionController::Base.allow_rescue = false
#############################################################################
ENV['SKIP_RAILS_ADMIN_INITIALIZER'] = 'false' # This fixes weird errors with cucumber + rails_admin (http://makandracards.com/makandra/9597-rake-spec-+-rails_admin-weirdly-failing-specs).
#############################################################################
Before do
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.clean
FactoryGirl.create(:setting)
ContactType.generate_contact_types
ContactType.generate_ims
end
Spork.prefork do
require 'cucumber/rails'
require 'email_spec' # add this line if you use spork
require 'email_spec/cucumber'
Capybara.default_selector = :css
end
Spork.each_run do
ActionController::Base.allow_rescue = false
begin
DatabaseCleaner.strategy = :truncation
rescue NameError
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
end
Capybara.register_driver :webkit do |app|
Capybara::Webkit::Driver.new(app, :stderr => nil)
end
Capybara.javascript_driver = :webkit
Cucumber::Rails::Database.javascript_strategy = :truncation
end
Problem appeard when I have updaded my project to rails4. Any ideas?
And I go to chats page
– Paolapry
insertrequire 'pry'; binding.pry
– Paola