|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.jayway.android.robotium.solo.Solo
public class Solo
This class contains all the methods that the sub-classes have. It supports test cases that span over multiple activities. Robotium has full support for Activities, Dialogs, Toasts, Menus and Context Menus. When writing tests there is no need to plan for or expect new activities in the test case. All is handled automatically by Robotium-Solo. Robotium-Solo can be used in conjunction with ActivityInstrumentationTestCase2. The test cases are written from a user perspective were technical details are not needed. Example of usage (test case spanning over multiple activities):
public void setUp() throws Exception {
solo = new Solo(getInstrumentation(), getActivity());
}
public void testTextShows() throws Exception {
solo.clickOnText("Categories");
solo.clickOnText("Other");
solo.clickOnButton("Edit");
solo.searchText("Edit Window");
solo.clickOnButton("Commit");
assertTrue(solo.searchText("Changes have been made successfully"));
}
| Field Summary | |
|---|---|
static int |
DELETE
|
static int |
DOWN
|
static int |
ENTER
|
static int |
LANDSCAPE
|
static int |
LEFT
|
static int |
MENU
|
static int |
PORTRAIT
|
static int |
RIGHT
|
static int |
UP
|
| Constructor Summary | |
|---|---|
Solo(android.app.Instrumentation inst,
android.app.Activity activity)
Constructor that takes in the instrumentation and the start activity. |
|
| Method Summary | ||
|---|---|---|
void |
assertCurrentActivity(String message,
Class expectedClass)
Asserts that the expected Activity is the currently active one. |
|
void |
assertCurrentActivity(String message,
Class expectedClass,
boolean isNewInstance)
Asserts that the expected Activity is the currently active one, with the possibility to
verify that the expected Activity is a new instance of the Activity. |
|
void |
assertCurrentActivity(String message,
String name)
Asserts that the expected Activity is the currently active one. |
|
void |
assertCurrentActivity(String message,
String name,
boolean isNewInstance)
Asserts that the expected Activity is the currently active one, with the possibility to
verify that the expected Activity is a new instance of the Activity. |
|
void |
assertMemoryNotLow()
Asserts that the available memory in the system is not low. |
|
void |
clearEditText(android.widget.EditText editText)
Clears the value of an EditText. |
|
void |
clearEditText(int index)
Clears the value of an EditText. |
|
ArrayList<android.widget.TextView> |
clickInList(int line)
Clicks on a given list line and returns an ArrayList of the TextView objects that
the list line is showing. |
|
ArrayList<android.widget.TextView> |
clickInList(int line,
int listIndex)
Clicks on a given list line on a specified list and returns an ArrayList of the TextViews that the list line is showing. |
|
void |
clickLongOnScreen(float x,
float y)
Long clicks a given coordinate on the screen. |
|
void |
clickLongOnScreen(float x,
float y,
int time)
Long clicks a given coordinate on the screen for a given amount of time. |
|
void |
clickLongOnText(String text)
Long clicks on a given View. |
|
void |
clickLongOnText(String text,
int match)
Long clicks on a given View. |
|
void |
clickLongOnText(String text,
int match,
boolean scroll)
Long clicks on a given View. |
|
void |
clickLongOnText(String text,
int match,
int time)
Long clicks on a given View. |
|
void |
clickLongOnTextAndPress(String text,
int index)
Long clicks on a given View and then selects
an item from the context menu that appears. |
|
void |
clickLongOnView(android.view.View view)
Long clicks on a given View. |
|
void |
clickLongOnView(android.view.View view,
int time)
Long clicks on a given View for a given amount of time. |
|
void |
clickOnButton(int index)
Clicks on a Button with a given index. |
|
void |
clickOnButton(String name)
Clicks on a Button with a given text. |
|
void |
clickOnCheckBox(int index)
Clicks on a CheckBox with a given index. |
|
void |
clickOnEditText(int index)
Clicks on an EditText with a given index. |
|
void |
clickOnImage(int index)
Clicks on an ImageView with a given index. |
|
void |
clickOnImageButton(int index)
Clicks on an ImageButton with a given index. |
|
void |
clickOnMenuItem(String text)
Clicks on a menu item with a given text. |
|
void |
clickOnMenuItem(String text,
boolean subMenu)
Clicks on a menu item with a given text. |
|
void |
clickOnRadioButton(int index)
Clicks on a RadioButton with a given index. |
|
void |
clickOnScreen(float x,
float y)
Clicks on a given coordinate on the screen. |
|
void |
clickOnText(String text)
Clicks on a View displaying a given
text. |
|
void |
clickOnText(String text,
int match)
Clicks on a View displaying a given text. |
|
void |
clickOnText(String text,
int match,
boolean scroll)
Clicks on a View displaying a given text. |
|
void |
clickOnToggleButton(String name)
Clicks on a ToggleButton with a given text. |
|
void |
clickOnView(android.view.View view)
Clicks on a given View. |
|
void |
drag(float fromX,
float toX,
float fromY,
float toY,
int stepCount)
Simulate touching a given location and dragging it to a new location. |
|
void |
enterText(android.widget.EditText editText,
String text)
Enters text into a given EditText. |
|
void |
enterText(int index,
String text)
Enters text into an EditText with a given index. |
|
void |
finalize()
All activites that have been active are finished. |
|
ArrayList<android.app.Activity> |
getAllOpenedActivities()
Returns an ArrayList of all the opened/active activities. |
|
android.widget.Button |
getButton(int index)
Returns a Button with a given index. |
|
android.widget.Button |
getButton(String text)
Returns a Button which shows a given text. |
|
android.app.Activity |
getCurrentActivity()
Returns the current Activity. |
|
ArrayList<android.widget.Button> |
getCurrentButtons()
Returns an ArrayList of the Button objects located in the current
Activity. |
|
ArrayList<android.widget.CheckBox> |
getCurrentCheckBoxes()
Returns an ArrayList of the CheckBox objects contained in the current
Activity. |
|
ArrayList<android.widget.DatePicker> |
getCurrentDatePickers()
Returns an ArrayList of the DatePicker objects contained in the current
Activity. |
|
ArrayList<android.widget.EditText> |
getCurrentEditTexts()
Returns an ArrayList of the EditText objects contained in the current
Activity. |
|
ArrayList<android.widget.GridView> |
getCurrentGridViews()
Returns an ArrayList of the GridView objects contained in the current
Activity. |
|
ArrayList<android.widget.ImageButton> |
getCurrentImageButtons()
Returns an ArrayList of the ImageButton objects contained in the current
Activity. |
|
ArrayList<android.widget.ImageView> |
getCurrentImageViews()
Returns an ArrayList of the ImageView objects contained in the current
Activity. |
|
ArrayList<android.widget.ListView> |
getCurrentListViews()
Returns an ArrayList of the ListView objects contained in the current
Activity. |
|
ArrayList<android.widget.ProgressBar> |
getCurrentProgressBars()
Returns an ArrayList of the ProgressBar objects contained in the current
Activity. |
|
ArrayList<android.widget.RadioButton> |
getCurrentRadioButtons()
Returns an ArrayList of the RadioButton objects contained in the current
Activity. |
|
ArrayList<android.widget.ScrollView> |
getCurrentScrollViews()
Returns an ArrayList of the ScrollView objects contained in the current
Activity. |
|
ArrayList<android.widget.Spinner> |
getCurrentSpinners()
Returns an ArrayList of the Spinner objects (drop-down menus) contained in the current
Activity. |
|
ArrayList<android.widget.TextView> |
getCurrentTextViews(android.view.View parent)
Returns an ArrayList of the TextView objects contained in the current
Activity or View. |
|
ArrayList<android.widget.TimePicker> |
getCurrentTimePickers()
Returns an ArrayList of the TimePicker objects contained in the current
Activity. |
|
ArrayList<android.widget.ToggleButton> |
getCurrentToggleButtons()
Returns an ArrayList of the ToggleButton objects contained in the current
Activity. |
|
android.widget.EditText |
getEditText(int index)
Returns an EditText with a given index. |
|
android.widget.EditText |
getEditText(String text)
Returns an EditText which shows a given text. |
|
android.widget.ImageView |
getImage(int index)
Returns an ImageView with a given index. |
|
android.widget.ImageButton |
getImageButton(int index)
Returns an ImageButton with a given index. |
|
String |
getString(int resId)
Returns a localized string. |
|
android.widget.TextView |
getText(int index)
Returns a TextView with a given index. |
|
android.widget.TextView |
getText(String text)
Returns a TextView which shows a given text. |
|
android.view.View |
getTopParent(android.view.View view)
Returns the absolute top parent View in for a given View. |
|
android.view.View |
getView(int id)
Returns a View with a given id. |
|
ArrayList<android.view.View> |
getViews()
Returns an ArrayList of the View objects located in the current
Activity. |
|
ArrayList<android.view.View> |
getViews(android.view.View parent)
Returns an ArrayList of the View objects contained in the parent view |
|
void |
goBack()
Simulates pressing the hardware back key. |
|
void |
goBackToActivity(String name)
Returns to the given Activity. |
|
boolean |
isCheckBoxChecked(int index)
Checks if a CheckBox with a given index is checked. |
|
boolean |
isCheckBoxChecked(String text)
Checks if a CheckBox with a given text is checked. |
|
boolean |
isRadioButtonChecked(int index)
Checks if a RadioButton with a given index is checked. |
|
boolean |
isRadioButtonChecked(String text)
Checks if a RadioButton with a given text is checked. |
|
boolean |
isSpinnerTextSelected(int index,
String text)
Checks if a given text is selected in a given Spinner. |
|
boolean |
isSpinnerTextSelected(String text)
Checks if a given text is selected in any Spinner located on the current screen. |
|
boolean |
isTextChecked(String text)
Checks if the given text is checked. |
|
boolean |
isToggleButtonChecked(int index)
Checks if a ToggleButton with a given index is checked. |
|
boolean |
isToggleButtonChecked(String text)
Checks if a ToggleButton with a given text is checked. |
|
void |
pressMenuItem(int index)
Presses a MenuItem with a given index. |
|
void |
pressSpinnerItem(int spinnerIndex,
int itemIndex)
Presses on a Spinner (drop-down menu) item. |
|
boolean |
scrollDown()
Scrolls down the screen. |
|
boolean |
scrollDownList(int listIndex)
Scrolls down a list with a given listIndex. |
|
void |
scrollToSide(int side)
Scrolls horizontally. |
|
boolean |
scrollUp()
Scrolls up the screen. |
|
boolean |
scrollUpList(int listIndex)
Scrolls up a list with a given listIndex. |
|
boolean |
searchButton(String text)
Searches for a Button with the given text string and returns true if at least one Button
is found. |
|
boolean |
searchButton(String text,
boolean onlyVisible)
Searches for a Button with the given text string and returns true if at least one Button
is found. |
|
boolean |
searchButton(String text,
int minimumNumberOfMatches)
Searches for a Button with the given text string and returns true if the
searched Button is found a given number of times. |
|
boolean |
searchButton(String text,
int minimumNumberOfMatches,
boolean onlyVisible)
Searches for a Button with the given text string and returns true if the
searched Button is found a given number of times. |
|
boolean |
searchEditText(String text)
Searches for a text string in the EditText objects located in the current
Activity. |
|
boolean |
searchText(String text)
Searches for a text string and returns true if at least one item
is found with the expected text. |
|
boolean |
searchText(String text,
boolean onlyVisible)
Searches for a text string and returns true if at least one item
is found with the expected text. |
|
boolean |
searchText(String text,
int minimumNumberOfMatches)
Searches for a text string and returns true if the searched text is found a given
number of times. |
|
boolean |
searchText(String text,
int minimumNumberOfMatches,
boolean scroll)
Searches for a text string and returns true if the searched text is found a given
number of times. |
|
boolean |
searchText(String text,
int minimumNumberOfMatches,
boolean scroll,
boolean onlyVisible)
Searches for a text string and returns true if the searched text is found a given
number of times. |
|
boolean |
searchToggleButton(String text)
Searches for a ToggleButton with the given text string and returns true if at least one ToggleButton
is found. |
|
boolean |
searchToggleButton(String text,
int minimumNumberOfMatches)
Searches for a ToggleButton with the given text string and returns true if the
searched ToggleButton is found a given number of times. |
|
void |
sendKey(int key)
Tells Robotium to send a key: Right, Left, Up, Down, Enter, Menu, Delete, Call or End Call. |
|
void |
setActivityOrientation(int orientation)
Sets the Orientation (Landscape/Portrait) for the current activity. |
|
void |
setDatePicker(android.widget.DatePicker datePicker,
int year,
int monthOfYear,
int dayOfMonth)
Sets the date in a given DatePicker. |
|
void |
setDatePicker(int index,
int year,
int monthOfYear,
int dayOfMonth)
Sets the date in a DatePicker with a given index. |
|
void |
setProgressBar(int index,
int progress)
Sets the progress of a ProgressBar with a given index. |
|
void |
setProgressBar(android.widget.ProgressBar progressBar,
int progress)
Sets the progress of a given ProgressBar. |
|
void |
setTimePicker(int index,
int hour,
int minute)
Sets the time in a TimePicker with a given index. |
|
void |
setTimePicker(android.widget.TimePicker timePicker,
int hour,
int minute)
Sets the time in a given TimePicker. |
|
void |
sleep(int time)
Robotium will sleep for a specified time. |
|
boolean |
waitForActivity(String name,
int timeout)
Waits for the given Activity. |
|
boolean |
waitForDialogToClose(long timeout)
Waits for a Dialog to close. |
|
boolean |
waitForText(String text)
Waits for a text to be shown. |
|
boolean |
waitForText(String text,
int minimumNumberOfMatches,
long timeout)
Waits for a text to be shown. |
|
boolean |
waitForText(String text,
int minimumNumberOfMatches,
long timeout,
boolean scroll)
Waits for a text to be shown. |
|
|
waitForView(Class<T> viewClass,
int minimumNumberOfMatches,
int timeout)
Waits for a view to be shown. |
|
|
waitForView(Class<T> viewClass,
int minimumNumberOfMatches,
int timeout,
boolean scroll)
Waits for a view to be shown. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int LANDSCAPE
public static final int PORTRAIT
public static final int RIGHT
public static final int LEFT
public static final int UP
public static final int DOWN
public static final int ENTER
public static final int MENU
public static final int DELETE
| Constructor Detail |
|---|
public Solo(android.app.Instrumentation inst,
android.app.Activity activity)
inst - the Instrumentation instance.activity - Activity the start activity| Method Detail |
|---|
public ArrayList<android.view.View> getViews()
ArrayList of the View objects located in the current
Activity.
ArrayList of the View objects located in the current Activitypublic ArrayList<android.view.View> getViews(android.view.View parent)
ArrayList of the View objects contained in the parent view
parent - the parent view from which to return the views
ArrayList of the View objects contained in the given Viewpublic android.view.View getTopParent(android.view.View view)
View in for a given View.
view - the View whose top parent is requested
Viewpublic void clearEditText(int index)
EditText.
index - the index of the EditText that should be cleared. 0 if only one is availablepublic void clearEditText(android.widget.EditText editText)
EditText.
editText - the EditText that should be clearedpublic boolean waitForText(String text)
text - the text that is expected to be shown
true if text is shown and false if it is not shown before the timeout
public boolean waitForText(String text,
int minimumNumberOfMatches,
long timeout)
text - the text that needs to be shownminimumNumberOfMatches - the minimum number of matches that are expected to be shown. 0 means any number of matchestimeout - the the amount of time in milliseconds to wait
true if text is shown and false if it is not shown before the timeout
public boolean waitForText(String text,
int minimumNumberOfMatches,
long timeout,
boolean scroll)
text - the text that needs to be shownminimumNumberOfMatches - the minimum number of matches that are expected to be shown. 0 means any number of matchestimeout - the the amount of time in milliseconds to waitscroll - true if scrolling should be performed
true if text is shown and false if it is not shown before the timeout
public <T extends android.view.View> boolean waitForView(Class<T> viewClass,
int minimumNumberOfMatches,
int timeout)
viewClass - the View class to wait forminimumNumberOfMatches - the minimum number of matches that are expected to be shown. 0 means any number of matchestimeout - the amount of time in milliseconds to wait
true if view is shown and false if it is not shown before the timeout
public <T extends android.view.View> boolean waitForView(Class<T> viewClass,
int minimumNumberOfMatches,
int timeout,
boolean scroll)
viewClass - the View class to wait forminimumNumberOfMatches - the minimum number of matches that are expected to be shown. 0 means any number of matchestimeout - the amount of time in milliseconds to waitscroll - true if scrolling should be performed
true if view is shown and false if it is not shown before the timeoutpublic boolean searchEditText(String text)
EditText objects located in the current
Activity. Will automatically scroll when needed.
text - the text to search for
true if an EditText with the given text is found or false if it is not foundpublic boolean searchButton(String text)
Button with the given text string and returns true if at least one Button
is found. Will automatically scroll when needed.
text - the text to search for. The parameter will be interpreted as a regular expression
true if a Button with the given text is found and false if it is not found
public boolean searchButton(String text,
boolean onlyVisible)
Button with the given text string and returns true if at least one Button
is found. Will automatically scroll when needed.
text - the text to search for. The parameter will be interpreted as a regular expressiononlyVisible - true if only Button visible on the screen should be searched
true if a Button with the given text is found and false if it is not foundpublic boolean searchToggleButton(String text)
ToggleButton with the given text string and returns true if at least one ToggleButton
is found. Will automatically scroll when needed.
text - the text to search for. The parameter will be interpreted as a regular expression
true if a ToggleButton with the given text is found and false if it is not found
public boolean searchButton(String text,
int minimumNumberOfMatches)
Button with the given text string and returns true if the
searched Button is found a given number of times. Will automatically scroll when needed.
text - the text to search for. The parameter will be interpreted as a regular expressionminimumNumberOfMatches - the minimum number of matches expected to be found. 0 matches means that one or more
matches are expected to be found
true if a Button with the given text is found a given number of times and false
if it is not found
public boolean searchButton(String text,
int minimumNumberOfMatches,
boolean onlyVisible)
Button with the given text string and returns true if the
searched Button is found a given number of times. Will automatically scroll when needed.
text - the text to search for. The parameter will be interpreted as a regular expressionminimumNumberOfMatches - the minimum number of matches expected to be found. 0 matches means that one or more
matches are expected to be foundonlyVisible - true if only Button visible on the screen should be searched
true if a Button with the given text is found a given number of times and false
if it is not found
public boolean searchToggleButton(String text,
int minimumNumberOfMatches)
ToggleButton with the given text string and returns true if the
searched ToggleButton is found a given number of times. Will automatically scroll when needed.
text - the text to search for. The parameter will be interpreted as a regular expressionminimumNumberOfMatches - the minimum number of matches expected to be found. 0 matches means that one or more
matches are expected to be found
true if a ToggleButton with the given text is found a given number of times and false
if it is not foundpublic boolean searchText(String text)
true if at least one item
is found with the expected text. Will automatically scroll when needed.
text - the text to search for. The parameter will be interpreted as a regular expression
true if the search string is found and false if it is not found
public boolean searchText(String text,
boolean onlyVisible)
true if at least one item
is found with the expected text. Will automatically scroll when needed.
text - the text to search for. The parameter will be interpreted as a regular expressiononlyVisible - true if only texts visible on the screen should be searched
true if the search string is found and false if it is not found
public boolean searchText(String text,
int minimumNumberOfMatches)
true if the searched text is found a given
number of times. Will automatically scroll when needed.
text - the text to search for. The parameter will be interpreted as a regular expressionminimumNumberOfMatches - the minimum number of matches expected to be found. 0 matches means that one or more
matches are expected to be found
true if text string is found a given number of times and false if the text string
is not found
public boolean searchText(String text,
int minimumNumberOfMatches,
boolean scroll)
true if the searched text is found a given
number of times.
text - the text to search for. The parameter will be interpreted as a regular expression.minimumNumberOfMatches - the minimum number of matches expected to be found. 0 matches means that one or more
matches are expected to be foundscroll - true if scrolling should be performed
true if text string is found a given number of times and false if the text string
is not found
public boolean searchText(String text,
int minimumNumberOfMatches,
boolean scroll,
boolean onlyVisible)
true if the searched text is found a given
number of times.
text - the text to search for. The parameter will be interpreted as a regular expression.minimumNumberOfMatches - the minimum number of matches expected to be found. 0 matches means that one or more
matches are expected to be foundscroll - true if scrolling should be performedonlyVisible - true if only texts visible on the screen should be searched
true if text string is found a given number of times and false if the text string
is not foundpublic void setActivityOrientation(int orientation)
orientation - the orientation to be set. Solo.LANDSCAPE for landscape or
Solo.PORTRAIT for portrait.public ArrayList<android.app.Activity> getAllOpenedActivities()
ArrayList of all the opened/active activities.
ArrayList of all the opened/active activitiespublic android.app.Activity getCurrentActivity()
Activity.
Activity
public void assertCurrentActivity(String message,
String name)
Activity is the currently active one.
message - the message that should be displayed if the assert failsname - the name of the Activity that is expected to be active e.g. "MyActivity"
public void assertCurrentActivity(String message,
Class expectedClass)
Activity is the currently active one.
message - the message that should be displayed if the assert failsexpectedClass - the Class object that is expected to be active e.g. MyActivity.class
public void assertCurrentActivity(String message,
String name,
boolean isNewInstance)
Activity is the currently active one, with the possibility to
verify that the expected Activity is a new instance of the Activity.
message - the message that should be displayed if the assert failsname - the name of the activity that is expected to be active e.g. "MyActivity"isNewInstance - true if the expected Activity is a new instance of the Activity
public void assertCurrentActivity(String message,
Class expectedClass,
boolean isNewInstance)
Activity is the currently active one, with the possibility to
verify that the expected Activity is a new instance of the Activity.
message - the message that should be displayed if the assert failsexpectedClass - the Class object that is expected to be active e.g. MyActivity.classisNewInstance - true if the expected Activity is a new instance of the Activitypublic void assertMemoryNotLow()
public boolean waitForDialogToClose(long timeout)
Dialog to close.
timeout - the amount of time in milliseconds to wait
true if the Dialog is closed before the timeout and false if it is not closedpublic void goBack()
public void clickOnScreen(float x,
float y)
x - the x coordinatey - the y coordinate
public void clickLongOnScreen(float x,
float y)
x - the x coordinatey - the y coordinate
public void clickLongOnScreen(float x,
float y,
int time)
x - the x coordinatey - the y coordinatetime - the amount of time to long clickpublic void clickOnButton(String name)
Button with a given text. Will automatically scroll when needed.
name - the name of the Button presented to the user. The parameter will be interpreted as a regular expressionpublic void clickOnImageButton(int index)
ImageButton with a given index.
index - the index of the ImageButton to be clicked. 0 if only one is availablepublic void clickOnToggleButton(String name)
ToggleButton with a given text.
name - the name of the ToggleButton presented to the user. The parameter will be interpreted as a regular expressionpublic void clickOnMenuItem(String text)
text - the menu text that should be clicked on. The parameter will be interpreted as a regular expression
public void clickOnMenuItem(String text,
boolean subMenu)
text - the menu text that should be clicked on. The parameter will be interpreted as a regular expressionsubMenu - true if the menu item could be located in a sub menupublic void pressMenuItem(int index)
MenuItem with a given index. Index 0 is the first item in the
first row, Index 3 is the first item in the second row and
index 5 is the first item in the third row.
index - the index of the menu item to be pressed
public void pressSpinnerItem(int spinnerIndex,
int itemIndex)
Spinner (drop-down menu) item.
spinnerIndex - the index of the Spinner menu to be useditemIndex - the index of the Spinner item to be pressed relative to the currently selected item
A Negative number moves up on the Spinner, positive moves downpublic void clickOnView(android.view.View view)
View.
view - the View that should be clickedpublic void clickLongOnView(android.view.View view)
View.
view - the view that should be long clicked
public void clickLongOnView(android.view.View view,
int time)
View for a given amount of time.
view - the view that should be long clickedtime - the amount of time to long clickpublic void clickOnText(String text)
View displaying a given
text. Will automatically scroll when needed.
text - the text that should be clicked on. The parameter will be interpreted as a regular expression
public void clickOnText(String text,
int match)
View displaying a given text. Will automatically scroll when needed.
text - the text that should be clicked on. The parameter will be interpreted as a regular expressionmatch - the match that should be clicked on
public void clickOnText(String text,
int match,
boolean scroll)
View displaying a given text.
text - the text that should be clicked on. The parameter will be interpreted as a regular expressionmatch - the match that should be clicked onscroll - true if scrolling should be performedpublic void clickLongOnText(String text)
View. Will automatically scroll when needed. clickOnText(String) can then be
used to click on the context menu items that appear after the long click.
text - the text that should be clicked on. The parameter will be interpreted as a regular expression
public void clickLongOnText(String text,
int match)
View. Will automatically scroll when needed. clickOnText(String) can then be
used to click on the context menu items that appear after the long click.
text - the text that should be clicked on. The parameter will be interpreted as a regular expressionmatch - the match that should be clicked on
public void clickLongOnText(String text,
int match,
boolean scroll)
View. clickOnText(String) can then be
used to click on the context menu items that appear after the long click.
text - the text that should be clicked on. The parameter will be interpreted as a regular expressionmatch - the match that should be clicked onscroll - true if scrolling should be performed
public void clickLongOnText(String text,
int match,
int time)
View. clickOnText(String) can then be
used to click on the context menu items that appear after the long click.
text - the text that should be clicked on. The parameter will be interpreted as a regular expressionmatch - the match that should be clicked ontime - the amount of time to long click
public void clickLongOnTextAndPress(String text,
int index)
View and then selects
an item from the context menu that appears. Will automatically scroll when needed.
text - the text to be clicked on. The parameter will be interpreted as a regular expressionindex - the index of the menu item to be pressed. 0 if only one is availablepublic void clickOnButton(int index)
Button with a given index.
index - the index number of the Button. 0 if only one is availablepublic void clickOnRadioButton(int index)
RadioButton with a given index.
index - the index of the RadioButton to be clicked. 0 if only one is availablepublic void clickOnCheckBox(int index)
CheckBox with a given index.
index - the index of the CheckBox to be clicked. 0 if only one is availablepublic void clickOnEditText(int index)
EditText with a given index.
index - the index of the EditText to be clicked. 0 if only one is availablepublic ArrayList<android.widget.TextView> clickInList(int line)
ArrayList of the TextView objects that
the list line is showing. Will use the first list it finds.
line - the line that should be clicked
ArrayList of the TextView objects located in the list line
public ArrayList<android.widget.TextView> clickInList(int line,
int listIndex)
ArrayList of the TextViews that the list line is showing.
line - the line that should be clickedlistIndex - the index of the list. 1 if two lists are available
ArrayList of the TextView objects located in the list line
public void drag(float fromX,
float toX,
float fromY,
float toY,
int stepCount)
TouchUtils.java in the Android Open Source Project, and modified here.
fromX - X coordinate of the initial touch, in screen coordinatestoX - X coordinate of the drag destination, in screen coordinatesfromY - X coordinate of the initial touch, in screen coordinatestoY - Y coordinate of the drag destination, in screen coordinatesstepCount - How many move steps to include in the dragpublic boolean scrollDown()
true if more scrolling can be done and false if it is at the end of
the screenpublic boolean scrollUp()
true if more scrolling can be done and false if it is at the top of
the screenpublic boolean scrollDownList(int listIndex)
listIndex.
listIndex - the ListView to be scrolled. 0 if only one list is available
true if more scrolling can be donepublic boolean scrollUpList(int listIndex)
listIndex.
listIndex - the ListView to be scrolled. 0 if only one list is available
true if more scrolling can be donepublic void scrollToSide(int side)
side - the side to which to scroll; RIGHT or LEFT
public void setDatePicker(int index,
int year,
int monthOfYear,
int dayOfMonth)
DatePicker with a given index.
index - the index of the DatePicker. 0 if only one is availableyear - the year e.g. 2011monthOfYear - the month e.g. 03dayOfMonth - the day e.g. 10
public void setDatePicker(android.widget.DatePicker datePicker,
int year,
int monthOfYear,
int dayOfMonth)
DatePicker.
datePicker - the DatePicker object.year - the year e.g. 2011monthOfYear - the month e.g. 03dayOfMonth - the day e.g. 10
public void setTimePicker(int index,
int hour,
int minute)
TimePicker with a given index.
index - the index of the TimePicker. 0 if only one is availablehour - the hour e.g. 15minute - the minute e.g. 30
public void setTimePicker(android.widget.TimePicker timePicker,
int hour,
int minute)
TimePicker.
timePicker - the TimePicker object.hour - the hour e.g. 15minute - the minute e.g. 30
public void setProgressBar(int index,
int progress)
ProgressBar with a given index. Examples are SeekBar and RatingBar.
index - the index of the ProgressBarprogress - the progress that the ProgressBar should be set to
public void setProgressBar(android.widget.ProgressBar progressBar,
int progress)
ProgressBar. Examples are SeekBar and RatingBar.
progressBar - the ProgressBarprogress - the progress that the ProgressBar should be set to
public void enterText(int index,
String text)
EditText with a given index.
index - the index of the EditText. 0 if only one is availabletext - the text string to enter into the EditText field
public void enterText(android.widget.EditText editText,
String text)
EditText.
editText - the EditText to enter text intotext - the text string to enter into the EditText fieldpublic void clickOnImage(int index)
ImageView with a given index.
index - the index of the ImageView to be clicked. 0 if only one is availablepublic ArrayList<android.widget.ImageView> getCurrentImageViews()
ArrayList of the ImageView objects contained in the current
Activity.
ArrayList of the ImageView objects contained in the current
Activitypublic android.widget.EditText getEditText(int index)
EditText with a given index.
index - the index of the EditText. 0 if only one is available
EditText with a specified index or null if index is invalidpublic android.widget.Button getButton(int index)
Button with a given index.
index - the index of the Button. 0 if only one is available
Button with a specified index or null if index is invalidpublic android.widget.TextView getText(int index)
TextView with a given index.
index - the index of the TextView. 0 if only one is available
TextView with a specified index or null if index is invalidpublic android.widget.ImageView getImage(int index)
ImageView with a given index.
index - the index of the ImageView. 0 if only one is available
ImageView with a specified index or null if index is invalidpublic android.widget.ImageButton getImageButton(int index)
ImageButton with a given index.
index - the index of the ImageButton. 0 if only one is available
ImageButton with a specified index or null if index is invalidpublic android.widget.TextView getText(String text)
TextView which shows a given text.
text - the text that is shown
TextView that shows the given textpublic android.widget.Button getButton(String text)
Button which shows a given text.
text - the text that is shown
Button that shows the given textpublic android.widget.EditText getEditText(String text)
EditText which shows a given text.
text - the text that is shown
EditText which shows the given textpublic android.view.View getView(int id)
View with a given id.
id - the R.id of the View to be returned
View with a given idpublic ArrayList<android.widget.EditText> getCurrentEditTexts()
ArrayList of the EditText objects contained in the current
Activity.
ArrayList of the EditText objects contained in the current
Activitypublic ArrayList<android.widget.ListView> getCurrentListViews()
ArrayList of the ListView objects contained in the current
Activity.
ArrayList of the ListView objects contained in the current
Activitypublic ArrayList<android.widget.ScrollView> getCurrentScrollViews()
ArrayList of the ScrollView objects contained in the current
Activity.
ArrayList of the ScrollView objects contained in the current
Activitypublic ArrayList<android.widget.Spinner> getCurrentSpinners()
ArrayList of the Spinner objects (drop-down menus) contained in the current
Activity.
ArrayList of the Spinner objects (drop-down menus) contained in the current
Activitypublic ArrayList<android.widget.TextView> getCurrentTextViews(android.view.View parent)
ArrayList of the TextView objects contained in the current
Activity or View.
parent - the parent View from which the TextView objects should be returned. null if
all TextView objects from the current Activity should be returned
ArrayList of the TextView objects contained in the current
Activity or Viewpublic ArrayList<android.widget.GridView> getCurrentGridViews()
ArrayList of the GridView objects contained in the current
Activity.
ArrayList of the GridView objects contained in the current
Activitypublic ArrayList<android.widget.Button> getCurrentButtons()
ArrayList of the Button objects located in the current
Activity.
ArrayList of the Button objects located in the current Activitypublic ArrayList<android.widget.ToggleButton> getCurrentToggleButtons()
ArrayList of the ToggleButton objects contained in the current
Activity.
ArrayList of the ToggleButton objects contained in the current
Activitypublic ArrayList<android.widget.RadioButton> getCurrentRadioButtons()
ArrayList of the RadioButton objects contained in the current
Activity.
ArrayList of the RadioButton objects contained in the current
Activitypublic ArrayList<android.widget.CheckBox> getCurrentCheckBoxes()
ArrayList of the CheckBox objects contained in the current
Activity.
ArrayList of the CheckBox objects contained in the current
Activitypublic ArrayList<android.widget.ImageButton> getCurrentImageButtons()
ArrayList of the ImageButton objects contained in the current
Activity.
ArrayList of the ImageButton objects contained in the current
Activitypublic ArrayList<android.widget.DatePicker> getCurrentDatePickers()
ArrayList of the DatePicker objects contained in the current
Activity.
ArrayList of the DatePicker objects contained in the current
Activitypublic ArrayList<android.widget.TimePicker> getCurrentTimePickers()
ArrayList of the TimePicker objects contained in the current
Activity.
ArrayList of the TimePicker objects contained in the current
Activitypublic ArrayList<android.widget.ProgressBar> getCurrentProgressBars()
ArrayList of the ProgressBar objects contained in the current
Activity.
ArrayList of the ProgressBar objects contained in the current
Activitypublic boolean isRadioButtonChecked(int index)
RadioButton with a given index is checked.
index - of the RadioButton to check. 0 if only one is available
true if RadioButton is checked and false if it is not checkedpublic boolean isRadioButtonChecked(String text)
RadioButton with a given text is checked.
text - the text that the RadioButton shows
true if a RadioButton with the given text is checked and false if it is not checkedpublic boolean isCheckBoxChecked(int index)
CheckBox with a given index is checked.
index - of the CheckBox to check. 0 if only one is available
true if CheckBox is checked and false if it is not checkedpublic boolean isToggleButtonChecked(String text)
ToggleButton with a given text is checked.
text - the text that the ToggleButton shows
true if a ToggleButton with the given text is checked and false if it is not checkedpublic boolean isToggleButtonChecked(int index)
ToggleButton with a given index is checked.
index - of the ToggleButton to check. 0 if only one is available
true if ToggleButton is checked and false if it is not checkedpublic boolean isCheckBoxChecked(String text)
CheckBox with a given text is checked.
text - the text that the CheckBox shows
true if a CheckBox with the given text is checked and false if it is not checkedpublic boolean isTextChecked(String text)
text - the text that the CheckedTextView or CompoundButton objects show
true if the given text is checked and false if it is not checkedpublic boolean isSpinnerTextSelected(String text)
Spinner located on the current screen.
text - the text that is expected to be selected
true if the given text is selected in any Spinner and false if it is not
public boolean isSpinnerTextSelected(int index,
String text)
Spinner.
index - the index of the spinner to check. 0 if only one spinner is availabletext - the text that is expected to be selected
Spinner and false if it is notpublic void sendKey(int key)
key - the key to be sent. Use Solo.RIGHT, LEFT, UP, DOWN, ENTER, MENU, DELETE, #CALL, #ENDCALLpublic void goBackToActivity(String name)
Activity.
name - the name of the Activity to return to, e.g. "MyActivity"
public boolean waitForActivity(String name,
int timeout)
Activity.
name - the name of the Activity to wait for e.g. "MyActivity"timeout - the amount of time in milliseconds to wait
true if Activity appears before the timeout and false if it does notpublic String getString(int resId)
resId - the resource ID for the string
public void sleep(int time)
time - the time in milliseconds that Robotium should sleep
public void finalize()
throws Throwable
finalize in class ObjectThrowable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||