-
Notifications
You must be signed in to change notification settings - Fork 3
Patrol Framework added for E2E test setup #542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ba5a960
feat: initial setup patrol e2e
dewabisma f9c92dc
feat: add create account e2e test
dewabisma c618ef2
feat: add import wallet, update real iphone device e2e script
dewabisma daf0be9
chore: add log for error register notification
dewabisma 1ad9bdf
feat: uncommit generated and sensitive files
dewabisma 0de8697
feat: add error to telemetry
dewabisma 74c67f4
fix: DRY best effort registering remote notification
dewabisma 3b1b01b
chore: formatting
dewabisma f1f9396
Merge branch 'main' of https://github.com/Quantus-Network/quantus-app…
dewabisma File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| @import XCTest; | ||
| @import patrol; | ||
| @import ObjectiveC.runtime; | ||
|
|
||
| #if !defined(PATROL_INTEGRATION_TEST_IOS_RUNNER) | ||
| #import "PatrolIntegrationTestIosRunner.h" | ||
| #endif | ||
|
|
||
| PATROL_INTEGRATION_TEST_IOS_RUNNER(RunnerUITests) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "defaultOptions" : { | ||
| "diagnosticCollectionPolicy" : "Never" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:flutter/services.dart'; | ||
| import 'package:flutter_dotenv/flutter_dotenv.dart'; | ||
| import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
| import 'package:quantus_sdk/quantus_sdk.dart'; | ||
| import 'package:resonance_network_wallet/app.dart'; | ||
| import 'package:resonance_network_wallet/app_initializer.dart'; | ||
| import 'package:resonance_network_wallet/app_lifecycle_manager.dart'; | ||
| import 'package:resonance_network_wallet/shared/utils/env_utils.dart'; | ||
| import 'package:supabase_flutter/supabase_flutter.dart'; | ||
| import 'package:telemetrydecksdk/telemetrydecksdk.dart'; | ||
|
|
||
| bool _initialized = false; | ||
|
|
||
| /// Initializes everything the app needs before [buildApp] can run. | ||
| /// | ||
| /// Safe to call more than once: the heavy, one-shot initializers (Supabase, | ||
| /// the Rust SDK, Telemetry) run only on the first invocation. This lets E2E | ||
| /// tests reuse the exact production startup path while running several tests in | ||
| /// a single app process. | ||
| Future<void> bootstrap() async { | ||
| WidgetsFlutterBinding.ensureInitialized(); | ||
| if (_initialized) return; | ||
|
|
||
| SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge); | ||
|
|
||
| await dotenv.load(); | ||
|
|
||
| await Supabase.initialize(url: EnvUtils.supabaseUrl, anonKey: EnvUtils.supabaseKey); | ||
| await QuantusSdk.init(); | ||
|
|
||
| Telemetrydecksdk.start( | ||
| const TelemetryManagerConfiguration(appID: '098B4397-8426-4054-B379-0E4C53D2CA63', salt: 'QDay'), | ||
| ); | ||
|
|
||
| _initialized = true; | ||
| } | ||
|
|
||
| /// The root widget tree shared by production and tests. | ||
| Widget buildApp() { | ||
| return const ProviderScope( | ||
| child: AppInitializer(child: AppLifecycleManager(child: ResonanceWalletApp())), | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,36 +1,9 @@ | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:flutter/services.dart'; | ||
| import 'package:flutter_dotenv/flutter_dotenv.dart'; | ||
| import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
| import 'package:quantus_sdk/quantus_sdk.dart'; | ||
| import 'package:resonance_network_wallet/app_initializer.dart'; | ||
| import 'package:resonance_network_wallet/app_lifecycle_manager.dart'; | ||
| import 'package:resonance_network_wallet/app.dart'; | ||
| import 'package:resonance_network_wallet/shared/utils/env_utils.dart'; | ||
| import 'package:supabase_flutter/supabase_flutter.dart'; | ||
| import 'package:telemetrydecksdk/telemetrydecksdk.dart'; | ||
| import 'package:resonance_network_wallet/bootstrap/app_bootstrap.dart'; | ||
|
|
||
| void main() async { | ||
| WidgetsFlutterBinding.ensureInitialized(); | ||
| SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge); | ||
|
|
||
| await dotenv.load(); | ||
|
|
||
| // Initialize Supabase | ||
| await Supabase.initialize(url: EnvUtils.supabaseUrl, anonKey: EnvUtils.supabaseKey); | ||
| await QuantusSdk.init(); | ||
|
|
||
| Telemetrydecksdk.start( | ||
| const TelemetryManagerConfiguration( | ||
| appID: '098B4397-8426-4054-B379-0E4C53D2CA63', | ||
| salt: 'QDay', | ||
| // debug: true, | ||
| ), | ||
| ); | ||
|
|
||
| runApp( | ||
| const ProviderScope( | ||
| child: AppInitializer(child: AppLifecycleManager(child: ResonanceWalletApp())), | ||
| ), | ||
| ); | ||
| await bootstrap(); | ||
| // buildApp() wraps the tree in a ProviderScope; the lint can't see through it. | ||
| // ignore: missing_provider_scope | ||
| runApp(buildApp()); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| /// Stable widget key identifiers shared between production widgets and E2E tests. | ||
| /// | ||
| /// These live in `lib/` (not in the test folder) so that production screens and | ||
| /// the Patrol selectors in `patrol_test/support/selectors.dart` reference the | ||
| /// exact same strings. This keeps the two in lockstep and avoids the drift that | ||
| /// happens when each side hardcodes its own copy of a key. | ||
| /// | ||
| /// Keep these as plain [String] constants (not [Key]s) so this file stays free | ||
| /// of any test-framework dependency and can be imported anywhere. | ||
| class E2EKeys { | ||
| E2EKeys._(); | ||
|
|
||
| static const String welcomeScreen = 'welcome_screen'; | ||
| static const String welcomeCreateWalletButton = 'welcome_create_wallet_button'; | ||
| static const String welcomeImportWalletButton = 'welcome_import_wallet_button'; | ||
|
|
||
| static const String accountReadyDoneButton = 'account_ready_done_button'; | ||
|
|
||
| static const String importWalletScreen = 'import_wallet_screen'; | ||
| static const String importWalletSeedPhraseField = 'import_wallet_seed_phrase_field'; | ||
| static const String importWalletButton = 'import_wallet_button'; | ||
|
|
||
| static const String homeScreen = 'home_screen'; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| 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'; | ||
|
|
||
| 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); | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| 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/test_env.dart'; | ||
|
|
||
| void main() { | ||
| patrolTest('import existing wallet from welcome lands on home', ($) async { | ||
| await AppLauncher.launchFresh($); | ||
|
|
||
| expect($(Selectors.welcomeScreen), findsOneWidget); | ||
|
|
||
| await $(Selectors.welcomeImportWalletButton).tap(); | ||
|
|
||
| await $(Selectors.importWalletScreen).waitUntilVisible(timeout: PatrolTimeouts.visible); | ||
|
|
||
| await $(Selectors.importWalletSeedPhraseField).enterText(TestEnv.importMnemonic); | ||
|
|
||
| await $(Selectors.importWalletButton).tap(); | ||
|
|
||
| await $(Selectors.homeScreen).waitUntilVisible(timeout: PatrolTimeouts.network); | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:flutter_test/flutter_test.dart'; | ||
| import 'package:patrol/patrol.dart'; | ||
|
|
||
| void main() { | ||
| patrolTest('hello world shows Quantus Patrol title', ($) async { | ||
| await $.pumpWidgetAndSettle( | ||
| MaterialApp( | ||
| home: Scaffold( | ||
| appBar: AppBar(title: const Text('Quantus Patrol')), | ||
| ), | ||
| ), | ||
| ); | ||
|
|
||
| expect($('Quantus Patrol'), findsOneWidget); | ||
| }); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.