Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

package to.bitkit.ui.screens.paymentrequests

import android.os.SystemClock
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
Expand Down Expand Up @@ -100,6 +101,8 @@ class CreatePaymentRequestScreenTest {
assertEquals(listOf(MethodId.UsdtArbitrum.rawValue), submitted?.acceptedPaymentEndpointIdentifiers)
composeTestRule.onNodeWithTag("PaymentRequestAccept-usdt").performClick().assertIsNotSelected()
composeTestRule.onNodeWithTag("PaymentRequestSend").assertIsNotEnabled()
// Chip clicks use a 500 ms real-clock debounce, independent of the Compose test clock.
SystemClock.sleep(600)
composeTestRule.onNodeWithTag("PaymentRequestAccept-bitcoin").performClick().assertIsSelected()
composeTestRule.onNodeWithTag("PaymentRequestSend").assertIsEnabled().performClick()
assertEquals(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import androidx.compose.ui.test.assertIsEnabled
import androidx.compose.ui.test.assertIsNotEnabled
import androidx.compose.ui.test.assertTextContains
import androidx.compose.ui.test.assertTextEquals
import androidx.compose.ui.test.hasAnyAncestor
import androidx.compose.ui.test.hasTestTag
import androidx.compose.ui.test.hasText
import androidx.compose.ui.test.junit4.v2.createComposeRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.onNodeWithText
Expand Down Expand Up @@ -188,7 +191,12 @@ class PaymentRequestsScreenTest {

composeTestRule.onNodeWithTag("PaymentRequestRow-accepted").assertIsDisplayed()
composeTestRule.onNodeWithTag("PaymentRequestRow-outgoing").assertIsDisplayed()
composeTestRule.onNodeWithText("pending").assertIsDisplayed()
composeTestRule.onNode(
hasText("pending") and hasAnyAncestor(hasTestTag("PaymentRequestRow-outgoing"))
).assertIsDisplayed()
composeTestRule.onNode(
hasText("pending") and hasAnyAncestor(hasTestTag("PaymentRequestRow-accepted"))
).assertIsDisplayed()
composeTestRule.onNodeWithText("PAYMENT REQUESTS").assertIsDisplayed()
composeTestRule.onNodeWithText("TODAY").assertIsDisplayed()
composeTestRule.onNodeWithTag("PaymentRequestCreate").assertIsDisplayed()
Expand Down Expand Up @@ -220,7 +228,9 @@ class PaymentRequestsScreenTest {
}

composeTestRule.onNodeWithTag("MoneyPrimary").assertTextContains("$", substring = true)
composeTestRule.onNodeWithText("Accepted").assertIsDisplayed()
composeTestRule.onNode(
hasText("pending") and hasAnyAncestor(hasTestTag("PaymentRequestRow-accepted"))
).assertIsDisplayed()
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import dagger.hilt.android.testing.HiltAndroidRule
import dagger.hilt.android.testing.HiltAndroidTest
import kotlinx.collections.immutable.persistentListOf
import org.junit.Before
import org.junit.Rule
import org.junit.Test
Expand All @@ -38,6 +39,8 @@ import to.bitkit.ui.sheets.SendRoute
import to.bitkit.ui.sheets.navigateToCoinSelection
import to.bitkit.ui.theme.AppThemeSurface
import to.bitkit.viewmodels.SendEvent
import to.bitkit.viewmodels.SendFundingOption
import to.bitkit.viewmodels.SendFundingSource
import to.bitkit.viewmodels.SendMethod
import to.bitkit.viewmodels.SendUiState
import to.bitkit.viewmodels.SettingsViewModel
Expand Down Expand Up @@ -73,7 +76,15 @@ class SendConfirmNavigationTest {
@Test
fun pickerBackReenablesSwipeButPendingPaymentKeepsFundingLocked() {
val state = mutableStateOf(
SendUiState(amount = 1_000u, isAmountInputValid = true, canSwitchFundingSource = true),
SendUiState(
amount = 1_000u,
isAmountInputValid = true,
canSwitchFundingSource = true,
fundingOptions = persistentListOf(
SendFundingOption(SendFundingSource.Savings, enabled = true),
SendFundingOption(SendFundingSource.Spending, enabled = true),
),
),
)
var swipes = 0
var fundingSwitches = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class UsdtBridgeDetailsTest {
composeTestRule.onNodeWithTag("UsdtDepositRefund").performScrollTo().performClick()
composeTestRule.waitForIdle()
composeTestRule.onNodeWithText("Confirm Refund").assertIsDisplayed()
composeTestRule.onNodeWithText("50,00 USDT", substring = true).assertIsDisplayed()
composeTestRule.onNodeWithText("50,000001 USDT", substring = true).assertIsDisplayed()
composeTestRule.onNodeWithText("Refund address:\n" + address, substring = true).assertIsDisplayed()
composeTestRule.onNodeWithText("BNB Smart Chain (BSC)", substring = true).assertIsDisplayed()
screenshot("refund")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class UsdtPaymentContentTest {
composeTestRule.onNodeWithText("4.47 USDT").assertIsDisplayed()
swipe.assertIsDisplayed()
assertTrue(total.fetchSemanticsNode().boundsInRoot.bottom <= swipe.fetchSemanticsNode().boundsInRoot.top)
composeTestRule.onNodeWithTag("UsdtReviewDetails").performScrollTo().performClick()
composeTestRule.onNodeWithTag("UsdtReviewDetails").assertIsDisplayed().performClick()
composeTestRule.onNodeWithTag("UsdtRecipientAmount").assertIsDisplayed()
total.assertIsDisplayed()
swipe.assertIsDisplayed()
Expand Down
Loading