|
|
|
@ -18,7 +18,8 @@ package com.google.samples.apps.nowinandroid.ui
|
|
|
|
|
|
|
|
|
|
import androidx.annotation.StringRes
|
|
|
|
|
import androidx.compose.ui.test.assertCountEquals
|
|
|
|
|
import androidx.compose.ui.test.assertIsOn
|
|
|
|
|
import androidx.compose.ui.test.assertIsDisplayed
|
|
|
|
|
import androidx.compose.ui.test.assertIsNotDisplayed
|
|
|
|
|
import androidx.compose.ui.test.assertIsSelected
|
|
|
|
|
import androidx.compose.ui.test.hasAnyAncestor
|
|
|
|
|
import androidx.compose.ui.test.hasTestTag
|
|
|
|
@ -97,6 +98,8 @@ class NavigationTest {
|
|
|
|
|
private val forYou by composeTestRule.stringResource(FeatureForyouR.string.feature_foryou_title)
|
|
|
|
|
private val interests by composeTestRule.stringResource(FeatureSearchR.string.feature_search_interests)
|
|
|
|
|
private val sampleTopic = "Headlines"
|
|
|
|
|
private val sampleTopicCheckIconDescription = "Headlines checked"
|
|
|
|
|
private val sampleTopicAddIconDescription = "Headlines add"
|
|
|
|
|
private val appName by composeTestRule.stringResource(R.string.app_name)
|
|
|
|
|
private val saved by composeTestRule.stringResource(BookmarksR.string.feature_bookmarks_title)
|
|
|
|
|
private val settings by composeTestRule.stringResource(SettingsR.string.feature_settings_top_app_bar_action_icon_description)
|
|
|
|
@ -131,7 +134,14 @@ class NavigationTest {
|
|
|
|
|
// AND the user navigates to the For You destination
|
|
|
|
|
onNodeWithText(forYou).performClick()
|
|
|
|
|
// THEN the state of the For You destination is restored
|
|
|
|
|
onNodeWithContentDescription(sampleTopic).assertIsOn()
|
|
|
|
|
onNodeWithContentDescription(
|
|
|
|
|
sampleTopicCheckIconDescription,
|
|
|
|
|
useUnmergedTree = true,
|
|
|
|
|
).assertIsDisplayed()
|
|
|
|
|
onNodeWithContentDescription(
|
|
|
|
|
sampleTopicAddIconDescription,
|
|
|
|
|
useUnmergedTree = true,
|
|
|
|
|
).assertIsNotDisplayed()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -146,7 +156,14 @@ class NavigationTest {
|
|
|
|
|
// WHEN the user taps the For You navigation bar item
|
|
|
|
|
onNodeWithText(forYou).performClick()
|
|
|
|
|
// THEN the state of the For You destination is restored
|
|
|
|
|
onNodeWithContentDescription(sampleTopic).assertIsOn()
|
|
|
|
|
onNodeWithContentDescription(
|
|
|
|
|
sampleTopicCheckIconDescription,
|
|
|
|
|
useUnmergedTree = true,
|
|
|
|
|
).assertIsDisplayed()
|
|
|
|
|
onNodeWithContentDescription(
|
|
|
|
|
sampleTopicAddIconDescription,
|
|
|
|
|
useUnmergedTree = true,
|
|
|
|
|
).assertIsNotDisplayed()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|