Merge pull request #738 from SimonMarquis/patch-5

Grant `POST_NOTIFICATIONS` permission in instrumented tests
pull/747/head
Don Turner 2 years ago committed by GitHub
commit a03307e14d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -16,6 +16,9 @@
package com.google.samples.apps.nowinandroid.feature.foryou
import android.Manifest
import android.os.Build.VERSION.SDK_INT
import android.os.Build.VERSION_CODES.TIRAMISU
import androidx.activity.ComponentActivity
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.ui.test.assertHasClickAction
@ -28,6 +31,8 @@ import androidx.compose.ui.test.onFirst
import androidx.compose.ui.test.onNodeWithContentDescription
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performScrollToNode
import androidx.test.rule.GrantPermissionRule
import androidx.test.rule.GrantPermissionRule.grant
import com.google.samples.apps.nowinandroid.core.testing.data.followableTopicTestData
import com.google.samples.apps.nowinandroid.core.testing.data.userNewsResourcesTestData
import com.google.samples.apps.nowinandroid.core.ui.NewsFeedUiState
@ -35,6 +40,15 @@ import org.junit.Rule
import org.junit.Test
class ForYouScreenTest {
@get:Rule
val permissionTestRule: GrantPermissionRule =
if (SDK_INT >= TIRAMISU) {
grant(Manifest.permission.POST_NOTIFICATIONS)
} else {
grant()
}
@get:Rule
val composeTestRule = createAndroidComposeRule<ComponentActivity>()

Loading…
Cancel
Save