How to override a Calabash predefined step?

人走茶凉 提交于 2019-12-05 14:29:13

I'd rather phase them out only when they become a problem. And I don't want to directly edit the calabash code if I can help it, as that would require rolling my own calabash distro instead of using gem to install it.

In your features/support/env.rb, replace require calabash-android/cucumber with

require 'calabash-android/color_helper'
require 'calabash-android/operations'

World(Calabash::Android::ColorHelper)
World(Calabash::Android::Operations)

Then copy the calabash-android canned steps to a file in your project features/step_definitions/canned_steps.rb.

Remove or replace the predefined steps as needed.

And a heads up - we are working on Calabash 2.0: a merge of the iOS and Android APIs. We are talking about removing the pre-defined steps from the new calabash gem and distributing them as a separate gem. As an example have a look at the way rspec distributes behaviors as separate gems. No decision has been made about this yet.

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