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
For test runtime in Capybara 2.2.4 version you can achieve this by doing
before do
handle = Capybara.page.driver.current_window_handle
Capybara.page.driver.resize_window_to(handle, height, width)
end
Or
before do
Capybara.page.current_window.resize_to(height, width)
end
If you get Capybara::NotSupportedByDriverError: Capybara::Driver::Base#current_window_handle YOU MUST CHANGE YOUR DRIVER FOR EXAMPLE USE JAVASCRIPT DRIVER!
before do
Capybara.page.current_window.resize_to(height, width)
end
scenario js: true do
# your test here
end