Skip to content

Commit

Permalink
maesto
Browse files Browse the repository at this point in the history
  • Loading branch information
KKA11010 committed Jan 22, 2024
1 parent a9f8291 commit 2db585b
Show file tree
Hide file tree
Showing 11 changed files with 265 additions and 6 deletions.
10 changes: 10 additions & 0 deletions .maestro/cleanState/createToken.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# createToken.yaml

# This testnut flow is just a temporary playground
appId: com.agron.enuts.dev
name: "Running createToken.yaml now..."
# onFlowComplete:
# - runFlow: createToken.yaml
---
- tapOn:
id: "wallet-Send"
88 changes: 88 additions & 0 deletions .maestro/cleanState/init.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# init.yaml

# MAESTRO commands: https://maestro.mobile.dev/api-reference/commands

# TODO use different images for different app states
# TODO test in different locales: https://maestro.mobile.dev/advanced/testing-in-different-locales

appId: com.agron.enuts.dev
# https://maestro.mobile.dev/cli/tags
tags:
- clean-state-build
onFlowComplete:
- runFlow: unlock.yaml
---
- launchApp:
# this will start the app with a clean state, showing the onboarding screen
clearState: true
label: 'Starting app...'
- runScript: ../main.js
# make sure the onboarding screen is displayed
- assertVisible: ${output.main.onboarding.header1}
# test onboarding screen
- tapOn: ${output.main.onboarding.nextBtn}
- assertVisible: ${output.main.onboarding.header2}
- swipe:
direction: LEFT
- assertVisible: ${output.main.onboarding.header3}
- swipe:
direction: RIGHT
- assertVisible: ${output.main.onboarding.header2}
- tapOn:
text: ${output.main.onboarding.skipBtn}
label: "Skipped onboarding after successfully swiping through the screens"
# setup a pin
- assertVisible:
id: "11"
enabled: false
label: "Check that the PIN confirm button is disabled"
- tapOn: "1"
- tapOn: "2"
- tapOn: "3"
# delete 1 char
- tapOn:
id: "10"
label: "Delete 1 char"
- tapOn: "3"
- tapOn: "4"
- assertVisible:
id: "11"
enabled: true
label: "Check that the PIN confirm button is enabled"
# confirm input
- tapOn:
id: "11"
label: "Confirm PIN input after min. 4 chars"
# check confirm pin screen is visible
- assertVisible: "Please confirm your PIN."
- assertVisible: "Back"
# go back and re-type pin
- tapOn:
text: ${output.main.onboarding.backBtn}
label: "Test the back button"
- assertVisible:
id: "11"
enabled: false
- tapOn: "1"
- tapOn: "2"
- tapOn: "3"
- tapOn: "4"
- tapOn:
id: "11"
# confirm with wrong PIN
- tapOn: "1"
- tapOn: "3"
- tapOn: "2"
- tapOn: "4"
- tapOn:
id: "11"
label: "Test wrong PIN confirmation"
- assertVisible: "Please confirm your PIN."
- tapOn: "1"
- tapOn: "2"
- tapOn: "3"
- tapOn: "4"
- tapOn:
id: "11"
label: "Test suites of init.yaml passed!"
# at this point, the pin should be set
99 changes: 99 additions & 0 deletions .maestro/cleanState/newMint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# newMint.yaml

# This testnut flow is just a temporary playground
appId: com.agron.enuts.dev
name: "Running newMint.yaml now..."
onFlowComplete:
- runFlow: createToken.yaml
---
- assertVisible:
text: "Get started"
# add testnut mint
- tapOn:
text: "Add mint URL"
label: "Focusing text input and typing an invalid mint URL"
- assertVisible: "Add a new mint"
# focus text input
- tapOn: "Mint URL"
- assertVisible:
text: "Mint URL"
focused: true
# type invalid URL
- inputText: "testnut"
- tapOn: "Add mint"
- assertVisible:
text: "Network request failed"
label: "Checking that the invalid URL error message is displayed"
# type in valid testnut URL
- tapOn: "Mint URL"
# https://maestro.mobile.dev/api-reference/commands/erasetext
- eraseText
- inputText:
text: ${output.main.mints.testnut}
label: "Typi${output.main.mints.testnut}ng a valid testnut URL"
- tapOn: "Add mint"
- assertVisible: "Mint added!"
# mint fake Ecash
- tapOn: "Yes"
# navigates to the invoice amount screen
- assertVisible:
text: "Create invoice"
label: "Checking that the invoice amount screen is displayed"
# make sure amount input is focused
- assertVisible:
id: "amountInput"
focused: true
# test bad case with empty input
- tapOn:
text: "Continue"
label: "Testing the continue button with empty input"
- assertVisible: "Create invoice"
- inputText: "100"
- tapOn:
text: "Continue"
label: "Testing the continue button with a valid amount"
- extendedWaitUntil:
visible: "100 Sats minted!"
timeout: 10000
# User can navigate back to the dashboard by pressing the "Back to dashboard" button
- tapOn:
text: "Back to dashboard"
label: "Navigating back to the dashboard"
- assertVisible:
text: "Send"
label: "Checking that the dashboard is displayed"
- assertVisible: "Scan"
- assertVisible:
text: "Receive"
# Check first history entry
- assertVisible: "Lightning"
- assertVisible: "+100 Sats"
- tapOn:
text: "Lightning"
label: "Checking that the history entry is a Lightning transaction"
# Check Transaction details
- assertVisible: "Lightning invoice"
- assertVisible: "Settle time"
- assertVisible: "Invoice"
- assertVisible: "Payment hash"
- assertVisible: "Fee"
- assertVisible: "Show QR code"
# Check the mint management screen
- tapOn:
id: ${output.main.navBackBtn}
- tapOn:
id: ${output.main.nav.options}
- tapOn: "Mint management"
- assertVisible: "Mints"
- tapOn: ${output.main.mints.testnut}
- assertVisible: "Balance"
- repeat:
times: 2
commands:
- tapOn:
id: ${output.main.navBackBtn}
- tapOn:
id: ${output.main.nav.wallet}
# add the eNuts mint
# - tapOn: "Use the eNuts mint"
# - assertVisible: "Mint added!"
41 changes: 41 additions & 0 deletions .maestro/cleanState/unlock.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# unlock.yaml

appId: com.agron.enuts.dev
onFlowComplete:
- runFlow: newMint.yaml
---
# close app
- stopApp:
label: "Running unlock.yaml now. Closing app..."
# re-launch app
- launchApp:
label: "Re-launching app to test PIN unlock..."
# make sure the pin prompt is displayed
- assertVisible: "Welcome back!"
# test wrong pin
# - repeat:
# times: 3
# label: "Typing a wrong PIN 3 times to lock the wallet"
# commands:
# - tapOn: "4"
# - tapOn: "3"
# - tapOn: "2"
# - tapOn: "1"
# - tapOn:
# id: "11"
# - assertVisible:
# text: "Wallet locked"
# label: "Check that the wallet is locked"
# # now the wallet is locked for 1min
# - extendedWaitUntil:
# visible: "Welcome back!" # waits until the text "Welcome back!" is visible again
# timeout: 65000
# label: "Waiting for 60s until wallet is unlocked again"
# the wallet should be unlocked now
- tapOn: "1"
- tapOn: "2"
- tapOn: "3"
- tapOn: "4"
- tapOn:
id: "11"
label: "Test suites of unlock.yaml passed!"
5 changes: 0 additions & 5 deletions .maestro/flow.yaml

This file was deleted.

20 changes: 20 additions & 0 deletions .maestro/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
output.main = {
nav: {
wallet: 'navWallet',
contacts: 'navContacts',
options: 'navOptions',
},
navBackBtn: 'navBackBtn',
onboarding: {
nextBtn: 'Next',
skipBtn: 'Skip',
backBtn: 'Back',
header1: 'eNuts & Ecash',
header2: 'Cashu & Mints',
header3: 'Send & receive',
},
mints: {
eNuts: 'legend.lnbits.com/cashu/api/v1/AptDNABNBXv8gpuywhx6NV',
testnut: 'testnut.cashu.space',
}
}
3 changes: 3 additions & 0 deletions src/components/nav/BottomNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export default function BottomNav({
animatedPosStyles
]}>
<TouchableOpacity
testID='navWallet'
style={styles.navIcon}
onPress={() => void handleNav('dashboard')}
disabled={isWalletRelatedScreen}
Expand All @@ -71,6 +72,7 @@ export default function BottomNav({
/>
</TouchableOpacity>
<TouchableOpacity
testID='navContacts'
style={styles.navIcon}
onPress={() => void handleNav('Address book')}
disabled={route.name === 'Address book'}
Expand All @@ -87,6 +89,7 @@ export default function BottomNav({
/>
</TouchableOpacity>
<TouchableOpacity
testID='navOptions'
style={styles.navIcon}
onPress={() => void handleNav('Settings')}
disabled={isSettingsRelatedScreen}
Expand Down
1 change: 1 addition & 0 deletions src/components/nav/TopNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export default function TopNav({
<View style={styles.wrap}>
{withBackBtn && !txt?.length &&
<TouchableOpacity
testID='navBackBtn'
onPress={handlePress}
style={styles.backiconWrap}
>
Expand Down
1 change: 1 addition & 0 deletions src/screens/Auth/PinPad.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export default function PinPad({ pinInput, confirmInput, isConfirm, mismatch, ha
{row.map(pad => (
<TouchableOpacity
key={`${i}${pad.n}`}
testID={pad.n.toString()}
onPress={() => void handleInput(pad.n)}
style={[styles.numWrap, pad.n < 10 ? { backgroundColor: getPinpadBg(highlight) } : {}]}
disabled={shouldDisablePad(pad.n)}
Expand Down
2 changes: 1 addition & 1 deletion src/screens/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ interface IActionBtnsProps {

function ActionBtn({ icon, onPress, txt, color, disabled }: IActionBtnsProps) {
return (
<View style={styles.btnWrap}>
<View style={styles.btnWrap} testID={`wallet-${txt}`}>
<IconBtn
icon={icon}
size={vs(60)}
Expand Down
1 change: 1 addition & 0 deletions src/screens/Payment/SelectAmount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ export default function SelectAmountScreen({ navigation, route }: TSelectAmountP
<View style={[styles.overviewWrap, { marginTop: isMelt || isSwap ? 0 : vs(20) }]}>
<Animated.View style={[styles.amountWrap, { transform: [{ translateX: anim.current }] }]}>
<TextInput
testID='amountInput'
keyboardType='numeric'
ref={numericInputRef}
placeholder='0'
Expand Down

0 comments on commit 2db585b

Please sign in to comment.