test: add UI smoke test for MainActivity placeholder

createAndroidComposeRule<MainActivity>() launches the activity in the
test process and verifies both app_name and app_tagline texts render
on the placeholder screen. Uses JUnit 4 + AndroidJUnit4 runner -
instrumented tests on Android still don't support JUnit Jupiter.

Test compiles (assembleDebugAndroidTest passes); execution requires
an emulator/device, performed in CI.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jean-Luc Makiola
2026-06-08 15:45:17 +02:00
parent dea5490bcf
commit 0593b9c60f

View File

@@ -0,0 +1,26 @@
package de.jeanlucmakiola.calendula
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.junit4.createAndroidComposeRule
import androidx.compose.ui.test.onNodeWithText
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class MainActivitySmokeTest {
@get:Rule
val composeTestRule = createAndroidComposeRule<MainActivity>()
@Test
fun appName_isDisplayed_onLaunch() {
composeTestRule.onNodeWithText("Calendula").assertIsDisplayed()
}
@Test
fun tagline_isDisplayed_onLaunch() {
composeTestRule.onNodeWithText("A modern calendar.").assertIsDisplayed()
}
}