-
Notifications
You must be signed in to change notification settings - Fork 74
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
Remove redundant configs for Capybara #3947
Conversation
Capybara.current_driver = DEFAULT_JS_DRIVER | ||
end | ||
|
||
Before '@chrome' do |
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.
Capybara.default_driver = :rack_test | ||
Capybara.javascript_driver = DEFAULT_JS_DRIVER | ||
Capybara.default_selector = :css | ||
Capybara.disable_animation = true | ||
|
||
# Capybara 3 changes the default server to Puma. It can be reverted to the previous default of WEBRick by specifying: | ||
Capybara.server = :webrick |
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.
I think it doesn't make sense to set the same configs both here, and then inside the Capybara.configure
block. They seem to have the same effect.
features/support/capybara.rb
Outdated
Capybara.current_driver = :firefox | ||
# Capybara 3 changes the default server to Puma. It can be reverted to the previous default of WEBRick by specifying: | ||
config.server = :webrick | ||
config.disable_animation = true |
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.
This disable_animation
is the only one that is not documented here: https://rubydoc.info/github/jnicklas/capybara/Capybara#configure-class_method
But the tests pass, so either it works fine, or this setting is irrelevant.
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.
In this case I would remove it and see if the tests pass. The more we can cleanup the better.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3947 +/- ##
==========================================
- Coverage 93.85% 93.80% -0.05%
==========================================
Files 3001 2999 -2
Lines 97351 96925 -426
Branches 629 629
==========================================
- Hits 91368 90924 -444
- Misses 5959 5977 +18
Partials 24 24 ☔ View full report in Codecov by Sentry. |
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.
looks nice! good to check if there are useful ideas also in #3911
Oh wow! I missed that one completely 🤦 Thanks, I'll take a look. |
@@ -237,6 +237,8 @@ def setup_provider(login) | |||
set_current_domain(@provider.external_admin_domain) | |||
stub_integration_errors_dashboard | |||
|
|||
@provider.users.first.user_sessions.create! # Prevents welcome flash from showing up |
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.
I understand the reason, but doesn't this make the login
param useless? it will create a session anyway... and doesn't this break any test?
4203836
to
695ecf7
Compare
@@ -22,7 +22,8 @@ | |||
click_link page | |||
end | |||
else | |||
input = find('input[aria-label="Current page"]') | |||
# Pagination controls are rendered twice: at the top and at the bottom of the data table | |||
input = find('input[aria-label="Current page"]', match: :first) |
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.
This change is not really needed anymore, it was needed when I tried config.match = :smart
match mode for Cabybara.
But probably we can leave it here to state that we are aware of this duplication, and have it fixed, if we ever switch to :smart
mode again. (currently there were too many changes to perform here)
features/support/capybara.rb
Outdated
Capybara.configure do |config| | ||
config.default_driver = :rack_test | ||
config.javascript_driver = DEFAULT_JS_DRIVER | ||
config.default_selector = :css |
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.
These first three lines are actually the defaults, so they could be removed potentially. I decided to keep them, because I think it's clearer if they are explicit and not hidden within Capybara's code (or docs).
But if anybody thinks they are redundant, we can drop them.
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.
Did you finally remove them?
@@ -5,8 +5,6 @@ | |||
end | |||
|
|||
When /^I switch to (builtin|3scale) content$/ do |group| | |||
ensure_javascript |
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.
why is this removed?
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.
I guess it's not strictly needed 🤔
I imagine that if this is used in a non-JS scenario, then just some following step will fail.
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.
I think it's nice to stay so that we know this is expected to fail without js. Otherwise it may require more cycles to figure out.
Capybara.register_driver :firefox do |app| | ||
Capybara::Selenium::Driver.new(app, browser: :firefox) | ||
end |
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.
we wont be able to run with firefox?
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.
Apparently, not 😬
Again, I just applied Josemi's suggestion.
I don't think I have run automated tests in firefox myself, but if you have and want to bring it back, I'll do it.
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.
Yeah, I think it is nice to be able to run something with it in case we see strange results with chrome. This is the only browser we ship with RHEL. And Chrome is evil.
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.
I agree Chrome is evil, in fact we should use only Firefox, but I guess clients use Chrome. IMO it's fine to keep both.
Remove session creation Revert to :prefer_exact capybara matching Remove default capybara values
0ad4d90
to
d757111
Compare
features/support/capybara.rb
Outdated
Capybara.configure do |config| | ||
config.default_driver = :rack_test | ||
config.javascript_driver = DEFAULT_JS_DRIVER | ||
config.default_selector = :css |
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.
Did you finally remove them?
What this PR does / why we need it:
There are some configs for Capybara that I believe are not needed - see comments inline.
Which issue(s) this PR fixes
Verification steps
Make sure all tests works :)
Special notes for your reviewer: