I have decided that one of the testing criteria for my application tests with Google\'s Espresso is:
Test should maintain Activity state after s
If you have the only Activity in your test case, you can do:
Rule.@Rule
public ActivityTestRule mActivityTestRule = new ActivityTestRule<>(TestActivity.class);
Activity and apply a screen rotation.mActivityTestRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
mActivityTestRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
That's a piece of pie!