Lamp with cucumber

I am using Cucumber with Selenium, FixtureReplacement and DatabaseCleaner.

Oddly enough, my data that I created with FixtureReplacement is not available from my tests.

I added my own selenium rail framework and I am using my own profile for my advanced selenium features. My cucumber setting for selenium profile:

Webrat.configure do |config|
  config.mode = :selenium
  config.application_environment = :selenium
end

Cucumber::Rails::World.use_transactional_fixtures = false

require "database_cleaner"

# Clean the database once when starting
DatabaseCleaner.clean_with :truncation
DatabaseCleaner.strategy = :truncation

Before do
  DatabaseCleaner.start
  include FixtureReplacement
end

After do
  DatabaseCleaner.clean
end

# this is necessary to have webrat "wait_for" the response body to be available
# when writing steps that match against the response body returned by selenium
World(Webrat::Selenium::Matchers)

      

FixtureReplacement works well, I tested it in the Rails console.

I am running my selenium functions with

RAILS_ENV=selenium cucumber -p selenium features/enhanced/test.feature

      

Does anyone know a solution to this problem?

Regards

+2


source to share


2 answers


It had nothing to do with Fixtures. I thought I could not access my data because I could not login.



The following fixed: Cucumbers + selenium crashing randomly

+1


source


I wonder if you are using Database Cleaner correctly? In my env.rb, I use it like this:

Before do
  require 'database_cleaner'
  require 'database_cleaner/cucumber'
  DatabaseCleaner.strategy = :truncation
end

      



This works for me when using Factory Girl.

+1


source







All Articles