Calabash-android pre-defined steps, calabashandroid
The canned_steps.md In the Calabash-android directory lists a series of predefined steps, which are defined in the calabash-android \ steps \ directory. This article describes the steps and usage.
1. asserted steps: defined in assert_steps.rb
The assertions see the text:
Then /^I see the text "([^\"]*)"$/Then /^I see "([^\"]*)"$/Then /^I should see "([^\"]*)"$/Then /^I should see text containing "([^\"]*)"$/
Example:
Feature: Hello word Scenario: See hello word The I see the text "Hello world"
No text is displayed for the assertion:
Then /^I should not see "([^\"]*)"$/Then /^I don't see the text "([^\"]*)"$/Then /^I don't see "([^\"]*)"$/
2. Input steps: defined in
Click the check box
Then /^I toggle checkbox number (\d+)$/ do |index|
Example:
# Click the first checkboxThen I togle checkbox number 1
Context_menu_steps:
Then/^ I long press "([^ \"] *) "$/do | text | example: then I long press "Stop" long press its attribute text = "Stop" View
3. Button
Click the return button:
Then I go back
Click Menu
Then I press the menu key
Enter entey on the keyboard
Then I press the enter button
4. gestures
Move to left
Then I swipe left
Slide to the right
Then I swipe right
Slide up and down for list controls
Then I scroll downThen I scroll up
Select menu_item from menu
# Select quitThen I select "quit" from menu
Drag from one point to another
Then /^I drag from (\d+):(\d+) to (\d+):(\d+) moving with (\d+) steps$/ do |from_x, from_y, to_x, to_y, steps|