diff --git a/docs/html/tools/help/uiautomator/Configurator.jd b/docs/html/tools/help/uiautomator/Configurator.jd new file mode 100644 index 0000000000000..c898772216d65 --- /dev/null +++ b/docs/html/tools/help/uiautomator/Configurator.jd @@ -0,0 +1,960 @@ +page.title=Configurator +parent.title=uiautomator +parent.link=index.html + +@jd:body + + +
Allows you to set key parameters for running uiautomator tests. The new
+settings take effect immediately and can be changed any time during a test run.
+To modify parameters using Configurator, first
+obtain an instance by calling getInstance().
+As a best practice, make sure you always save the original value of any
+parameter that you are modifying. After running your tests with the modified
+parameters, make sure to also restore the original parameter values, otherwise
+this will impact other tests cases.
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Gets the current timeout for waiting for an acknowledgment of generic
+ uiautomator actions, such as clicks, text setting, and menu presses.
+
+ | |||||||||||
Retrieves a singleton instance of Configurator.
+
+ | |||||||||||
Gets the current delay between key presses when injecting text input.
+
+ | |||||||||||
Gets the timeout for waiting for an acknowledgement of an
+ uiautomtor scroll swipe action.
+
+ | |||||||||||
Gets the current timeout used for waiting for the user interface to go
+ into an idle state.
+
+ | |||||||||||
Gets the current timeout for waiting for a widget to become visible in
+ the user interface so that it can be matched by a selector.
+
+ | |||||||||||
Sets the timeout for waiting for an acknowledgment of generic uiautomator
+ actions, such as clicks, text setting, and menu presses.
+
+ | |||||||||||
Sets a delay between key presses when injecting text input.
+
+ | |||||||||||
Sets the timeout for waiting for an acknowledgement of an
+ uiautomtor scroll swipe action.
+
+ | |||||||||||
Sets the timeout for waiting for the user interface to go into an idle
+ state before starting a uiautomator action.
+
+ | |||||||||||
Sets the timeout for waiting for a widget to become visible in the user
+ interface so that it can be matched by a selector.
+
+ | |||||||||||
|
+ [Expand]
+ Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
+
+From class
+
+ java.lang.Object
+
+
+
+
+
+
+ | |||||||||||
Gets the current timeout for waiting for an acknowledgment of generic
+ uiautomator actions, such as clicks, text setting, and menu presses.
+
+ The acknowledgment is an AccessibilityEvent,
+ corresponding to an action, that lets the framework determine if the
+ action was successful. Generally, this timeout should not be modified.
+ See UiObject
Retrieves a singleton instance of Configurator.
Gets the current delay between key presses when injecting text input.
+ See setText(String)
Gets the timeout for waiting for an acknowledgement of an
+ uiautomtor scroll swipe action.
+
+ The acknowledgment is an AccessibilityEvent,
+ corresponding to the scroll action, that lets the framework determine if
+ the scroll action was successful. Generally, this timeout should not be modified.
+ See UiScrollable
Gets the current timeout used for waiting for the user interface to go
+ into an idle state.
+
+ By default, all core uiautomator objects except UiDevice will perform
+ this wait before starting to search for the widget specified by the
+ object's UiSelector. Once the idle state is detected or the
+ timeout elapses (whichever occurs first), the object will start to wait
+ for the selector to find a match.
+ See setWaitForSelectorTimeout(long)
Gets the current timeout for waiting for a widget to become visible in + the user interface so that it can be matched by a selector. + + Because user interface content is dynamic, sometimes a widget may not + be visible immediately and won't be detected by a selector. This timeout + allows the uiautomator framework to wait for a match to be found, up until + the timeout elapses.
Sets the timeout for waiting for an acknowledgment of generic uiautomator
+ actions, such as clicks, text setting, and menu presses.
+
+ The acknowledgment is an AccessibilityEvent,
+ corresponding to an action, that lets the framework determine if the
+ action was successful. Generally, this timeout should not be modified.
+ See UiObject
| timeout + | Timeout value in milliseconds | +
|---|
Sets a delay between key presses when injecting text input.
+ See setText(String)
| delay + | Delay value in milliseconds | +
|---|
Sets the timeout for waiting for an acknowledgement of an
+ uiautomtor scroll swipe action.
+
+ The acknowledgment is an AccessibilityEvent,
+ corresponding to the scroll action, that lets the framework determine if
+ the scroll action was successful. Generally, this timeout should not be modified.
+ See UiScrollable
| timeout + | Timeout value in milliseconds | +
|---|
Sets the timeout for waiting for the user interface to go into an idle
+ state before starting a uiautomator action.
+
+ By default, all core uiautomator objects except UiDevice will perform
+ this wait before starting to search for the widget specified by the
+ object's UiSelector. Once the idle state is detected or the
+ timeout elapses (whichever occurs first), the object will start to wait
+ for the selector to find a match.
+ See setWaitForSelectorTimeout(long)
| timeout + | Timeout value in milliseconds | +
|---|
Sets the timeout for waiting for a widget to become visible in the user + interface so that it can be matched by a selector. + + Because user interface content is dynamic, sometimes a widget may not + be visible immediately and won't be detected by a selector. This timeout + allows the uiautomator framework to wait for a match to be found, up until + the timeout elapses.
| timeout + | Timeout value in milliseconds. | +
|---|
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| - - - - - - void + + | |||||||||||
| - clearLastTraversedText() - + | Clears the text from the last UI traversal event.
-
+
| ||||||||||
| - - - - - - boolean + + | |||||||||||
| - click(int x, int y) - + | Perform a click at arbitrary coordinates specified by the user
-
+
| ||||||||||
| - - - - - - void + + | |||||||||||
| - dumpWindowHierarchy(String fileName) - + | Performs a swipe from one coordinate to another coordinate.
+
+ | ||||||||||
Helper method used for debugging to dump the current window's layout hierarchy.
-
+
| |||||||||||
| - - - - - - void + + | |||||||||||
| - freezeRotation() - + | Disables the sensors and freezes the device rotation at its
current rotation state.
-
+
| ||||||||||
| - - - - - - String + + | |||||||||||
|
- getCurrentActivityName()
-
-
-
- This method is deprecated.
- The results returned should be considered unreliable
-
+ |
+ This method is deprecated.
+ The results returned should be considered unreliable
+
| ||||||||||
| - - - - - - String + + | |||||||||||
| - getCurrentPackageName() - + | Retrieves the name of the last package to report accessibility events.
-
+
| ||||||||||
| - - - - - - int + + | |||||||||||
| - getDisplayHeight() - + | Gets the height of the display, in pixels.
-
+
| ||||||||||
| - - - - - - int + + | |||||||||||
|
- getDisplayRotation()
-
- Returns the current rotation of the display, as defined in Surface@return
-
+ | Returns the current rotation of the display, as defined in
+
Surface | ||||||||||
| - - - - - - int + + | |||||||||||
| - getDisplayWidth() - + | Returns the display size in dp (device-independent pixel)
+
+ The returned display size is adjusted per screen rotation.
+
+ | ||||||||||
Gets the width of the display, in pixels.
-
+
| |||||||||||
| - - - + + | |||||||||||
| - getInstance() - + | Retrieves a singleton instance of UiDevice
-
+
| ||||||||||
| - - - - - - String + + | |||||||||||
| - getLastTraversedText() - + | Retrieves the text from the last UI traversal event received.
-
+
| ||||||||||
| - - - - - - String + + | |||||||||||
| - getProductName() - + | Retrieves the product name of the device.
-
+
| ||||||||||
| - - - - - - boolean + + | |||||||||||
| - hasAnyWatcherTriggered() - + | Checks if any registered
-
+
UiWatcher have triggered. | ||||||||||
| - - - - - - boolean + + | |||||||||||
| - hasWatcherTriggered(String watcherName) - + | Checks if a specific registered
-
+
UiWatcher has triggered. | ||||||||||
| - - - - - - boolean + + | |||||||||||
| - isNaturalOrientation() - + | Check if the device is in its natural orientation.
-
+
| ||||||||||
| - - - - - - boolean + + | |||||||||||
| - isScreenOn() - + | Checks the power manager if the screen is ON.
-
+
| ||||||||||
| - - - - - - boolean + + | |||||||||||
| - pressBack() - + | Opens the notification shade.
+
+ | ||||||||||
Opens the Quick Settings shade.
+
+ | |||||||||||
Simulates a short press on the BACK button.
-
+
| |||||||||||
| - - - - - - boolean + + | |||||||||||
| - pressDPadCenter() - + | Simulates a short press on the CENTER button.
-
+
| ||||||||||
| - - - - - - boolean + + | |||||||||||
| - pressDPadDown() - + | Simulates a short press on the DOWN button.
-
+
| ||||||||||
| - - - - - - boolean + + | |||||||||||
| - pressDPadLeft() - + | Simulates a short press on the LEFT button.
-
+
| ||||||||||
| - - - - - - boolean + + | |||||||||||
| - pressDPadRight() - + | Simulates a short press on the RIGHT button.
-
+
| ||||||||||
| - - - - - - boolean + + | |||||||||||
| - pressDPadUp() - + | Simulates a short press on the UP button.
-
+
| ||||||||||
| - - - - - - boolean + + | |||||||||||
| - pressDelete() - + | Simulates a short press on the DELETE key.
-
+
| ||||||||||
| - - - - - - boolean + + | |||||||||||
| - pressEnter() - + | Simulates a short press on the ENTER key.
-
+
| ||||||||||
| - - - - - - boolean + + | |||||||||||
| - pressHome() - + | Simulates a short press on the HOME button.
-
+
| ||||||||||
| - - - - - - boolean + + | |||||||||||
| - pressKeyCode(int keyCode) - + | Simulates a short press using a key code.
-
+
| ||||||||||
| - - - - - - boolean + + | |||||||||||
| - pressKeyCode(int keyCode, int metaState) - + | Simulates a short press using a key code.
-
+
| ||||||||||
| - - - - - - boolean + + | |||||||||||
| - pressMenu() - + | Simulates a short press on the MENU button.
-
+
| ||||||||||
| - - - - - - boolean + + | |||||||||||
| - pressRecentApps() - + | Simulates a short press on the Recent Apps button.
-
+
| ||||||||||
| - - - - - - boolean + + | |||||||||||
| - pressSearch() - + | Simulates a short press on the SEARCH button.
-
+
| ||||||||||
| - - - - - - void + + | |||||||||||
| - registerWatcher(String name, UiWatcher watcher) - + | Registers a
-
+
UiWatcher to run automatically when the testing framework is unable to
find a match using a UiSelector. | ||||||||||
| - - - - - - void + + | |||||||||||
| - removeWatcher(String name) - + | Removes a previously registered
-
+
UiWatcher. | ||||||||||
| - - - - - - void + + | |||||||||||
| - resetWatcherTriggers() - + | Resets a
-
+
UiWatcher that has been triggered. | ||||||||||
| - - - - - - void + + | |||||||||||
| - runWatchers() - + | This method forces all registered watchers to run.
-
+
| ||||||||||
| - - - - - - void + + | |||||||||||
| - setOrientationLeft() - + | Enables or disables layout hierarchy compression.
+
+ | ||||||||||
Simulates orienting the device to the left and also freezes rotation
by disabling the sensors.
-
+
| |||||||||||
| - - - - - - void + + | |||||||||||
| - setOrientationNatural() - + | Simulates orienting the device into its natural orientation and also freezes rotation
by disabling the sensors.
-
+
| ||||||||||
| - - - - - - void + + | |||||||||||
| - setOrientationRight() - + | Simulates orienting the device to the right and also freezes rotation
by disabling the sensors.
-
+
| ||||||||||
| - - - - - - void + + | |||||||||||
| - sleep() - + | This method simply presses the power button if the screen is ON else
it does nothing if the screen is already OFF.
-
+
| ||||||||||
| - - - - - - boolean + + | |||||||||||
| - swipe(Point[] segments, int segmentSteps) - + | Performs a swipe between points in the Point array.
-
+
| ||||||||||
| - - - - - - boolean + + | |||||||||||
| - swipe(int startX, int startY, int endX, int endY, int steps) - + | Performs a swipe from one coordinate to another using the number of steps
to determine smoothness and speed.
-
+
| ||||||||||
| - - - - - - boolean + + | |||||||||||
|
- takeScreenshot(File storePath, float scale, int quality)
-
- Take a screenshot of current window and store it as PNG
+ | |||||||||||
| - - - - - - boolean - | -
- takeScreenshot(File storePath)
-
Take a screenshot of current window and store it as PNG
Default scale of 1.0f (original size) and 90% quality is used
The screenshot is adjusted per screen rotation
-
+
| ||||||||||
| - - - - - - void + + | |||||||||||
| - unfreezeRotation() - + | Take a screenshot of current window and store it as PNG
+
+ The screenshot is adjusted per screen rotation
+
+ | ||||||||||
Re-enables the sensors and un-freezes the device rotation allowing its contents
to rotate with the device physical rotation.
-
+
| |||||||||||
| - - - - - - void + + | |||||||||||
| - waitForIdle(long time) - + | Waits for the current application to idle.
-
+
| ||||||||||
| - - - - - - void + + | |||||||||||
| - waitForIdle() - + | Waits for the current application to idle.
-
+
| ||||||||||
| - - - - - - boolean + + | |||||||||||
| - waitForWindowUpdate(String packageName, long timeout) - + | Waits for a window content update event to occur.
-
+
| ||||||||||
| - - - - - - void + + | |||||||||||
| - wakeUp() - + | This method simulates pressing the power button if the screen is OFF else
it does nothing if the screen is already ON.
-
+
| ||||||||||
|
| |||||||||||