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
1d421e9
commit 810c504
Showing
39 changed files
with
542 additions
and
497 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
58 changes: 43 additions & 15 deletions
58
app/src/androidTest/java/com/ivy/wallet/compose/helpers/AccountModal.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 |
---|---|---|
@@ -1,49 +1,77 @@ | ||
package com.ivy.wallet.compose.helpers | ||
|
||
import androidx.activity.ComponentActivity | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.test.* | ||
import androidx.compose.ui.test.junit4.AndroidComposeTestRule | ||
import androidx.test.ext.junit.rules.ActivityScenarioRule | ||
import com.ivy.wallet.compose.IvyComposeTestRule | ||
|
||
class AccountModal<A : ComponentActivity>( | ||
private val composeTestRule: AndroidComposeTestRule<ActivityScenarioRule<A>, A> | ||
) { | ||
val ivyColorPicker = IvyColorPicker(composeTestRule) | ||
val chooseIconFlow = ChooseIconFlow(composeTestRule) | ||
val currencyPicker = CurrencyPicker(composeTestRule) | ||
class AccountModal( | ||
private val composeTestRule: IvyComposeTestRule | ||
) : ColorPicker<AccountModal>, IconPicker<AccountModal>, | ||
CurrencyPicker<AccountModal>, AmountInput<AccountModal> { | ||
|
||
fun enterTitle( | ||
title: String | ||
) { | ||
): AccountModal { | ||
composeTestRule.onNodeWithTag("base_input") | ||
.performTextReplacement(title) | ||
return this | ||
} | ||
|
||
fun clickBalance() { | ||
private fun clickBalance(): IvyAmountInput { | ||
composeTestRule | ||
.onNode(hasTestTag("amount_balance")) | ||
.performClick() | ||
return IvyAmountInput(composeTestRule) | ||
} | ||
|
||
fun chooseCurrency() { | ||
private fun clickCurrency(): IvyCurrencyPicker { | ||
composeTestRule.onNodeWithTag("account_modal_currency") | ||
.performClick() | ||
return IvyCurrencyPicker(composeTestRule) | ||
} | ||
|
||
fun clickSave() { | ||
fun <N> clickSave(next: N): N { | ||
composeTestRule | ||
.onNode(hasText("Save")) | ||
.performClick() | ||
return next | ||
} | ||
|
||
fun clickAdd() { | ||
fun clickAdd(): AccountsTab { | ||
composeTestRule | ||
.onNode(hasText("Add")) | ||
.performClick() | ||
return AccountsTab(composeTestRule) | ||
} | ||
|
||
fun tapIncludeInBalance() { | ||
fun tapIncludeInBalance(): AccountModal { | ||
composeTestRule.onNodeWithText("Include account") | ||
.performClick() | ||
return this | ||
} | ||
|
||
override fun chooseColor(color: Color): AccountModal { | ||
IvyColorPicker(composeTestRule).chooseColor(color) | ||
return this | ||
} | ||
|
||
override fun chooseIcon(icon: String): AccountModal { | ||
ChooseIconFlow(composeTestRule).chooseIcon(icon) | ||
return this | ||
} | ||
|
||
|
||
override fun chooseCurrency(currencyCode: String): AccountModal { | ||
clickCurrency() | ||
.chooseCurrency(currencyCode) | ||
return this | ||
} | ||
|
||
override fun enterAmount(number: String): AccountModal { | ||
return clickBalance() | ||
.enterNumber( | ||
number = number, | ||
next = 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
37 changes: 37 additions & 0 deletions
37
app/src/androidTest/java/com/ivy/wallet/compose/helpers/AddFABMenu.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,37 @@ | ||
package com.ivy.wallet.compose.helpers | ||
|
||
import androidx.compose.ui.test.hasText | ||
import androidx.compose.ui.test.onNodeWithText | ||
import com.ivy.wallet.compose.IvyComposeTestRule | ||
import com.ivy.wallet.compose.clickWithRetry | ||
import com.ivy.wallet.compose.performClickWithRetry | ||
|
||
class AddFABMenu( | ||
private val composeTestRule: IvyComposeTestRule | ||
) { | ||
fun clickAddIncome(): TransactionScreen { | ||
composeTestRule.clickWithRetry( | ||
node = composeTestRule.onNode(hasText("ADD INCOME")), | ||
maxRetries = 3 | ||
) | ||
return TransactionScreen(composeTestRule) | ||
} | ||
|
||
fun clickAddExpense(): TransactionScreen { | ||
composeTestRule.onNode(hasText("ADD EXPENSE")) | ||
.performClickWithRetry(composeTestRule) | ||
return TransactionScreen(composeTestRule) | ||
} | ||
|
||
fun clickAddTransfer(): TransactionScreen { | ||
composeTestRule.onNode(hasText("ACCOUNT TRANSFER")) | ||
.performClickWithRetry(composeTestRule) | ||
return TransactionScreen(composeTestRule) | ||
} | ||
|
||
fun clickAddPlannedPayment(): EditPlannedScreen { | ||
composeTestRule.onNodeWithText("Add planned payment") | ||
.performClickWithRetry(composeTestRule) | ||
return EditPlannedScreen(composeTestRule) | ||
} | ||
} |
10 changes: 4 additions & 6 deletions
10
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
8 changes: 3 additions & 5 deletions
8
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
8 changes: 3 additions & 5 deletions
8
app/src/androidTest/java/com/ivy/wallet/compose/helpers/CategoriesScreen.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
8 changes: 3 additions & 5 deletions
8
app/src/androidTest/java/com/ivy/wallet/compose/helpers/CategoryModal.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
14 changes: 7 additions & 7 deletions
14
app/src/androidTest/java/com/ivy/wallet/compose/helpers/ChooseCategoryModal.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 |
---|---|---|
@@ -1,25 +1,25 @@ | ||
package com.ivy.wallet.compose.helpers | ||
|
||
import androidx.activity.ComponentActivity | ||
import androidx.compose.ui.test.hasTestTag | ||
import androidx.compose.ui.test.hasText | ||
import androidx.compose.ui.test.junit4.AndroidComposeTestRule | ||
import androidx.compose.ui.test.onNodeWithText | ||
import androidx.compose.ui.test.performClick | ||
import androidx.test.ext.junit.rules.ActivityScenarioRule | ||
import com.ivy.wallet.compose.IvyComposeTestRule | ||
|
||
class ChooseCategoryModal<A : ComponentActivity>( | ||
private val composeTestRule: AndroidComposeTestRule<ActivityScenarioRule<A>, A> | ||
class ChooseCategoryModal( | ||
private val composeTestRule: IvyComposeTestRule | ||
) { | ||
|
||
fun selectCategory(categoryName: String) { | ||
fun <N> selectCategory(categoryName: String, next: N): N { | ||
composeTestRule.onNode( | ||
hasTestTag("choose_category_button").and(hasText(categoryName)) | ||
).performClick() | ||
return next | ||
} | ||
|
||
fun skip() { | ||
fun <N> skip(next: N): N { | ||
composeTestRule.onNodeWithText("Skip") | ||
.performClick() | ||
return next | ||
} | ||
} |
Oops, something went wrong.