[HN Gopher] Show HN: Visual debugger for Rails system tests
___________________________________________________________________
Show HN: Visual debugger for Rails system tests
Hey all, I've been working on this side project to get a
Cypress.io-like experience, but for Ruby developers. It's plug-n-
play with Capybara system tests, with the following features: -
visualize assertions/commands as they happen - view all API
requests, errors, and logs in the timeline - pause/continue on any
step - rewind through history with a recorded video This is brand
new, so looking for people to start trying it out and leave
feedback.
Author : waveywhy
Score : 95 points
Date : 2024-05-07 13:32 UTC (9 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| tomhallett wrote:
| Very cool! Will definitely check it out.
|
| Random question: when you "pause" a test, is it actually pausing
| the capybara/rspec test such that I can have a
| breakpoint/debugger/REPL experience to try out various
| capybara/rspec code?
|
| The reason I ask: one of the slowest/annoying parts of writing
| capybara tests is the context jump between "this is the css
| selector i get from chrome dev tools" and "this is the
| capybara/rspec code which I use in my tests". While they are
| similar, there are differences which slow things down: locating
| buttons based on text (vs css), case sensitivity issues with
| text, ambigious matches, wanting to use nested "find" calls [ie:
| find(css: ".modal").click_button("Close")], trying to use page
| objects vs selectors directly in tests, etc.
|
| Often times my first attempt is "close" but not quite right,
| which compounds when you hit that on most steps of the user's
| flow.
|
| super stretch goal: if you are using page objects in your rails
| app, if the page objects where written in a way that "cyperful"
| could parse them, you COULD have a feature where cyperful could
| highlight the page objects on the page. So instead of showing me
| css selectors, you draw a box around a page/section object.
|
| I know that Playwright was doing some cool stuff with their "Pick
| Locators" and it allowing you to test playwright locators in the
| tool, not sure if this ever got extended to Page Objects or not.
| https://playwright.dev/docs/test-ui-mode#pick-locator
| waveywhy wrote:
| > is it actually pausing the capybara/rspec test such that I
| can have a breakpoint/debugger/REPL experience to try out
| various capybara/rspec code
|
| That's a good idea. The actual method of pausing is with a ruby
| Queue#pop within the same thread that the actual ruby test
| source code is running in. I'm not sure the exact mechanism,
| but I assume you could run a binding.pry instead, as long as
| you can "cancel" it from another thread.
| block_dagger wrote:
| If this avoids save_and_open_screenshot loops, it will be very
| valuable for reducing debug grind. Will take a look.
| mooktakim wrote:
| This could be a nice UI to let you create the test visually.
| Alifatisk wrote:
| I thought the same
| waveywhy wrote:
| I like this idea, it's even on my future roadmap: "Record
| browser interactions to save as ruby code"
|
| Is there an example of a tool doing this well?
| ciaran_lee wrote:
| looking forward to trying this!
| lgreiv wrote:
| Slightly different approach, but appears to have the same
| overarching goals: https://github.com/bullet-train-co/magic_test
|
| ,,Magic Test allows you to write Rails system tests interactively
| through a combination of trial-and-error in a debugger session
| and also just simple clicking around in the application being
| tested, all without the slowness of constantly restarting the
| testing environment."
|
| I will keep an eye on both now, probably they will compliment
| each other at some point in time.
| stirkac wrote:
| wow, this is awesome, thanks for sharing!
___________________________________________________________________
(page generated 2024-05-07 23:01 UTC)