From d2dd36d20d9e3c0a78a8317db6f822b84900a917 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Tue, 14 Nov 2017 07:21:57 +0100 Subject: [PATCH] Use GCE trusty environment for travis(#6010) This might just fix the SessionNotCreatedError errors during rspec retries. * Resize capybara window more carefully * Enable debug logging * Reset level to info * Remember whether we resized the window * Use GCE trusty environment [ci skip] --- .travis.yml | 2 +- spec/support/capybara.rb | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5629152f76..864b55575b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,7 @@ language: ruby rvm: - 2.4.2 -sudo: false +sudo: required dist: trusty cache: diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb index 809e62caf3..e855fc92ab 100644 --- a/spec/support/capybara.rb +++ b/spec/support/capybara.rb @@ -7,9 +7,20 @@ RSpec.configure do |config| Capybara.default_max_wait_time = 4 Capybara.javascript_driver = :selenium - + @resized = false config.before(:each, js: true) do - Capybara.page.current_window.resize_to(1920, 1080) + begin + window = Capybara.current_session.current_window + unless window.size == [1920, 1080] + warn "Resizing Capybara current window to 1920x1080 (Size was #{window.size.inspect})" + window.resize_to(1920, 1080) + end + + @resized = true + rescue => e + warn "Failed to update page width: #{e}" + warn e.backtrace + end end end @@ -71,7 +82,7 @@ Capybara.register_driver :selenium do |app| end # If you need to trace the webdriver commands, un-comment this line - # Selenium::WebDriver.logger.level = :debug + # Selenium::WebDriver.logger.level = :info Capybara::Selenium::Driver.new( app,