-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run tests against API 34 device #6059
Conversation
83908a5
to
b746aa1
Compare
--results-bucket opendatakit-collect-test-results \ | ||
--directories-to-pull /sdcard --timeout 20m | ||
--directories-to-pull /sdcard --timeout 20m \ | ||
--test-targets "notPackage org.odk.collect.android.regression" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've disabled regression
tests for now as they'll be reworked in #5983.
@@ -15,6 +16,7 @@ | |||
import org.odk.collect.android.support.rules.TestRuleChain; | |||
import org.odk.collect.testshared.RecyclerViewMatcher; | |||
|
|||
@Ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests are flaking out a lot. I'm actually not convinced that there isn't some problem in the repeat delete flows, but it's definitely not something I wanted to go deep on here. I'll create another issue to cover this.
collect_app/src/androidTest/java/org/odk/collect/android/support/rules/RecentAppsRule.kt
Outdated
Show resolved
Hide resolved
@@ -50,8 +51,18 @@ protected boolean matchesSafely(ImageView imageView) { | |||
|
|||
Bitmap actual = ((BitmapDrawable) drawable).getBitmap(); | |||
|
|||
return actual.sameAs(match); | |||
StrictMode.ThreadPolicy originalThreadPolicy = StrictMode.getThreadPolicy(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was the problem here (without your changes)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a comment below:
Permit slow calls to allow
sameAs
use
collect_app/src/androidTest/java/org/odk/collect/android/feature/smoke/AllWidgetsFormTest.java
Show resolved
Hide resolved
collect_app/src/androidTest/java/org/odk/collect/android/feature/smoke/AllWidgetsFormTest.java
Show resolved
Hide resolved
collect_app/src/androidTest/java/org/odk/collect/android/support/rules/RecentAppsRule.kt
Outdated
Show resolved
Hide resolved
collect_app/src/androidTest/java/org/odk/collect/android/support/rules/RecentAppsRule.kt
Outdated
Show resolved
Hide resolved
collect_app/src/androidTest/java/org/odk/collect/android/support/rules/RecentAppsRule.kt
Outdated
Show resolved
Hide resolved
collect_app/src/androidTest/java/org/odk/collect/android/support/DummyActivityLauncher.kt
Outdated
Show resolved
Hide resolved
...ect_app/src/androidTest/java/org/odk/collect/android/support/rules/NotificationDrawerRule.kt
Outdated
Show resolved
Hide resolved
View hierarchies logged on a `NoMatchingViewException` are truncated after a max line length, but are then written out to a file. This means we need to pull the `/sdcard` to make sure we have access to the file.
Here's a few observations from playing around with getting the tests more stable (and moving them to API 34):
inRoot
or you're at the mercy of Espresso's built in "heuristic" window chooser (https://developer.android.com/training/testing/espresso/recipes) and that doesn't always get it right.perform(click())
doesn't seem to work all the time.click()
injects events into the UI instead of usingperformClick()
on the view directly (which may be to catch problems with obscured views), and it seems like this sometimes doesn't end up propagating to the expected view.IdlingResource
magic - there's no provided way to deal with Kotlin Coroutines or Data Binding for instance. Given this, it's very hard to trust that there aren't other moving parts deep in the view rendering that aren't being accounted for.UIDevice
directly is still the only real option for flows that need rotation.Due to 3 and 4, I've ended up expanding our use of
WaitFor.waitFor()
andWaitFor.tryAgainOnFail()
quite a bit. Other than that, the largest changes are probably to the (new)RecentAppsRule
and toNotificationDrawer
to get them working with API 34 (as well as continuing support for API 30).