From 2db585b5da4ef9a93083461e3e4c1b0125110dc2 Mon Sep 17 00:00:00 2001 From: First-Terraner Date: Mon, 22 Jan 2024 09:39:36 +0100 Subject: [PATCH] maesto --- .maestro/cleanState/createToken.yaml | 10 +++ .maestro/cleanState/init.yaml | 88 +++++++++++++++++++++++++ .maestro/cleanState/newMint.yaml | 99 ++++++++++++++++++++++++++++ .maestro/cleanState/unlock.yaml | 41 ++++++++++++ .maestro/flow.yaml | 5 -- .maestro/main.js | 20 ++++++ src/components/nav/BottomNav.tsx | 3 + src/components/nav/TopNav.tsx | 1 + src/screens/Auth/PinPad.tsx | 1 + src/screens/Dashboard.tsx | 2 +- src/screens/Payment/SelectAmount.tsx | 1 + 11 files changed, 265 insertions(+), 6 deletions(-) create mode 100644 .maestro/cleanState/createToken.yaml create mode 100644 .maestro/cleanState/init.yaml create mode 100644 .maestro/cleanState/newMint.yaml create mode 100644 .maestro/cleanState/unlock.yaml delete mode 100644 .maestro/flow.yaml create mode 100644 .maestro/main.js diff --git a/.maestro/cleanState/createToken.yaml b/.maestro/cleanState/createToken.yaml new file mode 100644 index 00000000..63a4d9d3 --- /dev/null +++ b/.maestro/cleanState/createToken.yaml @@ -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" \ No newline at end of file diff --git a/.maestro/cleanState/init.yaml b/.maestro/cleanState/init.yaml new file mode 100644 index 00000000..2ad1c7e3 --- /dev/null +++ b/.maestro/cleanState/init.yaml @@ -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 \ No newline at end of file diff --git a/.maestro/cleanState/newMint.yaml b/.maestro/cleanState/newMint.yaml new file mode 100644 index 00000000..ac53b4d9 --- /dev/null +++ b/.maestro/cleanState/newMint.yaml @@ -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!" diff --git a/.maestro/cleanState/unlock.yaml b/.maestro/cleanState/unlock.yaml new file mode 100644 index 00000000..cf2d2dfc --- /dev/null +++ b/.maestro/cleanState/unlock.yaml @@ -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!" \ No newline at end of file diff --git a/.maestro/flow.yaml b/.maestro/flow.yaml deleted file mode 100644 index be713702..00000000 --- a/.maestro/flow.yaml +++ /dev/null @@ -1,5 +0,0 @@ -# flow.yaml - -appId: com.agron.enuts ---- -- launchApp \ No newline at end of file diff --git a/.maestro/main.js b/.maestro/main.js new file mode 100644 index 00000000..9aa12b38 --- /dev/null +++ b/.maestro/main.js @@ -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', + } +} diff --git a/src/components/nav/BottomNav.tsx b/src/components/nav/BottomNav.tsx index 930075de..fbe3c163 100644 --- a/src/components/nav/BottomNav.tsx +++ b/src/components/nav/BottomNav.tsx @@ -57,6 +57,7 @@ export default function BottomNav({ animatedPosStyles ]}> void handleNav('dashboard')} disabled={isWalletRelatedScreen} @@ -71,6 +72,7 @@ export default function BottomNav({ /> void handleNav('Address book')} disabled={route.name === 'Address book'} @@ -87,6 +89,7 @@ export default function BottomNav({ /> void handleNav('Settings')} disabled={isSettingsRelatedScreen} diff --git a/src/components/nav/TopNav.tsx b/src/components/nav/TopNav.tsx index ce9a3151..935ffa0a 100644 --- a/src/components/nav/TopNav.tsx +++ b/src/components/nav/TopNav.tsx @@ -60,6 +60,7 @@ export default function TopNav({ {withBackBtn && !txt?.length && diff --git a/src/screens/Auth/PinPad.tsx b/src/screens/Auth/PinPad.tsx index 11909a3c..0974ffb9 100644 --- a/src/screens/Auth/PinPad.tsx +++ b/src/screens/Auth/PinPad.tsx @@ -47,6 +47,7 @@ export default function PinPad({ pinInput, confirmInput, isConfirm, mismatch, ha {row.map(pad => ( void handleInput(pad.n)} style={[styles.numWrap, pad.n < 10 ? { backgroundColor: getPinpadBg(highlight) } : {}]} disabled={shouldDisablePad(pad.n)} diff --git a/src/screens/Dashboard.tsx b/src/screens/Dashboard.tsx index ebf46ab4..b9ff63a4 100644 --- a/src/screens/Dashboard.tsx +++ b/src/screens/Dashboard.tsx @@ -465,7 +465,7 @@ interface IActionBtnsProps { function ActionBtn({ icon, onPress, txt, color, disabled }: IActionBtnsProps) { return ( - +