-
Notifications
You must be signed in to change notification settings - Fork 69
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
Use Selenium with headless Chrome in system tests #106
Conversation
47781e7
to
ad55a0e
Compare
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 is cool! ❤️
A couple questions (stemming from my general lack of knowledge re: Selenium / webdrivers).
I've noticed that running bundle exec rake test
produces the following warning:
➜ maintenance_tasks git:(chrome) ✗ be rake test
/Users/adriannachang/.gem/ruby/2.6.3/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324: warning: /Users/adriannachang/.gem/ruby/2.6.3/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324: warning: loading in progress, circular require considered harmful - /Users/adriannachang/.gem/ruby/2.6.3/gems/webdrivers-4.4.1/lib/webdrivers.rb
Is this something we care about? Or is it beyond our control?
Fixed the warning! |
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.
Can we use the config mentioned here to make puma quiet?
https://github.com/teamcapybara/capybara/blob/master/README.md#setup
Also puma raises a warning when it boots that way.
Yeah the warning comes from puma/puma#2455 and teamcapybara/capybara#2413 but I believe we could avoid it by manually setting the environment, but it sucks a bit. |
cc0cb79
to
568f500
Compare
Apparently there's a way to setup the capybara server directly, even though it's not documented: https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/system_testing/server.rb#L7 Regarding the warning, it will raise when using |
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.
The deprecation warning from Capybara has been hidden by the fact that the configuration from #125 doesn't create a new process with the -w
flag, and Ruby 2.7.2 has turned off deprecation warnings by default without that. If we had a Warning[:deprecated] = true
in test_helper we'll get it back. I can look at this later though.
We now have a significant system test suite that is struggling with Rack test alone. With the addition of rapid-changing states and auto-refresh, we need to use a real-life browser such as Chrome to assert expectations properly with a closer-to-real test scenarios.
In an additional commit I am also improving assertions around system tests, such as ensuring that the timestamp used is different than the one used in our fixtures, as well as ensuring that there are no error information displayed when not expected.
A great benefit of using a real browser is that now we will have page screenshots when a test fails both locally and on CI. If a system test fails on GitHub you can simply download the zip file with the run artifacts and check the images.
Fixes #107