I really love the new rails-7 way, and together with vite, svelte and stimulus, see.
But, in the end, there remains one problem: painfully slow Capybara, especially the loading/initialisation time for each test (the running time for the test itself is OK).
I opened a issue on github/capybara too.
I work on a MacMini 2023. Before bying I also tested a MacStudio, but doubling the cores makes no difference because a single test can only use one core (except when using gems like parallel_tests, but that does not help for a single test). A single Capybara test with nothing more than a content like “visit root_path” takes 9 seconds, running only 9 tests at once takes 33 seconds! For comparison, by rspec I currently have 1,738 tests running for the same app, including these 9 Capybara specs, taking 3 minutes!
Working with much more interactive front-ends it is necessary to implement much more tests: For each stimulus or svelte component, you want … you have to! let the bot do a click and check the effect. That would mean implementing a lot more system tests! By writing a test you have to run it often!
While Capybara itself, with its intuitive commands, is really great it is the loading time of each test that is frustrating.
I am aware that this might be hard to solve, as it would require a solution like this: The browser and Rails environment would have to be started once in the background after opening the IDE, for example, to be initialised when I run one or more tests.
But, on the way for writing more front end interactive apps which is our or DHH’s vision I really see this slowdown of front end testing as the remaining problem.
Are there any ideas?
Best regards, Chris