Skip to content
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

Merged
merged 39 commits into from
Apr 10, 2024
Merged

Conversation

seadowg
Copy link
Member

@seadowg seadowg commented Mar 28, 2024

Here's a few observations from playing around with getting the tests more stable (and moving them to API 34):

  1. There's still very little support for flows that revolve around Activity/App recreation.
  2. Interacting with dialogs or pop-ups requires using 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.
  3. perform(click()) doesn't seem to work all the time. click() injects events into the UI instead of using performClick() 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.
  4. It feels like the AndroidX Test team has largely abandoned Espresso's 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.
  5. The new Espresso Device API looks really nice, but it's still Alpha and doesn't work with Firebase Test Lab yet. Using 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() and WaitFor.tryAgainOnFail() quite a bit. Other than that, the largest changes are probably to the (new) RecentAppsRule and to NotificationDrawer to get them working with API 34 (as well as continuing support for API 30).

@seadowg seadowg force-pushed the api-34-tests branch 2 times, most recently from 83908a5 to b746aa1 Compare April 3, 2024 12:50
--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"
Copy link
Member Author

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
Copy link
Member Author

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.

@@ -50,8 +51,18 @@ protected boolean matchesSafely(ImageView imageView) {

Bitmap actual = ((BitmapDrawable) drawable).getBitmap();

return actual.sameAs(match);
StrictMode.ThreadPolicy originalThreadPolicy = StrictMode.getThreadPolicy();
Copy link
Member

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)?

Copy link
Member Author

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

build.gradle Show resolved Hide resolved
seadowg added 6 commits April 10, 2024 10:46
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.
@grzesiek2010 grzesiek2010 merged commit cc8c464 into getodk:master Apr 10, 2024
6 checks passed
@seadowg seadowg deleted the api-34-tests branch April 10, 2024 10:56
@seadowg seadowg mentioned this pull request Apr 15, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants