Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CI test failures caused by ChromeDriver (PT-185924955) #1209

Merged
merged 6 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ jobs:
TEST_SOLR_PORT: 8981
env:
RAILS_ENV: ${{ matrix.env }}
CHROMEDRIVER_VERSION: '114.0.5735.90'
defaults:
run:
working-directory: ./rails/
Expand All @@ -76,6 +77,16 @@ jobs:
with:
bundler-cache: true # use Actions cache to significantly speed up subsequent runs
working-directory: ./rails/
# Install ChromeDriver (wiping out whatever version was previously installed on Actions Runner)
- name: Install ChromeDriver
uses: nanasess/setup-chromedriver@v2
with:
chromedriver-version: ${{ env.CHROMEDRIVER_VERSION }}
# Install Google Chrome browser (that matches ChromeDriver version from previous Actions step)
- name: Install Google Chrome
run: |
wget -O /tmp/google_chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROMEDRIVER_VERSION}-1_amd64.deb
sudo dpkg -i /tmp/google_chrome.deb

- run: cp -v ./config/database.github_actions.yml ./config/database.yml
- run: cp -v ./config/app_environment_variables.sample.rb ./config/app_environment_variables.rb
Expand Down Expand Up @@ -146,7 +157,7 @@ jobs:
type=ref,event=pr
type=sha,prefix=git-
- name: Build & push Docker image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v4
with:
#context: '{{defaultContext}}:rails'
context: ./rails/
Expand Down
5 changes: 5 additions & 0 deletions rails/spec/support/capybara_initializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ def call
Capybara.server_port = '43447'
end

# ChromeDriver version shipped with GitHub Actions: https://github.com/actions/runner-images/blob/d5d4c565dffff750a33f0f7d020bc12a4a896d90/images/linux/Ubuntu2204-Readme.md?plain=1#L158
# Latest ChromeDriver version available for download: https://chromedriver.storage.googleapis.com/LATEST_RELEASE
# See: https://github.com/hitobito/hitobito/blob/c5a459a95feefc32f7caa4c3bd5b36c7cb149916/spec/spec_helper.rb#L190-L196
Webdrivers::Chromedriver.required_version = '114.0.5735.90' # Pin ChromeDriver version

# Register the driver
Capybara.register_driver(:selenium) { |app| driver(app) }
Capybara.javascript_driver = :selenium
Expand Down
4 changes: 3 additions & 1 deletion rails/spec/support/solr_spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'open-uri'

$original_sunspot_session = Sunspot.session
Sunspot.session = Sunspot::Rails::StubSessionProxy.new($original_sunspot_session)

Expand All @@ -20,7 +22,7 @@ def reindex_all
end

def test_solr_server
open("http://#{SOLR_HOST}:#{SOLR_PORT}/")
URI.open("http://#{SOLR_HOST}:#{SOLR_PORT}/")
end

def solr_setup
Expand Down