v1.19.0
Added
- Rake tasks for test execution: Added
cypress:openandcypress:runrake tasks for seamless test execution, similar to cypress-rails functionality. Also addedplaywright:openandplaywright:runtasks. - Server lifecycle hooks: Added configuration hooks for test server management:
before_server_start: Run code before Rails server startsafter_server_start: Run code after Rails server is readyafter_transaction_start: Run code after database transaction beginsafter_state_reset: Run code after application state is resetbefore_server_stop: Run code before Rails server stops
- State reset endpoint: Added
/cypress_rails_reset_stateand/__cypress__/reset_stateendpoints for compatibility with cypress-rails - Transactional test mode: Added support for automatic database transaction rollback between tests
- Environment configuration: Support for
CYPRESS_RAILS_HOSTandCYPRESS_RAILS_PORTenvironment variables - Automatic server management: Test server automatically starts and stops with test execution
Migration Guide
From Manual Server Management (Old Way)
If you were previously running tests manually:
Before (Manual Process):
# Terminal 1: Start Rails server
CYPRESS=1 bin/rails server -p 5017
# Terminal 2: Run tests
yarn cypress open --project ./e2e
# or
npx cypress run --project ./e2eAfter (Automated with Rake Tasks):
# Single command - server managed automatically!
bin/rails cypress:open
# or
bin/rails cypress:runFrom cypress-rails Gem
If migrating from the cypress-rails gem:
-
Update your Gemfile:
# Remove gem 'cypress-rails' # Add gem 'cypress-on-rails', '~> 1.0'
-
Run bundle and generator:
bundle install rails g cypress_on_rails:install
-
Configure hooks in
config/initializers/cypress_on_rails.rb(optional):CypressOnRails.configure do |c| # These hooks match cypress-rails functionality c.before_server_start = -> { DatabaseCleaner.clean } c.after_server_start = -> { Rails.application.load_seed } c.transactional_server = true end
-
Use the same commands you're familiar with:
bin/rails cypress:open bin/rails cypress:run