/
ItemStatisticScreen.kt
78 lines (68 loc) · 2.19 KB
/
ItemStatisticScreen.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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
import androidx.compose.ui.test.assertTextEquals
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
import com.ivy.wallet.compose.IvyComposeTestRule
open class ItemStatisticScreen(
protected val composeTestRule: IvyComposeTestRule
) {
private fun clickDelete(): DeleteConfirmationModal {
composeTestRule.onNodeWithTag("delete_button")
.performClick()
return DeleteConfirmationModal(composeTestRule)
}
fun <N> clickEdit(next: N): N {
composeTestRule.onNodeWithText("Edit")
.performClick()
return next
}
fun <N> clickClose(next: N): N {
composeTestRule.onNodeWithTag("toolbar_close")
.performScrollTo()
.performClick()
return next
}
fun clickUpcoming() : ItemStatisticScreen {
composeTestRule.onNodeWithTag(
testTag = "upcoming_title",
useUnmergedTree = true
).performClick()
return this
}
fun clickTransactionSkip() : ItemStatisticScreen{
composeTestRule.onNode(
hasText("Skip")
.and(hasAnyAncestor(hasTestTag("transaction_card")))
)
.performScrollTo()
.performClick()
return this
}
fun clickTransactionPay(): ItemStatisticScreen{
composeTestRule.onNode(
hasText("Pay")
.and(hasAnyAncestor(hasTestTag("transaction_card")))
)
.performScrollTo()
.performClick()
return this
}
fun assertBalance(
balance: String,
balanceDecimal: String,
currency: String
): ItemStatisticScreen {
composeTestRule.onNodeWithTag("balance")
.assertTextEquals(currency, balance, balanceDecimal)
return this
}
fun <T> deleteItem(next: T): T {
return clickDelete()
.confirmDelete(next = next)
}
}