Skip to content

Commit

Permalink
Sleep longer in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mscwilson committed Apr 16, 2024
1 parent c9c3775 commit ddd0959
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ApplicationInstallEventTest {
.installAutotracking(true)
createTracker(listOf(trackerConfiguration, plugin))

Thread.sleep(1500)
Thread.sleep(2000)

// check if event was tracked
Assert.assertTrue(eventTracked)
Expand All @@ -67,7 +67,7 @@ class ApplicationInstallEventTest {
.installAutotracking(true)
createTracker(listOf(trackerConfiguration, plugin))

Thread.sleep(1500)
Thread.sleep(2000)

// check if event was tracked
Assert.assertTrue(eventTracked)
Expand All @@ -78,7 +78,7 @@ class ApplicationInstallEventTest {
// create tracker again
createTracker(listOf(trackerConfiguration, plugin))

Thread.sleep(1500)
Thread.sleep(2000)

// check if event was tracked
Assert.assertFalse(eventTracked)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class TestMediaController {
)
)

Thread.sleep(200)
Thread.sleep(300)

assertEquals(1, trackedEvents.size)
assertNotNull(
Expand Down Expand Up @@ -219,7 +219,7 @@ class TestMediaController {
media?.track(MediaVolumeChangeEvent(newVolume = 90))
media?.track(MediaPauseEvent())

Thread.sleep(100)
Thread.sleep(250)

assertEquals(2, trackedEvents.size)
val volumeEvent = trackedEvents.find { it.schema == eventSchema("volume_change") }
Expand All @@ -238,7 +238,7 @@ class TestMediaController {

media?.track(MediaFullscreenChangeEvent(fullscreen = true))

Thread.sleep(200)
Thread.sleep(300)

assertEquals(true, firstEvent.payload.get("fullscreen"))
assertEquals(true, firstPlayer?.get("fullscreen"))
Expand All @@ -265,7 +265,7 @@ class TestMediaController {

media?.track(MediaAdFirstQuartileEvent())

Thread.sleep(200)
Thread.sleep(300)

assertEquals(25, firstEvent.payload.get("percentProgress"))
}
Expand All @@ -276,7 +276,7 @@ class TestMediaController {

media?.track(MediaAdMidpointEvent())

Thread.sleep(200)
Thread.sleep(300)

assertEquals(50, firstEvent.payload.get("percentProgress"))
}
Expand All @@ -301,7 +301,7 @@ class TestMediaController {
media?.track(MediaAdResumeEvent(percentProgress = 40))
media?.track(MediaAdPauseEvent(percentProgress = 50))

Thread.sleep(200)
Thread.sleep(400)

val adClickEvent = trackedEvents.find { it.schema == eventSchema("ad_click") }
assertEquals(15, adClickEvent?.payload?.get("percentProgress"))
Expand Down Expand Up @@ -401,7 +401,7 @@ class TestMediaController {
media.update(player = MediaPlayerEntity(currentTime = 10.0))
media.track(MediaEndEvent())

Thread.sleep(200)
Thread.sleep(300)

val endEvent = trackedEvents.find { it.schema == eventSchema("end") }
val lastSession = endEvent?.entities?.find { it.map.get("schema") == sessionSchema }?.map?.get("data") as? Map<*, *>
Expand All @@ -427,7 +427,7 @@ class TestMediaController {

timer.fire()

Thread.sleep(200)
Thread.sleep(300)

assertEquals(1, trackedEvents.size)
assertEquals(10000L, timer.delay)
Expand Down Expand Up @@ -519,7 +519,7 @@ class TestMediaController {
media?.update(player = MediaPlayerEntity(currentTime = i.toDouble()))
}

Thread.sleep(200)
Thread.sleep(500)

assertEquals(4, trackedEvents.size)
assertEquals(3, trackedEvents.filter { it.schema == eventSchema("percent_progress") }.size)
Expand All @@ -539,7 +539,7 @@ class TestMediaController {
media?.update(player = MediaPlayerEntity(currentTime = i.toDouble()))
}

Thread.sleep(200)
Thread.sleep(400)

assertEquals(2, trackedEvents.size)

Expand Down Expand Up @@ -586,7 +586,7 @@ class TestMediaController {
media?.update(player = MediaPlayerEntity(currentTime = i.toDouble()))
}

Thread.sleep(200)
Thread.sleep(500)

assertEquals(5, trackedEvents.size)
assertEquals(3, trackedEvents.filter { it.schema == eventSchema("percent_progress") }.size)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ScreenStateMachineTest {
tracker.track(ScreenView(name = "Screen 3"))
tracker.track(Timing(category = "c4", variable = "v4", timing = 4))

Thread.sleep(200)
Thread.sleep(500)

val events = eventSink.trackedEvents

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class PluginsTest {
tracker.track(SelfDescribing("schema1", emptyMap()))
tracker.track(Structured("cat", "act"))

Thread.sleep(200)
Thread.sleep(300)
Assert.assertTrue(structuredCalled)
Assert.assertFalse(selfDescribingCalled)
}
Expand Down

0 comments on commit ddd0959

Please sign in to comment.