Timeline tests: unignored
This commit is contained in:
parent
28a79b4672
commit
a800a837cc
@ -17,10 +17,10 @@
|
|||||||
package org.matrix.android.sdk.session.room.timeline
|
package org.matrix.android.sdk.session.room.timeline
|
||||||
|
|
||||||
import androidx.test.filters.LargeTest
|
import androidx.test.filters.LargeTest
|
||||||
|
import kotlinx.coroutines.runBlocking
|
||||||
import org.amshove.kluent.shouldBeFalse
|
import org.amshove.kluent.shouldBeFalse
|
||||||
import org.amshove.kluent.shouldBeTrue
|
import org.amshove.kluent.shouldBeTrue
|
||||||
import org.junit.FixMethodOrder
|
import org.junit.FixMethodOrder
|
||||||
import org.junit.Ignore
|
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
import org.junit.runners.JUnit4
|
import org.junit.runners.JUnit4
|
||||||
@ -40,7 +40,6 @@ import java.util.concurrent.CountDownLatch
|
|||||||
|
|
||||||
@RunWith(JUnit4::class)
|
@RunWith(JUnit4::class)
|
||||||
@FixMethodOrder(MethodSorters.JVM)
|
@FixMethodOrder(MethodSorters.JVM)
|
||||||
@Ignore("This test will be ignored until it is fixed")
|
|
||||||
@LargeTest
|
@LargeTest
|
||||||
class TimelinePreviousLastForwardTest : InstrumentedTest {
|
class TimelinePreviousLastForwardTest : InstrumentedTest {
|
||||||
|
|
||||||
@ -232,11 +231,12 @@ class TimelinePreviousLastForwardTest : InstrumentedTest {
|
|||||||
bobTimeline.addListener(eventsListener)
|
bobTimeline.addListener(eventsListener)
|
||||||
|
|
||||||
bobTimeline.paginate(Timeline.Direction.FORWARDS, 50)
|
bobTimeline.paginate(Timeline.Direction.FORWARDS, 50)
|
||||||
bobTimeline.paginate(Timeline.Direction.FORWARDS, 50)
|
|
||||||
|
|
||||||
commonTestHelper.await(lock)
|
commonTestHelper.await(lock)
|
||||||
bobTimeline.removeAllListeners()
|
bobTimeline.removeAllListeners()
|
||||||
|
commonTestHelper.runBlockingTest {
|
||||||
|
val timelineEvents = bobTimeline.awaitPaginate(Timeline.Direction.FORWARDS, 50)
|
||||||
|
Timber.v("Number of timelineEvents=${timelineEvents.size}")
|
||||||
|
}
|
||||||
bobTimeline.hasMoreToLoad(Timeline.Direction.FORWARDS).shouldBeFalse()
|
bobTimeline.hasMoreToLoad(Timeline.Direction.FORWARDS).shouldBeFalse()
|
||||||
bobTimeline.hasMoreToLoad(Timeline.Direction.BACKWARDS).shouldBeFalse()
|
bobTimeline.hasMoreToLoad(Timeline.Direction.BACKWARDS).shouldBeFalse()
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ import androidx.test.filters.LargeTest
|
|||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import org.amshove.kluent.internal.assertEquals
|
import org.amshove.kluent.internal.assertEquals
|
||||||
import org.junit.FixMethodOrder
|
import org.junit.FixMethodOrder
|
||||||
import org.junit.Ignore
|
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
import org.junit.runners.JUnit4
|
import org.junit.runners.JUnit4
|
||||||
@ -35,11 +34,11 @@ import org.matrix.android.sdk.api.session.room.timeline.Timeline
|
|||||||
import org.matrix.android.sdk.api.session.room.timeline.TimelineSettings
|
import org.matrix.android.sdk.api.session.room.timeline.TimelineSettings
|
||||||
import org.matrix.android.sdk.common.CommonTestHelper.Companion.runCryptoTest
|
import org.matrix.android.sdk.common.CommonTestHelper.Companion.runCryptoTest
|
||||||
import org.matrix.android.sdk.common.TestConstants
|
import org.matrix.android.sdk.common.TestConstants
|
||||||
|
import timber.log.Timber
|
||||||
|
|
||||||
@RunWith(JUnit4::class)
|
@RunWith(JUnit4::class)
|
||||||
@FixMethodOrder(MethodSorters.JVM)
|
@FixMethodOrder(MethodSorters.JVM)
|
||||||
@LargeTest
|
@LargeTest
|
||||||
@Ignore
|
|
||||||
class TimelineSimpleBackPaginationTest : InstrumentedTest {
|
class TimelineSimpleBackPaginationTest : InstrumentedTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -68,28 +67,14 @@ class TimelineSimpleBackPaginationTest : InstrumentedTest {
|
|||||||
|
|
||||||
val bobTimeline = roomFromBobPOV.timelineService().createTimeline(null, TimelineSettings(30))
|
val bobTimeline = roomFromBobPOV.timelineService().createTimeline(null, TimelineSettings(30))
|
||||||
bobTimeline.start()
|
bobTimeline.start()
|
||||||
|
commonTestHelper.runBlockingTest {
|
||||||
commonTestHelper.waitWithLatch(timeout = TestConstants.timeOutMillis * 10) {
|
while (bobTimeline.hasMoreToLoad(Timeline.Direction.BACKWARDS)) {
|
||||||
val listener = object : Timeline.Listener {
|
val timelineEvents = bobTimeline.awaitPaginate(direction = Timeline.Direction.BACKWARDS, 30)
|
||||||
|
Timber.v("Number of TimelineEvents= ${timelineEvents.size}")
|
||||||
override fun onStateUpdated(direction: Timeline.Direction, state: Timeline.PaginationState) {
|
|
||||||
if (direction == Timeline.Direction.FORWARDS) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (state.hasMoreToLoad && !state.loading) {
|
|
||||||
bobTimeline.paginate(Timeline.Direction.BACKWARDS, 30)
|
|
||||||
} else if (!state.hasMoreToLoad) {
|
|
||||||
bobTimeline.removeListener(this)
|
|
||||||
it.countDown()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
bobTimeline.addListener(listener)
|
|
||||||
bobTimeline.paginate(Timeline.Direction.BACKWARDS, 30)
|
|
||||||
}
|
}
|
||||||
assertEquals(false, bobTimeline.hasMoreToLoad(Timeline.Direction.FORWARDS))
|
assertEquals(false, bobTimeline.hasMoreToLoad(Timeline.Direction.FORWARDS))
|
||||||
assertEquals(false, bobTimeline.hasMoreToLoad(Timeline.Direction.BACKWARDS))
|
assertEquals(false, bobTimeline.hasMoreToLoad(Timeline.Direction.BACKWARDS))
|
||||||
|
|
||||||
val onlySentEvents = runBlocking {
|
val onlySentEvents = runBlocking {
|
||||||
bobTimeline.getSnapshot()
|
bobTimeline.getSnapshot()
|
||||||
}
|
}
|
||||||
@ -99,7 +84,6 @@ class TimelineSimpleBackPaginationTest : InstrumentedTest {
|
|||||||
(it.root.content.toModel<MessageTextContent>())?.body?.startsWith(message).orFalse()
|
(it.root.content.toModel<MessageTextContent>())?.body?.startsWith(message).orFalse()
|
||||||
}
|
}
|
||||||
assertEquals(numberOfMessagesToSent, onlySentEvents.size)
|
assertEquals(numberOfMessagesToSent, onlySentEvents.size)
|
||||||
|
|
||||||
bobTimeline.dispose()
|
bobTimeline.dispose()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user