Fixed
Status Update
Comments
ku...@google.com <ku...@google.com>
ku...@google.com <ku...@google.com> #2
Here's a really detailed StackOverflow answer that seems to point out some things to look at in relation to this behaviour:
http://stackoverflow.com/a/14293528/238753
nk...@google.com <nk...@google.com>
ma...@gmail.com <ma...@gmail.com> #3
Thank you for your feedback. We assure you that we are doing our best to address the issue reported, however our product team has shifted work priority that doesn't include this issue. For now, we will be closing the issue as won't fix obsolete. If this issue currently still exists, we request that you log a new issue along with latest bug report here https://goo.gl/TbMiIO .
nk...@google.com <nk...@google.com> #4
Tested and confirmed that this bug affects Android 4.4 - 5.1 but was fixed in Android 6.0.
I've attached an updated sample project since the original one needed some tweaks to get it building.
I've attached an updated sample project since the original one needed some tweaks to get it building.
nk...@google.com <nk...@google.com> #5
The release is not out yet but marking this as fixed for now.
Description
Version used: "1.0.1"
What steps will reproduce the problem?
Test an `Activity`'s `setResult()` using `ActivityTestRule.getActivityResult()` and Espresso.
If the activity undergoes a configuration change (such as display rotation) during the test, `ActivityTestRule.getActivity()` will still return the previous instance of the activity (the one existing before the configuration change). This will make any subsequent calls to `ActivityTestRule.getActivityResult()` throw `IllegalStateException` with error message: "Activity is not finishing!".
Example code snippet:
@Rule
public ActivityTestRule<MyActivity> rule = new ActivityTestRule<>(MyActivity.class);
@Test
public void myTest() throws Exception {
rule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
Espresso.onView(ViewMatchers.withId(R.id.button)).perform(click()); // In MyActivity this button click will trigger setResult() and finish().
Instrumentation.ActivityResult result = activityTestRule.getActivityResult(); // Test will crash here.
}