Skip to content

Commit 9133d61

Browse files
committed
Add cypress-on-rails support
Enables: ManageIQ/manageiq-ui-classic#9633 We add this to core so the railtie in cypress-on-rails can hook into the rails app startup as needed: https://github.com/shakacode/cypress-playwright-on-rails/blob/d50de890b345879205124fa4de52bf899d9df2d0/lib/cypress_on_rails/railtie.rb#L6 Note, this could be pushed down to UI Classic, see below, but this has a few problems: 1) Core already has bundler groups for development and test that these nicely fit into. This allows us to easily exclude them from different installation scenarios such as smaller deployments with just the required runtime dependencies. 2) UI-Classic is a gem engine that gets pulled in, so only the runtime dependencies are resolved and available. Therefore, we would need to add these test gems as runtime dependencies which sends the wrong message and makes it difficult to exclude. Alternative setup (not suggested): a) Remove it from core: ```diff --git a/Gemfile b/Gemfile index cd45015..b62ae61 100644 --- a/Gemfile +++ b/Gemfile @@ -326,7 +326,4 @@ group :development, :test do gem "parallel_tests", "~>4.4", :require => false gem "routes_lazy_routes" gem "rspec-rails", "~>7.0" - gem "cypress-on-rails", "~>1.17.0" # Need railtie to be loaded with rails app - gem "factory_bot_rails" - gem "database_cleaner", "~>2.1" end ``` b) Require it in UI-Classic's Engine and add the gems to the gemspec: ```diff --git a/lib/manageiq/ui/classic/engine.rb b/lib/manageiq/ui/classic/engine.rb index dc72a001ec..cf420620c1 100644 --- a/lib/manageiq/ui/classic/engine.rb +++ b/lib/manageiq/ui/classic/engine.rb @@ -36,6 +36,8 @@ module ManageIQ config.assets.js_compressor = :manageiq_ui_classic_js_compressor end + require 'cypress-on-rails' if ENV['CYPRESS'].present? + def self.vmdb_plugin? true end diff --git a/manageiq-ui-classic.gemspec b/manageiq-ui-classic.gemspec index cef587a45a..3ed378abed 100644 --- a/manageiq-ui-classic.gemspec +++ b/manageiq-ui-classic.gemspec @@ -31,7 +31,10 @@ Gem::Specification.new do |s| s.add_dependency "uglifier", "~>4.2.0" s.add_dependency "webpacker", "~>2.0.0" - s.add_development_dependency "cypress-on-rails", "~> 1.0" + s.add_dependency "cypress-on-rails", "~>1.17.0" + s.add_dependency "factory_bot_rails" + s.add_dependency "database_cleaner", "~>2.1" + ```
1 parent 8694efe commit 9133d61

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,9 @@ group :test do
323323
end
324324

325325
group :development, :test do
326+
gem "cypress-on-rails", "~>1.17.0" # This is needed so the railtie can hook into the rails app startup
327+
gem "database_cleaner", "~>2.1"
328+
gem "factory_bot_rails"
326329
gem "parallel_tests", "~>4.4", :require => false
327330
gem "routes_lazy_routes"
328331
gem "rspec-rails", "~>7.0"

0 commit comments

Comments
 (0)