Comments (8)
I think there's a problem in this code, because this is where the exception was
thrown
RootViewPicker
private void waitForAtLeastOneActivityToBeResumed() {
Collection<Activity> resumedActivities =
activityLifecycleMonitor.getActivitiesInStage(Stage.RESUMED);
if (resumedActivities.isEmpty()) {
uiController.loopMainThreadUntilIdle();
resumedActivities = activityLifecycleMonitor.getActivitiesInStage(Stage.RESUMED);
}
if (resumedActivities.isEmpty()) {
List<Activity> activities = Lists.newArrayList();
for (Stage s : EnumSet.range(Stage.PRE_ON_CREATE, Stage.RESTARTED)) {
activities.addAll(activityLifecycleMonitor.getActivitiesInStage(Stage.RESUMED));
}
if (activities.isEmpty()) {
throw new RuntimeException("No activities found. Did you forget to launch the activity "
+ "by calling getActivity() or startActivitySync or similar?");
}
When there's no activity in resumed state, it tries to find all activities in
other states. However, when calling to the activitymonitor, it still passes
Stage.RESUME in. It should be:
for (Stage s : EnumSet.range(Stage.PRE_ON_CREATE, Stage.RESTARTED)) {
activities.addAll(activityLifecycleMonitor.getActivitiesInStage(s));
}
Original comment by [email protected]
on 19 Dec 2013 at 6:22
from android-test-kit.
There's another problem in the method:
for (int waitIdx = 0; waitIdx < waitTimes.length; waitIdx++) {
Log.w(TAG, "No activity currently resumed - waiting: " + waitTimes[waitIdx]
+ "ms for one to appear.");
uiController.loopMainThreadForAtLeast(waitTimes[waitIdx]);
resumedActivities = activityLifecycleMonitor.getActivitiesInStage(Stage.RESUMED);
if (!resumedActivities.isEmpty()) {
break;
}
}
throw new RuntimeException("No activities in stage RESUMED. Did you forget to launch the "
+ "activity. (test.getActivity() or similar)?");
Even if it gets the resumed activities in the for loop, it will still throw the
exception. It should be
if(resumedActivities.isEmpty())
{
throw new RuntimeException("No activities in stage RESUMED. Did you forget to launch the "
+ "activity. (test.getActivity() or similar)?");
}
Original comment by [email protected]
on 29 Dec 2013 at 11:32
from android-test-kit.
Thanks for reporting. Will be fixed in the next release.
Original comment by [email protected]
on 2 Jan 2014 at 9:22
- Changed state: Accepted
from android-test-kit.
Fixed in 1.1
Original comment by [email protected]
on 9 Jan 2014 at 7:34
- Changed state: Fixed
from android-test-kit.
Using 1.1 but still having this issue
Original comment by [email protected]
on 9 Mar 2014 at 4:01
from android-test-kit.
Same here, this is still a problem
Original comment by [email protected]
on 8 Jan 2015 at 7:47
from android-test-kit.
I confirm that the issue still occurs on Espresso 2.0. Marking this as FIXED
seems premature to me.
Original comment by [email protected]
on 31 Jan 2015 at 10:53
from android-test-kit.
getActivity() cause app crash.
it mention about attempt to invoke virtual method.
Original comment by [email protected]
on 18 Feb 2015 at 2:56
from android-test-kit.
Related Issues (20)
- Performing click on fullscreen does not work (Fullscreen Activity Code Template) HOT 4
- Test failing on Lollipop when performing a click on a view whose parent layout has an indeterminate progress bar HOT 2
- Prebuilt binaries provide/use inconsistent versions of Dagger HOT 3
- getting "Espresso ViewAssertion Failed Looped for 3528 iterations over 60 SECONDS. The following Idle Conditions failed ." error HOT 1
- openActionBarOverflowOrOptionsMenu does not work with non-english locale & proguard used HOT 1
- Unable to run espresso tests - ComponentInfo not found for android.support.test.runner.AndroidJUnitRunner HOT 2
- AndroidJUnitRunner now marking failures where before it had not HOT 1
- DrawerActions is (still) leaking the parent listener HOT 3
- Context not initialized with ProviderTestCase2 (NullPointerException) HOT 1
- Basic intent test fails. HOT 1
- Using recyclerview-v7:22.1.1 causes NPEs with espresso-contrib 2.1 because it depends on recyclerview-v7:22.0.0 HOT 1
- Using onData with an overlaid View won't properly click on items
- Getting DexException when running assembleDebugAndroidTest goal second time HOT 4
- Enhancement: FlakyTest for JUnit4/Espresso HOT 2
- MonitoringInstrumentation leaking activity instances through ExecutorService HOT 3
- withText doesn't find views with textAllCaps attribute used HOT 1
- using onData in RecyclerView HOT 4
- Espresso-contrib cannot inflate RecyclerView with IllegalStateException (Unable to find LayoutManager) HOT 5
- Provide API to list tests that will be run
- Add API for adding RunListeners to AndroidJUnitRunner
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-test-kit.