Skip to content

Commit

Permalink
Add TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
ILIYANGERMANOV committed Jun 13, 2022
1 parent 24be159 commit 3f8cba9
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ abstract class IvyComposeTest {
return InstrumentationRegistry.getInstrumentation().targetContext
}

protected fun testDebug(
test: OnboardingFlow.() -> Unit
) = testWithRetry(maxAttempts = 0, test = test)

protected fun testWithRetry(
attempt: Int = 0,
maxAttempts: Int = 3,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.ivy.wallet.compose.component.external

import com.ivy.wallet.compose.IvyComposeTestRule
import com.ivy.wallet.compose.util.printTree

class CalendarDialog(
private val composeTestRule: IvyComposeTestRule
) {
//TODO: Find a way to pick a date from the material Calendar dialog

fun print() {
composeTestRule.printTree(useUnmergedTree = true)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import com.ivy.wallet.compose.IvyComposeTestRule
import com.ivy.wallet.compose.component.DeleteConfirmationModal
import com.ivy.wallet.compose.component.amountinput.IvyAmountInput
import com.ivy.wallet.compose.component.edittrn.ChooseCategoryModal
import com.ivy.wallet.compose.component.external.CalendarDialog
import com.ivy.wallet.domain.data.IntervalType
import com.ivy.wallet.domain.data.TransactionType
import java.time.LocalDateTime

class EditPlannedScreen(
private val composeTestRule: IvyComposeTestRule
) {
//TODO: Re-work: make UI options strongly typed!

fun setPaymentType(type: TransactionType): IvyAmountInput {
val nodeText = when (type) {
Expand Down Expand Up @@ -142,4 +144,10 @@ class EditPlannedScreen(
.performClick()
return DeleteConfirmationModal(composeTestRule)
}

fun clickRecurringModalPickDate(): CalendarDialog {
composeTestRule.onNodeWithTag("recurring_modal_pick_date")
.performClick()
return CalendarDialog(composeTestRule)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import dagger.hilt.android.testing.HiltAndroidTest
import org.junit.Test

@HiltAndroidTest
class BudgetsTests : IvyComposeTest() {
class BudgetsTest : IvyComposeTest() {

@Test
fun CreateGlobalBudget() = testWithRetry {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.ivy.wallet.compose.scenario.lab

import com.ivy.wallet.compose.IvyComposeTest
import com.ivy.wallet.compose.component.edittrn.ChooseCategoryModal
import com.ivy.wallet.compose.component.planned.EditPlannedScreen
import com.ivy.wallet.domain.data.TransactionType
import dagger.hilt.android.testing.HiltAndroidTest
import org.junit.Test

@HiltAndroidTest
class ExperimentalTest : IvyComposeTest() {
@Test
fun openCalendar() = testDebug {
quickOnboarding()
.clickAddFAB()
.clickAddPlannedPayment()
.setPaymentType(TransactionType.EXPENSE)
.enterNumber(number = "10", next = ChooseCategoryModal(composeTestRule))
.selectCategory("Food & Drinks", next = EditPlannedScreen(composeTestRule))
.clickRecurringModalPickDate()
.print()
}
}

0 comments on commit 3f8cba9

Please sign in to comment.