public class EspPage extends EspView
Base class for new page objects.
A page could be an activity, fragment or just a partial view. Recommend is to give your root layout a unique id to safely check that a specific page is currently shown.
EspPage is not necessary for writing page objects. But it provides some actions and assertions you could do on pages.
Example usage:
Create subclass with some page elements.
public class MyPage extends EspPage {
public MyPage() {
super(R.id.activity_root_my);
}
public EspTextView someTextView() {
return EspTextView.byId(R.id.textView);
}
public EspTextView someButton() {
return EspButton.byId(R.id.button);
}
}
Then use it in your tests.
public class MyPageTest {
MyPage myPage = new MyPage();
public void testSomething() {
myPage.someTextView().assertTextIs("");
myPage.someButton().click();
myPage.someTextView().assertTextIs("Clicked");
}
}
| Constructor and Description |
|---|
EspPage(EspPage template)
Create new instance based on given element matcher.
|
EspPage(int resourceId)
Create new instance matching an element with given resourceId.
|
EspPage(org.hamcrest.Matcher<android.view.View> base)
Create new element instance with custom base matcher.
|
| Modifier and Type | Method and Description |
|---|---|
static EspPage |
byId(int resourceId)
Create new instance matching an element with given resourceId.
|
assertIsDisabled, assertIsDisplayedOnScreen, assertIsEnabled, assertIsHidden, assertIsNotSelected, assertIsPartiallyDisplayedOnly, assertIsPartiallyDisplayedOnScreen, assertIsSelected, assertIsVisible, assertNotExist, baseMatcher, byAll, click, createMatcherList, doubleClick, findView, findView, longClick, swipeDown, swipeUppublic EspPage(int resourceId)
Create new instance matching an element with given resourceId.
resourceId - Identifier for this element.public EspPage(org.hamcrest.Matcher<android.view.View> base)
Create new element instance with custom base matcher.
base - Matcher for this element.public EspPage(EspPage template)
Create new instance based on given element matcher.
template - Pre configured element matcher.public static EspPage byId(int resourceId)
Create new instance matching an element with given resourceId.
resourceId - Identifier for this page base layout.