Issue
I have the Espresso test and want to app stay on exact activity were test was finished. And i need to continue interaction with app.
@SmallTest
public void testOpenNavigationDrawer()
{
Espresso.onView(ViewMatchers.withId(com.eleks.espresso.example.app.R.id.content_frame)).perform(ViewActions.swipeRight());
ListView lvDrawerMenu = (ListView) getActivity().findViewById(com.eleks.espresso.example.app.R.id.lvDrawerMenu);
Preconditions.checkNotNull(lvDrawerMenu, "lvDrawerMenu is null");
final int count = lvDrawerMenu.getAdapter().getCount();
Preconditions.checkPositionIndex(2, count, "No 1 index " + count + " size");
Object obj = lvDrawerMenu.getItemAtPosition(2);
Espresso.onView(Matchers.allOf(ViewMatchers.withId(com.eleks.espresso.example.app.R.id.tvItem), ViewMatchers.hasSibling(ViewMatchers.withText(obj.toString())))).perform(ViewActions.click());
}
How can i do that? Thank you!
Solution
Sorry, but it's impossible.
I think you don't know enough good an idea of automated tests. \
Espresso, Robotium, Calabash and other UI test frameworks were made for short testing events. It simulates an user's specific behavior - run app, do some tricks and (if successful) than close an app.
Of course, Espresso allow you to create custom idling resources and than register it in app. Moreover, the simplest way to hibernate a test for a specific amount of time is use method Thread.sleep(time_in_miliseconds)
, but like I said it's against idea of automated testing.
Answered By - piotrek1543
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.