Calabash-android目录下的canned_steps.md中列出了一系列预定义的steps,这些steps的定义位于calabash-android\steps\目录下。本文将介绍这些steps和用法。
1.断言steps:定义在assert_steps.rb中
断言看到了文本:
Then /^I see the text "([^\"]*)"$/ Then /^I see "([^\"]*)"$/ Then /^I should see "([^\"]*)"$/ Then /^I should see text containing "([^\"]*)"$/
Feature: Hello word Scenario: See hello word The I see the text "Hello world"断言没看到文本:
Then /^I should not see "([^\"]*)"$/
Then /^I don‘t see the text "([^\"]*)"$/
Then /^I don‘t see "([^\"]*)"$/
2.输入steps:定义在
点击复选框
Then /^I toggle checkbox number (\d+)$/ do |index|
例:#点击第一个checkbox Then I togle checkbox number 1
context_menu_steps:
Then /^I long press "([^\"]*)"$/ do |text| 例:Then I long press "Stop" 长按其属性text="Stop"的View
点击返回按钮:
Then I go back点击Menu
Then I press the menu key模拟用户在键盘上输入entey
Then I press the enter button
往左滑动
Then I swipe left往右侧滑动
Then I swipe right
Then I scroll down Then I scroll up
#从menu中选择quit Then I select "quit" from menu
Then /^I drag from (\d+):(\d+) to (\d+):(\d+) moving with (\d+) steps$/ do |from_x, from_y, to_x, to_y, steps|
原文地址:http://blog.csdn.net/bigconvience/article/details/39134535