I'm testing my Ruby on Rails 3.2 App with RSpec, Capybara and Selenium (Used driver: webkit and poltergeist).
I will try testing the following code:
scenario 'ask a question', js: true do
visit group_path(@group, locale: 'en')
find('#question_subject').set 'A new question'
find('#question_content').set 'The content of the question'
find('#question_tag_tokens', visible: false).set @tag.id
find('#submit').click
expect(page).to have_content 'A new question'
end
But when I try to run the test I will receive the following error:
1) Interact with group ask a question
Failure/Error: find('#question_subject').set 'A new question'
Selenium::WebDriver::Error::JavascriptError:
waiting for evaluate.js load failed
# [remote server] file:///var/folders/gz/svmw_f_n73q9z25trgsp_tnm0000gn/T/webdriver-profile20130806-4190-1l8e4c4/extensions/[email protected]/components/driver_component.js:8360:in `r'
# [remote server] file:///var/folders/gz/svmw_f_n73q9z25trgsp_tnm0000gn/T/webdriver-profile20130806-4190-1l8e4c4/extensions/[email protected]/components/driver_component.js:392:in `fxdriver.Timer.prototype.runWhenTrue/g'
# [remote server] file:///var/folders/gz/svmw_f_n73q9z25trgsp_tnm0000gn/T/webdriver-profile20130806-4190-1l8e4c4/extensions/[email protected]/components/driver_component.js:386:in `fxdriver.Timer.prototype.setTimeout/<.notify'
# ./spec/features/groups_spec.rb:93:in `block (2 levels) in <top (required)>
In the spec_helper.rb file has additional lines for DatabaseCleaner:
config.use_transactional_fixtures = false
config.before(:suite) do
DatabaseCleaner.clean_with :truncation
end
config.before(:each) do
if example.metadata[:js]
DatabaseCleaner.strategy = :truncation
else
DatabaseCleaner.strategy = :transaction
end
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
I cannot solve this issue. I was trying different drivers for testing javascript: poltergeist and capybara-webkit. But I get the same error. Hope you can help me.