summaryrefslogtreecommitdiff
path: root/spec/support/capybara.rb
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2017-11-01 14:04:24 -0500
committerMike Greiling <mike@pixelcog.com>2017-11-01 14:04:24 -0500
commit3f3875dbf93b5e6b02d3f4320145f5a5bd8b42dc (patch)
tree6c19c560d8f6010c88459fa31beec8ff882c33db /spec/support/capybara.rb
parent2304550b4357167cbbd8c18697994f6bf4ba9ce9 (diff)
downloadgitlab-ce-3f3875dbf93b5e6b02d3f4320145f5a5bd8b42dc.tar.gz
make window resizing more resiliant on small screens when headless mode is off
Diffstat (limited to 'spec/support/capybara.rb')
-rw-r--r--spec/support/capybara.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb
index e196455206e..9f672bc92fc 100644
--- a/spec/support/capybara.rb
+++ b/spec/support/capybara.rb
@@ -41,13 +41,17 @@ RSpec.configure do |config|
end
config.before(:example, :js) do
+ session = Capybara.current_session
+
allow(Gitlab::Application.routes).to receive(:default_url_options).and_return(
- host: Capybara.current_session.server.host,
- port: Capybara.current_session.server.port,
+ host: session.server.host,
+ port: session.server.port,
protocol: 'http')
# reset window size between tests
- Capybara.current_session.current_window.resize_to(1240, 1400)
+ unless session.current_window.size == [1240, 1400]
+ session.current_window.resize_to(1240, 1400) rescue nil
+ end
end
config.after(:example, :js) do |example|