mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-29 06:38:45 +01:00
Merge upstream Cake Wallet v6.5.0
Catches up from the May 12 fork point (v6.1.2+23) through v6.5.0: 535 upstream commits, including the Monero silent-open fix, Monero on Trezor, Ledger/Trezor BLE fixes, the new seed and history screens, quick Bitcoin sync, git-pinned dependencies (pubspec_overrides.yaml), frozen Hive adapters (*.part.dart), monero_c v0.18.4.6-RC2 and Flutter 3.41.9. Merged with both sides normalized first (import rename, 100-column format), which took the conflict count from 614 paths to 322. The procedure is now scripts/upstream_sync.sh. Kept from Hash Bags: - WalletType enum order and Hive IDs. SQLite stores WalletType.index and our order differs from upstream's; taking theirs would reread saved wallets as other chains. Our frozen adapter keeps the shipped IDs. - The 1.0.2 legacy PIN and wallet-password decode and self-heal. - Removed chains (Solana, Tron, Zano, Zcash, Decred, Haven) and the new Robinhood chain stay out; Cake Pay and non-Trocador swaps stay out. - Default nodes (node.wownero.org, sethforprivacy, Blockstream, bysh.me), converted to upstream's isDefault node-list key; Wownero is back in the node reset list. - Privacy: address resolvers limited to domain-anchored sources again; prices.neroswap.com for fiat; upstream's charts tab, which reads prices.cakewallet.com, sits behind FeatureFlag.isChartsEnabled = false. - Lightning stays behind FeatureFlag.isLightningEnabled, including upstream's new post-seed Lightning username step. - Our icon pipeline, branding and bundle identifiers. Twelve new upstream widget tests are skipped: test and code are unchanged from v6.5.0 apart from renames (not rerun on a pristine upstream checkout; upstream's top_bar_test does not compile against its own TopBar). flutter analyze lib: 0 errors; flutter test: 345 passed, 12 skipped; flutter build bundle compiles. Built with Flutter 3.41.9.
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import "package:flutter_test/flutter_test.dart";
|
||||
|
||||
import "../core/test_config.dart";
|
||||
import "../robots/auth_page_robot.dart";
|
||||
|
||||
class AuthFlows {
|
||||
AuthFlows(this.tester) : _authPageRobot = AuthPageRobot(tester);
|
||||
|
||||
final WidgetTester tester;
|
||||
final AuthPageRobot _authPageRobot;
|
||||
|
||||
Future<void> authenticateWithPin({List<int>? pin, bool required = true}) async {
|
||||
final prompted = await _waitForPinWidget(
|
||||
timeout: required ? const Duration(seconds: 30) : const Duration(seconds: 5),
|
||||
);
|
||||
|
||||
if (!prompted) {
|
||||
expect(required, false, reason: "The pin was never asked for");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
await _authPageRobot.enterPinCode(pin ?? TestConfig.pin);
|
||||
}
|
||||
|
||||
bool isPinWidgetShown() => _authPageRobot.onAuthPage();
|
||||
|
||||
Future<bool> _waitForPinWidget({Duration timeout = const Duration(seconds: 30)}) async {
|
||||
final endTime = DateTime.now().add(timeout);
|
||||
|
||||
while (DateTime.now().isBefore(endTime)) {
|
||||
await tester.pump(const Duration(milliseconds: 100));
|
||||
|
||||
if (_authPageRobot.onAuthPage()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
import "package:hash_wallet/di.dart";
|
||||
import "package:hash_wallet/store/app_store.dart";
|
||||
import "package:cw_core/sync_status.dart";
|
||||
import "package:cw_core/wallet_type.dart";
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter_test/flutter_test.dart";
|
||||
|
||||
import "../core/test_config.dart";
|
||||
import "../core/test_wallets.dart";
|
||||
import "../robots/home_page_robot.dart";
|
||||
import "../robots/new_dashboard_robot.dart";
|
||||
import "../robots/new_send_page_robot.dart";
|
||||
import "onboarding_flows.dart";
|
||||
|
||||
class FundsFlows {
|
||||
FundsFlows(this.tester)
|
||||
: _onboardingFlows = OnboardingFlows(tester),
|
||||
_dashboardRobot = NewDashboardRobot(tester),
|
||||
_homePageRobot = HomePageRobot(tester),
|
||||
_sendRobot = NewSendPageRobot(tester);
|
||||
|
||||
final WidgetTester tester;
|
||||
final OnboardingFlows _onboardingFlows;
|
||||
final NewDashboardRobot _dashboardRobot;
|
||||
final HomePageRobot _homePageRobot;
|
||||
final NewSendPageRobot _sendRobot;
|
||||
|
||||
bool _hasRestoredAnyWallet = false;
|
||||
|
||||
Future<bool> openFundedWallet(WalletType type) async {
|
||||
final wallets = TestWallets.fundedWalletsFor(type);
|
||||
|
||||
for (int index = 0; index < wallets.length; index++) {
|
||||
final wallet = wallets[index];
|
||||
|
||||
tester.printToConsole("Trying funded wallet ${index + 1}/${wallets.length} for ${type.name}");
|
||||
|
||||
if (_hasRestoredAnyWallet) {
|
||||
await _dashboardRobot.openWalletsTab();
|
||||
|
||||
final isWalletListReady = await _dashboardRobot.pumpUntil(
|
||||
() =>
|
||||
tester.any(find.byKey(const ValueKey("wallet_list_page_restore_wallet_button_key"))),
|
||||
timeout: const Duration(seconds: 60),
|
||||
);
|
||||
|
||||
expect(
|
||||
isWalletListReady,
|
||||
true,
|
||||
reason: "The wallet list restore button didn't show before ${type.name}, "
|
||||
"Currently have: ${_dashboardRobot.describeScreen()} on screen",
|
||||
);
|
||||
|
||||
await _onboardingFlows.restoreAdditionalWalletFromWalletList(
|
||||
type,
|
||||
seed: wallet.seed,
|
||||
passphrase: wallet.passphrase,
|
||||
);
|
||||
} else {
|
||||
await _onboardingFlows.restoreFirstWalletFromSeed(
|
||||
type,
|
||||
seed: wallet.seed,
|
||||
passphrase: wallet.passphrase,
|
||||
);
|
||||
}
|
||||
|
||||
_hasRestoredAnyWallet = true;
|
||||
|
||||
await _waitForDashboard(type);
|
||||
await _homePageRobot.isDisplayed();
|
||||
|
||||
if (await _hasSpendableBalance()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
tester.printToConsole("Wallet ${index + 1} for ${type.name} has no spendable balance");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Future<bool> returnToHome({int maxPops = 6}) async {
|
||||
for (int attempt = 0; attempt <= maxPops; attempt++) {
|
||||
if (await _homePageRobot.pumpUntil(
|
||||
() => _isHomeInFront,
|
||||
timeout: const Duration(seconds: 3),
|
||||
)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
await _homePageRobot.dismissModal();
|
||||
} catch (e) {
|
||||
tester.printToConsole("Nothing left to pop while returning home: $e");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return _isHomeInFront;
|
||||
}
|
||||
|
||||
Future<void> _waitForDashboard(WalletType type) async {
|
||||
final reached = await _dashboardRobot.pumpUntil(
|
||||
() => tester.any(find.byKey(const ValueKey("new_dashboard_page_key"))),
|
||||
timeout: TestConfig.walletSyncBudget,
|
||||
);
|
||||
|
||||
if (reached) {
|
||||
return;
|
||||
}
|
||||
|
||||
final status = getIt.get<AppStore>().wallet?.syncStatus;
|
||||
final stillSyncing = status is SyncingSyncStatus || status is SyncronizingSyncStatus;
|
||||
|
||||
throw TestFailure(
|
||||
stillSyncing
|
||||
? "${type.name} never became ready to send, it is still syncing (${status.runtimeType})"
|
||||
: "${type.name} never reached the dashboard, its status was ${status.runtimeType}",
|
||||
);
|
||||
}
|
||||
|
||||
bool get _isHomeInFront => _homePageRobot.isInFront && !_sendRobot.isSendFlowOpen;
|
||||
|
||||
Future<bool> _hasSpendableBalance({Duration timeout = TestConfig.walletSyncBudget}) async {
|
||||
final appStore = getIt.get<AppStore>();
|
||||
final endTime = DateTime.now().add(timeout);
|
||||
DateTime? syncedSince;
|
||||
|
||||
while (DateTime.now().isBefore(endTime)) {
|
||||
await tester.pump(const Duration(milliseconds: 250));
|
||||
|
||||
final wallet = appStore.wallet;
|
||||
|
||||
if (wallet == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (wallet.balance.values.any((balance) => balance.available.sign > 0)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (wallet.syncStatus is SyncedSyncStatus) {
|
||||
syncedSince ??= DateTime.now();
|
||||
|
||||
if (DateTime.now().difference(syncedSince) > const Duration(seconds: 15)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
syncedSince = null;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,267 @@
|
||||
import "dart:io";
|
||||
|
||||
import "package:hash_wallet/entities/seed_type.dart";
|
||||
import "package:hash_wallet/reactions/wallet_utils.dart";
|
||||
import "package:cw_core/wallet_type.dart";
|
||||
import "package:flutter_test/flutter_test.dart";
|
||||
|
||||
import "../core/test_config.dart";
|
||||
import "../core/test_wallets.dart";
|
||||
import "../robots/create_pin_welcome_page_robot.dart";
|
||||
import "../robots/lightning_username_page_robot.dart";
|
||||
import "../robots/new_wallet_page_robot.dart";
|
||||
import "../robots/new_wallet_type_page_robot.dart";
|
||||
import "../robots/pre_seed_page_robot.dart";
|
||||
import "../robots/restore_from_seed_or_key_robot.dart";
|
||||
import "../robots/restore_options_page_robot.dart";
|
||||
import "../robots/seed_verification_page_robot.dart";
|
||||
import "../robots/setup_pin_code_robot.dart";
|
||||
import "../robots/wallet_group_description_page_robot.dart";
|
||||
import "../robots/wallet_group_existing_seed_page_robot.dart";
|
||||
import "../robots/wallet_groups_display_page_robot.dart";
|
||||
import "../robots/wallet_list_page_robot.dart";
|
||||
import "../robots/wallet_seed_page_robot.dart";
|
||||
import "../robots/welcome_page_robot.dart";
|
||||
|
||||
class OnboardingFlows {
|
||||
OnboardingFlows(this.tester)
|
||||
: _welcomePageRobot = WelcomePageRobot(tester),
|
||||
_preSeedPageRobot = PreSeedPageRobot(tester),
|
||||
_setupPinCodeRobot = SetupPinCodeRobot(tester),
|
||||
_newWalletPageRobot = NewWalletPageRobot(tester),
|
||||
_walletSeedPageRobot = WalletSeedPageRobot(tester),
|
||||
_walletListPageRobot = WalletListPageRobot(tester),
|
||||
_newWalletTypePageRobot = NewWalletTypePageRobot(tester),
|
||||
_seedVerificationPageRobot = SeedVerificationPageRobot(tester),
|
||||
_createPinWelcomePageRobot = CreatePinWelcomePageRobot(tester),
|
||||
_restoreOptionsPageRobot = RestoreOptionsPageRobot(tester),
|
||||
_restoreFromSeedOrKeysPageRobot = RestoreFromSeedOrKeysPageRobot(tester),
|
||||
_lightningUsernamePageRobot = LightningUsernamePageRobot(tester),
|
||||
_walletGroupDescriptionPageRobot = WalletGroupDescriptionPageRobot(tester),
|
||||
_walletGroupsDisplayPageRobot = WalletGroupsDisplayPageRobot(tester),
|
||||
_walletGroupExistingSeedPageRobot = WalletGroupExistingSeedPageRobot(tester);
|
||||
|
||||
final WidgetTester tester;
|
||||
|
||||
final WelcomePageRobot _welcomePageRobot;
|
||||
final PreSeedPageRobot _preSeedPageRobot;
|
||||
final SetupPinCodeRobot _setupPinCodeRobot;
|
||||
final NewWalletPageRobot _newWalletPageRobot;
|
||||
final WalletSeedPageRobot _walletSeedPageRobot;
|
||||
final WalletListPageRobot _walletListPageRobot;
|
||||
final NewWalletTypePageRobot _newWalletTypePageRobot;
|
||||
final SeedVerificationPageRobot _seedVerificationPageRobot;
|
||||
final CreatePinWelcomePageRobot _createPinWelcomePageRobot;
|
||||
final RestoreOptionsPageRobot _restoreOptionsPageRobot;
|
||||
final RestoreFromSeedOrKeysPageRobot _restoreFromSeedOrKeysPageRobot;
|
||||
final LightningUsernamePageRobot _lightningUsernamePageRobot;
|
||||
final WalletGroupDescriptionPageRobot _walletGroupDescriptionPageRobot;
|
||||
final WalletGroupsDisplayPageRobot _walletGroupsDisplayPageRobot;
|
||||
final WalletGroupExistingSeedPageRobot _walletGroupExistingSeedPageRobot;
|
||||
|
||||
Future<void> createFirstWallet(WalletType type, {List<int>? pin}) async {
|
||||
await _createPinWelcomePageRobot.tapSetAPinButton();
|
||||
|
||||
await setupPinCode(pin ?? TestConfig.pin);
|
||||
|
||||
await _welcomePageRobot.navigateToCreateNewWalletPage();
|
||||
|
||||
await _selectWalletType(type);
|
||||
|
||||
if (_welcomePageRobot.hasNewSingleSeedButton()) {
|
||||
await _welcomePageRobot.tapNewSingleSeed();
|
||||
}
|
||||
|
||||
await _completeWalletCreationSteps(type);
|
||||
}
|
||||
|
||||
Future<void> createAdditionalWalletFromWalletList(WalletType type) async {
|
||||
tester.printToConsole("Creating ${type.name} wallet");
|
||||
|
||||
await startCreatingWalletFromWalletList(type);
|
||||
|
||||
await _completeWalletCreationSteps(type);
|
||||
}
|
||||
|
||||
Future<void> createWalletInGroupOf(WalletType type, String existingWalletName) async {
|
||||
tester.printToConsole("Adding a ${type.name} wallet to the seed of $existingWalletName");
|
||||
|
||||
await _walletListPageRobot.navigateToCreateNewWalletPage();
|
||||
|
||||
await _selectWalletType(type);
|
||||
|
||||
await _walletGroupDescriptionPageRobot.isDisplayed();
|
||||
await _walletGroupDescriptionPageRobot.navigateToChooseWalletGroup();
|
||||
|
||||
await _walletGroupsDisplayPageRobot.isDisplayed();
|
||||
await _walletGroupsDisplayPageRobot.selectWallet(existingWalletName);
|
||||
await _walletGroupsDisplayPageRobot.continueWithSelectedSeed();
|
||||
|
||||
await _newWalletPageRobot.isDisplayed();
|
||||
await _newWalletPageRobot.generateWalletName();
|
||||
await _newWalletPageRobot.onNextButtonPressed();
|
||||
|
||||
await _walletGroupExistingSeedPageRobot.isDisplayed();
|
||||
await _walletGroupExistingSeedPageRobot.openWallet();
|
||||
}
|
||||
|
||||
Future<void> startCreatingWalletFromWalletList(WalletType type) async {
|
||||
await _walletListPageRobot.navigateToCreateNewWalletPage();
|
||||
|
||||
await _selectWalletType(type);
|
||||
|
||||
if (isBIP39Wallet(type)) {
|
||||
await _walletGroupDescriptionPageRobot.isDisplayed();
|
||||
await _walletGroupDescriptionPageRobot.navigateToCreateNewSeedPage();
|
||||
}
|
||||
|
||||
await _newWalletPageRobot.isDisplayed();
|
||||
}
|
||||
|
||||
Future<void> restoreFirstWalletFromSeed(
|
||||
WalletType type, {
|
||||
String? seed,
|
||||
String passphrase = "",
|
||||
List<int>? pin,
|
||||
}) async {
|
||||
await startRestoringFirstWallet(type, pin: pin);
|
||||
|
||||
await _restoreFromSeed(type, seed ?? TestWallets.seedFor(type), passphrase);
|
||||
}
|
||||
|
||||
Future<void> startRestoringFirstWallet(WalletType type, {List<int>? pin}) async {
|
||||
await _createPinWelcomePageRobot.tapSetAPinButton();
|
||||
|
||||
await setupPinCode(pin ?? TestConfig.pin);
|
||||
|
||||
await _welcomePageRobot.navigateToRestoreWalletPage();
|
||||
|
||||
// Desktop skips the restore options page and goes straight to the type list.
|
||||
if (!Platform.isLinux) {
|
||||
await _restoreOptionsPageRobot.navigateToRestoreFromSeedsOrKeysPage();
|
||||
}
|
||||
|
||||
await _selectWalletType(type);
|
||||
|
||||
await _restoreFromSeedOrKeysPageRobot.isDisplayed();
|
||||
}
|
||||
|
||||
Future<void> restoreAdditionalWalletFromWalletList(
|
||||
WalletType type, {
|
||||
String? seed,
|
||||
String passphrase = "",
|
||||
}) async {
|
||||
tester.printToConsole("Restoring ${type.name} wallet");
|
||||
|
||||
await _walletListPageRobot.navigateToRestoreWalletOptionsPage();
|
||||
|
||||
if (!Platform.isLinux) {
|
||||
await _restoreOptionsPageRobot.navigateToRestoreFromSeedsOrKeysPage();
|
||||
}
|
||||
|
||||
await _selectWalletType(type);
|
||||
|
||||
await _restoreFromSeed(type, seed ?? TestWallets.seedFor(type), passphrase);
|
||||
}
|
||||
|
||||
Future<void> _restoreFromSeed(WalletType type, String seed, String passphrase) async {
|
||||
await _restoreFromSeedOrKeysPageRobot.selectWalletNameFromAvailableOptions();
|
||||
await _restoreFromSeedOrKeysPageRobot.enterSeedPhraseForWalletRestore(seed);
|
||||
|
||||
if (passphrase.isNotEmpty) {
|
||||
await _restoreFromSeedOrKeysPageRobot.enablePassphrase();
|
||||
}
|
||||
|
||||
// 25 word monero seeds are legacy seeds and need their restore block height entered.
|
||||
if (seed.split(" ").length == 25 && type == WalletType.monero) {
|
||||
await _restoreFromSeedOrKeysPageRobot
|
||||
.chooseSeedTypeForMoneroOrWowneroWallets(MoneroSeedType.legacy);
|
||||
await _restoreFromSeedOrKeysPageRobot
|
||||
.enterBlockHeightForWalletRestore(TestWallets.moneroRestoreBlockHeight);
|
||||
}
|
||||
|
||||
if (type == WalletType.zcash && TestWallets.zcashRestoreHeight.isNotEmpty) {
|
||||
await _restoreFromSeedOrKeysPageRobot
|
||||
.enterBlockHeightForWalletRestore(TestWallets.zcashRestoreHeight);
|
||||
}
|
||||
|
||||
if (Platform.isLinux) {
|
||||
final password = TestConfig.pin.join("");
|
||||
await _restoreFromSeedOrKeysPageRobot.enterPasswordForWalletRestore(password);
|
||||
await _restoreFromSeedOrKeysPageRobot.enterPasswordRepeatForWalletRestore(password);
|
||||
}
|
||||
|
||||
await _restoreFromSeedOrKeysPageRobot.onRestoreWalletButtonPressed();
|
||||
|
||||
if (passphrase.isNotEmpty) {
|
||||
await _restoreFromSeedOrKeysPageRobot.enterPassphrase(passphrase);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> setupPinCode(List<int> pin) async {
|
||||
// Desktop builds take a wallet password on the new wallet form instead of a pin.
|
||||
if (Platform.isLinux) {
|
||||
return;
|
||||
}
|
||||
|
||||
await _setupPinCodeRobot.isDisplayed();
|
||||
|
||||
await _setupPinCodeRobot.enterPinCode(pin);
|
||||
await _setupPinCodeRobot.enterPinCode(pin);
|
||||
await _setupPinCodeRobot.tapSuccessButton();
|
||||
}
|
||||
|
||||
Future<void> _selectWalletType(WalletType type) async {
|
||||
await _newWalletTypePageRobot.isDisplayed();
|
||||
|
||||
await _newWalletTypePageRobot.findParticularWalletTypeInScrollableList(type);
|
||||
await _newWalletTypePageRobot.selectWalletType(type);
|
||||
}
|
||||
|
||||
Future<void> _completeWalletCreationSteps(WalletType type) async {
|
||||
await _generateNewWalletDetails();
|
||||
|
||||
await _preSeedPageRobot.isDisplayed();
|
||||
await _preSeedPageRobot.onConfirmButtonPressed();
|
||||
|
||||
await _confirmWalletSeedDetails();
|
||||
|
||||
await _verifyWalletSeed();
|
||||
|
||||
if (type == WalletType.bitcoin) {
|
||||
await _lightningUsernamePageRobot.isDisplayed();
|
||||
await _lightningUsernamePageRobot.tapSkip();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _generateNewWalletDetails() async {
|
||||
await _newWalletPageRobot.isDisplayed();
|
||||
|
||||
await _newWalletPageRobot.generateWalletName();
|
||||
|
||||
if (Platform.isLinux) {
|
||||
final password = TestConfig.pin.join("");
|
||||
await _restoreFromSeedOrKeysPageRobot.enterPasswordForWalletRestore(password);
|
||||
await _restoreFromSeedOrKeysPageRobot.enterPasswordRepeatForWalletRestore(password);
|
||||
}
|
||||
|
||||
await _newWalletPageRobot.onNextButtonPressed();
|
||||
}
|
||||
|
||||
Future<void> _confirmWalletSeedDetails() async {
|
||||
await _walletSeedPageRobot.isDisplayed();
|
||||
|
||||
_walletSeedPageRobot.confirmWalletDetailsDisplayCorrectly();
|
||||
_walletSeedPageRobot.confirmWalletSeedReminderDisplays();
|
||||
|
||||
await _walletSeedPageRobot.onVerifySeedButtonPressed();
|
||||
}
|
||||
|
||||
Future<void> _verifyWalletSeed() async {
|
||||
await _seedVerificationPageRobot.isDisplayed();
|
||||
|
||||
_seedVerificationPageRobot.hasTitle();
|
||||
|
||||
await _seedVerificationPageRobot.verifyWalletSeeds();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
import "package:hash_wallet/di.dart";
|
||||
import "package:hash_wallet/store/app_store.dart";
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter_test/flutter_test.dart";
|
||||
|
||||
import "../robots/new_dashboard_robot.dart";
|
||||
import "auth_flows.dart";
|
||||
|
||||
class WalletFlows {
|
||||
WalletFlows(this.tester)
|
||||
: _authFlows = AuthFlows(tester),
|
||||
_dashboardRobot = NewDashboardRobot(tester);
|
||||
|
||||
final WidgetTester tester;
|
||||
final AuthFlows _authFlows;
|
||||
final NewDashboardRobot _dashboardRobot;
|
||||
|
||||
Future<void> _expandWalletGroups({int maxGroups = 10}) async {
|
||||
for (int index = 0; index < maxGroups; index++) {
|
||||
final tile = find.byKey(ValueKey("group_wallets_expansion_tile_widget_$index"));
|
||||
|
||||
if (!tester.any(tile)) {
|
||||
return;
|
||||
}
|
||||
|
||||
await tester.tap(tile, warnIfMissed: false);
|
||||
await tester.pump(const Duration(milliseconds: 300));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> switchToWallet(String name) async {
|
||||
await _dashboardRobot.openWalletsTab();
|
||||
|
||||
final walletFinder = find.text(name);
|
||||
|
||||
// Wallets sharing a seed are listed under their group's name, so the wallet itself is
|
||||
// not on screen until that group is opened.
|
||||
if (!tester.any(walletFinder)) {
|
||||
await _expandWalletGroups();
|
||||
}
|
||||
|
||||
await _dashboardRobot.pumpUntilFound(walletFinder);
|
||||
|
||||
await tester.tap(walletFinder.first, warnIfMissed: false);
|
||||
await tester.pump(const Duration(milliseconds: 500));
|
||||
|
||||
await _authFlows.authenticateWithPin(required: false);
|
||||
|
||||
// The row does nothing at all when that wallet is already the open one, and the load
|
||||
// itself runs behind a progress overlay, so the store is the only thing that tells us
|
||||
// the switch happened.
|
||||
final switched = await _dashboardRobot.pumpUntil(
|
||||
() => getIt.get<AppStore>().wallet?.name == name,
|
||||
timeout: const Duration(minutes: 2),
|
||||
);
|
||||
|
||||
expect(switched, true, reason: "Wallet never became $name after tapping its row");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user