當我用鉻驅動程序運行測試 - 它通過。如何讓點擊網頁驅動器的JS點擊?
當我與騷靈運行它 - 它試圖使點擊與格式HTML,我有錯誤:
ActionController::UnknownFormat:
ActionController::UnknownFormat
controller.rb def features newspaper = Newspaper.find(params[:id]) respond_to do |format| format.js { render locals: { newspaper: newspaper } } end end
view.html.haml = link_to features_newspaper_path(newspaper), class: %w(qa-edit-features), format: 'js', remote: true
feature_spec.rb it 'enable newspaper hilsninger features', js: true do find('.qa-edit-features').click end
spec_helper.rb
require 'capybara/rspec' require 'capybara/poltergeist' Capybara.register_driver :chrome do |app| Capybara::Selenium::Driver.new(app, browser: :chrome) end if ENV['BROWSER'] == 'google-chrome' Capybara.javascript_driver = :chrome else Capybara.javascript_driver = :poltergeist end