mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-01 12:04:21 +01:00
Automated Integration Tests Flows (#1686)
* 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 * fix: Issue from merge conflicts * test: Remove automation of test in this PR --------- Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
This commit is contained in:
co-authored by
OmarHatem
parent
48457fdd6d
commit
0fcfd76afd
@@ -10,10 +10,16 @@ class CommonTestCases {
|
||||
hasType<T>();
|
||||
}
|
||||
|
||||
Future<void> tapItemByKey(String key, {bool shouldPumpAndSettle = true}) async {
|
||||
Future<void> tapItemByKey(
|
||||
String key, {
|
||||
bool shouldPumpAndSettle = true,
|
||||
int pumpDuration = 100,
|
||||
}) async {
|
||||
final widget = find.byKey(ValueKey(key));
|
||||
await tester.tap(widget);
|
||||
shouldPumpAndSettle ? await tester.pumpAndSettle() : await tester.pump();
|
||||
shouldPumpAndSettle
|
||||
? await tester.pumpAndSettle(Duration(milliseconds: pumpDuration))
|
||||
: await tester.pump();
|
||||
}
|
||||
|
||||
Future<void> tapItemByFinder(Finder finder, {bool shouldPumpAndSettle = true}) async {
|
||||
@@ -31,6 +37,11 @@ class CommonTestCases {
|
||||
expect(typeWidget, findsOneWidget);
|
||||
}
|
||||
|
||||
bool isKeyPresent(String key) {
|
||||
final typeWidget = find.byKey(ValueKey(key));
|
||||
return typeWidget.tryEvaluate();
|
||||
}
|
||||
|
||||
void hasValueKey(String key) {
|
||||
final typeWidget = find.byKey(ValueKey(key));
|
||||
expect(typeWidget, findsOneWidget);
|
||||
@@ -53,33 +64,86 @@ class CommonTestCases {
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
Future<void> scrollUntilVisible(String childKey, String parentScrollableKey,
|
||||
{double delta = 300}) async {
|
||||
final scrollableWidget = find.descendant(
|
||||
of: find.byKey(Key(parentScrollableKey)),
|
||||
Future<void> dragUntilVisible(String childKey, String parentKey) async {
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final itemFinder = find.byKey(ValueKey(childKey));
|
||||
final listFinder = find.byKey(ValueKey(parentKey));
|
||||
|
||||
// Check if the widget is already in the widget tree
|
||||
if (tester.any(itemFinder)) {
|
||||
// Widget is already built and in the tree
|
||||
tester.printToConsole('Child is already present');
|
||||
return;
|
||||
}
|
||||
|
||||
// We can adjust this as needed
|
||||
final maxScrolls = 200;
|
||||
|
||||
int scrolls = 0;
|
||||
bool found = false;
|
||||
|
||||
// We start by scrolling down
|
||||
bool scrollDown = true;
|
||||
|
||||
// Flag to check if we've already reversed direction
|
||||
bool reversedDirection = false;
|
||||
|
||||
// Find the Scrollable associated with the Parent Ad
|
||||
final scrollableFinder = find.descendant(
|
||||
of: listFinder,
|
||||
matching: find.byType(Scrollable),
|
||||
);
|
||||
|
||||
final isAlreadyVisibile = isWidgetVisible(find.byKey(ValueKey(childKey)));
|
||||
|
||||
if (isAlreadyVisibile) return;
|
||||
|
||||
await tester.scrollUntilVisible(
|
||||
find.byKey(ValueKey(childKey)),
|
||||
delta,
|
||||
scrollable: scrollableWidget,
|
||||
// Ensure that the Scrollable is found
|
||||
expect(
|
||||
scrollableFinder,
|
||||
findsOneWidget,
|
||||
reason: 'Scrollable descendant of the Parent Widget not found.',
|
||||
);
|
||||
}
|
||||
|
||||
bool isWidgetVisible(Finder finder) {
|
||||
try {
|
||||
final Element element = finder.evaluate().single;
|
||||
final RenderBox renderBox = element.renderObject as RenderBox;
|
||||
return renderBox.paintBounds
|
||||
.shift(renderBox.localToGlobal(Offset.zero))
|
||||
.overlaps(tester.binding.renderViews.first.paintBounds);
|
||||
} catch (e) {
|
||||
return false;
|
||||
// Get the initial scroll position
|
||||
final scrollableState = tester.state<ScrollableState>(scrollableFinder);
|
||||
double previousScrollPosition = scrollableState.position.pixels;
|
||||
|
||||
while (!found && scrolls < maxScrolls) {
|
||||
tester.printToConsole('Scrolling ${scrollDown ? 'down' : 'up'}, attempt $scrolls');
|
||||
|
||||
// Perform the drag in the current direction
|
||||
await tester.drag(
|
||||
scrollableFinder,
|
||||
scrollDown ? const Offset(0, -100) : const Offset(0, 100),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
scrolls++;
|
||||
|
||||
// Update the scroll position after the drag
|
||||
final currentScrollPosition = scrollableState.position.pixels;
|
||||
|
||||
if (currentScrollPosition == previousScrollPosition) {
|
||||
// Cannot scroll further in this direction
|
||||
if (reversedDirection) {
|
||||
// We've already tried both directions
|
||||
tester.printToConsole('Cannot scroll further in both directions. Widget not found.');
|
||||
break;
|
||||
} else {
|
||||
// Reverse the scroll direction
|
||||
scrollDown = !scrollDown;
|
||||
reversedDirection = true;
|
||||
tester.printToConsole('Reached the end, reversing direction');
|
||||
}
|
||||
} else {
|
||||
// Continue scrolling in the current direction
|
||||
previousScrollPosition = currentScrollPosition;
|
||||
}
|
||||
|
||||
// Check if the widget is now in the widget tree
|
||||
found = tester.any(itemFinder);
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
tester.printToConsole('Widget not found after scrolling in both directions.');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,6 +155,15 @@ class CommonTestCases {
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
void findWidgetViaDescendant({
|
||||
required FinderBase<Element> of,
|
||||
required FinderBase<Element> matching,
|
||||
}) {
|
||||
final textWidget = find.descendant(of: of, matching: matching);
|
||||
|
||||
expect(textWidget, findsOneWidget);
|
||||
}
|
||||
|
||||
Future<void> defaultSleepTime({int seconds = 2}) async =>
|
||||
await Future.delayed(Duration(seconds: seconds));
|
||||
}
|
||||
|
||||
@@ -9,5 +9,5 @@ class CommonTestConstants {
|
||||
static final String testWalletName = 'Integrated Testing Wallet';
|
||||
static final CryptoCurrency testReceiveCurrency = CryptoCurrency.sol;
|
||||
static final CryptoCurrency testDepositCurrency = CryptoCurrency.usdtSol;
|
||||
static final String testWalletAddress = 'An2Y2fsUYKfYvN1zF89GAqR1e6GUMBg3qA83Y5ZWDf8L';
|
||||
static final String testWalletAddress = '5v9gTW1yWPffhnbNKuvtL2frevAf4HpBMw8oYnfqUjhm';
|
||||
}
|
||||
|
||||
@@ -1,41 +1,65 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:cake_wallet/entities/seed_type.dart';
|
||||
import 'package:cake_wallet/reactions/bip39_wallet_utils.dart';
|
||||
import 'package:cake_wallet/wallet_types.g.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:cake_wallet/.secrets.g.dart' as secrets;
|
||||
import 'package:cake_wallet/main.dart' as app;
|
||||
|
||||
import '../robots/dashboard_page_robot.dart';
|
||||
import '../robots/disclaimer_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/setup_pin_code_robot.dart';
|
||||
import '../robots/wallet_group_description_page_robot.dart';
|
||||
import '../robots/wallet_list_page_robot.dart';
|
||||
import '../robots/wallet_seed_page_robot.dart';
|
||||
import '../robots/welcome_page_robot.dart';
|
||||
import 'common_test_cases.dart';
|
||||
import 'package:cake_wallet/.secrets.g.dart' as secrets;
|
||||
|
||||
import 'common_test_constants.dart';
|
||||
|
||||
class CommonTestFlows {
|
||||
CommonTestFlows(this._tester)
|
||||
: _commonTestCases = CommonTestCases(_tester),
|
||||
_welcomePageRobot = WelcomePageRobot(_tester),
|
||||
_preSeedPageRobot = PreSeedPageRobot(_tester),
|
||||
_setupPinCodeRobot = SetupPinCodeRobot(_tester),
|
||||
_dashboardPageRobot = DashboardPageRobot(_tester),
|
||||
_newWalletPageRobot = NewWalletPageRobot(_tester),
|
||||
_disclaimerPageRobot = DisclaimerPageRobot(_tester),
|
||||
_walletSeedPageRobot = WalletSeedPageRobot(_tester),
|
||||
_walletListPageRobot = WalletListPageRobot(_tester),
|
||||
_newWalletTypePageRobot = NewWalletTypePageRobot(_tester),
|
||||
_restoreOptionsPageRobot = RestoreOptionsPageRobot(_tester),
|
||||
_restoreFromSeedOrKeysPageRobot = RestoreFromSeedOrKeysPageRobot(_tester);
|
||||
_restoreFromSeedOrKeysPageRobot = RestoreFromSeedOrKeysPageRobot(_tester),
|
||||
_walletGroupDescriptionPageRobot = WalletGroupDescriptionPageRobot(_tester);
|
||||
|
||||
final WidgetTester _tester;
|
||||
final CommonTestCases _commonTestCases;
|
||||
|
||||
final WelcomePageRobot _welcomePageRobot;
|
||||
final PreSeedPageRobot _preSeedPageRobot;
|
||||
final SetupPinCodeRobot _setupPinCodeRobot;
|
||||
final NewWalletPageRobot _newWalletPageRobot;
|
||||
final DashboardPageRobot _dashboardPageRobot;
|
||||
final DisclaimerPageRobot _disclaimerPageRobot;
|
||||
final WalletSeedPageRobot _walletSeedPageRobot;
|
||||
final WalletListPageRobot _walletListPageRobot;
|
||||
final NewWalletTypePageRobot _newWalletTypePageRobot;
|
||||
final RestoreOptionsPageRobot _restoreOptionsPageRobot;
|
||||
final RestoreFromSeedOrKeysPageRobot _restoreFromSeedOrKeysPageRobot;
|
||||
final WalletGroupDescriptionPageRobot _walletGroupDescriptionPageRobot;
|
||||
|
||||
//* ========== Handles flow to start the app afresh and accept disclaimer =============
|
||||
Future<void> startAppFlow(Key key) async {
|
||||
await app.main(topLevelKey: ValueKey('send_flow_test_app_key'));
|
||||
|
||||
|
||||
await _tester.pumpAndSettle();
|
||||
|
||||
// --------- Disclaimer Page ------------
|
||||
@@ -46,56 +70,275 @@ class CommonTestFlows {
|
||||
await _disclaimerPageRobot.tapAcceptButton();
|
||||
}
|
||||
|
||||
Future<void> restoreWalletThroughSeedsFlow() async {
|
||||
await _welcomeToRestoreFromSeedsPath();
|
||||
await _restoreFromSeeds();
|
||||
//* ========== Handles flow from welcome to creating a new wallet ===============
|
||||
Future<void> welcomePageToCreateNewWalletFlow(
|
||||
WalletType walletTypeToCreate,
|
||||
List<int> walletPin,
|
||||
) async {
|
||||
await _welcomeToCreateWalletPath(walletTypeToCreate, walletPin);
|
||||
|
||||
await _generateNewWalletDetails();
|
||||
|
||||
await _confirmPreSeedInfo();
|
||||
|
||||
await _confirmWalletDetails();
|
||||
}
|
||||
|
||||
Future<void> restoreWalletThroughKeysFlow() async {
|
||||
await _welcomeToRestoreFromSeedsPath();
|
||||
//* ========== Handles flow from welcome to restoring wallet from seeds ===============
|
||||
Future<void> welcomePageToRestoreWalletThroughSeedsFlow(
|
||||
WalletType walletTypeToRestore,
|
||||
String walletSeed,
|
||||
List<int> walletPin,
|
||||
) async {
|
||||
await _welcomeToRestoreFromSeedsOrKeysPath(walletTypeToRestore, walletPin);
|
||||
await _restoreFromSeeds(walletTypeToRestore, walletSeed);
|
||||
}
|
||||
|
||||
//* ========== Handles flow from welcome to restoring wallet from keys ===============
|
||||
Future<void> welcomePageToRestoreWalletThroughKeysFlow(
|
||||
WalletType walletTypeToRestore,
|
||||
List<int> walletPin,
|
||||
) async {
|
||||
await _welcomeToRestoreFromSeedsOrKeysPath(walletTypeToRestore, walletPin);
|
||||
await _restoreFromKeys();
|
||||
}
|
||||
|
||||
Future<void> _welcomeToRestoreFromSeedsPath() async {
|
||||
// --------- Welcome Page ---------------
|
||||
await _welcomePageRobot.navigateToRestoreWalletPage();
|
||||
//* ========== Handles switching to wallet list or menu from dashboard ===============
|
||||
Future<void> switchToWalletMenuFromDashboardPage() async {
|
||||
_tester.printToConsole('Switching to Wallet Menu');
|
||||
await _dashboardPageRobot.openDrawerMenu();
|
||||
|
||||
// ----------- Restore Options Page -----------
|
||||
// Route to restore from seeds page to continue flow
|
||||
await _restoreOptionsPageRobot.navigateToRestoreFromSeedsPage();
|
||||
await _dashboardPageRobot.dashboardMenuWidgetRobot.navigateToWalletMenu();
|
||||
}
|
||||
|
||||
void confirmAllAvailableWalletTypeIconsDisplayCorrectly() {
|
||||
for (var walletType in availableWalletTypes) {
|
||||
final imageUrl = walletTypeToCryptoCurrency(walletType).iconPath;
|
||||
|
||||
final walletIconFinder = find.image(
|
||||
Image.asset(
|
||||
imageUrl!,
|
||||
width: 32,
|
||||
height: 32,
|
||||
).image,
|
||||
);
|
||||
|
||||
expect(walletIconFinder, findsAny);
|
||||
}
|
||||
}
|
||||
|
||||
//* ========== Handles creating new wallet flow from wallet list/menu ===============
|
||||
Future<void> createNewWalletFromWalletMenu(WalletType walletTypeToCreate) async {
|
||||
_tester.printToConsole('Creating ${walletTypeToCreate.name} Wallet');
|
||||
await _walletListPageRobot.navigateToCreateNewWalletPage();
|
||||
await _commonTestCases.defaultSleepTime();
|
||||
|
||||
await _selectWalletTypeForWallet(walletTypeToCreate);
|
||||
await _commonTestCases.defaultSleepTime();
|
||||
|
||||
// ---- Wallet Group/New Seed Implementation Comes here
|
||||
await _walletGroupDescriptionPageFlow(true, walletTypeToCreate);
|
||||
|
||||
await _generateNewWalletDetails();
|
||||
|
||||
await _confirmPreSeedInfo();
|
||||
|
||||
await _confirmWalletDetails();
|
||||
await _commonTestCases.defaultSleepTime();
|
||||
}
|
||||
|
||||
Future<void> _walletGroupDescriptionPageFlow(bool isNewSeed, WalletType walletType) async {
|
||||
if (!isBIP39Wallet(walletType)) return;
|
||||
|
||||
await _walletGroupDescriptionPageRobot.isWalletGroupDescriptionPage();
|
||||
|
||||
if (isNewSeed) {
|
||||
await _walletGroupDescriptionPageRobot.navigateToCreateNewSeedPage();
|
||||
} else {
|
||||
await _walletGroupDescriptionPageRobot.navigateToChooseWalletGroup();
|
||||
}
|
||||
}
|
||||
|
||||
//* ========== Handles restore wallet flow from wallet list/menu ===============
|
||||
Future<void> restoreWalletFromWalletMenu(WalletType walletType, String walletSeed) async {
|
||||
_tester.printToConsole('Restoring ${walletType.name} Wallet');
|
||||
await _walletListPageRobot.navigateToRestoreWalletOptionsPage();
|
||||
await _commonTestCases.defaultSleepTime();
|
||||
|
||||
await _restoreOptionsPageRobot.navigateToRestoreFromSeedsOrKeysPage();
|
||||
await _commonTestCases.defaultSleepTime();
|
||||
|
||||
await _selectWalletTypeForWallet(walletType);
|
||||
await _commonTestCases.defaultSleepTime();
|
||||
|
||||
await _restoreFromSeeds(walletType, walletSeed);
|
||||
await _commonTestCases.defaultSleepTime();
|
||||
}
|
||||
|
||||
//* ========== Handles setting up pin code for wallet on first install ===============
|
||||
Future<void> setupPinCodeForWallet(List<int> pin) async {
|
||||
// ----------- SetupPinCode Page -------------
|
||||
// Confirm initial defaults - Widgets to be displayed etc
|
||||
await _setupPinCodeRobot.isSetupPinCodePage();
|
||||
|
||||
await _setupPinCodeRobot.enterPinCode(CommonTestConstants.pin, true);
|
||||
await _setupPinCodeRobot.enterPinCode(CommonTestConstants.pin, false);
|
||||
await _setupPinCodeRobot.enterPinCode(pin);
|
||||
await _setupPinCodeRobot.enterPinCode(pin);
|
||||
await _setupPinCodeRobot.tapSuccessButton();
|
||||
}
|
||||
|
||||
Future<void> _welcomeToCreateWalletPath(
|
||||
WalletType walletTypeToCreate,
|
||||
List<int> pin,
|
||||
) async {
|
||||
await _welcomePageRobot.navigateToCreateNewWalletPage();
|
||||
|
||||
await setupPinCodeForWallet(pin);
|
||||
|
||||
await _selectWalletTypeForWallet(walletTypeToCreate);
|
||||
}
|
||||
|
||||
Future<void> _welcomeToRestoreFromSeedsOrKeysPath(
|
||||
WalletType walletTypeToRestore,
|
||||
List<int> pin,
|
||||
) async {
|
||||
await _welcomePageRobot.navigateToRestoreWalletPage();
|
||||
|
||||
await _restoreOptionsPageRobot.navigateToRestoreFromSeedsOrKeysPage();
|
||||
|
||||
await setupPinCodeForWallet(pin);
|
||||
|
||||
await _selectWalletTypeForWallet(walletTypeToRestore);
|
||||
}
|
||||
|
||||
//* ============ Handles New Wallet Type Page ==================
|
||||
Future<void> _selectWalletTypeForWallet(WalletType type) async {
|
||||
// ----------- NewWalletType Page -------------
|
||||
// Confirm scroll behaviour works properly
|
||||
await _newWalletTypePageRobot
|
||||
.findParticularWalletTypeInScrollableList(CommonTestConstants.testWalletType);
|
||||
await _newWalletTypePageRobot.findParticularWalletTypeInScrollableList(type);
|
||||
|
||||
// Select a wallet and route to next page
|
||||
await _newWalletTypePageRobot.selectWalletType(CommonTestConstants.testWalletType);
|
||||
await _newWalletTypePageRobot.selectWalletType(type);
|
||||
await _newWalletTypePageRobot.onNextButtonPressed();
|
||||
}
|
||||
|
||||
Future<void> _restoreFromSeeds() async {
|
||||
//* ============ Handles New Wallet Page ==================
|
||||
Future<void> _generateNewWalletDetails() async {
|
||||
await _newWalletPageRobot.isNewWalletPage();
|
||||
|
||||
await _newWalletPageRobot.generateWalletName();
|
||||
|
||||
await _newWalletPageRobot.onNextButtonPressed();
|
||||
}
|
||||
|
||||
//* ============ Handles Pre Seed Page =====================
|
||||
Future<void> _confirmPreSeedInfo() async {
|
||||
await _preSeedPageRobot.isPreSeedPage();
|
||||
|
||||
await _preSeedPageRobot.onConfirmButtonPressed();
|
||||
}
|
||||
|
||||
//* ============ Handles Wallet Seed Page ==================
|
||||
Future<void> _confirmWalletDetails() async {
|
||||
await _walletSeedPageRobot.isWalletSeedPage();
|
||||
|
||||
_walletSeedPageRobot.confirmWalletDetailsDisplayCorrectly();
|
||||
|
||||
_walletSeedPageRobot.confirmWalletSeedReminderDisplays();
|
||||
|
||||
await _walletSeedPageRobot.onCopySeedsButtonPressed();
|
||||
|
||||
await _walletSeedPageRobot.onNextButtonPressed();
|
||||
|
||||
await _walletSeedPageRobot.onConfirmButtonOnSeedAlertDialogPressed();
|
||||
}
|
||||
|
||||
//* Main Restore Actions - On the RestoreFromSeed/Keys Page - Restore from Seeds Action
|
||||
Future<void> _restoreFromSeeds(WalletType type, String walletSeed) async {
|
||||
// ----------- RestoreFromSeedOrKeys Page -------------
|
||||
await _restoreFromSeedOrKeysPageRobot.enterWalletNameText(CommonTestConstants.testWalletName);
|
||||
await _restoreFromSeedOrKeysPageRobot.enterSeedPhraseForWalletRestore(secrets.solanaTestWalletSeeds);
|
||||
|
||||
await _restoreFromSeedOrKeysPageRobot.selectWalletNameFromAvailableOptions();
|
||||
await _restoreFromSeedOrKeysPageRobot.enterSeedPhraseForWalletRestore(walletSeed);
|
||||
|
||||
final numberOfWords = walletSeed.split(' ').length;
|
||||
|
||||
if (numberOfWords == 25 && (type == WalletType.monero)) {
|
||||
await _restoreFromSeedOrKeysPageRobot
|
||||
.chooseSeedTypeForMoneroOrWowneroWallets(MoneroSeedType.legacy);
|
||||
|
||||
// Using a constant value of 2831400 for the blockheight as its the restore blockheight for our testing wallet
|
||||
await _restoreFromSeedOrKeysPageRobot
|
||||
.enterBlockHeightForWalletRestore(secrets.moneroTestWalletBlockHeight);
|
||||
}
|
||||
|
||||
await _restoreFromSeedOrKeysPageRobot.onRestoreWalletButtonPressed();
|
||||
}
|
||||
|
||||
//* Main Restore Actions - On the RestoreFromSeed/Keys Page - Restore from Keys Action
|
||||
Future<void> _restoreFromKeys() async {
|
||||
await _commonTestCases.swipePage();
|
||||
await _commonTestCases.defaultSleepTime();
|
||||
|
||||
await _restoreFromSeedOrKeysPageRobot.enterWalletNameText(CommonTestConstants.testWalletName);
|
||||
await _restoreFromSeedOrKeysPageRobot.selectWalletNameFromAvailableOptions(
|
||||
isSeedFormEntry: false,
|
||||
);
|
||||
|
||||
await _restoreFromSeedOrKeysPageRobot.enterSeedPhraseForWalletRestore('');
|
||||
await _restoreFromSeedOrKeysPageRobot.onRestoreWalletButtonPressed();
|
||||
}
|
||||
|
||||
//* ====== Utility Function to get test wallet seeds for each wallet type ========
|
||||
String getWalletSeedsByWalletType(WalletType walletType) {
|
||||
switch (walletType) {
|
||||
case WalletType.monero:
|
||||
return secrets.moneroTestWalletSeeds;
|
||||
case WalletType.bitcoin:
|
||||
return secrets.bitcoinTestWalletSeeds;
|
||||
case WalletType.ethereum:
|
||||
return secrets.ethereumTestWalletSeeds;
|
||||
case WalletType.litecoin:
|
||||
return secrets.litecoinTestWalletSeeds;
|
||||
case WalletType.bitcoinCash:
|
||||
return secrets.bitcoinCashTestWalletSeeds;
|
||||
case WalletType.polygon:
|
||||
return secrets.polygonTestWalletSeeds;
|
||||
case WalletType.solana:
|
||||
return secrets.solanaTestWalletSeeds;
|
||||
case WalletType.tron:
|
||||
return secrets.tronTestWalletSeeds;
|
||||
case WalletType.nano:
|
||||
return secrets.nanoTestWalletSeeds;
|
||||
case WalletType.wownero:
|
||||
return secrets.wowneroTestWalletSeeds;
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
//* ====== Utility Function to get test receive address for each wallet type ========
|
||||
String getReceiveAddressByWalletType(WalletType walletType) {
|
||||
switch (walletType) {
|
||||
case WalletType.monero:
|
||||
return secrets.moneroTestWalletReceiveAddress;
|
||||
case WalletType.bitcoin:
|
||||
return secrets.bitcoinTestWalletReceiveAddress;
|
||||
case WalletType.ethereum:
|
||||
return secrets.ethereumTestWalletReceiveAddress;
|
||||
case WalletType.litecoin:
|
||||
return secrets.litecoinTestWalletReceiveAddress;
|
||||
case WalletType.bitcoinCash:
|
||||
return secrets.bitcoinCashTestWalletReceiveAddress;
|
||||
case WalletType.polygon:
|
||||
return secrets.polygonTestWalletReceiveAddress;
|
||||
case WalletType.solana:
|
||||
return secrets.solanaTestWalletReceiveAddress;
|
||||
case WalletType.tron:
|
||||
return secrets.tronTestWalletReceiveAddress;
|
||||
case WalletType.nano:
|
||||
return secrets.nanoTestWalletReceiveAddress;
|
||||
case WalletType.wownero:
|
||||
return secrets.wowneroTestWalletReceiveAddress;
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user