docbrown/config/initializers/cypress_rails.rb
Ridhwana e827b8bab9
Minimal Seed Data for Admin Onboarding (#14385)
* minimal seeded flows

* fix: remove mistake

* refactor: rename the files appropriately

* feat: change some text

* fix: typo

* chore: new commit to rebuild
2021-07-29 17:08:41 +02:00

35 lines
1.1 KiB
Ruby

# We want to check not only if we are in the test environment, but also if we are
# running E2E tests. Otherwise this will run when system tests run.
return unless Rails.env.test? && ENV["E2E"].present?
# rubocop:disable Rails/Output
CypressRails.hooks.before_server_start do
# Called once, before either the transaction or the server is started
puts "Starting up server for end to end tests."
Rails.application.load_tasks
if ENV["CREATOR_ONBOARDING_SEED_DATA"]
Rake::Task["db:seed:e2e_creator_onboarding"].invoke
else
Rake::Task["db:seed:e2e"].invoke
end
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
# Called once, at_exit
puts "Cleaning up and stopping server for end to end tests."
Rake::Task["db:truncate_all"].invoke if ENV["SKIP_SEED_DATA"].blank?
puts "The end to end test server shutdown gracefully."
end
# rubocop:enable Rails/Output