try to fix tests failing sometimes

This commit is contained in:
Matthieu 2021-04-30 17:52:36 +02:00
parent c09979a910
commit ff16491a23
1 changed files with 13 additions and 0 deletions

View File

@ -51,6 +51,10 @@ class HomeFeedTest {
)
db.close()
activityScenario = ActivityScenario.launch(MainActivity::class.java)
waitForView(R.id.username)
onView(withId(R.id.list)).perform(scrollToPosition<StatusViewHolder>(0))
}
@After
fun after() {
@ -63,6 +67,9 @@ class HomeFeedTest {
//Wait for the feed to load
waitForView(R.id.postPager)
onView(withId(R.id.list)).perform(scrollToPosition<StatusViewHolder>(0))
activityScenario.onActivity {
a -> run {
//Pick the second photo
@ -136,6 +143,8 @@ class HomeFeedTest {
fun clickingUsernameOpensProfile() {
waitForView(R.id.username)
onView(withId(R.id.list)).perform(scrollToPosition<StatusViewHolder>(0))
onView(withId(R.id.list)).perform(
actionOnItemAtPosition<StatusViewHolder>(0, clickChildViewWithId(R.id.username))
)
@ -147,6 +156,8 @@ class HomeFeedTest {
fun clickingProfilePicOpensProfile() {
waitForView(R.id.profilePic)
onView(withId(R.id.list)).perform(scrollToPosition<StatusViewHolder>(0))
onView(withId(R.id.list)).perform(
actionOnItemAtPosition<StatusViewHolder>(0, clickChildViewWithId(R.id.profilePic))
)
@ -158,6 +169,8 @@ class HomeFeedTest {
fun clickingMentionOpensProfile() {
waitForView(R.id.description)
onView(withId(R.id.list)).perform(scrollToPosition<StatusViewHolder>(0))
onView(withId(R.id.list)).perform(
actionOnItemAtPosition<StatusViewHolder>(0, clickChildViewWithId(R.id.description))
)