I have a Unit Test which uses @RunWith(Robolectric...
# compose
j
I have a Unit Test which uses @RunWith(RobolectricTestRunner) and a compose test rule. However, when i start this simple test, i get the following error:
Functions that involve synchronization (Assertions, Actions, Synchronization; e.g. assertIsSelected(), doClick(), runOnIdle()) cannot be run from the main thread. Did you nest such a function inside runOnIdle {}, runOnUiThread {} or setContent {}?
How can i possibly not run my assertions/clicks on the main thread? What did i mess up here?
z
There is no “main thread” when running unit tests with robolectric. Code that hard-codes a check for main thread using android’s looper won’t work. The compose test library is meant to run as instrumentation tests.
157 Views