[3.4.0][Chat] 车聊聊添加单元测试
This commit is contained in:
46
app/src/androidTest/java/com/mogo/functions/test/ChatTest.kt
Normal file
46
app/src/androidTest/java/com/mogo/functions/test/ChatTest.kt
Normal 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
Reference in New Issue
Block a user