1*21373fa4SWill Schurman package host.exp.exponent
2*21373fa4SWill Schurman 
3*21373fa4SWill Schurman import android.Manifest
4*21373fa4SWill Schurman import androidx.test.espresso.Espresso
5*21373fa4SWill Schurman import androidx.test.espresso.IdlingResource
6*21373fa4SWill Schurman import androidx.test.rule.GrantPermissionRule
7*21373fa4SWill Schurman import host.exp.exponent.annotations.ExpoAlwaysPassThroughFilter
8*21373fa4SWill Schurman import host.exp.exponent.utils.*
9*21373fa4SWill Schurman import org.junit.*
10*21373fa4SWill Schurman import org.junit.rules.RuleChain
11*21373fa4SWill Schurman import org.junit.runner.RunWith
12*21373fa4SWill Schurman import org.junit.runners.MethodSorters
13*21373fa4SWill Schurman 
14*21373fa4SWill Schurman @RunWith(ExpoTestRunner::class)
15*21373fa4SWill Schurman @FixMethodOrder(MethodSorters.NAME_ASCENDING)
16*21373fa4SWill Schurman class DevModeTests : BaseTestClass() {
17*21373fa4SWill Schurman   private lateinit var loadingScreenIdlingResource: IdlingResource
18*21373fa4SWill Schurman 
19*21373fa4SWill Schurman   @Before
beforenull20*21373fa4SWill Schurman   fun before() {
21*21373fa4SWill Schurman     // Setup Espresso
22*21373fa4SWill Schurman     loadingScreenIdlingResource = LoadingScreenIdlingResource()
23*21373fa4SWill Schurman     Espresso.registerIdlingResources(loadingScreenIdlingResource)
24*21373fa4SWill Schurman   }
25*21373fa4SWill Schurman 
26*21373fa4SWill Schurman   @After
afternull27*21373fa4SWill Schurman   fun after() {
28*21373fa4SWill Schurman     Espresso.unregisterIdlingResources(loadingScreenIdlingResource)
29*21373fa4SWill Schurman   }
30*21373fa4SWill Schurman 
31*21373fa4SWill Schurman   @Rule
32*21373fa4SWill Schurman   @JvmField
33*21373fa4SWill Schurman   val chain: RuleChain = RuleChain.outerRule(TestReporterRule()).around(RetryTestRule(3))
34*21373fa4SWill Schurman 
35*21373fa4SWill Schurman   @Rule
36*21373fa4SWill Schurman   @JvmField
37*21373fa4SWill Schurman   val permissionRule: GrantPermissionRule = GrantPermissionRule.grant(Manifest.permission.SYSTEM_ALERT_WINDOW)
38*21373fa4SWill Schurman 
39*21373fa4SWill Schurman   @Test
40*21373fa4SWill Schurman   @ExpoAlwaysPassThroughFilter
junitIsSillyAndWillFailIfThereIsntOneTestRunPerFilenull41*21373fa4SWill Schurman   fun junitIsSillyAndWillFailIfThereIsntOneTestRunPerFile() {
42*21373fa4SWill Schurman   }
43*21373fa4SWill Schurman 
44*21373fa4SWill Schurman   companion object {
45*21373fa4SWill Schurman     @BeforeClass
46*21373fa4SWill Schurman     @JvmStatic
beforeClassnull47*21373fa4SWill Schurman     fun beforeClass() {
48*21373fa4SWill Schurman       BaseTestClass.beforeClass()
49*21373fa4SWill Schurman     }
50*21373fa4SWill Schurman   }
51*21373fa4SWill Schurman }
52