@@ -24,6 +24,7 @@ import app.cash.molecule.moleculeFlow
24
24
import app.cash.turbine.ReceiveTurbine
25
25
import app.cash.turbine.test
26
26
import com.google.common.truth.Truth.assertThat
27
+ import im.vector.app.features.analytics.plan.Composer
27
28
import io.element.android.features.messages.impl.messagecomposer.AttachmentsState
28
29
import io.element.android.features.messages.impl.messagecomposer.MessageComposerContextImpl
29
30
import io.element.android.features.messages.impl.messagecomposer.MessageComposerEvents
@@ -57,6 +58,7 @@ import io.element.android.libraries.textcomposer.Message
57
58
import io.element.android.libraries.textcomposer.MessageComposerMode
58
59
import io.element.android.services.analytics.test.FakeAnalyticsService
59
60
import io.element.android.tests.testutils.WarmUpRule
61
+ import io.element.android.tests.testutils.waitForPredicate
60
62
import io.mockk.mockk
61
63
import kotlinx.coroutines.CoroutineScope
62
64
import kotlinx.coroutines.ExperimentalCoroutinesApi
@@ -208,6 +210,15 @@ class MessageComposerPresenterTest {
208
210
val messageSentState = awaitItem()
209
211
assertThat(messageSentState.richTextEditorState.messageHtml).isEqualTo(" " )
210
212
assertThat(messageSentState.canSendMessage).isFalse()
213
+ waitForPredicate { analyticsService.capturedEvents.size == 1 }
214
+ assertThat(analyticsService.capturedEvents).containsExactly(
215
+ Composer (
216
+ inThread = false ,
217
+ isEditing = false ,
218
+ isReply = false ,
219
+ messageType = Composer .MessageType .Text ,
220
+ )
221
+ )
211
222
}
212
223
}
213
224
@@ -240,6 +251,14 @@ class MessageComposerPresenterTest {
240
251
assertThat(messageSentState.richTextEditorState.messageHtml).isEqualTo(" " )
241
252
assertThat(messageSentState.canSendMessage).isFalse()
242
253
assertThat(fakeMatrixRoom.editMessageCalls.first()).isEqualTo(ANOTHER_MESSAGE to ANOTHER_MESSAGE )
254
+ assertThat(analyticsService.capturedEvents).containsExactly(
255
+ Composer (
256
+ inThread = false ,
257
+ isEditing = true ,
258
+ isReply = false ,
259
+ messageType = Composer .MessageType .Text ,
260
+ )
261
+ )
243
262
}
244
263
}
245
264
@@ -272,6 +291,14 @@ class MessageComposerPresenterTest {
272
291
assertThat(messageSentState.richTextEditorState.messageHtml).isEqualTo(" " )
273
292
assertThat(messageSentState.canSendMessage).isFalse()
274
293
assertThat(fakeMatrixRoom.editMessageCalls.first()).isEqualTo(ANOTHER_MESSAGE to ANOTHER_MESSAGE )
294
+ assertThat(analyticsService.capturedEvents).containsExactly(
295
+ Composer (
296
+ inThread = false ,
297
+ isEditing = true ,
298
+ isReply = false ,
299
+ messageType = Composer .MessageType .Text ,
300
+ )
301
+ )
275
302
}
276
303
}
277
304
@@ -304,6 +331,14 @@ class MessageComposerPresenterTest {
304
331
assertThat(messageSentState.richTextEditorState.messageHtml).isEqualTo(" " )
305
332
assertThat(messageSentState.canSendMessage).isFalse()
306
333
assertThat(fakeMatrixRoom.replyMessageParameter).isEqualTo(A_REPLY to A_REPLY )
334
+ assertThat(analyticsService.capturedEvents).containsExactly(
335
+ Composer (
336
+ inThread = false ,
337
+ isEditing = false ,
338
+ isReply = true ,
339
+ messageType = Composer .MessageType .Text ,
340
+ )
341
+ )
307
342
}
308
343
}
309
344
0 commit comments