Issue#99 Create TestRule working around System ANRs on Emulators
This commit is contained in:
parent
98b9df9d6b
commit
e6e2434c81
8 changed files with 96 additions and 5 deletions
|
|
@ -4,6 +4,7 @@ import androidx.lifecycle.Lifecycle
|
|||
import androidx.test.core.app.ActivityScenario
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import org.fnives.test.showcase.android.testutil.activity.SafeCloseActivityRule
|
||||
import org.fnives.test.showcase.android.testutil.intent.DismissSystemDialogsRule
|
||||
import org.fnives.test.showcase.android.testutil.screenshot.ScreenshotRule
|
||||
import org.fnives.test.showcase.android.testutil.synchronization.MainDispatcherTestRule
|
||||
import org.fnives.test.showcase.testutils.ReloadKoinModulesIfNecessaryTestRule
|
||||
|
|
@ -24,7 +25,8 @@ class ScreenshotTest : KoinTest {
|
|||
|
||||
@Rule
|
||||
@JvmField
|
||||
val ruleOrder: RuleChain = RuleChain.outerRule(mainDispatcherTestRule)
|
||||
val ruleOrder: RuleChain = RuleChain.outerRule(DismissSystemDialogsRule())
|
||||
.around(mainDispatcherTestRule)
|
||||
.around(ReloadKoinModulesIfNecessaryTestRule())
|
||||
.around(SafeCloseActivityRule { activityScenario })
|
||||
.around(ScreenshotRule(prefix = "screenshot-rule", takeOnSuccess = true))
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import androidx.compose.ui.test.junit4.StateRestorationTester
|
|||
import androidx.compose.ui.test.junit4.createComposeRule
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import org.fnives.test.showcase.R
|
||||
import org.fnives.test.showcase.android.testutil.intent.DismissSystemDialogsRule
|
||||
import org.fnives.test.showcase.android.testutil.screenshot.ScreenshotRule
|
||||
import org.fnives.test.showcase.android.testutil.synchronization.idlingresources.anyResourceIdling
|
||||
import org.fnives.test.showcase.compose.screen.AppNavigation
|
||||
|
|
@ -33,7 +34,8 @@ class AuthComposeInstrumentedTest : KoinTest {
|
|||
|
||||
@Rule
|
||||
@JvmField
|
||||
val ruleOrder: RuleChain = RuleChain.outerRule(mockServerScenarioSetupTestRule)
|
||||
val ruleOrder: RuleChain = RuleChain.outerRule(DismissSystemDialogsRule())
|
||||
.around(mockServerScenarioSetupTestRule)
|
||||
.around(dispatcherTestRule)
|
||||
.around(composeTestRule)
|
||||
.around(ScreenshotRule("test-showcase-compose"))
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import androidx.test.espresso.intent.Intents
|
|||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import org.fnives.test.showcase.android.testutil.activity.SafeCloseActivityRule
|
||||
import org.fnives.test.showcase.android.testutil.activity.safeClose
|
||||
import org.fnives.test.showcase.android.testutil.intent.DismissSystemDialogsRule
|
||||
import org.fnives.test.showcase.android.testutil.screenshot.ScreenshotRule
|
||||
import org.fnives.test.showcase.android.testutil.synchronization.loopMainThreadFor
|
||||
import org.fnives.test.showcase.model.content.FavouriteContent
|
||||
|
|
@ -37,7 +38,8 @@ class MainActivityInstrumentedTest : KoinTest {
|
|||
|
||||
@Rule
|
||||
@JvmField
|
||||
val ruleOrder: RuleChain = RuleChain.outerRule(mockServerScenarioSetupTestRule)
|
||||
val ruleOrder: RuleChain = RuleChain.outerRule(DismissSystemDialogsRule())
|
||||
.around(mockServerScenarioSetupTestRule)
|
||||
.around(mainDispatcherTestRule)
|
||||
.around(AsyncDiffUtilInstantTestRule())
|
||||
.around(SafeCloseActivityRule { activityScenario })
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import androidx.test.espresso.intent.Intents
|
|||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import org.fnives.test.showcase.R
|
||||
import org.fnives.test.showcase.android.testutil.activity.SafeCloseActivityRule
|
||||
import org.fnives.test.showcase.android.testutil.intent.DismissSystemDialogsRule
|
||||
import org.fnives.test.showcase.android.testutil.screenshot.ScreenshotRule
|
||||
import org.fnives.test.showcase.network.mockserver.scenario.auth.AuthScenario
|
||||
import org.fnives.test.showcase.testutils.MockServerScenarioSetupResetingTestRule
|
||||
|
|
@ -31,7 +32,8 @@ class AuthActivityInstrumentedTest : KoinTest {
|
|||
|
||||
@Rule
|
||||
@JvmField
|
||||
val ruleOrder: RuleChain = RuleChain.outerRule(mockServerScenarioSetupTestRule)
|
||||
val ruleOrder: RuleChain = RuleChain.outerRule(DismissSystemDialogsRule())
|
||||
.around(mockServerScenarioSetupTestRule)
|
||||
.around(mainDispatcherTestRule)
|
||||
.around(SafeCloseActivityRule { activityScenario })
|
||||
.around(ScreenshotRule("test-showcase"))
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import androidx.test.core.app.ActivityScenario
|
|||
import androidx.test.espresso.intent.Intents
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import org.fnives.test.showcase.android.testutil.activity.SafeCloseActivityRule
|
||||
import org.fnives.test.showcase.android.testutil.intent.DismissSystemDialogsRule
|
||||
import org.fnives.test.showcase.android.testutil.screenshot.ScreenshotRule
|
||||
import org.fnives.test.showcase.testutils.MockServerScenarioSetupResetingTestRule
|
||||
import org.fnives.test.showcase.testutils.idling.MainDispatcherTestRule
|
||||
|
|
@ -31,7 +32,8 @@ class SplashActivityInstrumentedTest : KoinTest {
|
|||
|
||||
@Rule
|
||||
@JvmField
|
||||
val ruleOrder: RuleChain = RuleChain.outerRule(mockServerScenarioSetupTestRule)
|
||||
val ruleOrder: RuleChain = RuleChain.outerRule(DismissSystemDialogsRule())
|
||||
.around(mockServerScenarioSetupTestRule)
|
||||
.around(mainDispatcherTestRule)
|
||||
.around(SafeCloseActivityRule { activityScenario })
|
||||
.around(ScreenshotRule("test-showcase"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue