For #4877: Restored logic for closing tabs when not on browserFragment
Added base test for CreateCollectionFragment that we can build upon later
This commit is contained in:
parent
ef4a6b4154
commit
9e83edcac5
|
@ -450,6 +450,8 @@ dependencies {
|
||||||
|
|
||||||
androidTestImplementation Deps.androidx_test_core
|
androidTestImplementation Deps.androidx_test_core
|
||||||
androidTestImplementation Deps.espresso_idling_resources
|
androidTestImplementation Deps.espresso_idling_resources
|
||||||
|
debugImplementation Deps.androidx_fragment_testing
|
||||||
|
|
||||||
|
|
||||||
androidTestImplementation Deps.tools_test_runner
|
androidTestImplementation Deps.tools_test_runner
|
||||||
androidTestImplementation Deps.tools_test_rules
|
androidTestImplementation Deps.tools_test_rules
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
package org.mozilla.fenix.collections
|
||||||
|
|
||||||
|
import androidx.fragment.app.testing.FragmentScenario
|
||||||
|
import androidx.fragment.app.testing.launchFragment
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
|
import assertk.assertThat
|
||||||
|
import assertk.assertions.isNotNull
|
||||||
|
import assertk.assertions.isNull
|
||||||
|
import assertk.assertions.isTrue
|
||||||
|
import kotlinx.coroutines.ObsoleteCoroutinesApi
|
||||||
|
import org.junit.Before
|
||||||
|
import org.junit.Test
|
||||||
|
import org.junit.runner.RunWith
|
||||||
|
import org.mozilla.fenix.TestApplication
|
||||||
|
|
||||||
|
import org.robolectric.annotation.Config
|
||||||
|
|
||||||
|
@ObsoleteCoroutinesApi
|
||||||
|
@RunWith(AndroidJUnit4::class)
|
||||||
|
@Config(application = TestApplication::class)
|
||||||
|
class CreateCollectionFragmentTest {
|
||||||
|
|
||||||
|
private lateinit var scenario: FragmentScenario<CreateCollectionFragment>
|
||||||
|
|
||||||
|
@Before
|
||||||
|
fun setUp() {
|
||||||
|
scenario = launchFragment<CreateCollectionFragment>()
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
fun `fragment is loading`() {
|
||||||
|
assertThat(scenario).isNotNull()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `fragment is recreating`() {
|
||||||
|
scenario.recreate()
|
||||||
|
assertThat(scenario).isNotNull()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `creation dialog shows and can be dismissed`() {
|
||||||
|
with(scenario) {
|
||||||
|
onFragment { fragment ->
|
||||||
|
assertThat(fragment.dialog).isNotNull()
|
||||||
|
assertThat(fragment.requireDialog().isShowing).isTrue()
|
||||||
|
fragment.dismiss()
|
||||||
|
assertThat(fragment.dialog).isNull()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -64,6 +64,7 @@ object Versions {
|
||||||
const val robolectric = "4.2"
|
const val robolectric = "4.2"
|
||||||
|
|
||||||
const val google_ads_id_version = "16.0.0"
|
const val google_ads_id_version = "16.0.0"
|
||||||
|
const val androidx_fragment_testing_version = "1.2.0-alpha02"
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
|
@ -215,4 +216,5 @@ object Deps {
|
||||||
const val fenix_megazord_forUnitTests = "org.mozilla.appservices:fenix-megazord-forUnitTests:${Versions.mozilla_appservices}"
|
const val fenix_megazord_forUnitTests = "org.mozilla.appservices:fenix-megazord-forUnitTests:${Versions.mozilla_appservices}"
|
||||||
|
|
||||||
const val google_ads_id = "com.google.android.gms:play-services-ads-identifier:${Versions.google_ads_id_version}"
|
const val google_ads_id = "com.google.android.gms:play-services-ads-identifier:${Versions.google_ads_id_version}"
|
||||||
|
const val androidx_fragment_testing = "androidx.fragment:fragment-testing:${Versions.androidx_fragment_testing_version}"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user