Fix recommendify (#542)

* Switch to recomendify fork, replace poltergeist with selenium, add capybara config
This commit is contained in:
Philipp Bayer
2022-12-02 08:56:42 +08:00
committed by GitHub
parent cb3d21b000
commit 4740f8ea2b
5 changed files with 53 additions and 14 deletions

View File

@@ -35,7 +35,7 @@ gem 'json'
gem 'mediawiki-gateway', git: 'https://github.com/MusikAnimal/mediawiki-gateway'
gem 'paperclip'
gem 'friendly_id'
gem 'recommendify', git: 'https://github.com/paulasmuth/recommendify', ref: '34308c4'
gem 'recommendify', git: 'https://github.com/Kinoba/recommendify', ref: 'd8c252f'
# background jobs
gem 'sidekiq'
@@ -72,6 +72,7 @@ group :test do
gem 'vcr'
gem 'capybara'
gem 'poltergeist'
gem 'selenium-webdriver'
gem 'database_cleaner'
gem 'timecop'
end

View File

@@ -1,3 +1,11 @@
GIT
remote: https://github.com/Kinoba/recommendify
revision: d8c252fb0a2496904ba46b3206a0db66ef25166f
ref: d8c252f
specs:
recommendify (0.3.8)
redis (>= 2.2.2)
GIT
remote: https://github.com/MusikAnimal/mediawiki-gateway
revision: 26b225f7374cdc94ea97effb5042e893d956c987
@@ -5,14 +13,6 @@ GIT
mediawiki-gateway (1.2.7)
rest-client (~> 2.0)
GIT
remote: https://github.com/paulasmuth/recommendify
revision: 34308c41800a0ea9b02842c4cf84e8bcc5dd1f63
ref: 34308c4
specs:
recommendify (0.3.6)
redis (>= 2.2.2)
GIT
remote: https://github.com/ryanb/nested_form
revision: 1b0689dfb4d230ceabd278eba159fcb02f23c68a
@@ -94,6 +94,7 @@ GEM
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (>= 2.0, < 4.0)
childprocess (3.0.0)
chronic (0.10.2)
climate_control (0.2.0)
cliver (0.3.2)
@@ -225,8 +226,8 @@ GEM
plos (0.0.7)
nokogiri
rest-client
poltergeist (1.17.0)
capybara (~> 2.1)
poltergeist (1.18.1)
capybara (>= 2.1, < 4)
cliver (~> 0.3.1)
websocket-driver (>= 0.2.0)
power_assert (1.1.1)
@@ -326,6 +327,9 @@ GEM
tilt (>= 1.1, < 3)
scrypt (3.0.5)
ffi-compiler (>= 1.0, < 2.0)
selenium-webdriver (3.142.7)
childprocess (>= 0.5, < 4.0)
rubyzip (>= 1.2.2)
sentry-raven (2.7.2)
faraday (>= 0.7.6, < 1.0)
shellany (0.0.1)
@@ -386,7 +390,7 @@ GEM
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
websocket-driver (0.7.0)
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
whenever (0.10.0)
@@ -442,6 +446,7 @@ DEPENDENCIES
rvm-capistrano (= 1.4.4)
sanitize
sass-rails
selenium-webdriver
sentry-raven
shoulda-context
sidekiq

View File

@@ -1,6 +1,5 @@
# frozen_string_literal: true
require 'spec_helper'
feature 'search' do
let!(:snp) { create(:snp, name: 'foo123') }
let!(:phenotype) { create(:phenotype, characteristic: 'foonotype') }

View File

@@ -11,7 +11,8 @@ require 'factory_bot_rails'
require 'pry-rails' unless ENV['CI']
require 'authlogic/test_case'
require 'capybara/poltergeist'
Capybara.javascript_driver = :poltergeist
# commenting out poltergeist as phantomjs breaks Github tests
Capybara.javascript_driver = :selenium
# Requires supporting ruby files with custom matchers and macros, etc,

View File

@@ -0,0 +1,33 @@
# frozen_string_literal: true
# from https://www.railsagency.com/blog/2020/03/11/how-to-configure-full-stack-integration-testing-with-selenium-and-ruby-on-rails/
# lots of options, but gets around 'exit code 1' on github
Capybara.register_driver :chrome_headless do |app|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
'goog:chromeOptions': {
args: %w[no-sandbox headless disable-gpu --window-size=1920,1080]
}
)
Capybara::Selenium::Driver.new(app, browser: :chrome, desired_capabilities: capabilities)
end
# Ensure Log directory exists
`mkdir -p tmp/selenium_logs`
Capybara.register_driver :chrome do |app|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
'goog:chromeOptions': { args: %w[start-maximized] }
)
Capybara::Selenium::Driver.new(
app,
browser: :chrome,
desired_capabilities: capabilities,
driver_opts: {
log_path: "./tmp/selenium_logs/selenium-#{Time.now.to_i}.log",
verbose: true
}
)
end
Capybara.javascript_driver = ENV.fetch('CAPYBARA_JAVASCRIPT_DRIVER', :chrome_headless).to_sym