Test hotfixes
This commit is contained in:
parent
3d7c1c101f
commit
7ddd2e6b67
|
@ -5,7 +5,10 @@ import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.test.junit4.ComposeContentTestRule
|
import androidx.compose.ui.test.junit4.ComposeContentTestRule
|
||||||
import co.electriccoin.zcash.ui.common.model.WalletRestoringState
|
import co.electriccoin.zcash.ui.common.model.WalletRestoringState
|
||||||
import co.electriccoin.zcash.ui.common.model.WalletSnapshot
|
import co.electriccoin.zcash.ui.common.model.WalletSnapshot
|
||||||
|
import co.electriccoin.zcash.ui.design.R
|
||||||
|
import co.electriccoin.zcash.ui.design.component.IconButtonState
|
||||||
import co.electriccoin.zcash.ui.design.theme.ZcashTheme
|
import co.electriccoin.zcash.ui.design.theme.ZcashTheme
|
||||||
|
import co.electriccoin.zcash.ui.design.util.stringRes
|
||||||
import co.electriccoin.zcash.ui.fixture.BalanceStateFixture
|
import co.electriccoin.zcash.ui.fixture.BalanceStateFixture
|
||||||
import co.electriccoin.zcash.ui.fixture.WalletSnapshotFixture
|
import co.electriccoin.zcash.ui.fixture.WalletSnapshotFixture
|
||||||
import co.electriccoin.zcash.ui.fixture.ZashiMainTopAppBarStateFixture
|
import co.electriccoin.zcash.ui.fixture.ZashiMainTopAppBarStateFixture
|
||||||
|
@ -60,7 +63,27 @@ class AccountTestSetup(
|
||||||
transactionsUiState = initialTransactionState,
|
transactionsUiState = initialTransactionState,
|
||||||
walletRestoringState = WalletRestoringState.NONE,
|
walletRestoringState = WalletRestoringState.NONE,
|
||||||
walletSnapshot = WalletSnapshotFixture.new(),
|
walletSnapshot = WalletSnapshotFixture.new(),
|
||||||
zashiMainTopAppBarState = ZashiMainTopAppBarStateFixture.new()
|
zashiMainTopAppBarState =
|
||||||
|
ZashiMainTopAppBarStateFixture.new(
|
||||||
|
settingsButton =
|
||||||
|
IconButtonState(
|
||||||
|
icon = R.drawable.ic_app_bar_settings,
|
||||||
|
contentDescription =
|
||||||
|
stringRes(co.electriccoin.zcash.ui.R.string.settings_menu_content_description),
|
||||||
|
) {
|
||||||
|
onSettingsCount.incrementAndGet()
|
||||||
|
},
|
||||||
|
balanceVisibilityButton =
|
||||||
|
IconButtonState(
|
||||||
|
icon = R.drawable.ic_app_bar_balances_hide,
|
||||||
|
contentDescription =
|
||||||
|
stringRes(
|
||||||
|
co.electriccoin.zcash.ui.R.string.hide_balances_content_description
|
||||||
|
),
|
||||||
|
) {
|
||||||
|
onHideBalancesCount.incrementAndGet()
|
||||||
|
},
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,10 @@ import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.test.junit4.ComposeContentTestRule
|
import androidx.compose.ui.test.junit4.ComposeContentTestRule
|
||||||
import co.electriccoin.zcash.ui.common.model.WalletRestoringState
|
import co.electriccoin.zcash.ui.common.model.WalletRestoringState
|
||||||
import co.electriccoin.zcash.ui.common.model.WalletSnapshot
|
import co.electriccoin.zcash.ui.common.model.WalletSnapshot
|
||||||
|
import co.electriccoin.zcash.ui.design.R
|
||||||
|
import co.electriccoin.zcash.ui.design.component.IconButtonState
|
||||||
import co.electriccoin.zcash.ui.design.theme.ZcashTheme
|
import co.electriccoin.zcash.ui.design.theme.ZcashTheme
|
||||||
|
import co.electriccoin.zcash.ui.design.util.stringRes
|
||||||
import co.electriccoin.zcash.ui.fixture.BalanceStateFixture
|
import co.electriccoin.zcash.ui.fixture.BalanceStateFixture
|
||||||
import co.electriccoin.zcash.ui.fixture.ZashiMainTopAppBarStateFixture
|
import co.electriccoin.zcash.ui.fixture.ZashiMainTopAppBarStateFixture
|
||||||
import co.electriccoin.zcash.ui.screen.balances.model.ShieldState
|
import co.electriccoin.zcash.ui.screen.balances.model.ShieldState
|
||||||
|
@ -47,7 +50,16 @@ class BalancesTestSetup(
|
||||||
walletSnapshot = walletSnapshot,
|
walletSnapshot = walletSnapshot,
|
||||||
walletRestoringState = WalletRestoringState.NONE,
|
walletRestoringState = WalletRestoringState.NONE,
|
||||||
zashiMainTopAppBarState =
|
zashiMainTopAppBarState =
|
||||||
ZashiMainTopAppBarStateFixture.new()
|
ZashiMainTopAppBarStateFixture.new(
|
||||||
|
settingsButton =
|
||||||
|
IconButtonState(
|
||||||
|
icon = R.drawable.ic_app_bar_settings,
|
||||||
|
contentDescription =
|
||||||
|
stringRes(co.electriccoin.zcash.ui.R.string.settings_menu_content_description),
|
||||||
|
) {
|
||||||
|
onSettingsCount.incrementAndGet()
|
||||||
|
}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,8 @@ import androidx.compose.ui.test.onNodeWithContentDescription
|
||||||
import androidx.compose.ui.test.onNodeWithText
|
import androidx.compose.ui.test.onNodeWithText
|
||||||
import androidx.compose.ui.test.performClick
|
import androidx.compose.ui.test.performClick
|
||||||
import androidx.test.filters.MediumTest
|
import androidx.test.filters.MediumTest
|
||||||
import cash.z.ecc.android.sdk.fixture.WalletAddressesFixture
|
import cash.z.ecc.android.sdk.fixture.WalletAddressFixture
|
||||||
import co.electriccoin.zcash.ui.R
|
import co.electriccoin.zcash.ui.R
|
||||||
import co.electriccoin.zcash.ui.screen.send.ext.abbreviated
|
|
||||||
import co.electriccoin.zcash.ui.test.getAppContext
|
|
||||||
import co.electriccoin.zcash.ui.test.getStringResource
|
import co.electriccoin.zcash.ui.test.getStringResource
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Assert.assertEquals
|
import org.junit.Assert.assertEquals
|
||||||
|
@ -31,16 +29,14 @@ class ReceiveViewTest {
|
||||||
@MediumTest
|
@MediumTest
|
||||||
fun setup() =
|
fun setup() =
|
||||||
runTest {
|
runTest {
|
||||||
val walletAddresses = WalletAddressesFixture.new()
|
|
||||||
newTestSetup()
|
newTestSetup()
|
||||||
|
|
||||||
// Enable substring for ellipsizing
|
// Enable substring for ellipsizing
|
||||||
composeTestRule.onNodeWithText(
|
composeTestRule.onNodeWithText(
|
||||||
text = walletAddresses.unified.abbreviated(getAppContext()),
|
text = "${WalletAddressFixture.UNIFIED_ADDRESS_STRING.take(20)}...",
|
||||||
substring = true
|
substring = true,
|
||||||
).also {
|
useUnmergedTree = true
|
||||||
it.assertExists()
|
).assertExists()
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
package co.electriccoin.zcash.ui.screen.receive.view
|
package co.electriccoin.zcash.ui.screen.receive.view
|
||||||
|
|
||||||
import androidx.compose.ui.test.junit4.ComposeContentTestRule
|
import androidx.compose.ui.test.junit4.ComposeContentTestRule
|
||||||
|
import cash.z.ecc.android.sdk.fixture.WalletAddressFixture
|
||||||
|
import co.electriccoin.zcash.ui.R
|
||||||
|
import co.electriccoin.zcash.ui.design.component.IconButtonState
|
||||||
import co.electriccoin.zcash.ui.design.theme.ZcashTheme
|
import co.electriccoin.zcash.ui.design.theme.ZcashTheme
|
||||||
|
import co.electriccoin.zcash.ui.design.util.stringRes
|
||||||
import co.electriccoin.zcash.ui.fixture.ZashiMainTopAppBarStateFixture
|
import co.electriccoin.zcash.ui.fixture.ZashiMainTopAppBarStateFixture
|
||||||
|
import co.electriccoin.zcash.ui.screen.receive.model.ReceiveAddressState
|
||||||
import co.electriccoin.zcash.ui.screen.receive.model.ReceiveState
|
import co.electriccoin.zcash.ui.screen.receive.model.ReceiveState
|
||||||
import java.util.concurrent.atomic.AtomicInteger
|
import java.util.concurrent.atomic.AtomicInteger
|
||||||
|
|
||||||
|
@ -23,10 +28,36 @@ class ReceiveViewTestSetup(
|
||||||
ReceiveView(
|
ReceiveView(
|
||||||
state =
|
state =
|
||||||
ReceiveState(
|
ReceiveState(
|
||||||
items = listOf(),
|
items =
|
||||||
|
listOf(
|
||||||
|
ReceiveAddressState(
|
||||||
|
icon = R.drawable.ic_zec_round_full,
|
||||||
|
title = stringRes("Zashi"),
|
||||||
|
subtitle =
|
||||||
|
stringRes(
|
||||||
|
"${WalletAddressFixture.UNIFIED_ADDRESS_STRING.take(20)}...",
|
||||||
|
),
|
||||||
|
isShielded = true,
|
||||||
|
onCopyClicked = {},
|
||||||
|
onQrClicked = { },
|
||||||
|
onRequestClicked = {},
|
||||||
|
isExpanded = true,
|
||||||
|
onClick = {}
|
||||||
|
)
|
||||||
|
),
|
||||||
isLoading = false,
|
isLoading = false,
|
||||||
),
|
),
|
||||||
zashiMainTopAppBarState = ZashiMainTopAppBarStateFixture.new()
|
zashiMainTopAppBarState =
|
||||||
|
ZashiMainTopAppBarStateFixture.new(
|
||||||
|
settingsButton =
|
||||||
|
IconButtonState(
|
||||||
|
icon = co.electriccoin.zcash.ui.design.R.drawable.ic_app_bar_settings,
|
||||||
|
contentDescription =
|
||||||
|
stringRes(R.string.settings_menu_content_description),
|
||||||
|
) {
|
||||||
|
onSettingsCount.incrementAndGet()
|
||||||
|
}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,10 @@ import cash.z.ecc.android.sdk.model.Zatoshi
|
||||||
import cash.z.ecc.android.sdk.model.ZecSend
|
import cash.z.ecc.android.sdk.model.ZecSend
|
||||||
import cash.z.ecc.android.sdk.type.AddressType
|
import cash.z.ecc.android.sdk.type.AddressType
|
||||||
import co.electriccoin.zcash.ui.common.wallet.ExchangeRateState
|
import co.electriccoin.zcash.ui.common.wallet.ExchangeRateState
|
||||||
|
import co.electriccoin.zcash.ui.design.R
|
||||||
|
import co.electriccoin.zcash.ui.design.component.IconButtonState
|
||||||
import co.electriccoin.zcash.ui.design.theme.ZcashTheme
|
import co.electriccoin.zcash.ui.design.theme.ZcashTheme
|
||||||
|
import co.electriccoin.zcash.ui.design.util.stringRes
|
||||||
import co.electriccoin.zcash.ui.fixture.BalanceStateFixture
|
import co.electriccoin.zcash.ui.fixture.BalanceStateFixture
|
||||||
import co.electriccoin.zcash.ui.fixture.WalletSnapshotFixture
|
import co.electriccoin.zcash.ui.fixture.WalletSnapshotFixture
|
||||||
import co.electriccoin.zcash.ui.fixture.ZashiMainTopAppBarStateFixture
|
import co.electriccoin.zcash.ui.fixture.ZashiMainTopAppBarStateFixture
|
||||||
|
@ -148,7 +151,17 @@ class SendViewTestSetup(
|
||||||
isHintVisible = false,
|
isHintVisible = false,
|
||||||
onButtonClick = {}
|
onButtonClick = {}
|
||||||
),
|
),
|
||||||
zashiMainTopAppBarState = ZashiMainTopAppBarStateFixture.new()
|
zashiMainTopAppBarState =
|
||||||
|
ZashiMainTopAppBarStateFixture.new(
|
||||||
|
settingsButton =
|
||||||
|
IconButtonState(
|
||||||
|
icon = R.drawable.ic_app_bar_settings,
|
||||||
|
contentDescription =
|
||||||
|
stringRes(co.electriccoin.zcash.ui.R.string.settings_menu_content_description),
|
||||||
|
) {
|
||||||
|
onSettingsCount.incrementAndGet()
|
||||||
|
}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import co.electriccoin.zcash.ui.design.R
|
||||||
import co.electriccoin.zcash.ui.design.component.AccountSwitchState
|
import co.electriccoin.zcash.ui.design.component.AccountSwitchState
|
||||||
import co.electriccoin.zcash.ui.design.component.IconButtonState
|
import co.electriccoin.zcash.ui.design.component.IconButtonState
|
||||||
import co.electriccoin.zcash.ui.design.component.ZashiMainTopAppBarState
|
import co.electriccoin.zcash.ui.design.component.ZashiMainTopAppBarState
|
||||||
|
import co.electriccoin.zcash.ui.design.util.stringRes
|
||||||
import co.electriccoin.zcash.ui.preference.StandardPreferenceKeys
|
import co.electriccoin.zcash.ui.preference.StandardPreferenceKeys
|
||||||
import co.electriccoin.zcash.ui.screen.accountlist.AccountList
|
import co.electriccoin.zcash.ui.screen.accountlist.AccountList
|
||||||
import kotlinx.coroutines.flow.SharingStarted
|
import kotlinx.coroutines.flow.SharingStarted
|
||||||
|
@ -65,12 +66,14 @@ class ZashiMainTopAppBarViewModel(
|
||||||
} else {
|
} else {
|
||||||
R.drawable.ic_app_bar_balances_hide
|
R.drawable.ic_app_bar_balances_hide
|
||||||
},
|
},
|
||||||
onClick = ::onShowOrHideBalancesClicked
|
onClick = ::onShowOrHideBalancesClicked,
|
||||||
|
contentDescription = stringRes(co.electriccoin.zcash.ui.R.string.hide_balances_content_description)
|
||||||
),
|
),
|
||||||
settingsButton =
|
settingsButton =
|
||||||
IconButtonState(
|
IconButtonState(
|
||||||
icon = R.drawable.ic_app_bar_settings,
|
icon = R.drawable.ic_app_bar_settings,
|
||||||
onClick = ::onSettingsClicked
|
onClick = ::onSettingsClicked,
|
||||||
|
contentDescription = stringRes(co.electriccoin.zcash.ui.R.string.settings_menu_content_description)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -4,16 +4,28 @@ import co.electriccoin.zcash.ui.design.R
|
||||||
import co.electriccoin.zcash.ui.design.component.AccountSwitchState
|
import co.electriccoin.zcash.ui.design.component.AccountSwitchState
|
||||||
import co.electriccoin.zcash.ui.design.component.IconButtonState
|
import co.electriccoin.zcash.ui.design.component.IconButtonState
|
||||||
import co.electriccoin.zcash.ui.design.component.ZashiMainTopAppBarState
|
import co.electriccoin.zcash.ui.design.component.ZashiMainTopAppBarState
|
||||||
|
import co.electriccoin.zcash.ui.design.util.stringRes
|
||||||
|
|
||||||
object ZashiMainTopAppBarStateFixture {
|
object ZashiMainTopAppBarStateFixture {
|
||||||
fun new() =
|
fun new(
|
||||||
ZashiMainTopAppBarState(
|
accountSwitchState: AccountSwitchState =
|
||||||
accountSwitchState =
|
AccountSwitchState(
|
||||||
AccountSwitchState(
|
accountType = ZashiMainTopAppBarState.AccountType.ZASHI,
|
||||||
accountType = ZashiMainTopAppBarState.AccountType.ZASHI,
|
onAccountTypeClick = {}
|
||||||
onAccountTypeClick = {}
|
),
|
||||||
),
|
balanceVisibilityButton: IconButtonState =
|
||||||
balanceVisibilityButton = IconButtonState(R.drawable.ic_app_bar_balances_hide) {},
|
IconButtonState(
|
||||||
settingsButton = IconButtonState(R.drawable.ic_app_bar_settings) {},
|
icon = R.drawable.ic_app_bar_balances_hide,
|
||||||
)
|
contentDescription = stringRes(co.electriccoin.zcash.ui.R.string.hide_balances_content_description)
|
||||||
|
) {},
|
||||||
|
settingsButton: IconButtonState =
|
||||||
|
IconButtonState(
|
||||||
|
icon = R.drawable.ic_app_bar_settings,
|
||||||
|
contentDescription = stringRes(co.electriccoin.zcash.ui.R.string.settings_menu_content_description)
|
||||||
|
) {},
|
||||||
|
) = ZashiMainTopAppBarState(
|
||||||
|
accountSwitchState = accountSwitchState,
|
||||||
|
balanceVisibilityButton = balanceVisibilityButton,
|
||||||
|
settingsButton = settingsButton,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue