mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
Add poll test for users try to change their votes after poll is ended.
This commit is contained in:
parent
7c6167ace9
commit
a12f918dd5
@ -63,7 +63,7 @@ class PollAggregationTest : InstrumentedTest {
|
|||||||
val aliceTimeline = roomFromAlicePOV.createTimeline(null, TimelineSettings(30))
|
val aliceTimeline = roomFromAlicePOV.createTimeline(null, TimelineSettings(30))
|
||||||
aliceTimeline.start()
|
aliceTimeline.start()
|
||||||
|
|
||||||
val TOTAL_TEST_COUNT = 6
|
val TOTAL_TEST_COUNT = 7
|
||||||
val lock = CountDownLatch(TOTAL_TEST_COUNT)
|
val lock = CountDownLatch(TOTAL_TEST_COUNT)
|
||||||
|
|
||||||
val aliceEventsListener = object : Timeline.Listener {
|
val aliceEventsListener = object : Timeline.Listener {
|
||||||
@ -86,26 +86,38 @@ class PollAggregationTest : InstrumentedTest {
|
|||||||
roomFromBobPOV.voteToPoll(pollEventId, pollContent.pollCreationInfo?.answers?.firstOrNull()?.id ?: "")
|
roomFromBobPOV.voteToPoll(pollEventId, pollContent.pollCreationInfo?.answers?.firstOrNull()?.id ?: "")
|
||||||
}
|
}
|
||||||
TOTAL_TEST_COUNT - 1 -> {
|
TOTAL_TEST_COUNT - 1 -> {
|
||||||
|
// Bob: Option 1
|
||||||
testBobVotesOption1(pollContent, pollSummary)
|
testBobVotesOption1(pollContent, pollSummary)
|
||||||
lock.countDown()
|
lock.countDown()
|
||||||
roomFromBobPOV.voteToPoll(pollEventId, pollContent.pollCreationInfo?.answers?.get(1)?.id ?: "")
|
roomFromBobPOV.voteToPoll(pollEventId, pollContent.pollCreationInfo?.answers?.get(1)?.id ?: "")
|
||||||
}
|
}
|
||||||
TOTAL_TEST_COUNT - 2 -> {
|
TOTAL_TEST_COUNT - 2 -> {
|
||||||
|
// Bob: Option 2
|
||||||
testBobChangesVoteToOption2(pollContent, pollSummary)
|
testBobChangesVoteToOption2(pollContent, pollSummary)
|
||||||
lock.countDown()
|
lock.countDown()
|
||||||
roomFromAlicePOV.voteToPoll(pollEventId, pollContent.pollCreationInfo?.answers?.get(1)?.id ?: "")
|
roomFromAlicePOV.voteToPoll(pollEventId, pollContent.pollCreationInfo?.answers?.get(1)?.id ?: "")
|
||||||
}
|
}
|
||||||
TOTAL_TEST_COUNT - 3 -> {
|
TOTAL_TEST_COUNT - 3 -> {
|
||||||
|
// Alice: Option 2, Bob: Option 2
|
||||||
testAliceAndBobVoteToOption2(pollContent, pollSummary)
|
testAliceAndBobVoteToOption2(pollContent, pollSummary)
|
||||||
lock.countDown()
|
lock.countDown()
|
||||||
roomFromAlicePOV.voteToPoll(pollEventId, pollContent.pollCreationInfo?.answers?.firstOrNull()?.id ?: "")
|
roomFromAlicePOV.voteToPoll(pollEventId, pollContent.pollCreationInfo?.answers?.firstOrNull()?.id ?: "")
|
||||||
}
|
}
|
||||||
TOTAL_TEST_COUNT - 4 -> {
|
TOTAL_TEST_COUNT - 4 -> {
|
||||||
|
// Alice: Option 1, Bob: Option 2
|
||||||
testAliceVotesOption1AndBobVotesOption2(pollContent, pollSummary)
|
testAliceVotesOption1AndBobVotesOption2(pollContent, pollSummary)
|
||||||
lock.countDown()
|
lock.countDown()
|
||||||
roomFromBobPOV.endPoll(pollEventId)
|
roomFromBobPOV.endPoll(pollEventId)
|
||||||
}
|
}
|
||||||
TOTAL_TEST_COUNT - 5 -> {
|
TOTAL_TEST_COUNT - 5 -> {
|
||||||
|
// Alice: Option 1, Bob: Option 2 [poll is ended]
|
||||||
|
testEndedPoll(pollSummary)
|
||||||
|
lock.countDown()
|
||||||
|
roomFromAlicePOV.voteToPoll(pollEventId, pollContent.pollCreationInfo?.answers?.get(1)?.id ?: "")
|
||||||
|
}
|
||||||
|
TOTAL_TEST_COUNT - 6 -> {
|
||||||
|
// Alice: Option 1 (ignore change), Bob: Option 2 [poll is ended]
|
||||||
|
testAliceVotesOption1AndBobVotesOption2(pollContent, pollSummary)
|
||||||
testEndedPoll(pollSummary)
|
testEndedPoll(pollSummary)
|
||||||
lock.countDown()
|
lock.countDown()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user