Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions mobile-app/lib/shared/constants/e2e_keys.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,21 @@ class E2EKeys {

static const String homeScreen = 'home_screen';
static const String homeSendButton = 'home_send_button';
static const String homeSettingsButton = 'home_settings_button';
static const String homePendingSendActivityItem = 'home_pending_send_activity_item';

static const String settingsScreen = 'settings_screen';
static const String settingsWalletMenuRow = 'settings_wallet_menu_row';

static const String walletSettingsScreen = 'wallet_settings_screen';
static const String walletSettingsRecoveryPhraseRow = 'wallet_settings_recovery_phrase_row';

static const String recoveryPhraseConfirmScreen = 'recovery_phrase_confirm_screen';
static const String recoveryPhraseConfirmContinueButton = 'recovery_phrase_confirm_continue_button';
static const String recoveryPhraseScreen = 'recovery_phrase_screen';
static const String recoveryPhraseRevealArea = 'recovery_phrase_reveal_area';
static const String recoveryPhraseRevealed = 'recovery_phrase_revealed';

static const String sendSelectRecipientScreen = 'send_select_recipient_screen';
static const String sendRecipientField = 'send_recipient_field';
static const String sendContinueButton = 'send_continue_button';
Expand Down
13 changes: 11 additions & 2 deletions mobile-app/lib/v2/components/recovery_phrase_body.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:resonance_network_wallet/features/components/mnemonic_grid.dart';
import 'package:resonance_network_wallet/l10n/app_localizations.dart';
import 'package:resonance_network_wallet/providers/l10n_provider.dart';
import 'package:resonance_network_wallet/shared/constants/e2e_keys.dart';
import 'package:resonance_network_wallet/shared/extensions/clipboard_extensions.dart';
import 'package:resonance_network_wallet/v2/components/loader.dart';
import 'package:resonance_network_wallet/v2/components/quantus_button.dart';
Expand Down Expand Up @@ -87,6 +88,7 @@ class _RecoveryPhraseBodyState extends ConsumerState<RecoveryPhraseBody> {

Widget _grid(AppLocalizations l10n, AppColorsV2 colors, AppTextTheme text) {
return GestureDetector(
key: const Key(E2EKeys.recoveryPhraseRevealArea),
onTap: _toggleRevealed,
behavior: HitTestBehavior.opaque,
child: Column(
Expand All @@ -101,15 +103,22 @@ class _RecoveryPhraseBodyState extends ConsumerState<RecoveryPhraseBody> {
),
if (_isRevealed) ...[
const SizedBox(height: 16),
_tapHint(Icons.visibility_off_outlined, l10n.recoveryPhraseBodyTapToHide, colors.textSecondary, text),
_tapHint(
Icons.visibility_off_outlined,
l10n.recoveryPhraseBodyTapToHide,
colors.textSecondary,
text,
key: const Key(E2EKeys.recoveryPhraseRevealed),
),
],
],
),
);
}

Widget _tapHint(IconData icon, String label, Color color, AppTextTheme text) {
Widget _tapHint(IconData icon, String label, Color color, AppTextTheme text, {Key? key}) {
return Row(
key: key,
mainAxisSize: MainAxisSize.min,
children: [
Icon(icon, size: 18, color: color),
Expand Down
1 change: 1 addition & 0 deletions mobile-app/lib/v2/screens/home/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ class _HomeScreenState extends ConsumerState<HomeScreen> {
),
const SizedBox(width: 12),
QuantusIconButton.circular(
key: const Key(E2EKeys.homeSettingsButton),
style: IconButtonStyle.glass,
icon: Icons.settings_outlined,
onTap: () => Navigator.push(context, MaterialPageRoute(builder: (_) => const SettingsScreenV2())),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:resonance_network_wallet/providers/l10n_provider.dart';
import 'package:resonance_network_wallet/providers/wallet_providers.dart';
import 'package:resonance_network_wallet/services/local_auth_service.dart';
import 'package:resonance_network_wallet/shared/constants/e2e_keys.dart';
import 'package:resonance_network_wallet/shared/extensions/toaster_extensions.dart';
import 'package:resonance_network_wallet/v2/screens/settings/recovery_phrase_screen.dart';
import 'package:resonance_network_wallet/v2/screens/settings/settings_caution_scaffold.dart';
Expand Down Expand Up @@ -46,13 +47,17 @@ class _RecoveryPhraseConfirmationScreenState extends ConsumerState<RecoveryPhras
Widget build(BuildContext context) {
final l10n = ref.watch(l10nProvider);

return SettingsCautionScaffold(
appBarTitle: l10n.settingsRecoveryPhraseTitle,
data: SettingsCautionScaffoldData.recoveryPhrase(l10n),
continueLabel: l10n.commonContinue,
onContinue: _onContinue,
secondaryLabel: widget.showAlreadyBackedUp ? l10n.settingsRecoveryAlreadyBackedUp : null,
onSecondary: widget.showAlreadyBackedUp ? _onAlreadyBackedUp : null,
return KeyedSubtree(
key: const Key(E2EKeys.recoveryPhraseConfirmScreen),
child: SettingsCautionScaffold(
appBarTitle: l10n.settingsRecoveryPhraseTitle,
data: SettingsCautionScaffoldData.recoveryPhrase(l10n),
continueLabel: l10n.commonContinue,
continueButtonKey: const Key(E2EKeys.recoveryPhraseConfirmContinueButton),
onContinue: _onContinue,
secondaryLabel: widget.showAlreadyBackedUp ? l10n.settingsRecoveryAlreadyBackedUp : null,
onSecondary: widget.showAlreadyBackedUp ? _onAlreadyBackedUp : null,
),
);
}
}
16 changes: 10 additions & 6 deletions mobile-app/lib/v2/screens/settings/recovery_phrase_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:quantus_sdk/quantus_sdk.dart';
import 'package:resonance_network_wallet/providers/l10n_provider.dart';
import 'package:resonance_network_wallet/providers/wallet_providers.dart';
import 'package:resonance_network_wallet/shared/constants/e2e_keys.dart';
import 'package:resonance_network_wallet/v2/components/recovery_phrase_body.dart';

class RecoveryPhraseScreen extends ConsumerStatefulWidget {
Expand Down Expand Up @@ -42,12 +43,15 @@ class _RecoveryPhraseScreenState extends ConsumerState<RecoveryPhraseScreen> {
Widget build(BuildContext context) {
final l10n = ref.watch(l10nProvider);

return RecoveryPhraseBody(
appBarTitle: l10n.settingsRecoveryPhraseTitle,
words: _words,
primaryButtonLabel: l10n.settingsRecoveryPhraseDone,
onPrimary: () => Navigator.of(context).pop(),
onPhraseExposed: _onPhraseExposed,
return KeyedSubtree(
key: const Key(E2EKeys.recoveryPhraseScreen),
child: RecoveryPhraseBody(
appBarTitle: l10n.settingsRecoveryPhraseTitle,
words: _words,
primaryButtonLabel: l10n.settingsRecoveryPhraseDone,
onPrimary: () => Navigator.of(context).pop(),
onPhraseExposed: _onPhraseExposed,
),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class SettingsCautionScaffold extends StatelessWidget {
final bool continueButtonLoading;
final String? secondaryLabel;
final VoidCallback? onSecondary;
final Key? continueButtonKey;

const SettingsCautionScaffold({
super.key,
Expand All @@ -61,6 +62,7 @@ class SettingsCautionScaffold extends StatelessWidget {
this.continueButtonLoading = false,
this.secondaryLabel,
this.onSecondary,
this.continueButtonKey,
});

@override
Expand Down Expand Up @@ -96,6 +98,7 @@ class SettingsCautionScaffold extends StatelessWidget {
continueButtonLoading: continueButtonLoading,
secondaryLabel: secondaryLabel,
onSecondary: onSecondary,
continueButtonKey: continueButtonKey,
),
);
}
Expand All @@ -111,6 +114,7 @@ class _SettingsCautionBottom extends StatelessWidget {
required this.continueButtonLoading,
required this.secondaryLabel,
required this.onSecondary,
this.continueButtonKey,
});

final String? checkboxLabel;
Expand All @@ -121,6 +125,7 @@ class _SettingsCautionBottom extends StatelessWidget {
final bool continueButtonLoading;
final String? secondaryLabel;
final VoidCallback? onSecondary;
final Key? continueButtonKey;

@override
Widget build(BuildContext context) {
Expand All @@ -133,6 +138,7 @@ class _SettingsCautionBottom extends StatelessWidget {
const SizedBox(height: 32),
],
QuantusButton.simple(
key: continueButtonKey,
label: continueLabel,
onTap: onContinue,
variant: ButtonVariant.primary,
Expand Down
6 changes: 6 additions & 0 deletions mobile-app/lib/v2/screens/settings/settings_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:resonance_network_wallet/generated/version.g.dart';
import 'package:resonance_network_wallet/l10n/app_localizations.dart';
import 'package:resonance_network_wallet/providers/l10n_provider.dart';
import 'package:resonance_network_wallet/providers/mining_rewards_provider.dart';
import 'package:resonance_network_wallet/shared/constants/e2e_keys.dart';
import 'package:resonance_network_wallet/v2/components/scaffold_base.dart';
import 'package:resonance_network_wallet/v2/components/v2_app_bar.dart';
import 'package:resonance_network_wallet/v2/screens/settings/about_quantus_screen.dart';
Expand Down Expand Up @@ -35,6 +36,7 @@ class _SettingsScreenV2State extends ConsumerState<SettingsScreenV2> {
final entries = _settingsHubItems(colors, l10n);

return ScaffoldBase(
key: const Key(E2EKeys.settingsScreen),
appBar: V2AppBar(title: l10n.settingsTitle),
mainContent: ListView(
children: [
Expand Down Expand Up @@ -64,6 +66,7 @@ class _SettingsScreenV2State extends ConsumerState<SettingsScreenV2> {
}

Widget _buildTappableRow(_SettingsHubItem item, {required Widget trailing, String? subtitle}) => SettingsTappableRow(
key: item.rowKey,
leading: item.leading,
title: item.title,
subtitle: subtitle ?? item.subtitle,
Expand All @@ -79,13 +82,15 @@ class _SettingsHubItem {
required this.subtitle,
required this.page,
this.isMiningRewards = false,
this.rowKey,
});

final Widget leading;
final String title;
final String subtitle;
final Widget page;
final bool isMiningRewards;
final Key? rowKey;
}

List<_SettingsHubItem> _settingsHubItems(AppColorsV2 colors, AppLocalizations l10n) {
Expand All @@ -95,6 +100,7 @@ List<_SettingsHubItem> _settingsHubItems(AppColorsV2 colors, AppLocalizations l1
title: l10n.settingsWalletTitle,
subtitle: l10n.settingsWalletSubtitle,
page: const WalletSettingsScreenV2(),
rowKey: const Key(E2EKeys.settingsWalletMenuRow),
),
_SettingsHubItem(
leading: _settingsHubIcon(colors, icon: Icons.tune),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:quantus_sdk/quantus_sdk.dart';
import 'package:resonance_network_wallet/providers/account_providers.dart';
import 'package:resonance_network_wallet/providers/l10n_provider.dart';
import 'package:resonance_network_wallet/shared/constants/e2e_keys.dart';
import 'package:resonance_network_wallet/shared/extensions/toaster_extensions.dart';
import 'package:resonance_network_wallet/shared/utils/account_utils.dart';
import 'package:resonance_network_wallet/v2/components/loader.dart';
Expand Down Expand Up @@ -57,6 +58,7 @@ class _WalletSettingsScreenV2State extends ConsumerState<WalletSettingsScreenV2>
final accountsAsync = ref.watch(accountsProvider);

return ScaffoldBase(
key: const Key(E2EKeys.walletSettingsScreen),
appBar: V2AppBar(title: l10n.settingsWalletTitle),
mainContent: accountsAsync.when(
loading: () => const Center(child: Loader()),
Expand All @@ -66,6 +68,7 @@ class _WalletSettingsScreenV2State extends ConsumerState<WalletSettingsScreenV2>
data: (accounts) => ListView(
children: [
SettingsTappableRow(
key: const Key(E2EKeys.walletSettingsRecoveryPhraseRow),
title: l10n.settingsWalletRecoveryPhrase,
subtitle: l10n.settingsWalletRecoveryPhraseSubtitle,
onTap: () => _navigateToRecoveryPhrase(accounts),
Expand Down
16 changes: 2 additions & 14 deletions mobile-app/patrol_test/flows/create_wallet_test.dart
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:patrol/patrol.dart';

import '../support/app_launcher.dart';
import '../support/patrol_timeouts.dart';
import '../support/selectors.dart';
import '../support/wallet_flows.dart';

void main() {
patrolTest('create new wallet from welcome lands on home', ($) async {
await AppLauncher.launchFresh($);

expect($(Selectors.welcomeScreen), findsOneWidget);

await $(Selectors.welcomeCreateWalletButton).tap();

await $(Selectors.accountReadyDoneButton).waitUntilVisible(timeout: PatrolTimeouts.network);
expect($('Account 1'), findsOneWidget);

await $(Selectors.accountReadyDoneButton).tap();

await $(Selectors.homeScreen).waitUntilVisible(timeout: PatrolTimeouts.network);
await WalletFlows.createFromWelcome($);
});
}
31 changes: 31 additions & 0 deletions mobile-app/patrol_test/flows/view_recovery_phrase_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:patrol/patrol.dart';

import '../support/app_launcher.dart';
import '../support/patrol_timeouts.dart';
import '../support/selectors.dart';
import '../support/wallet_flows.dart';

void main() {
patrolTest('create wallet and view recovery phrase from settings', ($) async {
await AppLauncher.launchFresh($);
await WalletFlows.createFromWelcome($);

await $(Selectors.homeSettingsButton).tap();
await $(Selectors.settingsScreen).waitUntilVisible(timeout: PatrolTimeouts.visible);

await $(Selectors.settingsWalletMenuRow).tap();
await $(Selectors.walletSettingsScreen).waitUntilVisible(timeout: PatrolTimeouts.visible);

await $(Selectors.walletSettingsRecoveryPhraseRow).tap();
await $(Selectors.recoveryPhraseConfirmScreen).waitUntilVisible(timeout: PatrolTimeouts.visible);

await $(Selectors.recoveryPhraseConfirmContinueButton).tap();
await $(Selectors.recoveryPhraseScreen).waitUntilVisible(timeout: PatrolTimeouts.visible);

await $(Selectors.recoveryPhraseRevealArea).waitUntilVisible(timeout: PatrolTimeouts.network);
await $(Selectors.recoveryPhraseRevealArea).tap();

expect($(Selectors.recoveryPhraseRevealed), findsOneWidget);
});
}
13 changes: 13 additions & 0 deletions mobile-app/patrol_test/support/selectors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,21 @@ class Selectors {

static const Key homeScreen = Key(E2EKeys.homeScreen);
static const Key homeSendButton = Key(E2EKeys.homeSendButton);
static const Key homeSettingsButton = Key(E2EKeys.homeSettingsButton);
static const Key homePendingSendActivityItem = Key(E2EKeys.homePendingSendActivityItem);

static const Key settingsScreen = Key(E2EKeys.settingsScreen);
static const Key settingsWalletMenuRow = Key(E2EKeys.settingsWalletMenuRow);

static const Key walletSettingsScreen = Key(E2EKeys.walletSettingsScreen);
static const Key walletSettingsRecoveryPhraseRow = Key(E2EKeys.walletSettingsRecoveryPhraseRow);

static const Key recoveryPhraseConfirmScreen = Key(E2EKeys.recoveryPhraseConfirmScreen);
static const Key recoveryPhraseConfirmContinueButton = Key(E2EKeys.recoveryPhraseConfirmContinueButton);
static const Key recoveryPhraseScreen = Key(E2EKeys.recoveryPhraseScreen);
static const Key recoveryPhraseRevealArea = Key(E2EKeys.recoveryPhraseRevealArea);
static const Key recoveryPhraseRevealed = Key(E2EKeys.recoveryPhraseRevealed);

static const Key sendSelectRecipientScreen = Key(E2EKeys.sendSelectRecipientScreen);
static const Key sendRecipientField = Key(E2EKeys.sendRecipientField);
static const Key sendContinueButton = Key(E2EKeys.sendContinueButton);
Expand Down
12 changes: 12 additions & 0 deletions mobile-app/patrol_test/support/wallet_flows.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ import 'test_env.dart';
class WalletFlows {
WalletFlows._();

/// Creates a new wallet from the welcome screen and waits for home.
static Future<void> createFromWelcome(PatrolIntegrationTester $) async {
expect($(Selectors.welcomeScreen), findsOneWidget);

await $(Selectors.welcomeCreateWalletButton).tap();

await $(Selectors.accountReadyDoneButton).waitUntilVisible(timeout: PatrolTimeouts.network);
await $(Selectors.accountReadyDoneButton).tap();

await $(Selectors.homeScreen).waitUntilVisible(timeout: PatrolTimeouts.network);
}

/// Imports a wallet from the welcome screen and waits for home.
static Future<void> importFromWelcome(PatrolIntegrationTester $) async {
expect($(Selectors.welcomeScreen), findsOneWidget);
Expand Down
Loading