Skip to content

Commit

Permalink
Merge branch 'PE-6873-setup-integration-tests-flutter' of github.com:…
Browse files Browse the repository at this point in the history
…ardriveapp/ardrive-web into PE-6873-setup-integration-tests-flutter
  • Loading branch information
thiagocarvalhodev committed Nov 8, 2024
2 parents 649a672 + 64cbdcc commit 5323eae
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 22 deletions.
14 changes: 9 additions & 5 deletions integration_test/app_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,21 @@ import 'manifest_tests.dart' as manifest_test;
import 'onboarding_tests.dart' as onboarding_test;
import 'upload_tests.dart' as upload_test;
import 'utils.dart';
import 'snapshot_test.dart' as snapshot_test;
import 'logout_test.dart' as logout_test;

void main() {
final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive;

onboarding_test.main();
//onboarding_test.main();
login_test.main();
drive_test.main();
folder_test.main();
upload_test.main();
manifest_test.main();
logout_test.main();
//snapshot_test.main();
//drive_test.main();
//folder_test.main();
//upload_test.main();
//manifest_test.main();
}

Future<void> runAllTests(WidgetTester tester) async {
Expand Down
49 changes: 34 additions & 15 deletions integration_test/login_tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,27 @@ void main() {

group('Login Tests', () {
testWidgets('User can log in successfully', (WidgetTester tester) async {
await initApp(tester, deleteDatabase: true);
await testLoginSuccess(tester);
await initApp(tester, deleteDatabase: true);
await testLoginSuccess(tester);
});
});
} //testWidgets('User can unlock their account', (WidgetTester tester) async {
// await initApp(tester);
// await unlockUser(tester);
// });

testWidgets('User can unlock their account', (WidgetTester tester) async {
await initApp(tester);
await unlockUser(tester);
});
// testWidgets('Login fails with incorrect credentials',
// (WidgetTester tester) async {
// await initApp(tester, deleteDatabase: true);
// await testLoginFailure(tester);
// await tester.pumpAndSettle();
// });

// testWidgets('User can log in with seed phrase', (WidgetTester tester) async {
// await initApp(tester, deleteDatabase: true);
// await testLoginSeedPhrase(tester);
// });

testWidgets('Login fails with incorrect credentials',
(WidgetTester tester) async {
await initApp(tester, deleteDatabase: true);
await testLoginFailure(tester);
await tester.pumpAndSettle();
});
});
}

Future<void> testLoginSuccess(WidgetTester tester) async {
await I.see.button('Log In').tap().wait(500).go(tester);
Expand All @@ -42,7 +46,7 @@ Future<void> testLoginSuccess(WidgetTester tester) async {
await I.wait(100);
await I.see.button('Continue').tap().wait(5000).go(tester);
await I.waitToSee(driveDetailPageKey, tester, 30);
I.see.page(driveDetailPageKey);
I.see.page(driveDetailPageKey).wait(10000);
}

Future<void> testLoginFailure(WidgetTester tester) async {
Expand All @@ -66,3 +70,18 @@ Future<void> unlockUser(WidgetTester tester) async {
await I.waitToSee(driveDetailPageKey, tester, 30);
I.see.page(driveDetailPageKey);
}

Future<void> testLoginSeedPhrase(WidgetTester tester) async {
await I.see.button('Log In').tap().wait(100).go(tester);
await I.see.button('Import Wallet').tap().wait(1000).go(tester);
await I.see
.textField('import_wallet_modal_seed_phrase_text_field')
.enterText(
'measure brown citizen laptop dawn marriage twin tower taste rent long canvas')
.go(tester);
await I.see.button('Continue').tap().wait(30000).wait(1000).go(tester);
await I.see.textField('password-input').enterText('123').wait(1000).go(tester);
await I.see.button('Continue').tap().wait(3000).go(tester);
await I.waitToSee(driveDetailPageKey, tester, 1000);
I.see.page(driveDetailPageKey);
}
30 changes: 30 additions & 0 deletions integration_test/logout_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// ignore_for_file: non_constant_identifier_names

import 'package:ardrive/utils/widget_keys.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import 'app_test.dart';
import 'dsl/dsl.dart';
import 'utils.dart';
import 'login_tests.dart';

void main() {
final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive;

group('Logout Tests', () {
testWidgets('User can log out successfully', (WidgetTester tester) async {
await runPreConditionUserLoggedIn(tester);
await testLogoutSuccess(tester);
});
});
}

Future<void> testLogoutSuccess(WidgetTester tester) async {
I.see.page(driveDetailPageKey).wait(10000);
await I.see.profileCard().tap().wait(5000).go(tester);
await I.wait(1000);
await I.see.button('Log out').tap().wait(1000).go(tester);
I.see.button('Log In');
}
39 changes: 39 additions & 0 deletions integration_test/snapshot_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import 'package:ardrive/utils/widget_keys.dart';
import 'package:flutter_test/flutter_test.dart';

import 'dsl/dsl.dart';
import 'utils.dart';



void main() {
group('Snapshot Tests', () {
testWidgets('Create a snapshot of the drive detail page', (tester) async {
await runPreConditionUserLoggedIn(tester);
await testCreateSnapshot(tester);
});
});
}

Future<void> testCreateSnapshot(WidgetTester tester) async {
await I.see.publicDriveButton('drive test snapshot').tap().wait(500).go(tester);
await I.see.newButton().tap().wait(500).go(tester);
await I.see.button('Advanced').tap().wait(100).go(tester);
await I.see.button('New Snapshot').tap().wait(500).go(tester);
await I.see.button('PROCEED').tap().wait(10000).go(tester);
await I.see.button('UPLOAD').tap().wait(10000).go(tester);
I.see.text('Success');
await I.see.button('OK').tap().wait(100).go(tester);
}

Future<void> testCreatePrivateSnapshot(WidgetTester tester) async {
await I.see.privateDriveButton('drive test snapshot private').tap().wait(500).go(tester);
await I.see.newButton().tap().wait(500).go(tester);
await I.see.button('Advanced').tap().wait(100).go(tester);
await I.see.button('New Snapshot').tap().wait(500).go(tester);
await I.see.button('PROCEED').tap().wait(10000).go(tester);
await I.see.button('UPLOAD').tap().wait(10000).go(tester);
I.see.text('Success');
await I.see.button('OK').tap().wait(100).go(tester);
}

3 changes: 1 addition & 2 deletions scripts/run_integration_tests_fvm.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/bin/bash

# Store the JSON value in a variable to handle it more cleanly
JSON_VALUE='{"d":"boMCYRnKbWMZ2iKZtdWlNtMzQqk8rw6gNqT6l_l5VgdXnQ-dtxPhrgwJ0sGi8k5g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WML1Sds3JQXIGVS9cMd1ozwCSRTERvTYER6uvWbKRUvVQfRh8HfiQPfOZCEtoAziuWvfxL2HJUOJlKpz0UpSiGKA7XImMNZkAWQ","q":"zRwUAH2Ek-7ESKrxQaZgAhKLR78yNooL6MsjSjJBw07qR7YoeM9qM77jOymQbG6ZTUTmxM3tb4TcYweDcofyrj7974lWk-wtj4BxVmVXVpMsN22Cihi0rM8DmOg0PKZfJUZg8WECS-GN_Re4_YfRbKFWIvJ2CYGt6XSvn964FBhHq2K5k9uCmtby6cRxfirZJBQcoc0QzumBz-EZHmWoShiHuaTyOCMjZzQE268d9uOpl4tPtwILrNa5Vn8eExbn8Uo4BOrvQx4JCfz5OdOOG3kaVp_s9I1LUO7WJ1nuFqlBQJKrg4gaqXb992B5pMVXfhJD2HIVMN8-36gXFaGKFw","qi":"IymVRhthlwJR-oKOxyg6tF173fkEyaca4O9eRoaZjtXjo-FkQhthwghqwJ394RGBU3pk_XwvxmuQs0CvkQyaXWNMIPddThMxv2OMDCCYdpQay-6RJLbDpbzreV54Wtb23qqEFRp98v2aQqbZLG1PJZBu6DlKThFCQLOTG8RXMlZX5QLXnFSgo-HtSRuFmR_dNCp814h_bH-AX6aQJb4lWwlunW80JZ9W-gRTZQyf3zTPGAZSTK1hhFHZm9v2ePBKFUUWmbmwTLLVlrF9g5H8Pdi22VQTgfHen5FNdXQHXxedwEXmAPVk6FWENUzgBzs1Wut-QZUsG2cJWAaaLXtYUw"}'
# Run the Flutter drive command with the necessary parameters
fvm flutter drive \
--driver=test_driver/integration_test.dart \
Expand Down

0 comments on commit 5323eae

Please sign in to comment.