[SHARED] Add initial shared UI test
This commit is contained in:
@@ -233,6 +233,9 @@ android {
|
||||
unitTests {
|
||||
isReturnDefaultValues = true
|
||||
isIncludeAndroidResources = true
|
||||
all {
|
||||
it.exclude("**/screen/**")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ object TestData {
|
||||
|
||||
val cpuData = CpuData(
|
||||
processorName = "CPU_NAME",
|
||||
abi = "ABI",
|
||||
abi = "x64",
|
||||
coreNumber = 1,
|
||||
hasArmNeon = true,
|
||||
frequencies = emptyList(),
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package com.kgurgul.cpuinfo.data.provider
|
||||
class FakeCpuDataProvider : ICpuDataProvider {
|
||||
|
||||
override fun getAbi(): String {
|
||||
return "ABI"
|
||||
return "x64"
|
||||
}
|
||||
|
||||
override fun getNumberOfCores(): Int {
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.kgurgul.cpuinfo.screen
|
||||
|
||||
import androidx.compose.ui.test.ExperimentalTestApi
|
||||
import androidx.compose.ui.test.assertIsDisplayed
|
||||
import androidx.compose.ui.test.onNodeWithText
|
||||
import androidx.compose.ui.test.performScrollTo
|
||||
import androidx.compose.ui.test.runComposeUiTest
|
||||
import com.kgurgul.cpuinfo.data.TestData
|
||||
import com.kgurgul.cpuinfo.features.information.cpu.CpuInfoScreen
|
||||
import com.kgurgul.cpuinfo.features.information.cpu.CpuInfoViewModel
|
||||
import kotlin.test.Test
|
||||
|
||||
class CpuInfoScreenTest {
|
||||
|
||||
@OptIn(ExperimentalTestApi::class)
|
||||
@Test
|
||||
fun hasItems() = runComposeUiTest {
|
||||
setContent {
|
||||
CpuInfoScreen(
|
||||
uiState = CpuInfoViewModel.UiState(
|
||||
cpuData = TestData.cpuData
|
||||
)
|
||||
)
|
||||
}
|
||||
listOf(
|
||||
TestData.cpuData.processorName,
|
||||
TestData.cpuData.abi,
|
||||
TestData.cpuData.coreNumber.toString(),
|
||||
).forEach { tag ->
|
||||
onNodeWithText(tag).performScrollTo().assertIsDisplayed()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user