testdouble / cypress-rails

Helps you write Cypress tests of your Rails app
Other
321 stars 48 forks source link

Question: capybara driver? #107

Closed sdhull closed 2 years ago

sdhull commented 2 years ago

Hi there! 👋 this looks like a really cool tool and I can't wait to "test" it out (pun intended, apologies)

One thought I couldn't shake while reading the Readme was this: Capybara is intended to be an abstraction that can drive various frontend tests (it works with selenium of course, but also Rack::Test, mechanize, poltergeist, etc). Couldn't Cypress be a capybara driver?

One of the things I've always liked about Capybara is that it encourages good accessibility practices. For example, if you do fill_in "Name", with: "John Doe", it's going to look for a field with a label that has the text "Name", just like someone using a screen reader would.

I'm eager to try out Cypress but I want to see it integrated into the rest of my rspec test suite. And better yet, if I could simply swap the selenium driver with Cypress to get more reliable test runs, videos of test runs, and a better debugging experience, that seems like it would be a huge win!

searls commented 2 years ago

I don't think something like this would be achievable without forking Cypress to create a seam by which the test runner system is bypassed and rearchitecting how its JavaScript API controls browser behavior so that it can communicate back via Capybara's driver API. If I'm understanding what you're asking, this would be a daunting task.

sdhull commented 2 years ago

Thanks for the reply! I'll mull it a bit more but totally understand that's way out of scope for this particular project 😄