-
Notifications
You must be signed in to change notification settings - Fork 5
fix: add retry to coin selection loading #1288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
243e803
fix: add retry to coin selection loading
jvsena42 8e516f9
fix: stop retrying node run timeout in coin selection
jvsena42 85757ed
docs: add manual coin selection load journey
jvsena42 4f52432
Merge remote-tracking branch 'origin/fix/894-remove-coin-selection-au…
jvsena42 a0fd136
fix: center coin selection load states in list area
jvsena42 f7b31b3
docs: close received sheet in coin selection journey
jvsena42 9fe4283
docs: drop stale utxo reload note from journey
jvsena42 7de5df1
Merge remote-tracking branch 'origin/master' into fix/616-coin-select…
jvsena42 6e763ae
Merge remote-tracking branch 'origin/fix/894-remove-coin-selection-au…
jvsena42 378f6df
style: drop trailing comma after preview modifier
jvsena42 dd46737
test: cover coin selection loading, error and list branches
jvsena42 ef39fa1
Merge remote-tracking branch 'origin/master' into HEAD
jvsena42 2d6d605
Merge remote-tracking branch 'origin/fix/894-remove-coin-selection-au…
jvsena42 e8b5bcb
Merge remote-tracking branch 'origin/master' into HEAD
jvsena42 e1d249d
Merge remote-tracking branch 'origin/master' into HEAD
jvsena42 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
105 changes: 105 additions & 0 deletions
105
app/src/androidTest/java/to/bitkit/ui/screens/wallets/send/SendCoinSelectionContentTest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| package to.bitkit.ui.screens.wallets.send | ||
|
|
||
| import androidx.compose.ui.test.junit4.createComposeRule | ||
| import androidx.compose.ui.test.onNodeWithTag | ||
| import androidx.compose.ui.test.performClick | ||
| import kotlinx.collections.immutable.persistentListOf | ||
| import org.junit.Rule | ||
| import org.junit.Test | ||
| import org.lightningdevkit.ldknode.OutPoint | ||
| import org.lightningdevkit.ldknode.SpendableUtxo | ||
| import to.bitkit.ext.uniqueUtxoKey | ||
| import to.bitkit.test.annotations.ComposeUi | ||
| import to.bitkit.utils.AppError | ||
| import kotlin.test.assertTrue | ||
|
|
||
| @ComposeUi | ||
| class SendCoinSelectionContentTest { | ||
|
|
||
| @get:Rule | ||
| val composeTestRule = createComposeRule() | ||
|
|
||
| private val utxo = SpendableUtxo(outpoint = OutPoint(txid = "abc123", vout = 0u), valueSats = 50_000uL) | ||
|
|
||
| @Test | ||
| fun whenLoadingWithoutUtxos_shouldShowSpinnerOnly() { | ||
| composeTestRule.setContent { | ||
| SendCoinSelectionContent(uiState = CoinSelectionUiState(isLoading = true)) | ||
| } | ||
|
|
||
| composeTestRule.onNodeWithTag("CoinSelectionLoading").assertExists() | ||
| composeTestRule.onNodeWithTag("CoinSelectionLoadError").assertDoesNotExist() | ||
| composeTestRule.onNodeWithTag("CoinSelectionRetry").assertDoesNotExist() | ||
| } | ||
|
|
||
| @Test | ||
| fun whenLoadFailsWithoutUtxos_shouldShowErrorWithRetryInsteadOfSpinner() { | ||
| composeTestRule.setContent { | ||
| SendCoinSelectionContent( | ||
| uiState = CoinSelectionUiState(loadError = AppError("Node is not setup")) | ||
| ) | ||
| } | ||
|
|
||
| composeTestRule.onNodeWithTag("CoinSelectionLoadError").assertExists() | ||
| composeTestRule.onNodeWithTag("CoinSelectionRetry").assertExists() | ||
| composeTestRule.onNodeWithTag("CoinSelectionLoading").assertDoesNotExist() | ||
| } | ||
|
|
||
| @Test | ||
| fun whenRetryingAfterError_shouldShowErrorWithoutSpinner() { | ||
| composeTestRule.setContent { | ||
| SendCoinSelectionContent( | ||
| uiState = CoinSelectionUiState( | ||
| isLoading = true, | ||
| loadError = AppError("Node is not setup"), | ||
| ) | ||
| ) | ||
| } | ||
|
|
||
| composeTestRule.onNodeWithTag("CoinSelectionLoadError").assertExists() | ||
| composeTestRule.onNodeWithTag("CoinSelectionLoading").assertDoesNotExist() | ||
| } | ||
|
|
||
| @Test | ||
| fun whenRetryClicked_shouldTriggerEvent() { | ||
| var eventTriggered = false | ||
| composeTestRule.setContent { | ||
| SendCoinSelectionContent( | ||
| uiState = CoinSelectionUiState(loadError = AppError("Node is not setup")), | ||
| onRetry = { eventTriggered = true }, | ||
| ) | ||
| } | ||
|
|
||
| composeTestRule.onNodeWithTag("CoinSelectionRetry").performClick() | ||
|
|
||
| assertTrue(eventTriggered) | ||
| } | ||
|
|
||
| @Test | ||
| fun whenUtxosLoaded_shouldShowListWithoutSpinnerOrError() { | ||
| composeTestRule.setContent { | ||
| SendCoinSelectionContent( | ||
| uiState = CoinSelectionUiState(availableUtxos = persistentListOf(utxo)) | ||
| ) | ||
| } | ||
|
|
||
| composeTestRule.onNodeWithTag("utxo_row_${utxo.uniqueUtxoKey()}").assertExists() | ||
| composeTestRule.onNodeWithTag("CoinSelectionLoading").assertDoesNotExist() | ||
| composeTestRule.onNodeWithTag("CoinSelectionLoadError").assertDoesNotExist() | ||
| } | ||
|
|
||
| @Test | ||
| fun whenUtxosLoadedWhileReloading_shouldKeepListInsteadOfSpinner() { | ||
| composeTestRule.setContent { | ||
| SendCoinSelectionContent( | ||
| uiState = CoinSelectionUiState( | ||
| availableUtxos = persistentListOf(utxo), | ||
| isLoading = true, | ||
| ) | ||
| ) | ||
| } | ||
|
|
||
| composeTestRule.onNodeWithTag("utxo_row_${utxo.uniqueUtxoKey()}").assertExists() | ||
| composeTestRule.onNodeWithTag("CoinSelectionLoading").assertDoesNotExist() | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.