How to override Calabash predefined step?

I define custom calabash steps (for use on both iOS and Android) and would like to selectively override the various predefined steps. Example:

Given /^I press the "([^\"]*)" button$/ do |text|
  tap_when_element_exists("android.widget.Button {text CONTAINS[c] '#{text}'}")
end

Instead of using this implementation, I would like to provide my own. If I define and use a step with the appropriate regular expression, I get an error:

Ambiguous match of "I press the "big red" button"

He also suggests using --guess, but that didn’t help, and I still get the error Cucumber::Ambiguous. I could make some changes to the regex for my step, for example:

I tap the "big red" button

But this seems like a bad decision for several reasons.

  • To prevent the use of the built-in step, especially since it may be the most natural phrase
  • canned_steps ,
    • , Android iOS. , , iOS Android, Cucumber::Ambiguous Android.
  • , ( QA), , ,

? android canned_step , : You can add your own steps or change the ones you see here

(: calabash_steps.rb). , . , , calabash gem .

+4
1

, . , , calabash gem .

features/support/env.rb require calabash-android/cucumber

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

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

calabash-android features/step_definitions/canned_steps.rb.

.

- Calabash 2.0: iOS Android API. calabash . rspec . .

+4

All Articles