Skip to content

Enable Robolectric paused mode#35

Merged
ArnasSmicius merged 1 commit into
masterfrom
technical/robolectric_paused_mode
Sep 13, 2023
Merged

Enable Robolectric paused mode#35
ArnasSmicius merged 1 commit into
masterfrom
technical/robolectric_paused_mode

Conversation

@ArnasSmicius
Copy link
Copy Markdown
Contributor

I'm preparing for a Robolectric upgrade and from Robolectric 4.4 LooperMode.PAUSED is enabled by default. That means, that we have to execute shadowOf(getMainLooper()).idle() when we want to run all the runnables that are queued to run on the main thread.
In this case, we are having a Fragment transaction that is not run instantly. After the Fragment transaction, we have to execute shadowOf(getMainLooper()).idle() in order to run this Fragment transaction. Also, there is a problem that Coper blocks the coroutine until the user gives permission. So those tests were stuck until the timeout.
So I've created a function that runs a particular code block and shadowOf(getMainLooper()).idle() at the same time in order to avoid this problem

@ArnasSmicius ArnasSmicius requested a review from a team September 13, 2023 07:45
@ArnasSmicius ArnasSmicius merged commit 78a446d into master Sep 13, 2023
@ArnasSmicius ArnasSmicius deleted the technical/robolectric_paused_mode branch September 13, 2023 09:10
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.

3 participants