Updated on 2026-08-14
This commit is contained in:
parent
bff165de00
commit
62c5b2a557
7 changed files with 48 additions and 12 deletions
|
|
@ -13,24 +13,37 @@ fun BaseTestCase.checkSendWarning(
|
||||||
) {
|
) {
|
||||||
val assertDisplay = if (isDisplayed) "displayed" else "not displayed"
|
val assertDisplay = if (isDisplayed) "displayed" else "not displayed"
|
||||||
|
|
||||||
|
// When we expect the warning to be absent, it may still be finishing its disappear animation right after the
|
||||||
|
// Confirm screen opens (e.g. after re-entering a valid address), so poll the Compose tree until it is actually
|
||||||
|
// gone instead of asserting once. When we expect it to be present, assert straight away.
|
||||||
|
fun assertWarning(block: () -> Unit) {
|
||||||
|
if (isDisplayed) block() else awaitSuccess(block = block)
|
||||||
|
}
|
||||||
|
|
||||||
step("Assert 'Send confirm screen' is displayed") {
|
step("Assert 'Send confirm screen' is displayed") {
|
||||||
onSendConfirmScreen {
|
onSendConfirmScreen {
|
||||||
appBarTitle.assertIsDisplayed()
|
appBarTitle.assertIsDisplayed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
step("Assert warning title is $assertDisplay") {
|
step("Assert warning title is $assertDisplay") {
|
||||||
onSendConfirmScreen {
|
assertWarning {
|
||||||
warningTitle(title).assertVisibility(isDisplayed)
|
onSendConfirmScreen {
|
||||||
|
warningTitle(title).assertVisibility(isDisplayed)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
step("Assert warning icon is $assertDisplay") {
|
step("Assert warning icon is $assertDisplay") {
|
||||||
onSendConfirmScreen {
|
assertWarning {
|
||||||
sendWarningIcon(message).assertVisibility(isDisplayed)
|
onSendConfirmScreen {
|
||||||
|
sendWarningIcon(message).assertVisibility(isDisplayed)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
step("Assert warning message is $assertDisplay") {
|
step("Assert warning message is $assertDisplay") {
|
||||||
onSendConfirmScreen {
|
assertWarning {
|
||||||
sendWarningMessage(message).assertVisibility(isDisplayed)
|
onSendConfirmScreen {
|
||||||
|
sendWarningMessage(message).assertVisibility(isDisplayed)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sendButtonIsDisabled)
|
if (sendButtonIsDisabled)
|
||||||
|
|
@ -41,8 +54,10 @@ fun BaseTestCase.checkSendWarning(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
step("Assert 'Send' button is enabled") {
|
step("Assert 'Send' button is enabled") {
|
||||||
onSendConfirmScreen {
|
awaitSuccess {
|
||||||
sendButton.assertIsEnabled()
|
onSendConfirmScreen {
|
||||||
|
sendButton.assertIsEnabled()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -164,6 +164,16 @@ fun BaseTestCase.checkStoriesChanges() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun BaseTestCase.skipSwapStories() {
|
||||||
|
step("Skip 'Swap stories' screen if displayed") {
|
||||||
|
onSwapStoriesScreen {
|
||||||
|
if (closeButton.isDisplayedSafely()) {
|
||||||
|
closeButton.performClick()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun BaseTestCase.selectFeeType(feeType: FeeType, selectedFeeAmount: String) {
|
fun BaseTestCase.selectFeeType(feeType: FeeType, selectedFeeAmount: String) {
|
||||||
step("Click on 'Select fee' icon") {
|
step("Click on 'Select fee' icon") {
|
||||||
onSwapTokenScreen { selectFeeIcon.performClick() }
|
onSwapTokenScreen { selectFeeIcon.performClick() }
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,11 @@ class AddFundsBottomSheetPageObject(semanticsProvider: SemanticsNodeInteractions
|
||||||
useUnmergedTree = true
|
useUnmergedTree = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun titleWithTokenName(tokenTitle: String): KNode = child {
|
||||||
|
hasText(getResourceString(R.string.get_token_title, tokenTitle))
|
||||||
|
useUnmergedTree = true
|
||||||
|
}
|
||||||
|
|
||||||
fun userTokenWithTitle(tokenTitle: String): KNode = child {
|
fun userTokenWithTitle(tokenTitle: String): KNode = child {
|
||||||
hasTestTag(BuyTokenScreenTestTags.LAZY_LIST_ITEM)
|
hasTestTag(BuyTokenScreenTestTags.LAZY_LIST_ITEM)
|
||||||
hasAnyDescendant(withTestTag(TokenElementsTestTags.TOKEN_TITLE))
|
hasAnyDescendant(withTestTag(TokenElementsTestTags.TOKEN_TITLE))
|
||||||
|
|
|
||||||
|
|
@ -503,6 +503,9 @@ class MainScreenActionButtonsTest : BaseTestCase() {
|
||||||
step("Click on 'Swap' button") {
|
step("Click on 'Swap' button") {
|
||||||
onMainScreen { swapButton.performClick() }
|
onMainScreen { swapButton.performClick() }
|
||||||
}
|
}
|
||||||
|
step("Skip stories if displayed") {
|
||||||
|
skipSwapStories()
|
||||||
|
}
|
||||||
step("Check 'Action is unavailable' dialog") {
|
step("Check 'Action is unavailable' dialog") {
|
||||||
flakySafely(WAIT_UNTIL_TIMEOUT) {
|
flakySafely(WAIT_UNTIL_TIMEOUT) {
|
||||||
checkActionIsUnavailableDialog()
|
checkActionIsUnavailableDialog()
|
||||||
|
|
|
||||||
|
|
@ -128,11 +128,14 @@ class TokenDetailsScreenActionButtonsTest : BaseTestCase() {
|
||||||
step("Click on 'Add funds' button") {
|
step("Click on 'Add funds' button") {
|
||||||
onTokenDetailsScreen { addFundsButton.clickWithAssertion() }
|
onTokenDetailsScreen { addFundsButton.clickWithAssertion() }
|
||||||
}
|
}
|
||||||
|
step("Assert 'Get $tokenTitle' bottom-sheet is displayed") {
|
||||||
|
onAddFundsBottomSheet { titleWithTokenName(tokenTitle).assertIsDisplayed() }
|
||||||
|
}
|
||||||
step("Assert 'Buy' button in bottom sheet is enabled") {
|
step("Assert 'Buy' button in bottom sheet is enabled") {
|
||||||
onAddFundsBottomSheet { buyButton.assertIsEnabled() }
|
onAddFundsBottomSheet { buyButton.assertIsEnabled() }
|
||||||
}
|
}
|
||||||
step("Assert 'Swap' button in bottom sheet is not displayed") {
|
step("Assert 'Swap' button in bottom sheet is not enabled") {
|
||||||
onAddFundsBottomSheet { swapButton.assertIsNotDisplayed() }
|
onAddFundsBottomSheet { swapButton.assertIsNotEnabled() }
|
||||||
}
|
}
|
||||||
step("Assert 'Receive' button in bottom sheet is enabled") {
|
step("Assert 'Receive' button in bottom sheet is enabled") {
|
||||||
onAddFundsBottomSheet { receiveButton.assertIsEnabled() }
|
onAddFundsBottomSheet { receiveButton.assertIsEnabled() }
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ import org.junit.Test
|
||||||
@HiltAndroidTest
|
@HiltAndroidTest
|
||||||
class SolanaWarningsTest : BaseTestCase() {
|
class SolanaWarningsTest : BaseTestCase() {
|
||||||
private val tokenName = "Solana"
|
private val tokenName = "Solana"
|
||||||
private val amountToLeaveLessThanRent = "0.0016941"
|
private val amountToLeaveLessThanRent = "0.0372"
|
||||||
private val amountToLeaveGreaterThanRent = "0.0000941"
|
private val amountToLeaveGreaterThanRent = "0.0000941"
|
||||||
private val amountToLeaveRentOnly = "0.001689338"
|
private val amountToLeaveRentOnly = "0.001689338"
|
||||||
private val rentAmount = "SOL 0.00089088"
|
private val rentAmount = "SOL 0.00089088"
|
||||||
|
|
|
||||||
|
|
@ -554,7 +554,7 @@ class SwapTokenScreenWarningsTest : BaseTestCase() {
|
||||||
fun solanaRemainingBalanceLessThanRentAmountTest() {
|
fun solanaRemainingBalanceLessThanRentAmountTest() {
|
||||||
val tokenTitle = "Solana"
|
val tokenTitle = "Solana"
|
||||||
val receiveTokenName = "USDC"
|
val receiveTokenName = "USDC"
|
||||||
val inputAmount = "0.0016941"
|
val inputAmount = "0.0372"
|
||||||
val tokensScenarioState = "SolanaUSDC"
|
val tokensScenarioState = "SolanaUSDC"
|
||||||
val rentAmount = "SOL 0.00089088"
|
val rentAmount = "SOL 0.00089088"
|
||||||
val notificationTitle = getResourceString(R.string.send_notification_invalid_amount_title)
|
val notificationTitle = getResourceString(R.string.send_notification_invalid_amount_title)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue