before_server_stop hook not invoked when CYPRESS_RAILS_TRANSACTIONAL_SERVER=true
theforestvn88 opened this issue · 0 comments
theforestvn88 commented
Rails 7.1.3.2
Ruby 3.2.2
I setup config as below:
# initializers/cypress_rails.rb
return unless Rails.env.test?
CypressRails.hooks.before_server_start do
# Called once, before either the transaction or the server is started
Rails.application.load_tasks
Rake::Task["db:cypress:seed"].invoke
end
CypressRails.hooks.after_transaction_start do
# Called after the transaction is started (at launch and after each reset)
end
CypressRails.hooks.after_state_reset do
# Triggered after `/cypress_rails_reset_state` is called
end
CypressRails.hooks.before_server_stop do
p "before_server_stop................"
Rails.application.load_tasks
Rake::Task["db:truncate_all"].invoke
end
But the before_server_stop
hook is not triggered in case there's any test case failed
, it looks like there's something wrong with the rollback_transaction, i've not figured out yet. Even i not call the seed rake task on the before_server_start
hook , the rollback_transaction
is still stucked.
With CYPRESS_RAILS_TRANSACTIONAL_SERVER=false
, the before_server_stop
hook is triggered.
So i am not sure whether it's a bug or with the config CYPRESS_RAILS_TRANSACTIONAL_SERVER=true
we assume that we will not use the before_server_stop
hook ? if so, we need to update README.
Thanks!