Ask A Question

Notifications

You’re not receiving notifications from this thread.

Testing Turbolinks 3 partial replacement

Patrick Berarducci asked in Testing

Hey Chris (and everyone else) - Have you played around much with Turbolinks 3 partial replacement? (Chris, I wathed your livecoding segment; was great, thanks.) I'm using it with Rails 4.2.5, and it's working pretty well. My problem is that I can't seem to pick up the partial replacement in my feature tests (using Rspec/capybara/poltergeist). In other words, in my test, I'll visit the page, simulate the event (email entered and button click), and expect the resulting page to include the text from the partial replacement. But the text isn't showing up on the test page. I have js turned on. I couldn't afford to spend a ton of time trying to figure it out, so maybe I missed something. If anyone has any experience with this (e.g., you have or have not gotten tests to work for turbolinks 3 partial-replacement), I'd be interested to hear.

I did some googling and didn't find much on point. I can live without coverage on this for now, but if I can't figure out a testing strategy for partial replacement, I may not use it as much in other parts of the site. I can always resort to js links, react components or just standard page loads.

Reply

I just was looking into Turbolinks 5 yesterday and it looks like they've ditched partial replacement because it's sort of trivial gains in comparison to the complexity it adds (their claim) and I kinda agree.

I'm curious, do you know if poltergeist is executing the JS? A previous project I was using ran tests with Firefox and that made it a bit easier to pause and debug what was going wrong with them. Often it was something like that.

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,464+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.