[3.4.0][Chat] 车聊聊添加单元测试

This commit is contained in:
renwj
2023-08-03 18:24:20 +08:00
parent a3d90bfaa3
commit 2f56853f95
2 changed files with 217 additions and 171 deletions

View File

@@ -0,0 +1,46 @@
package com.mogo.functions.test
import androidx.test.core.app.ActivityScenario
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import androidx.test.platform.app.InstrumentationRegistry
import com.mogo.eagle.core.function.call.chat.CallerChatManager
import com.mogo.eagle.core.function.main.MainLauncherActivity
import kotlinx.coroutines.delay
import kotlinx.coroutines.runBlocking
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import java.util.concurrent.TimeUnit
@RunWith(AndroidJUnit4::class)
@LargeTest
class ChatTest {
lateinit var launch: ActivityScenario<MainLauncherActivity>
@Before
fun before() {
launch = ActivityScenario.launch(MainLauncherActivity::class.java)
}
@Test
fun testChat() = runBlocking {
val arguments = InstrumentationRegistry.getArguments()
val delay = arguments.getString("delay", "0")
val sn = arguments.getString("sn", "")
val delayLong = delay.toLong()
if (delayLong <= 0 || sn.isNullOrEmpty()) {
throw AssertionError("illegal state ..")
}
delay(delayLong)
launch.onActivity { activity ->
CallerChatManager.call(activity, sn)
}
delay(TimeUnit.MINUTES.toMillis(10))
}
}

File diff suppressed because one or more lines are too long