I’ve got a rails system test that is checking the current_path after creating an object. In the test scenario the controller is doing a redirect_to for a turbo_stream response. I have an assertion that the current_path is equal to the index path. However, current_path is still equal to the new path causing the test to fail. Though, all my content expectations are passing.
I am having the same exact problem. I assume it’s a timing issue, with the assertion occurring before the browser is fully updated.
My work around was to stop testing for the current path in the browser, and to assert for content changes after a button click that initiates the redirection. By the way, asserting on the url after success testing the content changes still failed.
I don’t love the work around, because there is value in confirming the url if the intention is to alter the navigator state, but I had to move past the issue.
This feels like a Capybara issue though. Turbo/Rails is doing what’s expected.