Calabash-android 预定义steps

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

3.按钮

点击返回按钮:

Then I go back
点击Menu

Then I press the menu key
模拟用户在键盘上输入entey

Then I press the enter button

4.手势

往左滑动

Then I swipe left
往右侧滑动

Then I swipe right

上下滑动,用于list控件

Then I scroll down
Then I scroll up

从menu中选择menu_item

#从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|


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值