-
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.
Merge pull request #175 from ILIYANGERMANOV/ui-tests
UI tests & minor issues closed
- Loading branch information
Showing
59 changed files
with
2,034 additions
and
136 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
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
52 changes: 52 additions & 0 deletions
52
app/src/androidTest/java/com/ivy/wallet/compose/helpers/BudgetModal.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,52 @@ | ||
package com.ivy.wallet.compose.helpers | ||
|
||
import androidx.activity.ComponentActivity | ||
import androidx.compose.ui.test.* | ||
import androidx.compose.ui.test.junit4.AndroidComposeTestRule | ||
import androidx.test.ext.junit.rules.ActivityScenarioRule | ||
|
||
class BudgetModal<A : ComponentActivity>( | ||
private val composeTestRule: AndroidComposeTestRule<ActivityScenarioRule<A>, A> | ||
) { | ||
private val amountInput = AmountInput(composeTestRule) | ||
|
||
fun enterName(budgetName: String) { | ||
composeTestRule.onNodeWithTag("base_input") | ||
.performTextReplacement(budgetName) | ||
} | ||
|
||
fun enterAmount(amount: String) { | ||
composeTestRule.onNodeWithTag("amount_balance") | ||
.performClick() | ||
|
||
amountInput.enterNumber(amount) | ||
} | ||
|
||
fun clickCategory(category: String) { | ||
composeTestRule.onNode( | ||
hasText(category) | ||
.and(hasAnyAncestor(hasTestTag("budget_categories_row"))), | ||
useUnmergedTree = true | ||
).performClick() | ||
} | ||
|
||
fun clickAdd() { | ||
composeTestRule.onNodeWithText("Add") | ||
.performClick() | ||
} | ||
|
||
fun clickSave() { | ||
composeTestRule.onNodeWithText("Save") | ||
.performClick() | ||
} | ||
|
||
fun clickDelete() { | ||
composeTestRule.onNodeWithTag("modal_delete") | ||
.performClick() | ||
} | ||
|
||
fun clickClose() { | ||
composeTestRule.onNodeWithContentDescription("close") | ||
.performClick() | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
app/src/androidTest/java/com/ivy/wallet/compose/helpers/BudgetsScreen.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,55 @@ | ||
package com.ivy.wallet.compose.helpers | ||
|
||
import androidx.activity.ComponentActivity | ||
import androidx.compose.ui.test.* | ||
import androidx.compose.ui.test.junit4.AndroidComposeTestRule | ||
import androidx.test.ext.junit.rules.ActivityScenarioRule | ||
|
||
class BudgetsScreen<A : ComponentActivity>( | ||
private val composeTestRule: AndroidComposeTestRule<ActivityScenarioRule<A>, A> | ||
) { | ||
fun clickAddBudget() { | ||
composeTestRule.onNodeWithText("Add budget") | ||
.performClick() | ||
} | ||
|
||
fun assertBudgetsInfo( | ||
appBudget: String?, | ||
categoryBudget: String?, | ||
currency: String = "USD" | ||
) { | ||
val budgetInfoNode = composeTestRule.onNodeWithTag("budgets_info_text") | ||
|
||
when { | ||
appBudget != null && categoryBudget == null -> { | ||
budgetInfoNode.assertTextEquals("Budget info: $appBudget $currency app budget") | ||
} | ||
appBudget == null && categoryBudget != null -> { | ||
budgetInfoNode.assertTextEquals("Budget info: $categoryBudget $currency for categories") | ||
} | ||
appBudget != null && categoryBudget != null -> { | ||
budgetInfoNode.assertTextEquals("Budget info: $categoryBudget $currency for categories / $appBudget $currency app budget") | ||
} | ||
appBudget == null && categoryBudget == null -> { | ||
budgetInfoNode.assertDoesNotExist() | ||
} | ||
else -> error("Unexpected case") | ||
} | ||
} | ||
|
||
fun clickBudget( | ||
budgetName: String | ||
) { | ||
composeTestRule.onNodeWithText(budgetName) | ||
.performScrollTo() | ||
.performClick() | ||
} | ||
|
||
fun assertBudgetDoesNotExist( | ||
budgetName: String | ||
) { | ||
composeTestRule.onNodeWithText(budgetName) | ||
.assertDoesNotExist() | ||
} | ||
|
||
} |
Oops, something went wrong.