-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[둘리] 1, 2단계 영화 극장 선택 제출합니다. #4
Merged
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
e0afc94
영화 티켓 예매 미션
woowahan-pjs 7026a40
feat(MovieListFragment): 영화 목록 화면 fragment로 변경
EmilyCh0 74deaf3
feat(MovieMainActivity): BottomNavigationView 구현
hyemdooly b2ef721
feat(ReservationListFragment): 예매 내역 레이아웃 구현
EmilyCh0 8135b14
feat(ReservationListFragment): RecyclerView 구현
hyemdooly 4f8255a
feat(ReservationListFragment): 클릭 시 예매 내역 상세 화면으로 이동 구현
EmilyCh0 add9dd3
feat(ReservationListFragment): Data 저장 구현
hyemdooly 40fcc29
refactor(MovieListAdapter): 클릭 이벤트 콜백 하나로 합치기
EmilyCh0 44bf562
feat(AlarmReceiver): 예매 후 상영 전 시간 푸시 알림 구현
hyemdooly cca69f7
feat(SettingFragment, AlarmController): 푸시 알림 수신 설정 구현
EmilyCh0 a508eaa
refactor(AlarmController): 알림 받을 시간 수정
EmilyCh0 1592c3d
refactor(AlarmController, AlarmReceiver): 코드 정리 및 메서드 분리
EmilyCh0 f5a9ef9
test(MovieMainActivityTest): 설정 프래그먼트 테스트
hyemdooly 9737d18
refactor(AndroidManifest): 필요없는 권한 삭제
hyemdooly 939d84a
refactor(layout): xml formatting
hyemdooly 76e9b00
test(SettingFragmentTest): 설정 프래그먼트 테스트
hyemdooly beb0b3a
test(MovieMainActivityTest): Fragment 선택 테스트
hyemdooly b71eb97
refactor(reservation_item.xml): isFocusable, isClickable 설정 삭제
hyemdooly 7a8b6b9
refactor(SettingFragment): property formatting
hyemdooly 070cce4
refactor(SettingFragment): if문 depth 수정
hyemdooly 8497d53
refactor(Adapter, ViewHolder): click listener 파라미터 고차함수 -> OnItemClic…
hyemdooly b2ce59d
refactor(MovieListFragment): click listener 분리
hyemdooly fcd527f
refactor(ReservationListFragment): 변수 분리 가독성 수정
hyemdooly c9df85d
refactor(ReservationCompletedActivity): 권한 유도 코드 이동
hyemdooly 8eba6d0
refactor(AlarmController): context private 수정
hyemdooly 085e9dd
refactor(AlarmReceiver, AlarmController): ALARM_REQUEST_CODE 상수 이동
hyemdooly fd3e4d3
refactor(ReservationCompletedActivity): pendingIntent를 리턴하는 함수 생성
hyemdooly 17cafbc
refactor(SeatSelectionActivity): repositoryMock에 직접 접근이 아닌 interface …
hyemdooly b634aa8
refactor(SettingFragment): defaultSharedPreferences로 변경
hyemdooly 72e7a58
refactor(Fragments): 레이아웃 id 생성자 사용
hyemdooly 00f4a8f
refactor(MovieMainActivity): Fragment 재활용
hyemdooly 923eedd
refactor(ReservationCompletedActivity): 권한 요청 코드 이동
hyemdooly File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test(MovieMainActivityTest): Fragment 선택 테스트
- Loading branch information
commit beb0b3a801bc1c71994ae433ddab76f1326e8e99
There are no files selected for viewing
37 changes: 8 additions & 29 deletions
37
app/src/androidTest/java/woowacourse/movie/view/MovieMainActivityTest.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 |
---|---|---|
@@ -1,59 +1,38 @@ | ||
package woowacourse.movie.view | ||
|
||
import android.content.Context | ||
import android.content.SharedPreferences | ||
import androidx.test.espresso.Espresso.onView | ||
import androidx.test.espresso.action.ViewActions.click | ||
import androidx.test.espresso.assertion.ViewAssertions.matches | ||
import androidx.test.espresso.matcher.ViewMatchers.isChecked | ||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed | ||
import androidx.test.espresso.matcher.ViewMatchers.isNotChecked | ||
import androidx.test.espresso.matcher.ViewMatchers.withId | ||
import androidx.test.ext.junit.rules.ActivityScenarioRule | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import woowacourse.movie.R | ||
import woowacourse.movie.view.moviemain.MovieMainActivity | ||
import woowacourse.movie.view.moviemain.setting.SettingFragment | ||
|
||
@RunWith(AndroidJUnit4::class) | ||
class MovieMainActivityTest { | ||
@get:Rule | ||
val mActivityTestRule = ActivityScenarioRule(MovieMainActivity::class.java) | ||
|
||
@Test | ||
fun 설정_버튼을_누르면_설정_Fragment로_바뀐다() { | ||
onView(withId(R.id.action_setting)).perform(click()) | ||
onView(withId(R.id.setting_toggle)).check(matches(isDisplayed())) | ||
fun 예매내역_버튼을_누르면_예매내역_Fragment로_바뀐다() { | ||
onView(withId(R.id.action_reservation_list)).perform(click()) | ||
onView(withId(R.id.recyclerview)).check(matches(isDisplayed())) | ||
} | ||
|
||
@Test | ||
fun 설정_Fragment에서_저장된_세팅값이_false면_토글도_꺼져있다() { | ||
setSharedPreferences(false) | ||
onView(withId(R.id.action_setting)).perform(click()) | ||
onView(withId(R.id.setting_toggle)).check(matches(isNotChecked())) | ||
fun 홈_버튼을_누르면_홈_Fragment로_바뀐다() { | ||
onView(withId(R.id.action_home)).perform(click()) | ||
onView(withId(R.id.movie_recyclerview)).check(matches(isDisplayed())) | ||
} | ||
|
||
@Test | ||
fun 설정_Fragment에서_저장된_세팅값이_true면_토글도_켜져있다() { | ||
setSharedPreferences(true) | ||
fun 설정_버튼을_누르면_설정_Fragment로_바뀐다() { | ||
onView(withId(R.id.action_setting)).perform(click()) | ||
onView(withId(R.id.setting_toggle)).check(matches(isChecked())) | ||
} | ||
|
||
private fun setSharedPreferences(isAlarmOn: Boolean) { | ||
val targetContext: Context = getInstrumentation().targetContext | ||
|
||
val preferencesEditor: SharedPreferences.Editor = | ||
targetContext.getSharedPreferences( | ||
SettingFragment.ALARM_SETTING, | ||
Context.MODE_PRIVATE, | ||
).edit() | ||
preferencesEditor.clear() | ||
preferencesEditor.putBoolean(SettingFragment.IS_ALARM_ON, isAlarmOn) | ||
preferencesEditor.commit() | ||
onView(withId(R.id.setting_toggle)).check(matches(isDisplayed())) | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
프래그먼트가 보인다를 테스트해야 하는데, 실제로 해당 프래그먼트의 컨텐츠를 확인하는게 아쉽네요..
저도 프래그먼트 테스트는 자주 해보지 않아서, 어떤 방식이 최적의 방식인지는 추천드리기 어려운데
프래그먼트 매니저를 이용해서 프래그먼트의 인스턴스가 해당 타입이 맞는지 확인하는게 가능할까 싶네요!?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TAG로 프래그먼트를 가져와서 그 프래그먼트가 visible인지 검사했습니다! :)