Upgrade old project to capybara

旧巷老猫 提交于 2020-04-21 13:35:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!