test: Attempting automation for testing (#1734)

* feat: Integration tests setup and tests for Disclaimer, Welcome and Setup Pin Code pages * feat: Integration test flow from start to restoring a wallet successfully done * test: Dashboard view test and linking to flow * feat: Testing the Exchange flow section, selecting sending and receiving currencies * test: Successfully create an exchange section * feat: Implement flow up to sending section * test: Complete Exchange flow * fix dependency issue * test: Final cleanups * feat: Add CI to run automated integration tests withan android emulator * feat: Adjust Automated integration test CI to run on ubuntu 20.04-a * fix: Move integration test CI into PR test build CI * ci: Add automated test ci which is a streamlined replica of pr test build ci * ci: Re-add step to access branch name * ci: Add KVM * ci: Add filepath to trigger the test run from * ci: Add required key * ci: Add required key * ci: Add missing secret key * ci: Add missing secret key * ci: Add nano secrets to workflow * ci: Switch step to free space on runner * ci: Remove timeout from workflow * ci: Confirm impact that removing copy_monero_deps would have on entire workflow time * ci: Update CI and temporarily remove cache related to emulator * ci: Remove dynamic java version * ci: Temporarily switch CI * ci: Switch to 11.x jdk * ci: Temporarily switch CI * ci: Revert ubuntu version * ci: Add more api levels * ci: Add more target options * ci: Settled on stable emulator matrix options * ci: Add more target options * ci: Modify flow * ci: Streamline api levels to 28 and 29 * ci: One more trial * ci: Switch to flutter drive * ci: Reduce options * ci: Remove haven from test * ci: Check for solana in list * ci: Adjust amounts and currencies for exchange flow * ci: Set write response on failure to true * ci: Split ci to funds and non funds related tests * test: Test for Send flow scenario and minor restructuring for test folders and files * chore: cleanup * ci: Pause CI for now * ci: Pause CI for now * ci: Pause CI for now * test: Restore wallets integration automated tests * Fix: Add keys back to currency amount textfield widget * fix: Switch variable name * fix: remove automation for now * tests: Automated tests for Create wallets flow * tests: Further optimize common flows * tests: Add missing await for call * tests: Confirm Seeds Display Properly WIP * tests: Confirm Seeds Display Correctly Automated Tests * fix: Add missing pubspec params for bitcoin and bitcoin_cash * feat: Automated Tests for Transaction History Flow * fix: Add missing pubspec parameter * feat: Automated Integration Tests for Transaction History flow * test: Updating send page robot and also syncing branch with main * test: Modifying tests to flow with wallet grouping implementation * fix: Issue with transaction history test * fix: Modifications to the PR and add automated confirmation for checking that all wallet types are restored or created correctly * test: Attempting automation for testing * test: Attempting automation for testing * test: Print out working directory * test: See if I can cut down time by removing the build step * test: More logs * test: Pubspec was not generated, checking if this fixes it * test: Pubspec was not generated, checking if this fixes it * test: Pubspec was not generated, checking if this fixes it * test: Pubspec was not generated, checking if this fixes it * test: Pubspec was not generated, checking if this fixes it * test: Pubspec was not generated, checking if this fixes it * test: Another trial * test: Another trial * test: Another trial * test: Another trial * test: Another trial * test: Another trial * fix: Adjust config file * test: Add commands to generate files and set codebase up as new * test: try another route * test: try another route - 2 * test: try another route * test: try another route - 2 * test: Uncomment KVM and optimizations-a * test: Try with sudo permissions-a * test: Try again * test: Pause build and rename steps, see how faster it resolves * test: Try using working directory * test: Check details of current working directory * test: Switch test run command from flutter drive to flutter test * test: Adding secrets to CI workflow * fix: add working directory to emulator and reactivate build step * test: Add verbosity * test: Check tat emulator is present and ready to connect * test: Try a direct test to see if it'll trigger properly * test: Try the flutter drive command * test: Try uninstalling before running * test: Create an aggregator test file as the entry point for all tests * test: Try without awaiting each test * test: Another trial at getting combined tests running * test: Use a test runner script that'll be responsible for running all available integration tests * test: Add command to make integration test runner file an executable * test: Fix failing exchange flow test * test: fix failing exchange flow test * test: Fix issue with send flow test * test: Fix issue with confirm seeds flow test * test: Modify create and restore flows to reflect modified onboarding flow * chore: Remove package declaration in AndroidManifestBase file to fix issue of it being deprecated * test: Bump up flutter version * fix: Add meld keys * chore: Remove package name declarations from AndroidManifests * better write close function definition comment integration tests workflow for now --------- Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>

David Adegoke committed Dec 13, 2024 at 20:45 UTC 3ad04227a48f7d1d52970e2d20eb0be651fa8c34
22 files changed +446 -38
.github/workflows/automated_integration_test.yml new
+298
@@ -0,0 +1,298 @@
1 +#name: Automated Integration Tests
2 +#
3 +#on:
4 +# pull_request:
5 +# branches: [main, CW-659-Transaction-History-Automated-Tests]
6 +# workflow_dispatch:
7 +# inputs:
8 +# branch:
9 +# description: "Branch name to build"
10 +# required: true
11 +# default: "main"
12 +#
13 +#jobs:
14 +# Automated_integration_test:
15 +# runs-on: ubuntu-20.04
16 +# strategy:
17 +# fail-fast: false
18 +# matrix:
19 +# api-level: [29]
20 +# # arch: [x86, x86_64]
21 +# env:
22 +# STORE_PASS: test@cake_wallet
23 +# KEY_PASS: test@cake_wallet
24 +# PR_NUMBER: ${{ github.event.number }}
25 +#
26 +# steps:
27 +# - name: is pr
28 +# if: github.event_name == 'pull_request'
29 +# run: echo "BRANCH_NAME=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
30 +#
31 +# - name: is not pr
32 +# if: github.event_name != 'pull_request'
33 +# run: echo "BRANCH_NAME=${{ github.event.inputs.branch }}" >> $GITHUB_ENV
34 +#
35 +# - name: Free Disk Space (Ubuntu)
36 +# uses: insightsengineering/disk-space-reclaimer@v1
37 +# with:
38 +# tools-cache: true
39 +# android: false
40 +# dotnet: true
41 +# haskell: true
42 +# large-packages: true
43 +# swap-storage: true
44 +# docker-images: true
45 +#
46 +# - uses: actions/checkout@v2
47 +# - uses: actions/setup-java@v2
48 +# with:
49 +# distribution: "temurin"
50 +# java-version: "17"
51 +# - name: Configure placeholder git details
52 +# run: |
53 +# git config --global user.email "CI@cakewallet.com"
54 +# git config --global user.name "Cake Github Actions"
55 +# - name: Flutter action
56 +# uses: subosito/flutter-action@v1
57 +# with:
58 +# flutter-version: "3.24.0"
59 +# channel: stable
60 +#
61 +# - name: Install package dependencies
62 +# run: |
63 +# sudo apt update
64 +# sudo apt-get install -y curl unzip automake build-essential file pkg-config git python libtool libtinfo5 cmake clang
65 +#
66 +# - name: Execute Build and Setup Commands
67 +# run: |
68 +# sudo mkdir -p /opt/android
69 +# sudo chown $USER /opt/android
70 +# cd /opt/android
71 +# -y curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
72 +# cargo install cargo-ndk
73 +# git clone https://github.com/cake-tech/cake_wallet.git --branch ${{ env.BRANCH_NAME }}
74 +# cd cake_wallet/scripts/android/
75 +# ./install_ndk.sh
76 +# source ./app_env.sh cakewallet
77 +# chmod +x pubspec_gen.sh
78 +# ./app_config.sh
79 +#
80 +# - name: Cache Externals
81 +# id: cache-externals
82 +# uses: actions/cache@v3
83 +# with:
84 +# path: |
85 +# /opt/android/cake_wallet/cw_haven/android/.cxx
86 +# /opt/android/cake_wallet/scripts/monero_c/release
87 +# key: ${{ hashFiles('**/prepare_moneroc.sh' ,'**/build_monero_all.sh' ,'**/cache_dependencies.yml') }}
88 +#
89 +# - if: ${{ steps.cache-externals.outputs.cache-hit != 'true' }}
90 +# name: Generate Externals
91 +# run: |
92 +# cd /opt/android/cake_wallet/scripts/android/
93 +# source ./app_env.sh cakewallet
94 +# ./build_monero_all.sh
95 +#
96 +# - name: Install Flutter dependencies
97 +# run: |
98 +# cd /opt/android/cake_wallet
99 +# flutter pub get
100 +#
101 +#
102 +# - name: Install go and gomobile
103 +# run: |
104 +# # install go > 1.23:
105 +# wget https://go.dev/dl/go1.23.1.linux-amd64.tar.gz
106 +# sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.23.1.linux-amd64.tar.gz
107 +# export PATH=$PATH:/usr/local/go/bin
108 +# export PATH=$PATH:~/go/bin
109 +# go install golang.org/x/mobile/cmd/gomobile@latest
110 +# gomobile init
111 +#
112 +# - name: Build mwebd
113 +# run: |
114 +# # paths are reset after each step, so we need to set them again:
115 +# export PATH=$PATH:/usr/local/go/bin
116 +# export PATH=$PATH:~/go/bin
117 +# cd /opt/android/cake_wallet/scripts/android/
118 +# ./build_mwebd.sh --dont-install
119 +#
120 +# - name: Generate KeyStore
121 +# run: |
122 +# cd /opt/android/cake_wallet/android/app
123 +# keytool -genkey -v -keystore key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias testKey -noprompt -dname "CN=CakeWallet, OU=CakeWallet, O=CakeWallet, L=Florida, S=America, C=USA" -storepass $STORE_PASS -keypass $KEY_PASS
124 +#
125 +# - name: Generate key properties
126 +# run: |
127 +# cd /opt/android/cake_wallet
128 +# flutter packages pub run tool/generate_android_key_properties.dart keyAlias=testKey storeFile=key.jks storePassword=$STORE_PASS keyPassword=$KEY_PASS
129 +#
130 +# - name: Generate localization
131 +# run: |
132 +# cd /opt/android/cake_wallet
133 +# flutter packages pub run tool/generate_localization.dart
134 +#
135 +# - name: Build generated code
136 +# run: |
137 +# cd /opt/android/cake_wallet
138 +# ./model_generator.sh
139 +#
140 +# - name: Add secrets
141 +# run: |
142 +# cd /opt/android/cake_wallet
143 +# touch lib/.secrets.g.dart
144 +# touch cw_evm/lib/.secrets.g.dart
145 +# touch cw_solana/lib/.secrets.g.dart
146 +# touch cw_core/lib/.secrets.g.dart
147 +# touch cw_nano/lib/.secrets.g.dart
148 +# touch cw_tron/lib/.secrets.g.dart
149 +# echo "const salt = '${{ secrets.SALT }}';" > lib/.secrets.g.dart
150 +# echo "const keychainSalt = '${{ secrets.KEY_CHAIN_SALT }}';" >> lib/.secrets.g.dart
151 +# echo "const key = '${{ secrets.KEY }}';" >> lib/.secrets.g.dart
152 +# echo "const walletSalt = '${{ secrets.WALLET_SALT }}';" >> lib/.secrets.g.dart
153 +# echo "const shortKey = '${{ secrets.SHORT_KEY }}';" >> lib/.secrets.g.dart
154 +# echo "const backupSalt = '${{ secrets.BACKUP_SALT }}';" >> lib/.secrets.g.dart
155 +# echo "const backupKeychainSalt = '${{ secrets.BACKUP_KEY_CHAIN_SALT }}';" >> lib/.secrets.g.dart
156 +# echo "const changeNowApiKey = '${{ secrets.CHANGE_NOW_API_KEY }}';" >> lib/.secrets.g.dart
157 +# echo "const changeNowApiKeyDesktop = '${{ secrets.CHANGE_NOW_API_KEY_DESKTOP }}';" >> lib/.secrets.g.dart
158 +# echo "const wyreSecretKey = '${{ secrets.WYRE_SECRET_KEY }}';" >> lib/.secrets.g.dart
159 +# echo "const wyreApiKey = '${{ secrets.WYRE_API_KEY }}';" >> lib/.secrets.g.dart
160 +# echo "const wyreAccountId = '${{ secrets.WYRE_ACCOUNT_ID }}';" >> lib/.secrets.g.dart
161 +# echo "const moonPayApiKey = '${{ secrets.MOON_PAY_API_KEY }}';" >> lib/.secrets.g.dart
162 +# echo "const moonPaySecretKey = '${{ secrets.MOON_PAY_SECRET_KEY }}';" >> lib/.secrets.g.dart
163 +# echo "const sideShiftAffiliateId = '${{ secrets.SIDE_SHIFT_AFFILIATE_ID }}';" >> lib/.secrets.g.dart
164 +# echo "const simpleSwapApiKey = '${{ secrets.SIMPLE_SWAP_API_KEY }}';" >> lib/.secrets.g.dart
165 +# echo "const simpleSwapApiKeyDesktop = '${{ secrets.SIMPLE_SWAP_API_KEY_DESKTOP }}';" >> lib/.secrets.g.dart
166 +# echo "const onramperApiKey = '${{ secrets.ONRAMPER_API_KEY }}';" >> lib/.secrets.g.dart
167 +# echo "const anypayToken = '${{ secrets.ANY_PAY_TOKEN }}';" >> lib/.secrets.g.dart
168 +# echo "const ioniaClientId = '${{ secrets.IONIA_CLIENT_ID }}';" >> lib/.secrets.g.dart
169 +# echo "const twitterBearerToken = '${{ secrets.TWITTER_BEARER_TOKEN }}';" >> lib/.secrets.g.dart
170 +# echo "const trocadorApiKey = '${{ secrets.TROCADOR_API_KEY }}';" >> lib/.secrets.g.dart
171 +# echo "const trocadorExchangeMarkup = '${{ secrets.TROCADOR_EXCHANGE_MARKUP }}';" >> lib/.secrets.g.dart
172 +# echo "const anonPayReferralCode = '${{ secrets.ANON_PAY_REFERRAL_CODE }}';" >> lib/.secrets.g.dart
173 +# echo "const fiatApiKey = '${{ secrets.FIAT_API_KEY }}';" >> lib/.secrets.g.dart
174 +# echo "const payfuraApiKey = '${{ secrets.PAYFURA_API_KEY }}';" >> lib/.secrets.g.dart
175 +# echo "const ankrApiKey = '${{ secrets.ANKR_API_KEY }}';" >> lib/.secrets.g.dart
176 +# echo "const etherScanApiKey = '${{ secrets.ETHER_SCAN_API_KEY }}';" >> lib/.secrets.g.dart
177 +# echo "const polygonScanApiKey = '${{ secrets.POLYGON_SCAN_API_KEY }}';" >> lib/.secrets.g.dart
178 +# echo "const etherScanApiKey = '${{ secrets.ETHER_SCAN_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
179 +# echo "const moralisApiKey = '${{ secrets.MORALIS_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
180 +# echo "const chatwootWebsiteToken = '${{ secrets.CHATWOOT_WEBSITE_TOKEN }}';" >> lib/.secrets.g.dart
181 +# echo "const exolixApiKey = '${{ secrets.EXOLIX_API_KEY }}';" >> lib/.secrets.g.dart
182 +# echo "const robinhoodApplicationId = '${{ secrets.ROBINHOOD_APPLICATION_ID }}';" >> lib/.secrets.g.dart
183 +# echo "const exchangeHelperApiKey = '${{ secrets.ROBINHOOD_CID_CLIENT_SECRET }}';" >> lib/.secrets.g.dart
184 +# echo "const walletConnectProjectId = '${{ secrets.WALLET_CONNECT_PROJECT_ID }}';" >> lib/.secrets.g.dart
185 +# echo "const moralisApiKey = '${{ secrets.MORALIS_API_KEY }}';" >> lib/.secrets.g.dart
186 +# echo "const polygonScanApiKey = '${{ secrets.POLYGON_SCAN_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
187 +# echo "const ankrApiKey = '${{ secrets.ANKR_API_KEY }}';" >> cw_solana/lib/.secrets.g.dart
188 +# echo "const testCakePayApiKey = '${{ secrets.TEST_CAKE_PAY_API_KEY }}';" >> lib/.secrets.g.dart
189 +# echo "const cakePayApiKey = '${{ secrets.CAKE_PAY_API_KEY }}';" >> lib/.secrets.g.dart
190 +# echo "const authorization = '${{ secrets.CAKE_PAY_AUTHORIZATION }}';" >> lib/.secrets.g.dart
191 +# echo "const CSRFToken = '${{ secrets.CSRF_TOKEN }}';" >> lib/.secrets.g.dart
192 +# echo "const quantexExchangeMarkup = '${{ secrets.QUANTEX_EXCHANGE_MARKUP }}';" >> lib/.secrets.g.dart
193 +# echo "const nano2ApiKey = '${{ secrets.NANO2_API_KEY }}';" >> cw_nano/lib/.secrets.g.dart
194 +# echo "const nanoNowNodesApiKey = '${{ secrets.NANO_NOW_NODES_API_KEY }}';" >> cw_nano/lib/.secrets.g.dart
195 +# echo "const tronGridApiKey = '${{ secrets.TRON_GRID_API_KEY }}';" >> cw_tron/lib/.secrets.g.dart
196 +# echo "const tronNowNodesApiKey = '${{ secrets.TRON_NOW_NODES_API_KEY }}';" >> cw_tron/lib/.secrets.g.dart
197 +# echo "const meldTestApiKey = '${{ secrets.MELD_TEST_API_KEY }}';" >> lib/.secrets.g.dart
198 +# echo "const meldTestPublicKey = '${{ secrets.MELD_TEST_PUBLIC_KEY}}';" >> lib/.secrets.g.dart
199 +# echo "const letsExchangeBearerToken = '${{ secrets.LETS_EXCHANGE_TOKEN }}';" >> lib/.secrets.g.dart
200 +# echo "const letsExchangeAffiliateId = '${{ secrets.LETS_EXCHANGE_AFFILIATE_ID }}';" >> lib/.secrets.g.dart
201 +# echo "const stealthExBearerToken = '${{ secrets.STEALTH_EX_BEARER_TOKEN }}';" >> lib/.secrets.g.dart
202 +# echo "const stealthExAdditionalFeePercent = '${{ secrets.STEALTH_EX_ADDITIONAL_FEE_PERCENT }}';" >> lib/.secrets.g.dart
203 +# echo "const moneroTestWalletSeeds ='${{ secrets.MONERO_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
204 +# echo "const moneroLegacyTestWalletSeeds = '${{ secrets.MONERO_LEGACY_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
205 +# echo "const bitcoinTestWalletSeeds = '${{ secrets.BITCOIN_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
206 +# echo "const ethereumTestWalletSeeds = '${{ secrets.ETHEREUM_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
207 +# echo "const litecoinTestWalletSeeds = '${{ secrets.LITECOIN_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
208 +# echo "const bitcoinCashTestWalletSeeds = '${{ secrets.BITCOIN_CASH_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
209 +# echo "const polygonTestWalletSeeds = '${{ secrets.POLYGON_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
210 +# echo "const solanaTestWalletSeeds = '${{ secrets.SOLANA_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
211 +# echo "const tronTestWalletSeeds = '${{ secrets.TRON_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
212 +# echo "const nanoTestWalletSeeds = '${{ secrets.NANO_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
213 +# echo "const wowneroTestWalletSeeds = '${{ secrets.WOWNERO_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
214 +# echo "const moneroTestWalletReceiveAddress = '${{ secrets.MONERO_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
215 +# echo "const bitcoinTestWalletReceiveAddress = '${{ secrets.BITCOIN_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
216 +# echo "const ethereumTestWalletReceiveAddress = '${{ secrets.ETHEREUM_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
217 +# echo "const litecoinTestWalletReceiveAddress = '${{ secrets.LITECOIN_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
218 +# echo "const bitcoinCashTestWalletReceiveAddress = '${{ secrets.BITCOIN_CASH_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
219 +# echo "const polygonTestWalletReceiveAddress = '${{ secrets.POLYGON_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
220 +# echo "const solanaTestWalletReceiveAddress = '${{ secrets.SOLANA_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
221 +# echo "const tronTestWalletReceiveAddress = '${{ secrets.TRON_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
222 +# echo "const nanoTestWalletReceiveAddress = '${{ secrets.NANO_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
223 +# echo "const wowneroTestWalletReceiveAddress = '${{ secrets.WOWNERO_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
224 +# echo "const moneroTestWalletBlockHeight = '${{ secrets.MONERO_TEST_WALLET_BLOCK_HEIGHT }}';" >> lib/.secrets.g.dart
225 +#
226 +# - name: Rename app
227 +# run: |
228 +# echo -e "id=com.cakewallet.test_${{ env.PR_NUMBER }}\nname=${{ env.BRANCH_NAME }}" > /opt/android/cake_wallet/android/app.properties
229 +#
230 +# - name: Build
231 +# run: |
232 +# cd /opt/android/cake_wallet
233 +# flutter build apk --release --split-per-abi
234 +#
235 +# # - name: Rename apk file
236 +# # run: |
237 +# # cd /opt/android/cake_wallet/build/app/outputs/flutter-apk
238 +# # mkdir test-apk
239 +# # cp app-arm64-v8a-release.apk test-apk/${{env.BRANCH_NAME}}.apk
240 +# # cp app-x86_64-release.apk test-apk/${{env.BRANCH_NAME}}_x86.apk
241 +#
242 +# # - name: Upload Artifact
243 +# # uses: kittaakos/upload-artifact-as-is@v0
244 +# # with:
245 +# # path: /opt/android/cake_wallet/build/app/outputs/flutter-apk/test-apk/
246 +#
247 +# # - name: Send Test APK
248 +# # continue-on-error: true
249 +# # uses: adrey/slack-file-upload-action@1.0.5
250 +# # with:
251 +# # token: ${{ secrets.SLACK_APP_TOKEN }}
252 +# # path: /opt/android/cake_wallet/build/app/outputs/flutter-apk/test-apk/${{env.BRANCH_NAME}}.apk
253 +# # channel: ${{ secrets.SLACK_APK_CHANNEL }}
254 +# # title: "${{ env.BRANCH_NAME }}.apk"
255 +# # filename: ${{ env.BRANCH_NAME }}.apk
256 +# # initial_comment: ${{ github.event.head_commit.message }}
257 +#
258 +# - name: 🦾 Enable KVM
259 +# run: |
260 +# echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
261 +# sudo udevadm control --reload-rules
262 +# sudo udevadm trigger --name-match=kvm
263 +#
264 +# - name: 🦾 Cache gradle
265 +# uses: gradle/actions/setup-gradle@v3
266 +#
267 +# - name: 🦾 Cache AVD
268 +# uses: actions/cache@v4
269 +# id: avd-cache
270 +# with:
271 +# path: |
272 +# ~/.android/avd/*
273 +# ~/.android/adb*
274 +# key: avd-${{ matrix.api-level }}
275 +#
276 +# - name: 🦾 Create AVD and generate snapshot for caching
277 +# if: steps.avd-cache.outputs.cache-hit != 'true'
278 +# uses: reactivecircus/android-emulator-runner@v2
279 +# with:
280 +# api-level: ${{ matrix.api-level }}
281 +# force-avd-creation: false
282 +# # arch: ${{ matrix.arch }}
283 +# emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
284 +# working-directory: /opt/android/cake_wallet
285 +# disable-animations: false
286 +# script: echo "Generated AVD snapshot for caching."
287 +#
288 +# - name: 🚀 Integration tests on Android Emulator
289 +# uses: reactivecircus/android-emulator-runner@v2
290 +# with:
291 +# api-level: ${{ matrix.api-level }}
292 +# force-avd-creation: false
293 +# emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
294 +# disable-animations: true
295 +# working-directory: /opt/android/cake_wallet
296 +# script: |
297 +# chmod a+rx integration_test_runner.sh
298 +# ./integration_test_runner.sh
\ No newline at end of file
.github/workflows/pr_test_build_android.yml
+1 -1
@@ -207,7 +207,7 @@ jobs:
207 echo "const tronGridApiKey = '${{ secrets.TRON_GRID_API_KEY }}';" >> cw_tron/lib/.secrets.g.dart
208 echo "const tronNowNodesApiKey = '${{ secrets.TRON_NOW_NODES_API_KEY }}';" >> cw_tron/lib/.secrets.g.dart
209 echo "const meldTestApiKey = '${{ secrets.MELD_TEST_API_KEY }}';" >> lib/.secrets.g.dart
210 - echo "const meldTestPublicKey = '${{ secrets.MELD_TEST_PUBLIC_KEY}}';" >> lib/.secrets.g.dar
210 + echo "const meldTestPublicKey = '${{ secrets.MELD_TEST_PUBLIC_KEY}}';" >> lib/.secrets.g.dart
211 echo "const letsExchangeBearerToken = '${{ secrets.LETS_EXCHANGE_TOKEN }}';" >> lib/.secrets.g.dart
212 echo "const letsExchangeAffiliateId = '${{ secrets.LETS_EXCHANGE_AFFILIATE_ID }}';" >> lib/.secrets.g.dart
213 echo "const stealthExBearerToken = '${{ secrets.STEALTH_EX_BEARER_TOKEN }}';" >> lib/.secrets.g.dart
cw_bitcoin/lib/electrum_wallet.dart
+1 -1
@@ -1346,7 +1346,7 @@ abstract class ElectrumWalletBase
1346 }
1347
1348 @override
1349 - Future<void> close({required bool shouldCleanup}) async {
1349 + Future<void> close({bool shouldCleanup = false}) async {
1350 try {
1351 await _receiveStream?.cancel();
1352 await electrumClient.close();
cw_bitcoin/lib/litecoin_wallet.dart
+1 -1
@@ -1191,7 +1191,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
1191 }
1192
1193 @override
1194 - Future<void> close({required bool shouldCleanup}) async {
1194 + Future<void> close({bool shouldCleanup = false}) async {
1195 _utxoStream?.cancel();
1196 _feeRatesTimer?.cancel();
1197 _syncTimer?.cancel();
cw_core/lib/wallet_base.dart
+1 -1
@@ -83,7 +83,7 @@ abstract class WalletBase<BalanceType extends Balance, HistoryType extends Trans
83
84 Future<void> rescan({required int height});
85
86 - Future<void> close({required bool shouldCleanup});
86 + Future<void> close({bool shouldCleanup = false});
87
88 Future<void> changePassword(String password);
89
cw_evm/lib/evm_chain_wallet.dart
+1 -1
@@ -270,7 +270,7 @@ abstract class EVMChainWalletBase
270 }
271
272 @override
273 - Future<void> close({required bool shouldCleanup}) async {
273 + Future<void> close({bool shouldCleanup = false}) async {
274 _client.stop();
275 _transactionsUpdateTimer?.cancel();
276 _updateFeesTimer?.cancel();
cw_haven/lib/haven_wallet.dart
+1 -1
@@ -108,7 +108,7 @@ abstract class HavenWalletBase
108 Future<void>? updateBalance() => null;
109
110 @override
111 - Future<void> close({required bool shouldCleanup}) async {
111 + Future<void> close({bool shouldCleanup = false}) async {
112 _listener?.stop();
113 _onAccountChangeReaction?.reaction.dispose();
114 _autoSaveTimer?.cancel();
cw_monero/lib/monero_wallet.dart
+1 -1
@@ -175,7 +175,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
175 Future<void>? updateBalance() => null;
176
177 @override
178 - Future<void> close({required bool shouldCleanup}) async {
178 + Future<void> close({bool shouldCleanup = false}) async {
179 _listener?.stop();
180 _onAccountChangeReaction?.reaction.dispose();
181 _onTxHistoryChangeReaction?.reaction.dispose();
cw_nano/lib/nano_wallet.dart
+1 -1
@@ -150,7 +150,7 @@ abstract class NanoWalletBase
150 Future<void> changePassword(String password) => throw UnimplementedError("changePassword");
151
152 @override
153 - Future<void> close({required bool shouldCleanup}) async {
153 + Future<void> close({bool shouldCleanup = false}) async {
154 _client.stop();
155 _receiveTimer?.cancel();
156 }
cw_solana/lib/solana_wallet.dart
+1 -1
@@ -180,7 +180,7 @@ abstract class SolanaWalletBase
180 Future<void> changePassword(String password) => throw UnimplementedError("changePassword");
181
182 @override
183 - Future<void> close({required bool shouldCleanup}) async {
183 + Future<void> close({bool shouldCleanup = false}) async {
184 _client.stop();
185 _transactionsUpdateTimer?.cancel();
186 }
cw_tron/lib/tron_wallet.dart
+1 -1
@@ -217,7 +217,7 @@ abstract class TronWalletBase
217 Future<void> changePassword(String password) => throw UnimplementedError("changePassword");
218
219 @override
220 - Future<void> close({required bool shouldCleanup}) async => _transactionsUpdateTimer?.cancel();
220 + Future<void> close({bool shouldCleanup = false}) async => _transactionsUpdateTimer?.cancel();
221
222 @action
223 @override
cw_wownero/lib/wownero_wallet.dart
+1 -1
@@ -162,7 +162,7 @@ abstract class WowneroWalletBase
162 Future<void>? updateBalance() => null;
163
164 @override
165 - Future<void> close({required bool shouldCleanup}) async {
165 + Future<void> close({bool shouldCleanup = false}) async {
166 _listener?.stop();
167 _onAccountChangeReaction?.reaction.dispose();
168 _onTxHistoryChangeReaction?.reaction.dispose();
integration_test/components/common_test_constants.dart
+3 -3
@@ -4,10 +4,10 @@ import 'package:cw_core/wallet_type.dart';
4 class CommonTestConstants {
5 static final pin = [0, 8, 0, 1];
6 static final String sendTestAmount = '0.00008';
7 - static final String exchangeTestAmount = '8';
7 + static final String exchangeTestAmount = '0.01';
8 static final WalletType testWalletType = WalletType.solana;
9 static final String testWalletName = 'Integrated Testing Wallet';
10 - static final CryptoCurrency testReceiveCurrency = CryptoCurrency.sol;
11 - static final CryptoCurrency testDepositCurrency = CryptoCurrency.usdtSol;
10 + static final CryptoCurrency testReceiveCurrency = CryptoCurrency.usdtSol;
11 + static final CryptoCurrency testDepositCurrency = CryptoCurrency.sol;
12 static final String testWalletAddress = '5v9gTW1yWPffhnbNKuvtL2frevAf4HpBMw8oYnfqUjhm';
13 }
integration_test/components/common_test_flows.dart
+10 -3
@@ -7,6 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
7
8 import 'package:cake_wallet/main.dart' as app;
9
10 +import '../robots/create_pin_welcome_page_robot.dart';
11 import '../robots/dashboard_page_robot.dart';
12 import '../robots/disclaimer_page_robot.dart';
13 import '../robots/new_wallet_page_robot.dart';
@@ -37,6 +38,7 @@ class CommonTestFlows {
38 _walletListPageRobot = WalletListPageRobot(_tester),
39 _newWalletTypePageRobot = NewWalletTypePageRobot(_tester),
40 _restoreOptionsPageRobot = RestoreOptionsPageRobot(_tester),
41 + _createPinWelcomePageRobot = CreatePinWelcomePageRobot(_tester),
42 _restoreFromSeedOrKeysPageRobot = RestoreFromSeedOrKeysPageRobot(_tester),
43 _walletGroupDescriptionPageRobot = WalletGroupDescriptionPageRobot(_tester);
44
@@ -53,6 +55,7 @@ class CommonTestFlows {
55 final WalletListPageRobot _walletListPageRobot;
56 final NewWalletTypePageRobot _newWalletTypePageRobot;
57 final RestoreOptionsPageRobot _restoreOptionsPageRobot;
58 + final CreatePinWelcomePageRobot _createPinWelcomePageRobot;
59 final RestoreFromSeedOrKeysPageRobot _restoreFromSeedOrKeysPageRobot;
60 final WalletGroupDescriptionPageRobot _walletGroupDescriptionPageRobot;
61
@@ -190,10 +193,12 @@ class CommonTestFlows {
193 WalletType walletTypeToCreate,
194 List<int> pin,
195 ) async {
193 - await _welcomePageRobot.navigateToCreateNewWalletPage();
196 + await _createPinWelcomePageRobot.tapSetAPinButton();
197
198 await setupPinCodeForWallet(pin);
199
200 + await _welcomePageRobot.navigateToCreateNewWalletPage();
201 +
202 await _selectWalletTypeForWallet(walletTypeToCreate);
203 }
204
@@ -201,12 +206,14 @@ class CommonTestFlows {
206 WalletType walletTypeToRestore,
207 List<int> pin,
208 ) async {
209 + await _createPinWelcomePageRobot.tapSetAPinButton();
210 +
211 + await setupPinCodeForWallet(pin);
212 +
213 await _welcomePageRobot.navigateToRestoreWalletPage();
214
215 await _restoreOptionsPageRobot.navigateToRestoreFromSeedsOrKeysPage();
216
208 - await setupPinCodeForWallet(pin);
209 -
217 await _selectWalletTypeForWallet(walletTypeToRestore);
218 }
219
integration_test/robots/create_pin_welcome_page_robot.dart new
+53
@@ -0,0 +1,53 @@
1 +import 'package:cake_wallet/generated/i18n.dart';
2 +import 'package:cake_wallet/src/screens/welcome/create_pin_welcome_page.dart';
3 +import 'package:cake_wallet/wallet_type_utils.dart';
4 +import 'package:flutter_test/flutter_test.dart';
5 +
6 +import '../components/common_test_cases.dart';
7 +
8 +class CreatePinWelcomePageRobot {
9 + CreatePinWelcomePageRobot(this.tester) : commonTestCases = CommonTestCases(tester);
10 +
11 + final WidgetTester tester;
12 + late CommonTestCases commonTestCases;
13 +
14 + Future<void> isCreatePinWelcomePage() async {
15 + await commonTestCases.isSpecificPage<CreatePinWelcomePage>();
16 + }
17 +
18 + void hasTitle() {
19 + String title;
20 + if (isMoneroOnly) {
21 + title = S.current.monero_com;
22 + }
23 +
24 + if (isHaven) {
25 + title = S.current.haven_app;
26 + }
27 +
28 + title = S.current.cake_wallet;
29 +
30 + commonTestCases.hasText(title);
31 + }
32 +
33 + void hasDescription() {
34 + String description;
35 + if (isMoneroOnly) {
36 + description = S.current.monero_com_wallet_text;
37 + }
38 +
39 + if (isHaven) {
40 + description = S.current.haven_app_wallet_text;
41 + }
42 +
43 + description = S.current.new_first_wallet_text;
44 +
45 + commonTestCases.hasText(description);
46 + }
47 +
48 + Future<void> tapSetAPinButton() async {
49 + await commonTestCases.tapItemByKey('create_pin_welcome_page_create_a_pin_button_key');
50 +
51 + await commonTestCases.defaultSleepTime();
52 + }
53 +}
integration_test/robots/exchange_page_robot.dart
+5 -9
@@ -123,10 +123,8 @@ class ExchangePageRobot {
123 return;
124 }
125
126 - await commonTestCases.dragUntilVisible(
127 - 'picker_items_index_${depositCurrency.name}_button_key',
128 - 'picker_scrollbar_key',
129 - );
126 + await commonTestCases.enterText(depositCurrency.name, 'search_bar_widget_key');
127 +
128 await commonTestCases.defaultSleepTime();
129
130 await commonTestCases.tapItemByKey('picker_items_index_${depositCurrency.name}_button_key');
@@ -149,10 +147,8 @@ class ExchangePageRobot {
147 return;
148 }
149
152 - await commonTestCases.dragUntilVisible(
153 - 'picker_items_index_${receiveCurrency.name}_button_key',
154 - 'picker_scrollbar_key',
155 - );
150 + await commonTestCases.enterText(receiveCurrency.name, 'search_bar_widget_key');
151 +
152 await commonTestCases.defaultSleepTime();
153
154 await commonTestCases.tapItemByKey('picker_items_index_${receiveCurrency.name}_button_key');
@@ -318,7 +314,7 @@ class ExchangePageRobot {
314
315 Future<void> handleErrors(String initialAmount) async {
316 await tester.pumpAndSettle();
321 -
317 +
318 await _handleMinLimitError(initialAmount);
319
320 await _handleMaxLimitError(initialAmount);
integration_test/robots/send_page_robot.dart
+5 -6
@@ -84,13 +84,11 @@ class SendPageRobot {
84 return;
85 }
86
87 - await commonTestCases.dragUntilVisible(
88 - 'picker_items_index_${receiveCurrency.name}_button_key',
89 - 'picker_scrollbar_key',
90 - );
87 + await commonTestCases.enterText(receiveCurrency.title, 'search_bar_widget_key');
88 +
89 await commonTestCases.defaultSleepTime();
90
93 - await commonTestCases.tapItemByKey('picker_items_index_${receiveCurrency.name}_button_key');
91 + await commonTestCases.tapItemByKey('picker_items_index_${receiveCurrency.fullName}_button_key');
92 }
93
94 Future<void> enterReceiveAddress(String receiveAddress) async {
@@ -210,6 +208,7 @@ class SendPageRobot {
208 _handleAuthPage();
209 }
210 }
211 + await tester.pump();
212 }
213
214 Future<void> handleSendResult() async {
@@ -366,4 +365,4 @@ class SendPageRobot {
365 Future<void> _onIgnoreButtonOnSentDialogPressed() async {
366 await commonTestCases.tapItemByKey('send_page_sent_dialog_ignore_button_key');
367 }
369 -}
\ No newline at end of file
368 +}
integration_test/robots/wallet_keys_robot.dart
+13 -5
@@ -42,11 +42,11 @@ class WalletKeysAndSeedPageRobot {
42 bool hasPrivateKey = appStore.wallet!.privateKey != null;
43
44 if (walletType == WalletType.monero) {
45 - final moneroWallet = appStore.wallet as MoneroWallet;
45 + final moneroWallet = appStore.wallet as MoneroWalletBase;
46 final lang = PolyseedLang.getByPhrase(moneroWallet.seed);
47 final legacySeed = moneroWallet.seedLegacy(lang.nameEnglish);
48
49 - _confirmMoneroWalletCredentials(
49 + await _confirmMoneroWalletCredentials(
50 appStore,
51 walletName,
52 moneroWallet.seed,
@@ -59,7 +59,7 @@ class WalletKeysAndSeedPageRobot {
59 final lang = PolyseedLang.getByPhrase(wowneroWallet.seed);
60 final legacySeed = wowneroWallet.seedLegacy(lang.nameEnglish);
61
62 - _confirmMoneroWalletCredentials(
62 + await _confirmMoneroWalletCredentials(
63 appStore,
64 walletName,
65 wowneroWallet.seed,
@@ -105,12 +105,12 @@ class WalletKeysAndSeedPageRobot {
105 await commonTestCases.defaultSleepTime(seconds: 5);
106 }
107
108 - void _confirmMoneroWalletCredentials(
108 + Future<void> _confirmMoneroWalletCredentials(
109 AppStore appStore,
110 String walletName,
111 String seed,
112 String legacySeed,
113 - ) {
113 + ) async {
114 final keys = appStore.wallet!.keys as MoneroWalletKeys;
115
116 final hasPublicSpendKey = commonTestCases.isKeyPresent(
@@ -145,10 +145,18 @@ class WalletKeysAndSeedPageRobot {
145 tester.printToConsole('$walletName wallet has private view key properly displayed');
146 }
147 if (hasSeeds) {
148 + await commonTestCases.dragUntilVisible(
149 + '${walletName}_wallet_seed_item_key',
150 + 'wallet_keys_page_credentials_list_view_key',
151 + );
152 commonTestCases.hasText(seed);
153 tester.printToConsole('$walletName wallet has seeds properly displayed');
154 }
155 if (hasSeedLegacy) {
156 + await commonTestCases.dragUntilVisible(
157 + '${walletName}_wallet_seed_legacy_item_key',
158 + 'wallet_keys_page_credentials_list_view_key',
159 + );
160 commonTestCases.hasText(legacySeed);
161 tester.printToConsole('$walletName wallet has legacy seeds properly displayed');
162 }
integration_test/test_suites/confirm_seeds_flow_test.dart
+1 -1
@@ -101,7 +101,7 @@ Future<void> _confirmSeedsFlowForWalletType(
101 walletKeysAndSeedPageRobot.hasTitle();
102 walletKeysAndSeedPageRobot.hasShareWarning();
103
104 - walletKeysAndSeedPageRobot.confirmWalletCredentials(walletType);
104 + await walletKeysAndSeedPageRobot.confirmWalletCredentials(walletType);
105
106 await walletKeysAndSeedPageRobot.backToDashboard();
107 }
integration_test_runner.sh new
+45
@@ -0,0 +1,45 @@
1 +#!/bin/bash
2 +
3 +declare -a targets
4 +declare -a passed_tests
5 +declare -a failed_tests
6 +
7 +# Collect all Dart test files in the integration_test directory
8 +while IFS= read -r -d $'\0' file; do
9 + targets+=("$file")
10 +done < <(find integration_test/test_suites -name "*.dart" -type f -print0)
11 +
12 +# Run each test and collect results
13 +for target in "${targets[@]}"
14 +do
15 + echo "Running test: $target"
16 + if flutter drive \
17 + --driver=test_driver/integration_test.dart \
18 + --target="$target"; then
19 + echo "✅ Test passed: $target"
20 + passed_tests+=("$target")
21 + else
22 + echo "❌ Test failed: $target"
23 + failed_tests+=("$target")
24 + fi
25 +done
26 +
27 +# Provide a summary of test results
28 +echo -e "\n===== Test Summary ====="
29 +if [ ${#passed_tests[@]} -gt 0 ]; then
30 + echo "✅ Passed Tests:"
31 + for test in "${passed_tests[@]}"; do
32 + echo " - $test"
33 + done
34 +fi
35 +
36 +if [ ${#failed_tests[@]} -gt 0 ]; then
37 + echo -e "\n❌ Failed Tests:"
38 + for test in "${failed_tests[@]}"; do
39 + echo " - $test"
40 + done
41 + # Exit with a non-zero status to indicate failure
42 + exit 1
43 +else
44 + echo -e "\n🎉 All tests passed successfully!"
45 +fi
lib/src/screens/wallet_keys/wallet_keys_page.dart
+1
@@ -84,6 +84,7 @@ class WalletKeysPage extends BasePage {
84 child: Observer(
85 builder: (_) {
86 return ListView.separated(
87 + key: ValueKey('wallet_keys_page_credentials_list_view_key'),
88 separatorBuilder: (context, index) => Container(
89 height: 1,
90 padding: EdgeInsets.only(left: 24),
lib/src/widgets/search_bar_widget.dart
+1
@@ -17,6 +17,7 @@ class SearchBarWidget extends StatelessWidget {
17 @override
18 Widget build(BuildContext context) {
19 return TextFormField(
20 + key: ValueKey('search_bar_widget_key'),
21 controller: searchController,
22 style: TextStyle(color: Theme.of(context).extension<PickerTheme>()!.searchHintColor),
23 decoration: InputDecoration(