bullet_train
bullet_train copied to clipboard
Move to Ferrum + Cuprite for system tests.
The default Selenium backend for system tests can be super flaky. Seems like every dev I've talked to has hit a frustrating experience with it. Usually the response is to give up on end to end tests and move on to more productive work.
Ferrum/Cuprite is a modern, pure Ruby alternative to Selenium that is faster and more reliable. Adopting it seems very in line with the Bullet Train approach.
This article should be a useful resource https://evilmartians.com/chronicles/system-of-a-test-setting-up-end-to-end-rails-testing
Also here's some docs on getting it working with magic_test https://github-wiki-see.page/m/bullet-train-co/magic_test/wiki/Magic-Test-and-Cuprite
@existentialmutt Sounds great. Want to take a stab at it?
@existentialmutt Just a heads up, but if there isn't a workaround for this it would be a deal breaker: https://twitter.com/JacobDaddario/status/1524436224915787776
We depend on send_keys
for integration with things like super_select
testing. Tagging @adampal as well, because I know he implemented that stuff.
Just seeing this now. I did hit an issue there and solved it with page.driver.browser.keyboard.type
@existentialmutt that looks good to me if you were able to get around the send_keys
issue. Without that, it would have been really difficult!
It may not be too big of an issue, but I'm noticing that system tests are failing intermittently in the System Tests with Cuprite
check.
Error:
AuthenticationSystemTest#test_visitors_can_sign-up,_sign-out,_sign-in,_reset_passwords,_etc._with_subscriptions_disabled_on_a_macbook_pro_15_inch:
Ferrum::PendingConnectionsError: Request to http://localhost:3001/ reached server, but there are still pending connections: https://rsms.me/inter/font-files/Inter-roman.var.woff2?v=3.19
test/system/authentication_test.rb:10:in `block (2 levels) in <class:AuthenticationSystemTest>'
Example CircleCI jobs: Job 3078 Job 2934 Job 2907
Most tests seem to pass just fine if you re-run the jobs in CircleCI, which is what I've been doing with the depfu dependencies.
The issue was addressed here in the Ferrum repository, and other people are seeming to have problems with it when using it with Capybara specfically. The lead contributor commented, and these are the first 3 options that were provided:
- If request is to your local server figure out why it's so slow
- If request is to external server try to block such if it's not vital part of your app
- Try to increase :timeout, because if timeout is reached and there are still pending connection the error is raised.
Since we're not making requests to a local server and we depend on the external server in the system tests, we might just want to increase the timeout value a little bit to see if this takes care of the problem.