From a12f918dd5e37b6451c81de0607b7aa7da2653f7 Mon Sep 17 00:00:00 2001 From: Onuray Sahin Date: Fri, 11 Mar 2022 19:19:20 +0300 Subject: [PATCH] Add poll test for users try to change their votes after poll is ended. --- .../session/room/timeline/PollAggregationTest.kt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/room/timeline/PollAggregationTest.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/room/timeline/PollAggregationTest.kt index e104f29ed2..1de5498040 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/room/timeline/PollAggregationTest.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/room/timeline/PollAggregationTest.kt @@ -63,7 +63,7 @@ class PollAggregationTest : InstrumentedTest { val aliceTimeline = roomFromAlicePOV.createTimeline(null, TimelineSettings(30)) aliceTimeline.start() - val TOTAL_TEST_COUNT = 6 + val TOTAL_TEST_COUNT = 7 val lock = CountDownLatch(TOTAL_TEST_COUNT) val aliceEventsListener = object : Timeline.Listener { @@ -86,26 +86,38 @@ class PollAggregationTest : InstrumentedTest { roomFromBobPOV.voteToPoll(pollEventId, pollContent.pollCreationInfo?.answers?.firstOrNull()?.id ?: "") } TOTAL_TEST_COUNT - 1 -> { + // Bob: Option 1 testBobVotesOption1(pollContent, pollSummary) lock.countDown() roomFromBobPOV.voteToPoll(pollEventId, pollContent.pollCreationInfo?.answers?.get(1)?.id ?: "") } TOTAL_TEST_COUNT - 2 -> { + // Bob: Option 2 testBobChangesVoteToOption2(pollContent, pollSummary) lock.countDown() roomFromAlicePOV.voteToPoll(pollEventId, pollContent.pollCreationInfo?.answers?.get(1)?.id ?: "") } TOTAL_TEST_COUNT - 3 -> { + // Alice: Option 2, Bob: Option 2 testAliceAndBobVoteToOption2(pollContent, pollSummary) lock.countDown() roomFromAlicePOV.voteToPoll(pollEventId, pollContent.pollCreationInfo?.answers?.firstOrNull()?.id ?: "") } TOTAL_TEST_COUNT - 4 -> { + // Alice: Option 1, Bob: Option 2 testAliceVotesOption1AndBobVotesOption2(pollContent, pollSummary) lock.countDown() roomFromBobPOV.endPoll(pollEventId) } 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) lock.countDown() }