Skip to content
Snippets Groups Projects
Unverified Commit d9d4b4a8 authored by guido's avatar guido
Browse files

Switch from apparition to cuprite for tests

appration doesn't seem to having much love during the last two years,
and there were two different issues with it making the tests process
stuck (no output, setting headless to false didn't show chrome and a
modal getting the process stuck).

curprite seems to be the easier transition compared to selenium.
parent a7fb7d56
Branches fix/enable_ci
No related tags found
1 merge request!318Draft: Update rails to 6.1.7.8
...@@ -226,7 +226,7 @@ group :test, :ci do ...@@ -226,7 +226,7 @@ group :test, :ci do
gem 'capybara', require: false gem 'capybara', require: false
# Capybara driver with javascript capabilities using chromes CDP # Capybara driver with javascript capabilities using chromes CDP
gem 'apparition', github: 'twalpole/apparition', ref: 'ca86be4d54af835d531dbcd2b86e7b2c77f85f34' gem 'cuprite'
# The castle_gates tests are based on sqlite # The castle_gates tests are based on sqlite
gem 'sqlite3' gem 'sqlite3'
......
GIT
remote: https://github.com/twalpole/apparition.git
revision: ca86be4d54af835d531dbcd2b86e7b2c77f85f34
ref: ca86be4d54af835d531dbcd2b86e7b2c77f85f34
specs:
apparition (0.6.0)
capybara (~> 3.13, < 4)
websocket-driver (>= 0.6.5)
GIT GIT
remote: https://github.com/voxmedia/prototype-rails.git remote: https://github.com/voxmedia/prototype-rails.git
revision: 740f70179a7c2a1d8619518294f75cd3755a8f68 revision: 740f70179a7c2a1d8619518294f75cd3755a8f68
...@@ -27,62 +18,62 @@ GEM ...@@ -27,62 +18,62 @@ GEM
RedCloth (4.3.4) RedCloth (4.3.4)
aasm (5.5.0) aasm (5.5.0)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
actioncable (6.1.7.8) actioncable (6.1.7.9)
actionpack (= 6.1.7.8) actionpack (= 6.1.7.9)
activesupport (= 6.1.7.8) activesupport (= 6.1.7.9)
nio4r (~> 2.0) nio4r (~> 2.0)
websocket-driver (>= 0.6.1) websocket-driver (>= 0.6.1)
actionmailbox (6.1.7.8) actionmailbox (6.1.7.9)
actionpack (= 6.1.7.8) actionpack (= 6.1.7.9)
activejob (= 6.1.7.8) activejob (= 6.1.7.9)
activerecord (= 6.1.7.8) activerecord (= 6.1.7.9)
activestorage (= 6.1.7.8) activestorage (= 6.1.7.9)
activesupport (= 6.1.7.8) activesupport (= 6.1.7.9)
mail (>= 2.7.1) mail (>= 2.7.1)
actionmailer (6.1.7.8) actionmailer (6.1.7.9)
actionpack (= 6.1.7.8) actionpack (= 6.1.7.9)
actionview (= 6.1.7.8) actionview (= 6.1.7.9)
activejob (= 6.1.7.8) activejob (= 6.1.7.9)
activesupport (= 6.1.7.8) activesupport (= 6.1.7.9)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
actionpack (6.1.7.8) actionpack (6.1.7.9)
actionview (= 6.1.7.8) actionview (= 6.1.7.9)
activesupport (= 6.1.7.8) activesupport (= 6.1.7.9)
rack (~> 2.0, >= 2.0.9) rack (~> 2.0, >= 2.0.9)
rack-test (>= 0.6.3) rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0)
actionpack-page_caching (1.2.4) actionpack-page_caching (1.2.4)
actionpack (>= 4.0.0) actionpack (>= 4.0.0)
actiontext (6.1.7.8) actiontext (6.1.7.9)
actionpack (= 6.1.7.8) actionpack (= 6.1.7.9)
activerecord (= 6.1.7.8) activerecord (= 6.1.7.9)
activestorage (= 6.1.7.8) activestorage (= 6.1.7.9)
activesupport (= 6.1.7.8) activesupport (= 6.1.7.9)
nokogiri (>= 1.8.5) nokogiri (>= 1.8.5)
actionview (6.1.7.8) actionview (6.1.7.9)
activesupport (= 6.1.7.8) activesupport (= 6.1.7.9)
builder (~> 3.1) builder (~> 3.1)
erubi (~> 1.4) erubi (~> 1.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.1.7.8) activejob (6.1.7.9)
activesupport (= 6.1.7.8) activesupport (= 6.1.7.9)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (6.1.7.8) activemodel (6.1.7.9)
activesupport (= 6.1.7.8) activesupport (= 6.1.7.9)
activerecord (6.1.7.8) activerecord (6.1.7.9)
activemodel (= 6.1.7.8) activemodel (= 6.1.7.9)
activesupport (= 6.1.7.8) activesupport (= 6.1.7.9)
activestorage (6.1.7.8) activestorage (6.1.7.9)
actionpack (= 6.1.7.8) actionpack (= 6.1.7.9)
activejob (= 6.1.7.8) activejob (= 6.1.7.9)
activerecord (= 6.1.7.8) activerecord (= 6.1.7.9)
activesupport (= 6.1.7.8) activesupport (= 6.1.7.9)
marcel (~> 1.0) marcel (~> 1.0)
mini_mime (>= 1.1.0) mini_mime (>= 1.1.0)
activesupport (6.1.7.8) activesupport (6.1.7.9)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2) i18n (>= 1.6, < 2)
minitest (>= 5.1) minitest (>= 5.1)
...@@ -90,7 +81,7 @@ GEM ...@@ -90,7 +81,7 @@ GEM
zeitwerk (~> 2.3) zeitwerk (~> 2.3)
acts-as-taggable-on (8.1.0) acts-as-taggable-on (8.1.0)
activerecord (>= 5.0, < 6.2) activerecord (>= 5.0, < 6.2)
acts_as_list (1.2.2) acts_as_list (1.2.3)
activerecord (>= 6.1) activerecord (>= 6.1)
activesupport (>= 6.1) activesupport (>= 6.1)
addressable (2.8.7) addressable (2.8.7)
...@@ -103,7 +94,7 @@ GEM ...@@ -103,7 +94,7 @@ GEM
bootsnap (1.18.4) bootsnap (1.18.4)
msgpack (~> 1.2) msgpack (~> 1.2)
builder (3.3.0) builder (3.3.0)
bundler-audit (0.9.1) bundler-audit (0.9.2)
bundler (>= 1.2.0, < 3) bundler (>= 1.2.0, < 3)
thor (~> 1.0) thor (~> 1.0)
byebug (11.1.3) byebug (11.1.3)
...@@ -117,28 +108,36 @@ GEM ...@@ -117,28 +108,36 @@ GEM
regexp_parser (>= 1.5, < 3.0) regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2) xpath (~> 3.2)
chronic (0.10.2) chronic (0.10.2)
concurrent-ruby (1.3.3) concurrent-ruby (1.3.4)
crabgrass_media (0.5.0) crabgrass_media (0.5.0)
activesupport (~> 6.0) activesupport (~> 6.0)
mime-types (~> 3.1) mime-types (~> 3.1)
crass (1.0.6) crass (1.0.6)
cuprite (0.15.1)
capybara (~> 3.0)
ferrum (~> 0.15.0)
daemons (1.4.1) daemons (1.4.1)
date (3.3.4) date (3.3.4)
delayed_job (4.1.11) delayed_job (4.1.12)
activesupport (>= 3.0, < 8.0) activesupport (>= 3.0, < 8.0)
delayed_job_active_record (4.1.8) delayed_job_active_record (4.1.10)
activerecord (>= 3.0, < 8.0) activerecord (>= 3.0, < 8.0)
delayed_job (>= 3.0, < 5) delayed_job (>= 3.0, < 5)
docile (1.4.1) docile (1.4.1)
erubi (1.13.0) erubi (1.13.0)
execjs (2.9.1) execjs (2.9.1)
factory_bot (6.4.6) factory_bot (6.5.0)
activesupport (>= 5.0.0) activesupport (>= 5.0.0)
factory_bot_rails (6.4.3) factory_bot_rails (6.4.3)
factory_bot (~> 6.4) factory_bot (~> 6.4)
railties (>= 5.0.0) railties (>= 5.0.0)
faker (2.23.0) faker (2.23.0)
i18n (>= 1.8.11, < 2) i18n (>= 1.8.11, < 2)
ferrum (0.15)
addressable (~> 2.5)
concurrent-ruby (~> 1.1)
webrick (~> 1.7)
websocket-driver (~> 0.7)
ffi (1.17.0) ffi (1.17.0)
globalid (1.2.1) globalid (1.2.1)
activesupport (>= 6.1) activesupport (>= 6.1)
...@@ -153,7 +152,7 @@ GEM ...@@ -153,7 +152,7 @@ GEM
haml (>= 4.0.6) haml (>= 4.0.6)
railties (>= 5.1) railties (>= 5.1)
http_accept_language (2.1.1) http_accept_language (2.1.1)
i18n (1.14.5) i18n (1.14.6)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
innertube (1.1.0) innertube (1.1.0)
invisible_captcha (2.3.0) invisible_captcha (2.3.0)
...@@ -162,6 +161,7 @@ GEM ...@@ -162,6 +161,7 @@ GEM
activerecord (>= 6.1.0) activerecord (>= 6.1.0)
json (2.7.2) json (2.7.2)
libv8-node (18.19.0.0-x86_64-linux) libv8-node (18.19.0.0-x86_64-linux)
logger (1.6.1)
loofah (2.22.0) loofah (2.22.0)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.12.0) nokogiri (>= 1.12.0)
...@@ -177,19 +177,20 @@ GEM ...@@ -177,19 +177,20 @@ GEM
matrix (0.4.2) matrix (0.4.2)
method_source (1.1.0) method_source (1.1.0)
middleware (0.1.0) middleware (0.1.0)
mime-types (3.5.2) mime-types (3.6.0)
logger
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
mime-types-data (3.2024.0806) mime-types-data (3.2024.1001)
mini_mime (1.1.5) mini_mime (1.1.5)
mini_portile2 (2.8.7) mini_portile2 (2.8.7)
mini_racer (0.14.0) mini_racer (0.16.0)
libv8-node (~> 18.19.0.0) libv8-node (~> 18.19.0.0)
minitest (5.24.1) minitest (5.25.1)
msgpack (1.7.2) msgpack (1.7.3)
mysql2 (0.5.6) mysql2 (0.5.6)
net-http (0.4.1) net-http (0.4.1)
uri uri
net-imap (0.4.14) net-imap (0.5.0)
date date
net-protocol net-protocol
net-pop (0.1.2) net-pop (0.1.2)
...@@ -202,28 +203,28 @@ GEM ...@@ -202,28 +203,28 @@ GEM
nokogiri (1.16.7-x86_64-linux) nokogiri (1.16.7-x86_64-linux)
racc (~> 1.4) racc (~> 1.4)
public_suffix (6.0.1) public_suffix (6.0.1)
puma (6.4.2) puma (6.4.3)
nio4r (~> 2.0) nio4r (~> 2.0)
pundit (2.3.2) pundit (2.4.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
racc (1.8.1) racc (1.8.1)
rack (2.2.9) rack (2.2.10)
rack-test (2.1.0) rack-test (2.1.0)
rack (>= 1.3) rack (>= 1.3)
rails (6.1.7.8) rails (6.1.7.9)
actioncable (= 6.1.7.8) actioncable (= 6.1.7.9)
actionmailbox (= 6.1.7.8) actionmailbox (= 6.1.7.9)
actionmailer (= 6.1.7.8) actionmailer (= 6.1.7.9)
actionpack (= 6.1.7.8) actionpack (= 6.1.7.9)
actiontext (= 6.1.7.8) actiontext (= 6.1.7.9)
actionview (= 6.1.7.8) actionview (= 6.1.7.9)
activejob (= 6.1.7.8) activejob (= 6.1.7.9)
activemodel (= 6.1.7.8) activemodel (= 6.1.7.9)
activerecord (= 6.1.7.8) activerecord (= 6.1.7.9)
activestorage (= 6.1.7.8) activestorage (= 6.1.7.9)
activesupport (= 6.1.7.8) activesupport (= 6.1.7.9)
bundler (>= 1.15.0) bundler (>= 1.15.0)
railties (= 6.1.7.8) railties (= 6.1.7.9)
sprockets-rails (>= 2.0.0) sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.5) rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1) actionpack (>= 5.0.1.rc1)
...@@ -236,9 +237,9 @@ GEM ...@@ -236,9 +237,9 @@ GEM
rails-html-sanitizer (1.6.0) rails-html-sanitizer (1.6.0)
loofah (~> 2.21) loofah (~> 2.21)
nokogiri (~> 1.14) nokogiri (~> 1.14)
railties (6.1.7.8) railties (6.1.7.9)
actionpack (= 6.1.7.8) actionpack (= 6.1.7.9)
activesupport (= 6.1.7.8) activesupport (= 6.1.7.9)
method_source method_source
rake (>= 12.2) rake (>= 12.2)
thor (~> 1.0) thor (~> 1.0)
...@@ -259,12 +260,12 @@ GEM ...@@ -259,12 +260,12 @@ GEM
rb-inotify (~> 0.9, >= 0.9.7) rb-inotify (~> 0.9, >= 0.9.7)
sdoc (2.6.1) sdoc (2.6.1)
rdoc (>= 5.0) rdoc (>= 5.0)
secure_headers (6.5.0) secure_headers (6.7.0)
simplecov (0.22.0) simplecov (0.22.0)
docile (~> 1.1) docile (~> 1.1)
simplecov-html (~> 0.11) simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1) simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3) simplecov-html (0.13.1)
simplecov_json_formatter (0.1.4) simplecov_json_formatter (0.1.4)
simpleidn (0.2.3) simpleidn (0.2.3)
spring (4.2.1) spring (4.2.1)
...@@ -275,7 +276,7 @@ GEM ...@@ -275,7 +276,7 @@ GEM
actionpack (>= 6.1) actionpack (>= 6.1)
activesupport (>= 6.1) activesupport (>= 6.1)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
sqlite3 (2.0.3) sqlite3 (2.1.0)
mini_portile2 (~> 2.8.0) mini_portile2 (~> 2.8.0)
temple (0.10.3) temple (0.10.3)
thinking-sphinx (5.6.0) thinking-sphinx (5.6.0)
...@@ -285,7 +286,7 @@ GEM ...@@ -285,7 +286,7 @@ GEM
joiner (>= 0.3.4) joiner (>= 0.3.4)
middleware (>= 0.1.0) middleware (>= 0.1.0)
riddle (~> 2.3) riddle (~> 2.3)
thor (1.3.1) thor (1.3.2)
tilt (2.4.0) tilt (2.4.0)
timeout (0.4.1) timeout (0.4.1)
ts-delayed-delta (2.1.0) ts-delayed-delta (2.1.0)
...@@ -294,9 +295,9 @@ GEM ...@@ -294,9 +295,9 @@ GEM
thinking-sphinx (>= 1.5.0) thinking-sphinx (>= 1.5.0)
tzinfo (2.0.6) tzinfo (2.0.6)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
uglifier (4.2.0) uglifier (4.2.1)
execjs (>= 0.3.0, < 3) execjs (>= 0.3.0, < 3)
uri (0.13.0) uri (0.13.1)
utf8-cleaner (1.0.0) utf8-cleaner (1.0.0)
activesupport activesupport
validates_email_format_of (1.8.2) validates_email_format_of (1.8.2)
...@@ -307,6 +308,7 @@ GEM ...@@ -307,6 +308,7 @@ GEM
activemodel (>= 6.0.0) activemodel (>= 6.0.0)
bindex (>= 0.4.0) bindex (>= 0.4.0)
railties (>= 6.0.0) railties (>= 6.0.0)
webrick (1.8.2)
websocket-driver (0.7.6) websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0) websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5) websocket-extensions (0.1.5)
...@@ -315,7 +317,7 @@ GEM ...@@ -315,7 +317,7 @@ GEM
will_paginate (3.3.1) will_paginate (3.3.1)
xpath (3.2.0) xpath (3.2.0)
nokogiri (~> 1.8) nokogiri (~> 1.8)
zeitwerk (2.6.17) zeitwerk (2.6.18)
zip-zip (0.3) zip-zip (0.3)
rubyzip (>= 1.0.0) rubyzip (>= 1.0.0)
...@@ -329,13 +331,13 @@ DEPENDENCIES ...@@ -329,13 +331,13 @@ DEPENDENCIES
acts-as-taggable-on (~> 8.1) acts-as-taggable-on (~> 8.1)
acts_as_list (~> 1.0) acts_as_list (~> 1.0)
after_commit_everywhere (~> 1.1) after_commit_everywhere (~> 1.1)
apparition!
bcrypt (~> 3.1.7) bcrypt (~> 3.1.7)
bootsnap (~> 1.9) bootsnap (~> 1.9)
bundler-audit bundler-audit
byebug byebug
capybara capybara
crabgrass_media (~> 0.5.0) crabgrass_media (~> 0.5.0)
cuprite
daemons daemons
delayed_job_active_record (~> 4.0) delayed_job_active_record (~> 4.0)
factory_bot_rails factory_bot_rails
......
...@@ -61,6 +61,6 @@ module AjaxPending ...@@ -61,6 +61,6 @@ module AjaxPending
def pending_requests def pending_requests
# If the setup of the test failed the driver might not be a js driver # If the setup of the test failed the driver might not be a js driver
return [] unless page.driver.respond_to? :network_traffic return [] unless page.driver.respond_to? :network_traffic
page.driver.network_traffic.select { |req| req.response_parts.blank? } page.driver.network_traffic.select { |req| req.response.blank? }
end end
end end
require 'test_helper' require 'test_helper'
require 'capybara/rails' require 'capybara/rails'
require 'active_support/test_case' require 'active_support/test_case'
require 'capybara/cuprite'
# require all integration helpers # require all integration helpers
Dir[File.dirname(__FILE__) + '/helpers/integration/*.rb'].each do |file| Dir[File.dirname(__FILE__) + '/helpers/integration/*.rb'].each do |file|
require file require file
end end
Capybara.register_driver :apparition do |app| Capybara.javascript_driver = :cuprite
Capybara::Apparition::Driver.new(app, browser_options: { 'no-sandbox' => nil, 'disable-web-security' => nil, 'disable-features' => 'VizDisplayCompositor' }) Capybara.register_driver(:cuprite) do |app|
Capybara::Cuprite::Driver.new(app, window_size: [1200, 800], browser_options: { 'no-sandbox': nil })
end end
class IntegrationTest < ActionDispatch::IntegrationTest class IntegrationTest < ActionDispatch::IntegrationTest
include Capybara::DSL include Capybara::DSL
include RecordTracking include RecordTracking
......
require 'integration_test' require 'integration_test'
require 'capybara/apparition' require 'capybara/cuprite'
# require all javascript integration helpers # require all javascript integration helpers
Dir[File.dirname(__FILE__) + '/helpers/integration/javascript/*.rb'].each do |file| Dir[File.dirname(__FILE__) + '/helpers/integration/javascript/*.rb'].each do |file|
...@@ -11,7 +11,7 @@ class JavascriptIntegrationTest < IntegrationTest ...@@ -11,7 +11,7 @@ class JavascriptIntegrationTest < IntegrationTest
include AjaxPending include AjaxPending
include Autocomplete include Autocomplete
Capybara.javascript_driver = :apparition Capybara.javascript_driver = :cuprite
self.use_transactional_tests = false self.use_transactional_tests = false
def setup def setup
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment