dev
dart 82 lines 2.92 KB
Raw
1 import 'package:cw_core/wallet_type.dart';
2 import 'package:flutter/material.dart';
3 import 'package:flutter_test/flutter_test.dart';
4 import 'package:integration_test/integration_test.dart';
5
6 import '../components/common_test_constants.dart';
7 import '../components/common_test_flows.dart';
8 import '../robots/dashboard_page_robot.dart';
9 import '../robots/transactions_page_robot.dart';
10 import 'package:cake_wallet/.secrets.g.dart' as secrets;
11
12 void main() {
13 IntegrationTestWidgetsFlutterBinding.ensureInitialized();
14
15 CommonTestFlows commonTestFlows;
16 DashboardPageRobot dashboardPageRobot;
17 TransactionsPageRobot transactionsPageRobot;
18
19 /// Two Test Scenarios
20 /// - Fully Synchronizes and display the transaction history either immediately or few seconds after fully synchronizing
21 /// - Displays the transaction history progressively as synchronizing happens
22 testWidgets('Transaction history flow', (tester) async {
23 FlutterError.onError = (FlutterErrorDetails details) {
24 debugPrint('FlutterError caught: ${details.exception}');
25 };
26
27 commonTestFlows = CommonTestFlows(tester);
28 dashboardPageRobot = DashboardPageRobot(tester);
29 transactionsPageRobot = TransactionsPageRobot(tester);
30
31 await commonTestFlows.startAppFlow(
32 ValueKey('confirm_creds_display_correctly_flow_app_key'),
33 );
34
35 /// Test Scenario 1 - Displays transaction history list while synchronizing.
36 ///
37 /// For Solana/Tron WalletTypes.
38 await commonTestFlows.welcomePageToRestoreWalletThroughSeedsFlow(
39 WalletType.solana,
40 secrets.solanaTestWalletSeeds,
41 CommonTestConstants.pin,
42 );
43
44 await dashboardPageRobot.confirmWalletTypeIsDisplayedCorrectly(WalletType.solana);
45
46 await dashboardPageRobot.swipeDashboardTab(true);
47
48 await transactionsPageRobot.isTransactionsPage();
49
50 await transactionsPageRobot.confirmTransactionsPageConstantsDisplayProperly();
51
52 // Wait time for the first scenario to ensure proper loading
53 await tester.pump(Duration(seconds: 3));
54 await tester.pumpAndSettle();
55
56 await transactionsPageRobot.confirmTransactionHistoryListDisplaysCorrectly(true);
57
58 /// Test Scenario 2 - Displays transaction history list after fully synchronizing.
59 ///
60 /// For Bitcoin/Monero/Wownero WalletTypes.
61 await dashboardPageRobot.navigateToWalletsListPage();
62
63 await commonTestFlows.restoreWalletFromWalletMenu(
64 WalletType.bitcoin,
65 secrets.bitcoinTestWalletSeeds,
66 );
67
68 await dashboardPageRobot.confirmWalletTypeIsDisplayedCorrectly(WalletType.bitcoin);
69
70 await dashboardPageRobot.swipeDashboardTab(true);
71
72 await transactionsPageRobot.isTransactionsPage();
73
74 await transactionsPageRobot.confirmTransactionsPageConstantsDisplayProperly();
75
76 // Wait time for the second scenario to ensure proper loading
77 await tester.pump(Duration(seconds: 3));
78 await tester.pumpAndSettle();
79
80 await transactionsPageRobot.confirmTransactionHistoryListDisplaysCorrectly(false);
81 });
82 }