, I'm trying a basic E2E scenario on my app.
The main content stays blank (I get top app bar, bottom nav etc.) until the test finishes, despite using the
waitUntil*
helpers.
I have 2 steps in the start sequence to load content:
null
(loading), then
List<T>
(empty or not), the first step remains until test end but never change before that.
The state relies on a Room database
Flow
from a
Dao
.
What could prevent the Room flow mechanism to operate in the context of Compose UI tests?
✅ 1
Olivier Patry
10/03/2024, 7:04 PM
On Compose side, I'm using
Copy code
val content by viewModel.content.collectAsState(null)
Olivier Patry
10/03/2024, 7:09 PM
Hmm…
It appears that adding
Copy code
= runTest {}
around the test solves the issue…
I'm not sure I spotted that anywhere, but might be logical if Room behavior is tweaked in test context (which feels a bit weird for E2E maybe, no?)
c
CLOVIS
10/08/2024, 10:28 PM
Hey! This seems to be an Android question, maybe ask in #C0B8M7BUY or #C1CFAFJSK? There isn't really enough information in your message to understand what the problem could be.
o
Olivier Patry
10/09/2024, 6:20 AM
The issue came from coroutines managed by Room weren't resumed because execution under test (compose test rule behavior I guess).
Adding
runTest{}
solved the issue as answered to myself.
Totally linked to #C0NBD4UF8 IMO even if, yes, linked to #C1CFAFJSK as well.
c
CLOVIS
10/09/2024, 7:26 AM
Yeah, no problem. It's just, this channel is usually used for methodology questions, and usually technical questions don't get an answer because they depend on a specific technology that people here don't necessarily know 👍