public class EspView
extends java.lang.Object
Basic view actions and assertions for a common view.
Used as base class for mostly all view elements. Extending this element is a good starting point if you need to create a new view element.
| Constructor and Description |
|---|
EspView(EspView template)
Create new instance based on given element matcher.
|
EspView(int resourceId)
Create new instance matching an element with given resourceId.
|
EspView(org.hamcrest.Matcher<android.view.View> base)
Create new element instance with custom base matcher.
|
| Modifier and Type | Method and Description |
|---|---|
void |
assertIsDisabled()
Check that the view is in state disabled.
|
void |
assertIsDisplayedOnScreen()
Check that a view is currently full shown on the screen so the user can see it.
|
void |
assertIsEnabled()
Check that the view is in state enabled.
|
void |
assertIsHidden()
Check that you can’t see the view.
|
void |
assertIsNotSelected()
Check that the view is not in state selected.
|
void |
assertIsPartiallyDisplayedOnly()
Check only a small part of the view is visible on screen.
|
void |
assertIsPartiallyDisplayedOnScreen()
Check if at least a small part of the view is visible on screen.
|
void |
assertIsSelected()
Check that the view is in state selected.
|
void |
assertIsVisible()
Check that the view is in state visible.
|
void |
assertNotExist()
Check that no view matches the given matcher in the view hierarchy.
|
protected org.hamcrest.Matcher<android.view.View> |
baseMatcher() |
static EspAllOfBuilder<? extends EspView> |
byAll()
Create an allOf matcher builder for this element.
|
static EspView |
byId(int resourceId)
Create new instance matching an element with given resourceId.
|
void |
click()
Perform click on the view.
|
protected java.util.ArrayList<org.hamcrest.Matcher<android.view.View>> |
createMatcherList(org.hamcrest.Matcher<android.view.View>... matcher) |
void |
doubleClick()
Perform double click on the view.
|
protected android.support.test.espresso.ViewInteraction |
findView(java.util.List<org.hamcrest.Matcher<android.view.View>> additional)
Find view to perform actions or assertions.
|
protected android.support.test.espresso.ViewInteraction |
findView(org.hamcrest.Matcher<android.view.View>... matcher)
Convenience method for
findView(List) |
void |
longClick()
Perform long click on the view.
|
void |
swipeDown()
Perform swipe down on the view.
|
void |
swipeUp()
Perform swipe up on the view.
|
public EspView(int resourceId)
Create new instance matching an element with given resourceId.
resourceId - Identifier for this element.public EspView(org.hamcrest.Matcher<android.view.View> base)
Create new element instance with custom base matcher.
base - Matcher for this element.public EspView(EspView template)
Create new instance based on given element matcher.
template - Pre configured element matcher.public static EspView byId(int resourceId)
Create new instance matching an element with given resourceId.
resourceId - Identifier for this element.public static EspAllOfBuilder<? extends EspView> byAll()
Create an allOf matcher builder for this element.
public void assertIsDisplayedOnScreen()
Check that a view is currently full shown on the screen so the user can see it.
A view can exist and is in state visible but not currently displayed. When the view height or width is greater than the screen it would still match.
public void assertIsVisible()
Check that the view is in state visible.
public void assertIsHidden()
Check that you can’t see the view.
True when the view is in state invisible, gone or currently not displayed on screen.
public void assertIsPartiallyDisplayedOnly()
Check only a small part of the view is visible on screen.
Does fail if the view is fully displayed.
public void assertIsPartiallyDisplayedOnScreen()
Check if at least a small part of the view is visible on screen.
Does fail if the view is not displayed. Success if partially or full visible.
public void assertNotExist()
Check that no view matches the given matcher in the view hierarchy.
public void assertIsSelected()
Check that the view is in state selected.
public void assertIsNotSelected()
Check that the view is not in state selected.
public void assertIsEnabled()
Check that the view is in state enabled.
public void assertIsDisabled()
Check that the view is in state disabled.
public void click()
Perform click on the view.
public void doubleClick()
Perform double click on the view.
public void longClick()
Perform long click on the view.
public void swipeUp()
Perform swipe up on the view.
public void swipeDown()
Perform swipe down on the view.
protected android.support.test.espresso.ViewInteraction findView(java.util.List<org.hamcrest.Matcher<android.view.View>> additional)
Find view to perform actions or assertions.
additional - Provide extra matcher additional to the base matcher.@SafeVarargs protected final android.support.test.espresso.ViewInteraction findView(org.hamcrest.Matcher<android.view.View>... matcher)
Convenience method for findView(List)
@SafeVarargs @NonNull protected final java.util.ArrayList<org.hamcrest.Matcher<android.view.View>> createMatcherList(org.hamcrest.Matcher<android.view.View>... matcher)
protected org.hamcrest.Matcher<android.view.View> baseMatcher()