Skip to content

Commit b06ed5c

Browse files
committed
chore: reorganize maestro tests into helpers and subflows; add full login/logout and pulling out a bill
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent 98ad0e4 commit b06ed5c

15 files changed

Lines changed: 94 additions & 48 deletions

File tree

apps/flipcash/features/scanner/src/main/kotlin/com/flipcash/app/scanner/internal/bills/BillContainerView.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import androidx.compose.ui.Alignment.Companion.BottomCenter
3333
import androidx.compose.ui.Modifier
3434
import androidx.compose.ui.graphics.Color
3535
import androidx.compose.ui.platform.LocalContext
36+
import androidx.compose.ui.platform.testTag
3637
import androidx.compose.ui.unit.dp
3738
import androidx.lifecycle.compose.collectAsStateWithLifecycle
3839
import cafe.adriel.voyager.navigator.currentOrThrow
@@ -119,6 +120,7 @@ internal fun BillContainer(
119120
modifier = Modifier
120121
.fillMaxSize()
121122
.then(modifier)
123+
.testTag("scanner_view")
122124
) {
123125
val availableUpdate by LocalAppUpdater.current.availableUpdate.collectAsStateWithLifecycle()
124126

apps/flipcash/features/scanner/src/main/kotlin/com/flipcash/app/scanner/internal/ui/components/DecorView.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import androidx.compose.ui.Alignment
3131
import androidx.compose.ui.Modifier
3232
import androidx.compose.ui.draw.clip
3333
import androidx.compose.ui.graphics.Color
34+
import androidx.compose.ui.platform.testTag
3435
import androidx.compose.ui.res.painterResource
3536
import androidx.compose.ui.res.stringResource
3637
import androidx.compose.ui.unit.dp
@@ -74,7 +75,7 @@ internal fun DecorView(
7475
indication = null
7576
) {
7677
onAction(ScannerDecorItem.Logo)
77-
},
78+
}.testTag("flipcash_logo"),
7879
painter = painterResource(R.drawable.ic_flipcash_logo_w_name),
7980
contentDescription = "Tap to share the app",
8081
)
@@ -93,7 +94,7 @@ internal fun DecorView(
9394
.clip(CircleShape)
9495
.unboundedClickable {
9596
onAction(ScannerDecorItem.Menu)
96-
},
97+
}.testTag("menu_button"),
9798
painter = painterResource(R.drawable.ic_home_options),
9899
contentDescription = "",
99100
)

apps/flipcash/shared/bills/src/main/kotlin/com/flipcash/app/bills/CashBill.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ import androidx.compose.ui.graphics.lerp
6262
import androidx.compose.ui.layout.ContentScale
6363
import androidx.compose.ui.platform.LocalContext
6464
import androidx.compose.ui.platform.LocalResources
65+
import androidx.compose.ui.platform.testTag
6566
import androidx.compose.ui.res.imageResource
6667
import androidx.compose.ui.res.painterResource
6768
import androidx.compose.ui.text.TextStyle
@@ -310,6 +311,7 @@ internal fun CashBill(
310311
.fillMaxHeight()
311312
.fillMaxWidth(0.95f)
312313
.clipToBounds()
314+
.testTag("cash_bill")
313315
) {
314316
val geometry = remember(maxWidth, maxHeight) {
315317
CashBillGeometry(maxWidth, maxHeight)

libs/messaging/src/main/kotlin/com/getcode/manager/BottomBarManager.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,7 @@ object BottomBarManager {
159159
title: String,
160160
message: String,
161161
additionalInfo: Map<String, Any?> = emptyMap(),
162-
actions: List<BottomBarAction> = listOf(
163-
BottomBarAction(
164-
text = "OK",
165-
style = BottomBarButtonStyle.Filled
166-
)
167-
),
162+
actions: List<BottomBarAction> = listOf(BottomBarAction.Ok),
168163
showCancel: Boolean = false,
169164
onDismiss: (fromAction: Boolean) -> Unit = { },
170165
) {

maestro/helpers/launch_app.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
appId: com.flipcash.app.android.dev
2+
---
3+
- launchApp:
4+
clearState: true
5+
arguments:
6+
isUiTest: true

maestro/login.yaml

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,4 @@
1-
# maestro/login.yaml
21
appId: com.flipcash.app.android.dev
32
---
4-
- launchApp:
5-
clearState: true
6-
arguments:
7-
isUiTest: true
8-
- extendedWaitUntil:
9-
visible:
10-
id: "login_screen"
11-
- tapOn:
12-
id: "login_button"
13-
- extendedWaitUntil:
14-
visible:
15-
id: seed_input_screen
16-
- tapOn:
17-
id: "seed_input_field"
18-
- inputText: ${SEED_PHRASE}
19-
- tapOn:
20-
id: "login_confirm_button"
21-
- extendedWaitUntil:
22-
visible:
23-
id: "scanner_screen"
3+
- runFlow: helpers/launch_app.yaml
4+
- runFlow: subflows/login.yaml

maestro/login_logout.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
appId: com.flipcash.app.android.dev
2+
---
3+
- runFlow: helpers/launch_app.yaml
4+
- runFlow: subflows/login.yaml
5+
- runFlow: subflows/logout.yaml
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
appId: com.flipcash.app.android.dev
2+
---
3+
- runFlow: helpers/launch_app.yaml
4+
- runFlow: subflows/login.yaml
5+
- runFlow: subflows/pull_out_bill.yaml
6+
- tapOn: Cancel
7+
- extendedWaitUntil:
8+
visible:
9+
id: "scanner_screen"

maestro/subflows/login.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Login
2+
appId: com.flipcash.app.android.dev
3+
---
4+
- tapOn: Log in
5+
- extendedWaitUntil:
6+
visible:
7+
id: seed_input_screen
8+
- tapOn:
9+
id: "seed_input_field"
10+
- inputText: ${SEED_PHRASE}
11+
- tapOn: Log in
12+
- extendedWaitUntil:
13+
visible:
14+
id: "scanner_screen"

maestro/subflows/logout.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Reusable Logout flow
2+
appId: com.flipcash.app.android.dev
3+
---
4+
- tapOn:
5+
id: scanner_view
6+
- extendedWaitUntil:
7+
visible:
8+
id: scanner_screen
9+
- tapOn:
10+
id: menu_button
11+
- extendedWaitUntil:
12+
visible:
13+
id: menu_screen
14+
- tapOn: Log Out
15+
- assertVisible: Log Out
16+
- assertVisible: Cancel
17+
- tapOn: Log Out
18+
- extendedWaitUntil:
19+
visible:
20+
id: login_screen

0 commit comments

Comments
 (0)