خرید بک لینک

Vote count: 0

I have a rspec/capybara test which fails with the following error because Selenium does not support headers, however this test works fine with :rack_test driver. Since a lot of my other tests heavily rely on Selenium I caot change the driver to :rack_test.

How do I fix this? Is there a way to run this specific test with :rack_test driver while other tests still use the default :selenium driver?

error-report.xml

    <failure message="Capybara::Driver::Base#response_headers" type="Capybara::NotSupportedByDriverError">
      <![CDATA[Capybara::Driver::Base#response_headers
./spec/feature/transaction_search_spec.rb:35:in `block (2 levels) in <top (required)>']]>
    </failure>

rails_helper.rb

 Capybara.ignore_hidden_elements = false
 Capybara.configure do |c|
   c.default_driver = :selenium     # BREAKS :(  !!!!!
   c.app_host = "http://localhost:3000"
 end

transaction_search_spec.rb

require 'rails_helper'
require 'capybara/rspec'

RSpec.feature 'Transaction Search' do

  scenario ' - Download CSV scenario' do
    visit '/signin'
    fill_in 'Email', :with => 'user@payments.org'
    fill_in 'Password', :with => 'Password123'
    page.find('#login').click

    expect(page).to have_content('Stores:')

    # search page
    visit '/search'
    expect(page).to have_content('Search')
    click_button 'Search'

    sleep 5

    click_button 'Download CSV'
    expect(page.response_headers['Content-Type']).to eq('text/csv; charset=utf-8; header=present')
    # expect(page.response_headers['Content-Disposition']).to match('filename="transactions.csv"')
  end

end

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 24 ارديبهشت 1395 ساعت: 22:56

صفحه بندی