Change default Capybara browser window size

capybara, rspec, ruby, selenium

Solution

You could define that under `before(:all)`

describe "Test" do
  before(:all) do
    ...
    ...
    page.driver.browser.manage.window.resize_to(x,y) #Mention it here
  end

  it "should find everything" do
    ...
  end

  after(:all) do
   ...
  end
end

Problem

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) ``` per How to set Browser Window size in Rspec (Selenium) for specific RSpec tests, but is there a way to do this globally so that every test that is affected by media queries doesn't have to define this?

Original source