-
Notifications
You must be signed in to change notification settings - Fork 911
[WIP] Add cypress-on-rails support #23600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jrafanie
wants to merge
1
commit into
ManageIQ:master
Choose a base branch
from
jrafanie:cypress-on-rails
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fryguy
reviewed
Sep 29, 2025
Gemfile
Outdated
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor but add a gap before this or rubocop is going to complain about sort order.
Suggested change
gem "cypress-on-rails", "~>1.17.0" # Need railtie to be loaded with rails app | |
gem "cypress-on-rails", "~>1.17.0" # Need railtie to be loaded with rails app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On that note, the next 3 need to be in sort order 😆
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" + ```
1a8303b
to
1ac51f8
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Enables: ManageIQ/manageiq-ui-classic#9633 to use cypress on rails
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:
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.
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:
b) Require it in UI-Classic's Engine and add the gems to the gemspec: