Skip to content

Instantly share code, notes, and snippets.

@JoseAlcerreca
Created June 26, 2020 15:42
Show Gist options
  • Save JoseAlcerreca/61154606f448d43a19e3ab9d6ba6b4d1 to your computer and use it in GitHub Desktop.
Save JoseAlcerreca/61154606f448d43a19e3ab9d6ba6b4d1 to your computer and use it in GitHub Desktop.
<!-- Copyright 2020 Google LLC.
SPDX-License-Identifier: Apache-2.0 -->
@HiltAndroidTest
@UninstallModules(CoroutinesModule::class)
@RunWith(AndroidJUnit4::class)
class AgendaTest {
@get:Rule(order = 0)
var hiltRule = HiltAndroidRule(this)
// Executes tasks in a synchronous [TaskScheduler]
@get:Rule(order = 1)
var syncTaskExecutorRule = SyncTaskExecutorRule()
// Sets the preferences so no welcome screens are shown
@get:Rule(order = 1)
var preferencesRule = SetPreferencesRule()
@get:Rule(order = 2)
var activityRule = MainActivityTestRule(R.id.navigation_agenda)
@Test
fun agenda_basicViewsDisplayed() {
// Title
onView(allOf(instanceOf(TextView::class.java), withParent(withId(R.id.toolbar))))
.check(matches(withText(R.string.agenda)))
// One of the blocks
onView(withText("Breakfast")).check(matches(isDisplayed()))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment