This repository has been archived by the owner on Nov 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 722
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
27bd6fc
commit a85a26e
Showing
9 changed files
with
74 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
2 changes: 1 addition & 1 deletion
2
.../com/ivy/wallet/compose/ComposeTestExt.kt → ...va/com/ivy/wallet/compose/util/Logging.kt
This file contains 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
51 changes: 51 additions & 0 deletions
51
app/src/androidTest/java/com/ivy/wallet/compose/util/Scroll.kt
This file contains 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,51 @@ | ||
package com.ivy.wallet.compose.util | ||
|
||
import androidx.compose.ui.test.* | ||
import com.ivy.wallet.compose.IvyComposeTestRule | ||
|
||
fun IvyComposeTestRule.scrollNextUntilFound( | ||
lazyColumnTag: String, | ||
index: Int = 0, | ||
maxIndex: Int = 10, | ||
interaction: () -> Unit | ||
) { | ||
try { | ||
onNodeWithTag(lazyColumnTag) | ||
.performScrollToIndex(index) | ||
|
||
interaction() | ||
} catch (ignored: Exception) { | ||
if (index <= maxIndex) { | ||
scrollNextUntilFound( | ||
lazyColumnTag = lazyColumnTag, | ||
index = index + 1, | ||
maxIndex = maxIndex, | ||
interaction = interaction | ||
) | ||
} | ||
} | ||
} | ||
|
||
fun <T> T.scroll( | ||
container: SemanticsNodeInteraction, | ||
toIndex: Int | ||
): T { | ||
container.performScrollToIndex(index = toIndex) | ||
return this | ||
} | ||
|
||
fun <T> T.scroll( | ||
container: SemanticsNodeInteraction, | ||
toKey: String | ||
): T { | ||
container.performScrollToKey(key = toKey) | ||
return this | ||
} | ||
|
||
fun <T> T.scroll( | ||
container: SemanticsNodeInteraction, | ||
toMatcher: SemanticsMatcher | ||
): T { | ||
container.performScrollToNode(toMatcher) | ||
return this | ||
} |
This file contains 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,9 @@ | ||
package com.ivy.wallet.compose.util | ||
|
||
import com.ivy.wallet.compose.IvyComposeTestRule | ||
import com.ivy.wallet.compose.waitSeconds | ||
|
||
fun <T> T.waitSeconds(composeTestRule: IvyComposeTestRule, seconds: Int): T { | ||
composeTestRule.waitSeconds(seconds.toLong()) | ||
return this | ||
} |
This file contains 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
This file contains 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