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

Fix the Instrumented Tests for once and for all? #327

Merged
merged 19 commits into from
Oct 12, 2022
Merged

Conversation

igorescodro
Copy link
Owner

@igorescodro igorescodro commented Sep 20, 2022

The problem was not related to the Android Gradle Managed Devices after all. It seems that my new FlakyTest() (which was created because some Compose tests were flaky on CI) made the tests EVEN FLAKIER. That's ironic. Or not, because the name says that they are flaky... Anyway, reverting it back.

In the end, I decided to add more emulators and if at least one passes all the tests, it’s good to go. That’s the solution for now, otherwise I’ll never merge code anymore.

@igorescodro igorescodro changed the title Fix/tests Fix the Instrumented Tests for once and for all? Sep 20, 2022
@igorescodro igorescodro force-pushed the fix/tests branch 7 times, most recently from d99aab0 to d9bcb01 Compare September 27, 2022 19:27
@igorescodro igorescodro force-pushed the fix/tests branch 8 times, most recently from c3e50f1 to 38f4d87 Compare October 3, 2022 12:57
@igorescodro igorescodro force-pushed the fix/tests branch 3 times, most recently from 28e6536 to 445a606 Compare October 7, 2022 19:10
The problem was not related to the Android Gradle Managed Devices after
all. It seems that my new `FlakyTest()` (which was created because some
Compose tests were flaky on CI) made the tests EVEN FLAKIER. That's
ironic. Or not, because the name says that they are flaky... Anyway,
reverting it back.
Okay, that's a tentative. But seems that the tests are crashing because
the test scenario was stuck during some tests. The idea is to make all
the rules run in a specific order and use the ActivityScenarioRule to
rely on the library implementation and avoid boilerplate.
They were very annoying...
The CI were not happy with some of the changes...
Remove the `runBlocking` in favor of `runTest` which is more appropriate
for testing.
Removing all the `Thread.sleep()` in favor of Compose "waitUntil()" for
better handling idling resources. The solution here is based on the
excellent article from Jose Alcérreca.

https://medium.com/androiddevelopers/alternatives-to-idling-resources-in-compose-tests-8ae71f9fc473
Adding more `waitUntil` and hoping for the best
Hopefully adding this will make the test stop failing with
`keyDispatchingTimedOut`?
Let's work on test at the time until it's consistent.
This is a never ending task, right?
The Database Migration test class were using deprecated API and the
dependency for AndroidJUnit4 was missing due to wrong Gradle
configuration.
Slow and steady!
Let's try this based on random comments in different issues
@igorescodro igorescodro force-pushed the fix/tests branch 2 times, most recently from 8f63a98 to 7ae8da3 Compare October 12, 2022 19:35
It seems that this problem is happening EVERYWHERE. So I'll copy the
Accompanist setup and add more emulator. I'll start assuming that, if
one emulator pass all the tests, then we are good to go.
Dependency re-added as a `implementation` rather than a
`androidTestImplementation`.
This test is redundant with the flow one in :app and also seems to vary
based on SDK. Setting it on fire for now.
@igorescodro igorescodro merged commit 6794b33 into main Oct 12, 2022
@igorescodro igorescodro deleted the fix/tests branch October 12, 2022 21:23
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.

1 participant