-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'an/develop' into an/fix/pokemon-evolution-navigation
- Loading branch information
Showing
19 changed files
with
463 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
...id/app/src/androidTest/java/poke/rogue/helper/presentation/dex/PokemonListActivityTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
package poke.rogue.helper.presentation.dex | ||
|
||
import androidx.lifecycle.lifecycleScope | ||
import androidx.test.espresso.Espresso.onView | ||
import androidx.test.espresso.IdlingRegistry | ||
import androidx.test.espresso.IdlingResource | ||
import androidx.test.espresso.action.ViewActions | ||
import androidx.test.espresso.assertion.ViewAssertions.matches | ||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed | ||
import androidx.test.espresso.matcher.ViewMatchers.withId | ||
import androidx.test.ext.junit.rules.activityScenarioRule | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import io.kotest.matchers.nulls.shouldNotBeNull | ||
import org.hamcrest.CoreMatchers.not | ||
import org.junit.After | ||
import org.junit.Before | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.koin.androidx.viewmodel.ext.android.getViewModel | ||
import poke.rogue.helper.R | ||
import poke.rogue.helper.presentation.di.testViewModelModule | ||
import poke.rogue.helper.testing.idleresource.asIdlingResource | ||
import poke.rogue.helper.testing.rule.KoinAndroidUnitTestRule | ||
import poke.rogue.helper.testing.view.withItemCount | ||
|
||
@RunWith(AndroidJUnit4::class) | ||
class PokemonListActivityTest { | ||
@get:Rule | ||
val activityRule = activityScenarioRule<PokemonListActivity>() | ||
val scenario get() = activityRule.scenario | ||
private lateinit var idlingResource: IdlingResource | ||
|
||
@get:Rule | ||
val koinTestRule = | ||
KoinAndroidUnitTestRule( | ||
testViewModelModule, | ||
) | ||
|
||
@Before | ||
fun setUp() { | ||
scenario.onActivity { activity -> | ||
val viewModel = activity.getViewModel<PokemonListViewModel>() | ||
|
||
// StateFlow의 값이 비어 있지 않은 상태를 Idle로 간주 | ||
idlingResource = | ||
viewModel.uiState.asIdlingResource(activity.lifecycleScope) { uiState -> | ||
uiState.pokemons.isNotEmpty() | ||
} | ||
|
||
// IdlingResource 등록 | ||
IdlingRegistry.getInstance().register(idlingResource) | ||
} | ||
} | ||
|
||
@After | ||
fun tearDown() { | ||
IdlingRegistry.getInstance().unregister(idlingResource) | ||
} | ||
|
||
@Test | ||
fun `Activity_실행_테스트`() { | ||
scenario.onActivity { activity -> | ||
activity.shouldNotBeNull() | ||
} | ||
} | ||
|
||
@Test | ||
fun `포켓몬_리스트가_화면에_보인다`() { | ||
onView(withId(R.id.rv_pokemon_list)) | ||
.check(matches(isDisplayed())) | ||
} | ||
|
||
@Test | ||
fun `포켓몬_리스트_아이템_카운트_테스트`() { | ||
onView(withId(R.id.rv_pokemon_list)) | ||
.check(withItemCount(10)) | ||
} | ||
|
||
@Test | ||
fun `스크롤_down_시_헤더_그룹이_사라지고_스크롤_up_시_헤더_그룹이_보인다`() { | ||
// scroll down | ||
onView(withId(R.id.root_pokemon_list)) | ||
.perform(ViewActions.swipeUp()) | ||
onView(withId(R.id.header_group)) | ||
.check(matches(not(isDisplayed()))) | ||
// scroll up | ||
onView(withId(R.id.root_pokemon_list)) | ||
.perform(ViewActions.swipeDown()) | ||
onView(withId(R.id.header_group)) | ||
.check(matches(isDisplayed())) | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
android/app/src/androidTest/java/poke/rogue/helper/presentation/di/TestViewModelModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package poke.rogue.helper.presentation.di | ||
|
||
import org.koin.core.module.dsl.singleOf | ||
import org.koin.core.module.dsl.viewModel | ||
import org.koin.core.module.dsl.viewModelOf | ||
import org.koin.dsl.module | ||
import poke.rogue.helper.presentation.ability.AbilityViewModel | ||
import poke.rogue.helper.presentation.ability.detail.AbilityDetailViewModel | ||
import poke.rogue.helper.presentation.battle.BattleViewModel | ||
import poke.rogue.helper.presentation.battle.selection.BattleSelectionViewModel | ||
import poke.rogue.helper.presentation.battle.selection.pokemon.PokemonSelectionViewModel | ||
import poke.rogue.helper.presentation.battle.selection.skill.SkillSelectionViewModel | ||
import poke.rogue.helper.presentation.biome.BiomeViewModel | ||
import poke.rogue.helper.presentation.biome.detail.BiomeDetailViewModel | ||
import poke.rogue.helper.presentation.dex.PokemonListViewModel | ||
import poke.rogue.helper.presentation.dex.detail.PokemonDetailViewModel | ||
import poke.rogue.helper.presentation.home.HomeViewModel | ||
import poke.rogue.helper.presentation.type.TypeViewModel | ||
import poke.rogue.helper.testing.di.testingModule | ||
|
||
val testViewModelModule = | ||
module { | ||
includes(testingModule) | ||
|
||
singleOf(::PokemonListViewModel) | ||
singleOf(::HomeViewModel) | ||
singleOf(::AbilityViewModel) | ||
singleOf(::AbilityDetailViewModel) | ||
viewModelOf(::TypeViewModel) | ||
viewModel<BattleViewModel> { params -> | ||
BattleViewModel(get(), get(), get(), params.getOrNull(), params.getOrNull()) | ||
} | ||
viewModel<BattleSelectionViewModel> { params -> | ||
BattleSelectionViewModel(params.get(), params.get(), get()) | ||
} | ||
viewModel { params -> | ||
PokemonSelectionViewModel(get(), params.getOrNull(), get()) | ||
} | ||
viewModel { params -> | ||
SkillSelectionViewModel(get(), params.getOrNull(), get()) | ||
} | ||
singleOf(::BiomeViewModel) | ||
singleOf(::BiomeDetailViewModel) | ||
singleOf(::PokemonDetailViewModel) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 0 additions & 103 deletions
103
android/app/src/androidTest/java/poke/rogue/helper/presentation/util/RecyclerViewUtils.kt
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
android/app/src/androidTest/java/poke/rogue/helper/presentation/util/ViewAssertionUtils.kt
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
android/app/src/main/java/poke/rogue/helper/presentation/battle/BattleActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
android/app/src/main/java/poke/rogue/helper/presentation/battle/WeatherSpinnerAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.