cypress-rails icon indicating copy to clipboard operation
cypress-rails copied to clipboard

Incompatible with Rails 7.2

Open ledermann opened this issue 6 months ago • 28 comments

The gem fails after upgrading an app to Rails 7.2, because ActiveRecord::ConnectionAdapters::ConnectionPool#lock_thread= does not exist anymore. There is a deprecation warning as well:

$ DISABLE_SPRING=1 RAILS_ENV=test bin/rake cypress:run

cypress-rails configuration:
============================
 CYPRESS_RAILS_DIR....................."/Users/ledermann/Projects/solectrus/solectrus"
 CYPRESS_RAILS_CYPRESS_DIR............."/Users/ledermann/Projects/solectrus/solectrus"
 CYPRESS_RAILS_HOST...................."127.0.0.1"
 CYPRESS_RAILS_PORT....................nil
 CYPRESS_RAILS_BASE_PATH..............."/"
 CYPRESS_RAILS_TRANSACTIONAL_SERVER....true
 CYPRESS_RAILS_CYPRESS_OPTS............""

DEPRECATION WARNING: ActiveRecord::ConnectionAdapters::ConnectionPool#connection is deprecated
and will be removed in Rails 8.0. Use #lease_connection instead.
 (called from map at /Users/ledermann/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/cypress-rails-0.7.0/lib/cypress-rails/manages_transactions.rb:61)
Coverage report generated for Cypress, RSpec to /Users/ledermann/Projects/solectrus/solectrus/coverage. 1905 / 2661 LOC (71.59%) covered.
Stopped processing SimpleCov as a previous error not related to SimpleCov has been detected
/Users/ledermann/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/cypress-rails-0.7.0/lib/cypress-rails/manages_transactions.rb:13:in `block in begin_transaction': undefined method `lock_thread=' for an instance of ActiveRecord::ConnectionAdapters::ConnectionPool (NoMethodError)

        connection.pool.lock_thread = true
                       ^^^^^^^^^^^^^^
	from /Users/ledermann/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/cypress-rails-0.7.0/lib/cypress-rails/manages_transactions.rb:11:in `each'
	from /Users/ledermann/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/cypress-rails-0.7.0/lib/cypress-rails/manages_transactions.rb:11:in `begin_transaction'
	from /Users/ledermann/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/cypress-rails-0.7.0/lib/cypress-rails/launches_cypress.rb:20:in `call'
	from /Users/ledermann/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/cypress-rails-0.7.0/lib/cypress-rails/run.rb:11:in `call'
	from /Users/ledermann/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/cypress-rails-0.7.0/exe/cypress-rails:15:in `<main>'

I haven't gone any deeper, but removing the two lines with lock_thread= fixes the problem in my application.

ledermann avatar Aug 10 '24 06:08 ledermann