Change default Capybara browser window size

前端 未结 5 2006
不思量自难忘°
不思量自难忘° 2021-01-01 09:44

So, with respect to integration testing using Capybara and RSpec, I know I can do this:

page.driver.browser.manage.window.resize_to(x,y)

pe

5条回答
  •  执念已碎
    2021-01-01 10:44

    @tirdadc if you're using Poltergeist, you can add something like this to your rails_helper.rb file:

    Capybara.register_driver :poltergeist do |app|
      options = {
        # js_errors: true,
        # cookies: true,
        window_size: [320, 568] # iphone 5
      }
      Capybara::Poltergeist::Driver.new(app, options)
    end
    

提交回复
热议问题