Replies: 2 comments 1 reply
-
Good question @drewguild yes, your assumption is right about having different behavior between your local and on CI. When I initially started writing cypress tests I would start the server using the test environment so it would not overwrite my development database. As you would see in the README.md So that is how it has become the default 😄 |
Beta Was this translation helpful? Give feedback.
-
That all said, we don't do it like that anymore and instead on our local, we start the server in development and change which database gets used, using an environment variable. DB_DATABASE=cypress_db CYPRESS=1 bin/rails s -p 5017 -P tmp/cypress.pid We still use the test environment on CI but no longer need to disable We handlle the CI difference now inside the if defined?(CypressOnRails)
CypressOnRails.configure do |c|
c.cypress_folder = File.expand_path("#{__dir__}/../../cypress")
c.use_middleware = !Rails.env.production?
c.logger = Rails.logger
end
if ENV['CI'].present?
Rails.application.configure do
config.assets.compile = false
config.assets.unknown_asset_fallback = false
config.active_job.queue_adapter = :async
end
end
end This could maybe be a better default? |
Beta Was this translation helpful? Give feedback.
-
Installing CypressOnRails will change
cache_classes=true
tocache_classes=ENV['CI'].present?
. What is the reason for deriving this value from the presence of that environment variable? I assume the idea is to get different behavior between local development and running the suite on a CI server. Not sure I understand why one would want that. Any insight is appreciated!Beta Was this translation helpful? Give feedback.
All reactions