问题
We are working right now with Ruby, Cucumber and Selenium to perform our integration tests.
Right now we want to improve the quality of our tests and therefore we want to use Capybara.
Now since all our methods need to be rewritten for that, we thought maybe someone has already done that and wrote a wrapper for the selenium webdriver, where Capybara does the job.
For example:
The wrapper should replace the following:
driver.navigate_to "/home"
to something like
visit "/home"
The point is, we don´t want to rewrite all our code, since the functionality out of my view is quite of the same and it should not be that difficult to write a wrapper for driver, which does this automatically. Means: the navigate_to method just calls a visit method, and I am happy.
Do I have to write this on my own, or was this already done?
Thanks alot!
回答1:
No, there is no existing wrapper for that.
You seem to be missing the fact that Capybara is itself a wrapper around selenium-webdriver, so you are asking for a selenium compatible wrapper around a wrapper around selenium. This coupled with the fact that if all you do is emulate your existing selenium commands with Capybara commands you won't be gaining anything from Capybara, so it's pointless. It sounds like your team would be better off leaving the existing tests as they are, writing all new tests using Capybara, and as existing tests need change/maintenance rewriting them to use Capybara with it's built-in waiting/retrying and friendlier API.
来源:https://stackoverflow.com/questions/45893060/upgrade-old-project-to-capybara