Wednesday, July 10, 2013

calabash-android Input Steps

INPUT STEPS

Then /^I toggle checkbox number (\d+)$/ do |checkboxNumber|
Toggles checkout with the specified index.

Then /^I long press "([^\"]*)"$/ do |text_to_press|
Long presses the text if found.

Then /^I long press "([^\"]*)" and select item number "([^\"]*)"$/ do |text_to_press, index|
Long presses the text (if found) and select the specified number in the context menu that appear.

Then /^I long press "([^\"]*)" and select "([^\"]*)"$/ do |text_to_press, context_text|
Long presses the text (if found) and select the specified number in the context menu that appear.

Given /^I set the date to "(\d\d-\d\d-\d\d\d\d)" on DatePicker with index "([^\"]*)"$/ do |date, index|
Finds the datepicker with the specified index and changes the date.

Given /^I set the time to "(\d\d:\d\d)" on TimePicker with index "([^\"]*)"$/
Given /^I set the "([^\"]*)" time to "(\d\d:\d\d)"$/
Finds the timepicker with the specified index and changes the time.

Given /^I set the "([^\"]*)" date to "(\d\d-\d\d-\d\d\d\d)"$/ do |content_description, date|
Find the datepicker by content description and changes the date.

Then /^I enter "([^\"]*)" into input field number (\d+)$/ do |text, number|
Enters the specified text into the input field with index number.

Then /^I enter text "([^\"]*)" into field with id "([^\"]*)"$/ do |text, view_id|
Enters Text into the input field with id view_id.

Then /^I enter "([^\"]*)" as "([^\"]*)"$/ do |text, target|
Then /^I enter "([^\"]*)" into "([^\"]*)"$/ do |text, target|
Enters the specified text into the input field that has a content desciption that matches the provided target.

Then /^I clear input field number (\d+)$/ do |number|
Finds a input field by index and blanks its value.

Then /^I clear "([^\"]*)"$/ do |name|
Finds a input field with matching content description and blanks its value.

Then /^I clear input field with id "([^\"]*)"$/ do |view_id|
Finds the input field with id view_id and clears the text from it.

Then /^I select "([^\"]*)" from "([^\"]*)"$/ do |item_text, spinner_content_description|
Finds the Spinner by 'spinner_content_description' and selects the item with the matching 'item_text'

calabash-android Waiting Steps

WAITING STEPS

This is one of the major aspects of any Test Automation. Waiting for Object (Image,Text,Label,Link, Button etc) to appear before launching\Perform the next user action.

The Custom Steps to WAIT are as described below:

Then /^I wait for progress$/ do
Will wait till there is no more progress bars.

Then /^I wait for dialog to close$/
Waits for the current dialog to close.

Then /^I wait for "([^\"]*)" to appear$/
Then /^I wait to see "([^\"]*)"$/
Waits for the specified text to appear.

Then /^I wait up to (\d+) seconds for "([^\"]*)" to appear$/
Then /^I wait up to (\d+) seconds to see "([^\"]*)"$/
Waits for the specified text to appear, with a custom timeout

Then /^I wait for the "([^\"]*)" button to appear$/
Waits for a button with the specified text to appear.

Then /^I wait for the "([^\"]*)" screen to appear$/
Waits for a particular screen (Android Activity) to appear.

Then /^I wait for the view with id "([^\"]*)" to appear$/ do |text|
Waits for a view view that id to appear. Note that use the short name and not the fully quantified name. That means if your id is 'com.foo.R.id.bar_label' you would use 'I press view with id "bar_label"'.

Then /^I wait up to (\d+) seconds for the "([^\"]*)" screen to appear$/
Then /^I wait upto (\d+) seconds for the "([^\"]*)" screen to appear$/
Waits for a particular screen (Android Activity) to appear with a timeout.

Then /^I wait for 1 second$/
Then /^I wait for a second$/
Waits for one second.

Then /^I wait$/
Waits for two seconds.

Then /^I wait for (\d+) seconds$/
Waits for a specified number of seconds

calabash-android Buttons Steps

BUTTONS STEPS

Simulates that the user pressed the back button.
Then /^I go back$/

Simulates that the user pressed the menu button.
Then /^I press the menu key$/

Simulates that the user pressed the enter button on the keyboard.
Then /^I press the enter button$/ do