From f961ce9b7a7467dd541f339ed21b0099958d7cac Mon Sep 17 00:00:00 2001 From: ut Date: Thu, 10 Feb 2022 12:07:09 +0100 Subject: [PATCH 1/3] Fix feature tests with webdrivers on (my) ubuntu #216 --- spec/helpers/places_helper_spec.rb | 2 ++ spec/spec_helper.rb | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/spec/helpers/places_helper_spec.rb b/spec/helpers/places_helper_spec.rb index 0b1c21d9..1ff083ba 100644 --- a/spec/helpers/places_helper_spec.rb +++ b/spec/helpers/places_helper_spec.rb @@ -17,7 +17,9 @@ describe 'image_link' do it 'it returns an polymorphic image link' do + p = create(:place) i = Image.new + i.place = p i.attach(io: File.open(Rails.root.join('spec', 'support', 'files', 'test.jpg')), filename: 'attachment.jpg', content_type: 'image/jpeg') expect(helper.image_link(i)).to eq("http://test.host#{polymorphic_path(i.file.variant(resize: '800x800').processed)}") end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index fe410157..1836d86c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -13,6 +13,19 @@ 'chromedriver.storage.googleapis.com' ]) + +# special setup to make feature tests run on ubuntu 20.4 LTS +if ENV['UBUNTU'] + puts 'Running Rspecs on Ubuntu' + # Webdrivers.logger.level = :debug + # On Ubuntu >= 20 Chrome is installed via snap, so provide the path here + ::Selenium::WebDriver::Chrome.path = '/snap/chromium/current/usr/lib/chromium-browser/chrome' + # For the moment, at my machine, Chromedriver v98 fails with Chromium v98 (sic!) + Webdrivers::Chromedriver.required_version = '97.0.4692.71' +else + puts 'Running Rspecs on Linux (If you use Ubuntu and encounter problems you might try to call this with "UBUNTU=true"' +end + Capybara.register_driver :chrome do |app| Capybara::Selenium::Driver.new(app, browser: :chrome) end @@ -30,7 +43,7 @@ capabilities: options end -Selenium::WebDriver.logger.ignore(:driver_path) +# Selenium::WebDriver.logger.ignore(:driver_path) # switch to :chrome for watching the tests in browser Capybara.default_driver = :headless_chrome From 885461c1c2ee1d999909f921d5dc8b57e095884d Mon Sep 17 00:00:00 2001 From: ut Date: Thu, 10 Feb 2022 12:15:46 +0100 Subject: [PATCH 2/3] Try to trigger feature branch commits for CI --- .github/workflows/rubyonrails-ci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rubyonrails-ci.yml b/.github/workflows/rubyonrails-ci.yml index 8d917b8c..2b12e306 100644 --- a/.github/workflows/rubyonrails-ci.yml +++ b/.github/workflows/rubyonrails-ci.yml @@ -8,9 +8,13 @@ env: name: Rails - Install dependencies, run linters & rspec on: push: - branches: [main] + branches: + - main + - feature* pull_request: - branches: [main] + branches: + - main + - feature* jobs: run-lint: name: Rubocop & Brakeman From 40c4d16747cfae0b37cb29c492b7ce6f13fa3ce7 Mon Sep 17 00:00:00 2001 From: ut Date: Thu, 10 Feb 2022 12:21:10 +0100 Subject: [PATCH 3/3] rubocop'ed --- spec/spec_helper.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 1836d86c..8e5bf2ba 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -13,7 +13,6 @@ 'chromedriver.storage.googleapis.com' ]) - # special setup to make feature tests run on ubuntu 20.4 LTS if ENV['UBUNTU'] puts 'Running Rspecs on Ubuntu'