-
Notifications
You must be signed in to change notification settings - Fork 573
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add AccountsTest.kt & remove "UI tests" workflow from README
- Loading branch information
Iliyan Germanov
committed
Nov 22, 2021
1 parent
48b114f
commit 6cbe418
Showing
10 changed files
with
137 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
26 changes: 26 additions & 0 deletions
26
app/src/androidTest/java/com/ivy/wallet/compose/helpers/ChooseIconFlow.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,26 @@ | ||
package com.ivy.wallet.compose.helpers | ||
|
||
import androidx.activity.ComponentActivity | ||
import androidx.compose.ui.test.junit4.AndroidComposeTestRule | ||
import androidx.compose.ui.test.onNodeWithTag | ||
import androidx.compose.ui.test.onNodeWithText | ||
import androidx.compose.ui.test.performClick | ||
import androidx.compose.ui.test.performScrollTo | ||
import androidx.test.ext.junit.rules.ActivityScenarioRule | ||
|
||
class ChooseIconFlow<A : ComponentActivity>( | ||
private val composeTestRule: AndroidComposeTestRule<ActivityScenarioRule<A>, A> | ||
) { | ||
|
||
fun chooseIcon(icon: String) { | ||
composeTestRule.onNodeWithTag("modal_item_icon") | ||
.performClick() | ||
|
||
composeTestRule.onNodeWithTag(icon) | ||
.performScrollTo() | ||
.performClick() | ||
|
||
composeTestRule.onNodeWithText("Save") | ||
.performClick() | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
app/src/androidTest/java/com/ivy/wallet/compose/helpers/IvyColorPicker.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,23 @@ | ||
package com.ivy.wallet.compose.helpers | ||
|
||
import androidx.activity.ComponentActivity | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.test.hasTestTag | ||
import androidx.compose.ui.test.junit4.AndroidComposeTestRule | ||
import androidx.compose.ui.test.performClick | ||
import androidx.compose.ui.test.performScrollTo | ||
import androidx.test.ext.junit.rules.ActivityScenarioRule | ||
import com.ivy.wallet.compose.printTree | ||
|
||
class IvyColorPicker<A : ComponentActivity>( | ||
private val composeTestRule: AndroidComposeTestRule<ActivityScenarioRule<A>, A> | ||
) { | ||
|
||
fun chooseColor(color: Color) { | ||
composeTestRule.printTree() | ||
|
||
composeTestRule.onNode(hasTestTag("color_item_${color.value}")) | ||
.performScrollTo() | ||
.performClick() | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
app/src/androidTest/java/com/ivy/wallet/compose/scenario/AccountsTest.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,47 @@ | ||
package com.ivy.wallet.compose.scenario | ||
|
||
import com.ivy.wallet.compose.IvyComposeTest | ||
import com.ivy.wallet.compose.helpers.* | ||
import com.ivy.wallet.ui.theme.Blue | ||
import dagger.hilt.android.testing.HiltAndroidTest | ||
import org.junit.Test | ||
|
||
@HiltAndroidTest | ||
class AccountsTest : IvyComposeTest() { | ||
|
||
private val onboarding = OnboardingFlow(composeTestRule) | ||
private val amountInput = AmountInput(composeTestRule) | ||
private val accountModal = AccountModal(composeTestRule) | ||
private val mainBottomBar = MainBottomBar(composeTestRule) | ||
private val transactionFlow = TransactionFlow(composeTestRule) | ||
private val homeTab = HomeTab(composeTestRule) | ||
private val accountsTab = AccountsTab(composeTestRule) | ||
private val editTransactionScreen = EditTransactionScreen(composeTestRule) | ||
|
||
|
||
@Test | ||
fun contextLoads() { | ||
} | ||
|
||
@Test | ||
fun CreateAccount() { | ||
onboarding.quickOnboarding() | ||
|
||
mainBottomBar.clickAccounts() | ||
mainBottomBar.clickAddFAB() | ||
|
||
accountModal.apply { | ||
enterTitle("Revolut") | ||
ivyColorPicker.chooseColor(Blue) | ||
chooseIconFlow.chooseIcon("revolut") | ||
clickAdd() | ||
} | ||
|
||
accountsTab.assertAccountBalance( | ||
account = "Revolut", | ||
balance = "0", | ||
balanceDecimal = ".00", | ||
currency = "USD" | ||
) | ||
} | ||
} |
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