Skip to content

CountDownActivity Compose 전환 및 테스트 추가#403

Open
unam98 wants to merge 4 commits into
developfrom
feature/countdown-compose-tdd-migration
Open

CountDownActivity Compose 전환 및 테스트 추가#403
unam98 wants to merge 4 commits into
developfrom
feature/countdown-compose-tdd-migration

Conversation

@unam98

@unam98 unam98 commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

작업 배경

  • 카운트다운 화면을 XML/DataBinding 기반에서 Compose로 전환하고, 3→2→1 후 러닝 화면으로 이동하는 규칙을 테스트로 고정했습니다.

변경 사항

영역 내용
presentation/countdown/CountDownActivity DataBinding/XML 의존 제거, Compose CountDownRoute 렌더링 및 완료 시 RunActivity 이동 처리
presentation/countdown/CountDownScreen 카운트다운 UI, 숫자 상태 전이, drawable 매핑 로직 추가
CountDownStateMachineTest 카운트다운 시작값/순서/drawable 매핑 단위 테스트 추가
CountDownScreenTest Compose UI 노출 및 카운트다운 완료 콜백 instrumentation 테스트 추가
res/layout/activity_count_down.xml, res/anim/anim_count.xml Compose 전환으로 미사용 XML 리소스 제거

영향 범위

  • 러닝 시작 전 카운트다운 화면의 렌더링 및 3초 후 RunActivity 진입 흐름
  • 기존 CourseData intent extra 전달과 뒤로가기 analytics/전환 애니메이션은 유지
  • XML 레이아웃/뷰 애니메이션 제거로 CountDown 화면은 Compose runtime에 의존

검증 매트릭스

영향 범위 항목 테스트 코드
카운트다운 시작값이 3으로 유지된다 카운트다운은 3에서 시작한다
카운트다운이 3→2→1 순서로 진행되고 이후 완료된다 카운트다운은 3_2_1 순서로 진행되고 이후 종료된다
카운트다운이_끝나면_완료_콜백이_호출된다
숫자별 drawable 매핑이 유지된다 카운트다운 숫자에 맞는 drawable을 반환한다
숫자 애니메이션 scale 범위가 기존 XML과 동일하다 카운트다운 숫자 애니메이션은 기존 XML scale 범위를 유지한다
카운트다운 화면의 배경/숫자/안내 문구가 노출된다 카운트다운_배경_숫자_안내문구가_노출된다

Test Plan

  • ./gradlew testDebugUnitTest --tests 'com.runnect.runnect.presentation.countdown.*' 통과: 4/4
  • ANDROID_SERIAL=emulator-5554 ./gradlew connectedDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.runnect.runnect.presentation.countdown.CountDownScreenTest 통과: 2/2
  • ./gradlew assembleDebug 통과

Before / After 영상

Before After
countdown_before.mp4
countdown_after.mp4

기존 리소스 기반 카운트다운 3→2→1 화면과 Compose 전환 후 카운트다운 3→2→1 화면을 비교했습니다.

🤖 Generated with Claude Code

@unam98 unam98 self-assigned this Jun 28, 2026
@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The countdown screen now uses Jetpack Compose instead of view binding and XML animation resources. CountDownActivity hosts CountDownRoute, CountDownScreen.kt provides the countdown UI and state, and unit plus instrumented tests cover the new flow.

Changes

Compose Countdown Migration

Layer / File(s) Summary
CountDownScreen: state machine and composables
app/src/main/java/com/runnect/runnect/presentation/countdown/CountDownScreen.kt
Defines CountDownScreenTestTags, CountDownStateMachine, CountDownAnimationSpec, CountDownRoute, and CountDownContent for the countdown screen.
CountDownActivity refactored to Compose
app/src/main/java/com/runnect/runnect/presentation/countdown/CountDownActivity.kt
Switches to Compose content, wires onFinished to moveToRun(), updates back-press handling, and removes the old countdown constants and animation setup.
Unit and UI tests for countdown
app/src/test/.../CountDownStateMachineTest.kt, app/src/androidTest/.../CountDownScreenTest.kt
CountDownStateMachineTest checks progression, drawable mapping, and animation scale constants. CountDownScreenTest verifies the rendered UI and that onFinished fires once after clock advancement.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 Three, two, one — hop away!
Old XML bids farewell today.
Compose now ticks the countdown beat,
State and tests keep time complete.
A cheerful bounce to run begins today!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed CountDownActivity를 Compose로 전환하고 관련 테스트를 추가한 핵심 변경을 잘 요약합니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/countdown-compose-tdd-migration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@app/src/androidTest/java/com/runnect/runnect/presentation/countdown/CountDownScreenTest.kt`:
- Line 30: The countdown test is asserting against hard-coded Korean UI text,
which makes it locale-dependent. Update CountDownScreenTest to locate the
countdown description through CountDownContent’s DESCRIPTION tag and verify it
against the R.string.count_down_desc resource instead of onNodeWithText. Keep
the assertion tied to the existing Compose semantics/tag identifiers so the test
remains stable across locales.

In
`@app/src/main/java/com/runnect/runnect/presentation/countdown/CountDownScreen.kt`:
- Around line 65-73: The countdown logic in CountDownScreen’s
LaunchedEffect(currentCount) keeps ticking even when the activity is not
RESUMED, which can trigger onFinished() while the app is backgrounded. Update
the countdown tick to be lifecycle-aware by tying the delay/nextCount update
flow to the current lifecycle, using repeatOnLifecycle(Lifecycle.State.RESUMED)
or equivalent, so currentCount only advances while the screen is visible and
active.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d0d5b828-279c-4d4d-988b-2f1daf5d6d2d

📥 Commits

Reviewing files that changed from the base of the PR and between abeb1ca and c3812a2.

📒 Files selected for processing (6)
  • app/src/androidTest/java/com/runnect/runnect/presentation/countdown/CountDownScreenTest.kt
  • app/src/main/java/com/runnect/runnect/presentation/countdown/CountDownActivity.kt
  • app/src/main/java/com/runnect/runnect/presentation/countdown/CountDownScreen.kt
  • app/src/main/res/anim/anim_count.xml
  • app/src/main/res/layout/activity_count_down.xml
  • app/src/test/java/com/runnect/runnect/presentation/countdown/CountDownStateMachineTest.kt
💤 Files with no reviewable changes (2)
  • app/src/main/res/layout/activity_count_down.xml
  • app/src/main/res/anim/anim_count.xml

composeTestRule.onNodeWithTag(CountDownScreenTestTags.NUMBER)
.assertIsDisplayed()
.assertContentDescriptionEquals("3")
composeTestRule.onNodeWithText("잠시 후 러닝을 시작합니다").assertIsDisplayed()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Avoid hard-coding localized UI copy in the assertion.

This makes the test locale-dependent even though CountDownContent already exposes a DESCRIPTION tag and reads from R.string.count_down_desc. Assert via the tag plus the string resource instead.

Suggested change
+import androidx.compose.ui.test.assertTextEquals
 import androidx.compose.ui.test.assertContentDescriptionEquals
 import androidx.compose.ui.test.assertIsDisplayed
 import androidx.compose.ui.test.junit4.createComposeRule
 import androidx.compose.ui.test.onNodeWithTag
-import androidx.compose.ui.test.onNodeWithText
+import androidx.test.platform.app.InstrumentationRegistry
+import com.runnect.runnect.R
 import com.runnect.runnect.presentation.ui.theme.RunnectTheme
@@
     fun 카운트다운_배경_숫자_안내문구가_노출된다() {
+        val context = InstrumentationRegistry.getInstrumentation().targetContext
+
         composeTestRule.setContent {
             RunnectTheme {
                 CountDownContent(count = 3)
@@
-        composeTestRule.onNodeWithText("잠시 후 러닝을 시작합니다").assertIsDisplayed()
+        composeTestRule.onNodeWithTag(CountDownScreenTestTags.DESCRIPTION)
+            .assertIsDisplayed()
+            .assertTextEquals(context.getString(R.string.count_down_desc))
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
composeTestRule.onNodeWithText("잠시 후 러닝을 시작합니다").assertIsDisplayed()
val context = InstrumentationRegistry.getInstrumentation().targetContext
composeTestRule.onNodeWithTag(CountDownScreenTestTags.DESCRIPTION)
.assertIsDisplayed()
.assertTextEquals(context.getString(R.string.count_down_desc))
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@app/src/androidTest/java/com/runnect/runnect/presentation/countdown/CountDownScreenTest.kt`
at line 30, The countdown test is asserting against hard-coded Korean UI text,
which makes it locale-dependent. Update CountDownScreenTest to locate the
countdown description through CountDownContent’s DESCRIPTION tag and verify it
against the R.string.count_down_desc resource instead of onNodeWithText. Keep
the assertion tied to the existing Compose semantics/tag identifiers so the test
remains stable across locales.

Comment thread app/src/main/java/com/runnect/runnect/presentation/countdown/CountDownScreen.kt Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant