Skip to content

Instantly share code, notes, and snippets.

@jraska
Last active May 12, 2021 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jraska/729a624235299f301c4b869414fc80cb to your computer and use it in GitHub Desktop.
Save jraska/729a624235299f301c4b869414fc80cb to your computer and use it in GitHub Desktop.
class PushIntegrationTest {
lateinit var pushClient: PushServerClient
lateinit var thisDeviceToken: String
@get:Rule
val pushRule = PushAwaitRule()
@Before
fun setUp() {
pushClient = PushServerClient.create(apiKey())
val tokenTask = FirebaseMessaging.getInstance().token
thisDeviceToken = Tasks.await(tokenTask)
}
@Test
fun testPushIntegrationFromSettingsToAbout() {
DeepLinkLaunchTest.launchDeepLink("https://github.com/settings") // just launches screen to start from
pushRule.onViewAwaitPush() // makes Espresso wait for push to arrive
sendDeepLinkPush("https://github.com/about") // Triggers the push through FCM backend
onView(withText("by Josef Raska")).check(matches(isDisplayed())) // Asserts that the expected about screen was launched
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment