Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
main ▾

Modern-Apps.git / office / src / test / java / com / vayunmathur / office / Slice4Pass2MainActivityTest.kt

Slice4Pass2MainActivityTest.kt25 lines · 1.0 KiBRaw
1package com.vayunmathur.office
2
3import android.content.Context
4import androidx.compose.ui.test.junit4.createAndroidComposeRule
5import androidx.compose.ui.test.onNodeWithText
6import androidx.test.core.app.ApplicationProvider
7import androidx.test.ext.junit.runners.AndroidJUnit4
8import org.junit.Rule
9import org.junit.Test
10import org.junit.runner.RunWith
11import kotlin.test.assertTrue
12
13/** Slice 4 pass 2: MainActivity launches into the office home (nav graph + theme). */
14@RunWith(AndroidJUnit4::class)
15class Slice4Pass2MainActivityTest {
16
17 @get:Rule val rule = createAndroidComposeRule<MainActivity>()
18 private val ctx: Context get() = ApplicationProvider.getApplicationContext()
19
20 @Test fun mainActivityLaunchesToHome() {
21 rule.onNodeWithText(ctx.getString(R.string.open_document)).assertExists()
22 rule.onNodeWithText(ctx.getString(R.string.app_name), substring = true).assertExists()
23 assertTrue(rule.activity.intent?.action == "android.intent.action.MAIN" || rule.activity.intent != null)
24 }
25}