Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,33 @@ val bcp47Locales = listOf(
)
val e2eBackendEnv = System.getenv("E2E_BACKEND") ?: "local"
val e2eHomegateUrlEnv = System.getenv("E2E_HOMEGATE_URL") ?: "http://127.0.0.1:6288"
val coreServiceIntegrationTestAnnotation = "to.bitkit.test.annotations.CoreServiceIntegrationTest"
val composeUiTestAnnotation = "to.bitkit.test.annotations.ComposeUiTest"
val deviceIntegrationTestAnnotation = "to.bitkit.test.annotations.DeviceIntegrationTest"
val deviceStorageIntegrationTestAnnotation = "to.bitkit.test.annotations.DeviceStorageIntegrationTest"
val deviceUiIntegrationTestAnnotation = "to.bitkit.test.annotations.DeviceUiIntegrationTest"
val requestedTaskNames = gradle.startParameter.taskNames.map { it.substringAfterLast(":") }
val bitkitAndroidTestSuite = providers.gradleProperty("bitkitAndroidTestSuite").orNull
val bitkitAndroidTestAnnotation = when {
requestedTaskNames.any { it == "connectedDevDebugComposeAndroidTest" } -> composeUiTestAnnotation
requestedTaskNames.any { it == "connectedDevDebugCoreServiceIntegrationAndroidTest" } -> {
coreServiceIntegrationTestAnnotation
}
requestedTaskNames.any { it == "connectedDevDebugDeviceStorageIntegrationAndroidTest" } -> {
deviceStorageIntegrationTestAnnotation
}
requestedTaskNames.any { it == "connectedDevDebugDeviceUiIntegrationAndroidTest" } -> {
deviceUiIntegrationTestAnnotation
}
requestedTaskNames.any { it == "connectedDevDebugDeviceIntegrationAndroidTest" } -> deviceIntegrationTestAnnotation
bitkitAndroidTestSuite == "compose" -> composeUiTestAnnotation
bitkitAndroidTestSuite == "core-service" -> coreServiceIntegrationTestAnnotation
bitkitAndroidTestSuite == "device-storage" -> deviceStorageIntegrationTestAnnotation
bitkitAndroidTestSuite == "device-ui" -> deviceUiIntegrationTestAnnotation
bitkitAndroidTestSuite == "integration" -> deviceIntegrationTestAnnotation
bitkitAndroidTestSuite == null -> null
else -> error("Unsupported bitkitAndroidTestSuite '$bitkitAndroidTestSuite'")
}

android {
namespace = "to.bitkit"
Expand All @@ -59,6 +86,9 @@ android {
versionCode = 181
versionName = "2.2.0"
testInstrumentationRunner = "to.bitkit.test.HiltTestRunner"
bitkitAndroidTestAnnotation?.let {
testInstrumentationRunnerArguments["annotation"] = it
}
vectorDrawables {
useSupportLibrary = true
}
Expand Down Expand Up @@ -363,4 +393,34 @@ tasks.withType<Test>().configureEach {
jvmArgs("-XX:+EnableDynamicAgentLoading")
}

tasks.register("connectedDevDebugComposeAndroidTest") {
group = "verification"
description = "Runs devDebug Android tests annotated as Compose UI tests."
dependsOn("connectedDevDebugAndroidTest")
}

tasks.register("connectedDevDebugDeviceIntegrationAndroidTest") {
group = "verification"
description = "Runs devDebug Android tests annotated as device integration tests."
dependsOn("connectedDevDebugAndroidTest")
}

tasks.register("connectedDevDebugCoreServiceIntegrationAndroidTest") {
group = "verification"
description = "Runs devDebug Android tests annotated as core service integration tests."
dependsOn("connectedDevDebugAndroidTest")
}

tasks.register("connectedDevDebugDeviceStorageIntegrationAndroidTest") {
group = "verification"
description = "Runs devDebug Android tests annotated as device storage integration tests."
dependsOn("connectedDevDebugAndroidTest")
}

tasks.register("connectedDevDebugDeviceUiIntegrationAndroidTest") {
group = "verification"
description = "Runs devDebug Android tests annotated as device UI integration tests."
dependsOn("connectedDevDebugAndroidTest")
}

// endregion
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ import org.junit.runner.RunWith
import to.bitkit.data.AppDb
import to.bitkit.data.entities.ConfigEntity
import to.bitkit.test.BaseAndroidTest
import to.bitkit.test.annotations.DeviceIntegrationTest
import to.bitkit.test.annotations.DeviceStorageIntegrationTest
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
import kotlin.test.assertNull
import kotlin.test.assertTrue

@RunWith(AndroidJUnit4::class)
@DeviceIntegrationTest
@DeviceStorageIntegrationTest
class KeychainTest : BaseAndroidTest() {

private val appContext by lazy { ApplicationProvider.getApplicationContext<Context>() }
Expand Down
4 changes: 4 additions & 0 deletions app/src/androidTest/java/to/bitkit/services/BlocktankTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@ import org.junit.Before
import org.junit.Rule
import org.junit.Test
import to.bitkit.env.Env
import to.bitkit.test.annotations.CoreServiceIntegrationTest
import to.bitkit.test.annotations.DeviceIntegrationTest
import javax.inject.Inject
import kotlin.test.assertEquals
import kotlin.test.assertNotEquals
import kotlin.test.assertNotNull
import kotlin.test.assertTrue

@HiltAndroidTest
@DeviceIntegrationTest
@CoreServiceIntegrationTest
class BlocktankTest {
@get:Rule
var hiltRule = HiltAndroidRule(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ import org.junit.Test
import org.junit.runner.RunWith
import org.lightningdevkit.ldknode.Network
import to.bitkit.models.toDerivationPath
import to.bitkit.test.annotations.CoreServiceIntegrationTest
import to.bitkit.test.annotations.DeviceIntegrationTest
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
import kotlin.test.assertTrue

@RunWith(AndroidJUnit4::class)
@DeviceIntegrationTest
@CoreServiceIntegrationTest
class OnchainServiceTests {
private lateinit var onchainService: OnchainService

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import to.bitkit.data.CacheStore
import to.bitkit.data.keychain.Keychain
import to.bitkit.env.Env
import to.bitkit.repositories.WalletRepo
import to.bitkit.test.annotations.CoreServiceIntegrationTest
import to.bitkit.test.annotations.DeviceIntegrationTest
import to.bitkit.utils.LdkError
import javax.inject.Inject
import kotlin.test.assertEquals
Expand All @@ -27,6 +29,8 @@ import kotlin.test.assertTrue

@HiltAndroidTest
@RunWith(AndroidJUnit4::class)
@DeviceIntegrationTest
@CoreServiceIntegrationTest
class RoutingFeeEstimationTest {

companion object {
Expand Down
4 changes: 4 additions & 0 deletions app/src/androidTest/java/to/bitkit/services/TxBumpingTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import org.junit.runner.RunWith
import to.bitkit.data.keychain.Keychain
import to.bitkit.env.Env
import to.bitkit.repositories.WalletRepo
import to.bitkit.test.annotations.CoreServiceIntegrationTest
import to.bitkit.test.annotations.DeviceIntegrationTest
import javax.inject.Inject
import kotlin.test.assertEquals
import kotlin.test.assertFalse
Expand All @@ -23,6 +25,8 @@ import kotlin.test.assertTrue

@HiltAndroidTest
@RunWith(AndroidJUnit4::class)
@DeviceIntegrationTest
@CoreServiceIntegrationTest
class TxBumpingTests {

@get:Rule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import org.lightningdevkit.ldknode.CoinSelectionAlgorithm
import to.bitkit.data.keychain.Keychain
import to.bitkit.env.Env
import to.bitkit.repositories.WalletRepo
import to.bitkit.test.annotations.CoreServiceIntegrationTest
import to.bitkit.test.annotations.DeviceIntegrationTest
import javax.inject.Inject
import kotlin.test.assertEquals
import kotlin.test.assertFalse
Expand All @@ -25,6 +27,8 @@ import kotlin.test.fail

@HiltAndroidTest
@RunWith(AndroidJUnit4::class)
@DeviceIntegrationTest
@CoreServiceIntegrationTest
class UtxoSelectionTests {

@get:Rule
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package to.bitkit.test.annotations

@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
annotation class ComposeUiTest
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package to.bitkit.test.annotations

@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
annotation class CoreServiceIntegrationTest
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package to.bitkit.test.annotations

@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
annotation class DeviceIntegrationTest
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package to.bitkit.test.annotations

@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
annotation class DeviceStorageIntegrationTest
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package to.bitkit.test.annotations

@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
annotation class DeviceUiIntegrationTest
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import androidx.compose.ui.test.performClick
import org.junit.Rule
import org.junit.Test
import to.bitkit.models.NodeLifecycleState
import to.bitkit.test.annotations.ComposeUiTest
import to.bitkit.viewmodels.SendMethod
import to.bitkit.viewmodels.SendUiState
import to.bitkit.viewmodels.previewAmountInputViewModel

@ComposeUiTest
class SendAmountContentTest {

@get:Rule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithTag
import org.junit.Rule
import org.junit.Test
import to.bitkit.test.annotations.ComposeUiTest
import to.bitkit.ui.theme.AppThemeSurface

@ComposeUiTest
class BlockCardTest {

@get:Rule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithTag
import org.junit.Rule
import org.junit.Test
import to.bitkit.test.annotations.ComposeUiTest
import to.bitkit.ui.theme.AppThemeSurface

@ComposeUiTest
class FactsCardTest {

@get:Rule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.performClick
import org.junit.Rule
import org.junit.Test
import to.bitkit.test.annotations.ComposeUiTest
import to.bitkit.ui.theme.AppThemeSurface

@ComposeUiTest
class FactsPreviewContentTest {

@get:Rule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithTag
import org.junit.Rule
import org.junit.Test
import to.bitkit.test.annotations.ComposeUiTest
import to.bitkit.ui.theme.AppThemeSurface

@ComposeUiTest
class HeadlineCardTest {

@get:Rule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ import org.junit.Rule
import org.junit.Test
import to.bitkit.models.widget.ArticleModel
import to.bitkit.models.widget.HeadlinePreferences
import to.bitkit.test.annotations.ComposeUiTest
import to.bitkit.ui.theme.AppThemeSurface

@ComposeUiTest
class HeadlinesEditContentTest {

@get:Rule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import org.junit.Rule
import org.junit.Test
import to.bitkit.models.widget.ArticleModel
import to.bitkit.models.widget.HeadlinePreferences
import to.bitkit.test.annotations.ComposeUiTest
import to.bitkit.ui.theme.AppThemeSurface

@ComposeUiTest
class HeadlinesPreviewContentTest {

@get:Rule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import to.bitkit.R
import to.bitkit.data.dto.FeeCondition
import to.bitkit.models.widget.WeatherDataOption
import to.bitkit.models.widget.WeatherPreferences
import to.bitkit.test.annotations.ComposeUiTest
import to.bitkit.ui.screens.widgets.blocks.WeatherModel
import to.bitkit.ui.theme.AppThemeSurface

@ComposeUiTest
class WeatherCardTest {

@get:Rule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import to.bitkit.R
import to.bitkit.data.dto.FeeCondition
import to.bitkit.models.widget.WeatherDataOption
import to.bitkit.models.widget.WeatherPreferences
import to.bitkit.test.annotations.ComposeUiTest
import to.bitkit.ui.screens.widgets.blocks.WeatherModel
import to.bitkit.ui.theme.AppThemeSurface

@ComposeUiTest
class WeatherEditScreenTest {

@get:Rule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import to.bitkit.R
import to.bitkit.data.dto.FeeCondition
import to.bitkit.models.widget.WeatherDataOption
import to.bitkit.models.widget.WeatherPreferences
import to.bitkit.test.annotations.ComposeUiTest
import to.bitkit.ui.screens.widgets.blocks.WeatherModel
import to.bitkit.ui.theme.AppThemeSurface

@ComposeUiTest
class WeatherPreviewContentTest {

@get:Rule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.performClick
import org.junit.Rule
import org.junit.Test
import to.bitkit.test.annotations.ComposeUiTest
import to.bitkit.ui.theme.AppThemeSurface

@ComposeUiTest
class BackupIntroScreenTest {

@get:Rule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import dagger.hilt.android.testing.HiltAndroidTest
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import to.bitkit.test.annotations.ComposeUiTest
import to.bitkit.ui.theme.AppThemeSurface

@HiltAndroidTest
@ComposeUiTest
class QuickPaySettingsScreenTest {

@get:Rule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import androidx.compose.ui.test.performClick
import androidx.compose.ui.test.performTextInput
import org.junit.Rule
import org.junit.Test
import to.bitkit.test.annotations.ComposeUiTest
import to.bitkit.ui.theme.AppThemeSurface

@ComposeUiTest
class ReportIssueContentTest {

@get:Rule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import to.bitkit.test.annotations.ComposeUiTest
import to.bitkit.ui.sheets.BoostTransactionContent
import to.bitkit.ui.sheets.BoostTransactionTestTags
import to.bitkit.ui.sheets.BoostTransactionUiState
Expand All @@ -28,6 +29,7 @@ import to.bitkit.ui.theme.AppThemeSurface

@HiltAndroidTest
@RunWith(AndroidJUnit4::class)
@ComposeUiTest
class BoostTransactionContentTest {

@get:Rule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ import org.junit.Test
import to.bitkit.models.NewTransactionSheetDetails
import to.bitkit.models.NewTransactionSheetDirection
import to.bitkit.models.NewTransactionSheetType
import to.bitkit.test.annotations.ComposeUiTest

@HiltAndroidTest
@ComposeUiTest
class NewTransactionSheetViewTest {

@get:Rule
Expand Down
Loading