From 8ed6eabdb2cdc0d8a8050294231239968c35409b Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Fri, 6 Jun 2025 00:00:54 -0400 Subject: [PATCH] Use cuprite to drive Chrome (#60) headless tests started to fail due to elements not being present in time or not being found period. CBA to fix so just switch to this other driver for now. Reviewed-on: https://git.atomaka.com/atomaka/budget/pulls/60 --- Gemfile | 2 +- Gemfile.lock | 21 +++++++++++---------- test/application_system_test_case.rb | 5 ++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Gemfile b/Gemfile index 2501837..3655681 100644 --- a/Gemfile +++ b/Gemfile @@ -61,7 +61,7 @@ end group :test do # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing] gem "capybara" - gem "selenium-webdriver" + gem "cuprite" end gem "tailwindcss-rails", "~> 3.3.1" diff --git a/Gemfile.lock b/Gemfile.lock index 461fa1a..f117914 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -125,6 +125,9 @@ GEM concurrent-ruby (1.3.5) connection_pool (2.5.0) crass (1.0.6) + cuprite (0.17) + capybara (~> 3.0) + ferrum (~> 0.17.0) date (3.4.1) debug (1.10.0) irb (~> 1.10) @@ -133,6 +136,12 @@ GEM erubi (1.13.1) et-orbi (1.2.11) tzinfo + ferrum (0.17.1) + addressable (~> 2.5) + base64 (~> 0.2) + concurrent-ruby (~> 1.1) + webrick (~> 1.7) + websocket-driver (~> 0.7) fugit (1.11.1) et-orbi (~> 1, >= 1.2.11) raabro (~> 1.4) @@ -226,7 +235,6 @@ GEM regexp_parser (2.10.0) reline (0.6.0) io-console (~> 0.5) - rexml (3.4.0) rubocop (1.71.2) json (~> 2.3) language_server-protocol (>= 3.17.0) @@ -256,14 +264,7 @@ GEM rubocop-performance rubocop-rails ruby-progressbar (1.13.0) - rubyzip (2.4.1) securerandom (0.4.1) - selenium-webdriver (4.28.0) - base64 (~> 0.2) - logger (~> 1.4) - rexml (~> 3.2, >= 3.2.5) - rubyzip (>= 1.2.2, < 3.0) - websocket (~> 1.0) solid_cable (3.0.7) actioncable (>= 7.2) activejob (>= 7.2) @@ -309,7 +310,7 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - websocket (1.2.11) + webrick (1.9.1) websocket-driver (0.7.7) base64 websocket-extensions (>= 0.1.0) @@ -329,6 +330,7 @@ DEPENDENCIES bootsnap brakeman capybara + cuprite debug importmap-rails jbuilder @@ -336,7 +338,6 @@ DEPENDENCIES puma (>= 5.0) rails! rubocop-rails-omakase - selenium-webdriver solid_cable solid_cache solid_queue diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb index e3e8707..d5bde40 100644 --- a/test/application_system_test_case.rb +++ b/test/application_system_test_case.rb @@ -1,9 +1,8 @@ require "test_helper" +require "capybara/cuprite" class ApplicationSystemTestCase < ActionDispatch::SystemTestCase - driven_by :selenium, - using: ENV["VISIBLE_SYSTEM_TESTS"].present? ? :chrome : :headless_chrome, - screen_size: [ 1400, 1400 ] + driven_by :cuprite, options: { headless: ENV["VISIBLE_SYSTEM_TESTS"].blank? } def login(email, password = "secret") visit new_session_url