Skip to content

Commit 1a8303b

Browse files
committed
Initialize cypress on rails with the app
1 parent 2b58d8f commit 1a8303b

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This is identical to the generated file[1] with the exceptions below:
2+
# [1] https://github.com/shakacode/cypress-playwright-on-rails/blob/ac5d69f9ea951c7545e5141db2abb2cb1350e740/lib/generators/cypress_on_rails/templates/config/initializers/cypress_on_rails.rb.erb
3+
# * install_folder (uses our rails engine path)
4+
# * require ENV['CYPRESS'] to be set
5+
if defined?(CypressOnRails) && ENV['CYPRESS'].present?
6+
CypressOnRails.configure do |c|
7+
c.api_prefix = ""
8+
9+
# Currently, the only change from the template:
10+
c.install_folder = ManageIQ::UI::Classic::Engine.root.join("cypress/e2e")
11+
# WARNING!! CypressOnRails can execute arbitrary ruby code
12+
# please use with extra caution if enabling on hosted servers or starting your local server on 0.0.0.0
13+
c.use_middleware = !Rails.env.production?
14+
15+
# # Use this if you want to use use_cassette wrapper instead of manual insert/eject
16+
# # c.use_vcr_use_cassette_middleware = !Rails.env.production?
17+
# # Pass custom VCR options
18+
# c.vcr_options = {
19+
# hook_into: :webmock,
20+
# default_cassette_options: { record: :once },
21+
# cassette_library_dir: File.expand_path("#{__dir__}/../../e2e/cypress/fixtures/vcr_cassettes")
22+
# }
23+
c.logger = Rails.logger
24+
25+
# If you want to enable a before_request logic, such as authentication, logging, sending metrics, etc.
26+
# Refer to https://www.rubydoc.info/gems/rack/Rack/Request for the `request` argument.
27+
# Return nil to continue through the Cypress command. Return a response [status, header, body] to halt.
28+
# c.before_request = lambda { |request|
29+
# unless request.env['warden'].authenticate(:secret_key)
30+
# return [403, {}, ["forbidden"]]
31+
# end
32+
# }
33+
end
34+
35+
# # if you compile your asssets on CI
36+
# if ENV['CYPRESS'].present? && ENV['CI'].present?
37+
# Rails.application.configure do
38+
# config.assets.compile = false
39+
# config.assets.unknown_asset_fallback = false
40+
# end
41+
# end
42+
end

0 commit comments

Comments
 (0)