A series of predefined steps are listed in Canned_steps.md in the Calabash-android directory, and these steps are defined in the Calabash-android\steps\ directory. This article describes these steps and usage.
1. Assert steps: Defined in ASSERT_STEPS.RB
The assertion sees the text:
Then/^i see the text "([^\]]*)" $/then/^i See "([^\]]*)" $/then/^i should See "([^\]]*)" $/then/^i should see text Contai Ning "([^\"]*) "$/
Cases:
Feature:hello word scenario:see Hello word the I see the text "Hello World"
Assertion does not see text:
Then /^I should not see "([^\"]*)"$/Then /^I don‘t see the text "([^\"]*)"$/Then /^I don‘t see "([^\"]*)"$/
2. Enter steps: Defined in
Click the check box
Then /^I toggle checkbox number (\d+)$/ do |index|
Cases:
#点击第一个checkboxThen I togle checkbox number 1
Context_menu_steps:
Then/^i Long Press "([^\]"]*) "$/do |text| example: then I long presses" Stop "in its properties text=" Stop "view
3. Button
Click the Back button:
Then I go back
Click menu
Then I press the Menu key
Impersonate the user to enter Entey on the keyboard
Then I Press the Enter button
4. Gestures
Swipe left
Then I Swipe left
Swipe to the right
Then I swipe right
Swipe up and down for the list control
Then I scroll downthen i scroll up
Select Menu_item from the menu
#从menu中选择quitThen I Select "Quit" from the 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|
Calabash-android pre-defined steps